From: Charles Hsu Date: Mon, 26 Jan 2026 06:37:12 +0000 (+0800) Subject: hwmon: pmbus: add support for STEF48H28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64824861ebd77706e58017c84292753dfc8f2d0c;p=thirdparty%2Fkernel%2Flinux.git hwmon: pmbus: add support for STEF48H28 Add support for STEF48H28 hot-swap controller. Signed-off-by: Charles Hsu Link: https://lore.kernel.org/r/20260126063712.1049025-2-hsu.yungteng@gmail.com Signed-off-by: Guenter Roeck --- diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index 6181c3f62177e..e61e9afc3b21a 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -234,6 +234,7 @@ Hardware Monitoring Kernel Drivers shtc1 sis5595 sl28cpld + stef48h28 smpro-hwmon smsc47b397 smsc47m192 diff --git a/Documentation/hwmon/stef48h28.rst b/Documentation/hwmon/stef48h28.rst new file mode 100644 index 0000000000000..00bef9e55651d --- /dev/null +++ b/Documentation/hwmon/stef48h28.rst @@ -0,0 +1,73 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver stef48h28 +======================= + +Supported chips: + + * Analog Devices STEF48H28 + + Prefix: 'stef48h28' + + Addresses scanned: - + + Datasheet: https://www.st.com/resource/en/data_brief/stef48h28.pdf + +Author: + + - Charles Hsu + + +Description +----------- + +The STEF48H28 is a 30 A integrated e-fuse for 9-80 V DC power rails. +It provides inrush control, undervoltage/overvoltage lockout and +overcurrent protection using an adaptive (I x t) scheme that permits +short high-current pulses typical of CPU/GPU loads. + +The device offers an analog current-monitor output and an on-chip +temperature-monitor signal for system supervision. Startup behavior is +programmable through insertion-delay and soft-start settings. + +Additional features include power-good indication, self-diagnostics, +thermal shutdown and a PMBus interface for telemetry and status +reporting. + +Platform data support +--------------------- + +The driver supports standard PMBus driver platform data. + +Sysfs entries +------------- + +========================================================= +in1_label "vin". +in1_input Measured voltage. From READ_VIN register. +in1_min Minimum Voltage. From VIN_UV_WARN_LIMIT register. +in1_max Maximum voltage. From VIN_OV_WARN_LIMIT register. + +in2_label "vout1". +in2_input Measured voltage. From READ_VOUT register. +in2_min Minimum Voltage. From VOUT_UV_WARN_LIMIT register. +in2_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. + +curr1_label "iin". +curr1_input Measured current. From READ_IIN register. + +curr2_label "iout1". +curr2_input Measured current. From READ_IOUT register. + +power1_label "pin" +power1_input Measured input power. From READ_PIN register. + +power2_label "pout1" +power2_input Measured output power. From READ_POUT register. + +temp1_input Measured temperature. From READ_TEMPERATURE_1 register. +temp1_max Maximum temperature. From OT_WARN_LIMIT register. +temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. + +temp2_input Measured temperature. From READ_TEMPERATURE_2 register. +========================================================= diff --git a/MAINTAINERS b/MAINTAINERS index 126cbc6668a1e..6a5c02e6393f9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24710,6 +24710,13 @@ S: Maintained F: Documentation/devicetree/bindings/power/supply/st,stc3117.yaml F: drivers/power/supply/stc3117_fuel_gauge.c +ST STEF48H28 DRIVER +M: Charles Hsu +L: linux-hwmon@vger.kernel.org +S: Maintained +F: Documentation/hwmon/stef48h28.rst +F: drivers/hwmon/pmbus/stef48h28.c + ST STM32 FIREWALL M: Gatien Chevallier S: Maintained diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index d0aa460abdc9d..ff01d8155019f 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -585,6 +585,15 @@ config SENSORS_Q54SJ108A2 This driver can also be built as a module. If so, the module will be called q54sj108a2. +config SENSORS_STEF48H28 + tristate "ST STEF48H28" + help + If you say yes here you get hardware monitoring support for ST + STEF48H28. + + This driver can also be built as a module. If so, the module will + be called stef48h28. + config SENSORS_STPDDC60 tristate "ST STPDDC60" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 75ec4956ca8d4..85130fd32b7e4 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_SENSORS_PLI1209BC) += pli1209bc.o obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_Q54SJ108A2) += q54sj108a2.o +obj-$(CONFIG_SENSORS_STEF48H28) += stef48h28.o obj-$(CONFIG_SENSORS_STPDDC60) += stpddc60.o obj-$(CONFIG_SENSORS_TDA38640) += tda38640.o obj-$(CONFIG_SENSORS_TPS25990) += tps25990.o diff --git a/drivers/hwmon/pmbus/stef48h28.c b/drivers/hwmon/pmbus/stef48h28.c new file mode 100644 index 0000000000000..4bde2215697cb --- /dev/null +++ b/drivers/hwmon/pmbus/stef48h28.c @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Hardware monitoring driver for STMicroelectronics digital controller stef48h28 + */ + +#include +#include +#include +#include + +#include "pmbus.h" + +static struct pmbus_driver_info stef48h28_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = direct, + .format[PSC_VOLTAGE_OUT] = direct, + .format[PSC_CURRENT_IN] = direct, + .format[PSC_CURRENT_OUT] = direct, + .format[PSC_POWER] = direct, + .format[PSC_TEMPERATURE] = direct, + .m[PSC_VOLTAGE_IN] = 50, + .b[PSC_VOLTAGE_IN] = 0, + .R[PSC_VOLTAGE_IN] = 0, + .m[PSC_VOLTAGE_OUT] = 50, + .b[PSC_VOLTAGE_OUT] = 0, + .R[PSC_VOLTAGE_OUT] = 0, + .m[PSC_CURRENT_IN] = 100, + .b[PSC_CURRENT_IN] = 0, + .R[PSC_CURRENT_IN] = 0, + .m[PSC_CURRENT_OUT] = 100, + .b[PSC_CURRENT_OUT] = 0, + .R[PSC_CURRENT_OUT] = 0, + .m[PSC_POWER] = 9765, + .b[PSC_POWER] = 0, + .R[PSC_POWER] = -3, + .m[PSC_TEMPERATURE] = 25, + .b[PSC_TEMPERATURE] = 500, + .R[PSC_TEMPERATURE] = 0, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN + | PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT +}; + +static int stef48h28_probe(struct i2c_client *client) +{ + return pmbus_do_probe(client, &stef48h28_info); +} + +static const struct i2c_device_id stef48h28_id[] = { + {"stef48h28"}, + {} +}; +MODULE_DEVICE_TABLE(i2c, stef48h28_id); + +static const struct of_device_id __maybe_unused stef48h28_of_match[] = { + {.compatible = "st,stef48h28"}, + {} +}; + +static struct i2c_driver stef48h28_driver = { + .driver = { + .name = "stef48h28", + .of_match_table = of_match_ptr(stef48h28_of_match), + }, + .probe = stef48h28_probe, + .id_table = stef48h28_id, +}; + +module_i2c_driver(stef48h28_driver); + +MODULE_AUTHOR("Charles Hsu "); +MODULE_DESCRIPTION("PMBus driver for ST stef48h28"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("PMBUS");