]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: pmbus: add support for STEF48H28
authorCharles Hsu <hsu.yungteng@gmail.com>
Mon, 26 Jan 2026 06:37:12 +0000 (14:37 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 31 Jan 2026 15:38:32 +0000 (07:38 -0800)
Add support for STEF48H28 hot-swap controller.

Signed-off-by: Charles Hsu <hsu.yungteng@gmail.com>
Link: https://lore.kernel.org/r/20260126063712.1049025-2-hsu.yungteng@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/index.rst
Documentation/hwmon/stef48h28.rst [new file with mode: 0644]
MAINTAINERS
drivers/hwmon/pmbus/Kconfig
drivers/hwmon/pmbus/Makefile
drivers/hwmon/pmbus/stef48h28.c [new file with mode: 0644]

index 6181c3f62177e5cc6ba79f776bf6c8238e83e10c..e61e9afc3b21a3e1a2e44a84cd75ee9fc6611d29 100644 (file)
@@ -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 (file)
index 0000000..00bef9e
--- /dev/null
@@ -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 <hsu.yungteng@gmail.com>
+
+
+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.
+=========================================================
index 126cbc6668a1ea4e339df6030e0b4882f5d2ca59..6a5c02e6393f9771c19cbf073a0d67815543ab14 100644 (file)
@@ -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     <hsu.yungteng@gmail.com>
+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 <gatien.chevallier@foss.st.com>
 S:     Maintained
index d0aa460abdc9dc06ad0cb3297362650e489ffab6..ff01d8155019fe549db73c61a6d31ebe3926fb21 100644 (file)
@@ -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
index 75ec4956ca8d48257f9ea4e6e3e90ffffce5287d..85130fd32b7e4cd6dd178adc9e6068282224b50e 100644 (file)
@@ -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 (file)
index 0000000..4bde221
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Hardware monitoring driver for STMicroelectronics digital controller stef48h28
+ */
+
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+
+#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 <hsu.yungteng@gmail.com>");
+MODULE_DESCRIPTION("PMBus driver for ST stef48h28");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("PMBUS");