Skip to contentSkip to conversation

hwmon: Add TSC1641 I2C power monitor driver

PATCH Applied Igor Reznichenko 3 participants 6 messages Nov 5, 2025 – Nov 12, 2025

Subsystems (4)
lore
Share & tools
lore

Igor Reznichenko

author maintainer
#0 lore raw

v4 cover hwmon: Add TSC1641 I2C power monitor driver

This patch series adds support for the ST Microelectronics TSC1641 I2C power monitor. The TSC1641 provides bus voltage, current, power, and temperature measurements via the hwmon subsystem. The driver supports optional ALERT pin polarity configuration and exposes the shunt resistor value and update interval via sysfs.

Tested on Raspberry Pi 3B+ with a TSC1641 evaluation board.

v3: https://lore.kernel.org/linux-hwmon/[email protected]/

Changes in v4:
- Updated devicetree binding example
- Removed unnecessary check for !current_lsb
- Added clamping to current val
- No extra calls to validate_shunt()

Igor Reznichenko (2):
dt-bindings: hwmon: ST TSC1641 power monitor
hwmon: Add TSC1641 I2C power monitor driver

 .../devicetree/bindings/hwmon/st,tsc1641.yaml |  63 ++
 Documentation/hwmon/index.rst                 |   1 +
 Documentation/hwmon/tsc1641.rst               |  87 ++
 drivers/hwmon/Kconfig                         |  12 +
 drivers/hwmon/Makefile                        |   1 +
 drivers/hwmon/tsc1641.c                       | 748 ++++++++++++++++++
 6 files changed, 912 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
 create mode 100644 Documentation/hwmon/tsc1641.rst
 create mode 100644 drivers/hwmon/tsc1641.c
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v4 1/2 dt-bindings: hwmon: ST TSC1641 power monitor

Add binding for the TSC1641 I2C power monitor.

---
 .../devicetree/bindings/hwmon/st,tsc1641.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml new file +63 -0
new file mode 100644
index 000000000000..aaf244790663
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/st,tsc1641.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ST Microelectronics TSC1641 I2C power monitor
+
+maintainers:
+  - Igor Reznichenko <[email protected]>
+
+description: |
+  TSC1641 is a 60 V, 16-bit high-precision power monitor with I2C and
+  MIPI I3C interface
+
+  Datasheets:
+    https://www.st.com/resource/en/datasheet/tsc1641.pdf
+
+properties:
+  compatible:
+    const: st,tsc1641
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: Optional alert interrupt.
+    maxItems: 1
+
+  shunt-resistor-micro-ohms:
+    description: Shunt resistor value in micro-ohms. Since device has internal
+      16-bit RSHUNT register with 10 uOhm LSB, the maximum value is capped at
+      655.35 mOhm.
+    minimum: 100
+    default: 1000
+    maximum: 655350
+
+  st,alert-polarity-active-high:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Default value is 0 which configures the normal polarity of the
+      ALERT pin, being active low open-drain. Setting this to 1 configures the
+      polarity of the ALERT pin to be inverted and active high open-drain.
+      Specify this property to set the alert polarity to active-high.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        power-sensor@40 {
+            compatible = "st,tsc1641";
+            reg = <0x40>;
+            shunt-resistor-micro-ohms = <1000>;
+            st,alert-polarity-active-high;
+        };
+    };
Signature · 1 line
2.43.0
Reviewed-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: hwmon: ST TSC1641 power monitor

Quoted 7 lines · Igor Reznichenko

Add binding for the TSC1641 I2C power monitor.

---
 .../devicetree/bindings/hwmon/st,tsc1641.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml

Best regards,
Krzysztof

author maintainer
#4 lore raw

PATCH v4 2/2 hwmon: Add TSC1641 I2C power monitor driver

In reply to Igor Reznichenko

Add a driver for the ST Microelectronics TSC1641 16-bit high-precision power monitor. The driver supports reading bus voltage, current, power, and temperature. Sysfs attributes are exposed for shunt resistor and update interval. The driver integrates with the hwmon subsystem and supports optional ALERT pin polarity configuration.

---
 Documentation/hwmon/index.rst   |   1 +
 Documentation/hwmon/tsc1641.rst |  87 ++++
 drivers/hwmon/Kconfig           |  12 +
 drivers/hwmon/Makefile          |   1 +
 drivers/hwmon/tsc1641.c         | 748 ++++++++++++++++++++++++++++++++
 5 files changed, 849 insertions(+)
 create mode 100644 Documentation/hwmon/tsc1641.rst
 create mode 100644 drivers/hwmon/tsc1641.c
Documentation/hwmon/index.rst +1 -0
index 51a5bdf75b08..4fb9f91f83b3 100644
@@ -253,6 +253,7 @@ Hardware Monitoring Kernel Drivers
    tps40422
    tps53679
    tps546d24
+   tsc1641
    twl4030-madc-hwmon
    ucd9000
    ucd9200
Documentation/hwmon/tsc1641.rst new file +87 -0

88 lines not on this page · raw message

drivers/hwmon/Kconfig +12 -0
index 2760feb9f83b..b9d7b02932a6 100644
@@ -2434,6 +2434,18 @@ config SENSORS_TMP513
 	  This driver can also be built as a module. If so, the module
 	  will be called tmp513.
 
+config SENSORS_TSC1641
+	tristate "ST Microelectronics TSC1641 Power Monitor"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for TSC1641 power  monitor chip.
+	  The TSC1641 driver is configured for the default configuration of
+	  the part except temperature is enabled by default.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called tsc1641.
+
 config SENSORS_VEXPRESS
 	tristate "Versatile Express"
 	depends on VEXPRESS_CONFIG
drivers/hwmon/Makefile +1 -0
index 73b2abdcc6dd..a8de5bc69f2a 100644
@@ -233,6 +233,7 @@ obj-$(CONFIG_SENSORS_TMP401)	+= tmp401.o
 obj-$(CONFIG_SENSORS_TMP421)	+= tmp421.o
 obj-$(CONFIG_SENSORS_TMP464)	+= tmp464.o
 obj-$(CONFIG_SENSORS_TMP513)	+= tmp513.o
+obj-$(CONFIG_SENSORS_TSC1641)	+= tsc1641.o
 obj-$(CONFIG_SENSORS_VEXPRESS)	+= vexpress-hwmon.o
 obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
drivers/hwmon/tsc1641.c new file +748 -0

748 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer Applied
#5 lore raw
Quoted 7 lines · Igor Reznichenko

Add a driver for the ST Microelectronics TSC1641 16-bit high-precision power monitor. The driver supports reading bus voltage, current, power, and temperature. Sysfs attributes are exposed for shunt resistor and update interval. The driver integrates with the hwmon subsystem and supports optional ALERT pin polarity configuration.

Applied.

Thanks,
Guenter