mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
hwmon: Add TSC1641 I2C power monitor driver
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. Signed-off-by: Igor Reznichenko <igor@reznichenko.net> Link: https://lore.kernel.org/r/20251105201406.1210856-3-igor@reznichenko.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
committed by
Guenter Roeck
parent
96cee719d2
commit
0c7d530a04
@@ -256,6 +256,7 @@ Hardware Monitoring Kernel Drivers
|
||||
tps40422
|
||||
tps53679
|
||||
tps546d24
|
||||
tsc1641
|
||||
twl4030-madc-hwmon
|
||||
ucd9000
|
||||
ucd9200
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
Kernel driver tsc1641
|
||||
=====================
|
||||
|
||||
Supported chips:
|
||||
|
||||
* ST TSC1641
|
||||
|
||||
Prefix: 'tsc1641'
|
||||
|
||||
Addresses scanned: -
|
||||
|
||||
Datasheet:
|
||||
https://www.st.com/resource/en/datasheet/tsc1641.pdf
|
||||
|
||||
Author:
|
||||
- Igor Reznichenko <igor@reznichenko.net>
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The TSC1641 is a high-precision current, voltage, power, and temperature
|
||||
monitoring analog front-end (AFE). It monitors bidirectional current into a
|
||||
shunt resistor and load voltage up to 60 V in a synchronized way. Digital bus
|
||||
interface is I2C/SMbus. The TSC1641 allows the assertion of several alerts
|
||||
regarding the voltage, current, power and temperature.
|
||||
|
||||
Usage Notes
|
||||
-----------
|
||||
|
||||
The TSC1641 driver requires the value of the external shunt resistor to
|
||||
correctly compute current and power measurements. The resistor value, in
|
||||
micro-ohms, should be provided either through the device tree property
|
||||
"shunt-resistor-micro-ohms" or via writable sysfs attribute "shunt_resistor".
|
||||
Please refer to the Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
|
||||
for bindings if the device tree is used.
|
||||
|
||||
Supported range of shunt resistor values is from 100 uOhm to 655.35 mOhm, in
|
||||
10 uOhm steps.
|
||||
When selecting the value keep in mind device maximum DC power measurement is
|
||||
1600W. See datasheet p.22 for ST recommendations on selecting shunt value.
|
||||
|
||||
If the shunt resistor value is not specified in the device tree, the driver
|
||||
initializes it to 1000 uOhm by default. Users may configure the correct shunt
|
||||
resistor value at runtime by writing to the "shunt_resistor" sysfs attribute.
|
||||
|
||||
The driver only supports continuous operating mode.
|
||||
Measurement ranges:
|
||||
|
||||
================ ===============================================================
|
||||
Current Bidirectional, dependent on shunt
|
||||
Bus voltage 0-60V
|
||||
Maximum DC power 1600W
|
||||
Temperature -40C to +125C
|
||||
================ ===============================================================
|
||||
|
||||
Sysfs entries
|
||||
-------------
|
||||
|
||||
==================== ===========================================================
|
||||
in0_input bus voltage (mV)
|
||||
in0_max bus voltage max alarm limit (mV)
|
||||
in0_max_alarm bus voltage max alarm limit exceeded
|
||||
in0_min bus voltage min alarm limit (mV)
|
||||
in0_min_alarm bus voltage min alarm limit exceeded
|
||||
|
||||
curr1_input current measurement (mA)
|
||||
curr1_max current max alarm limit (mA)
|
||||
curr1_max_alarm current max alarm limit exceeded
|
||||
curr1_min current min alarm limit (mA)
|
||||
curr1_min_alarm current min alarm limit exceeded
|
||||
|
||||
power1_input power measurement (uW)
|
||||
power1_max power max alarm limit (uW)
|
||||
power1_max_alarm power max alarm limit exceeded
|
||||
|
||||
shunt_resistor shunt resistor value (uOhms)
|
||||
|
||||
temp1_input temperature measurement (mdegC)
|
||||
temp1_max temperature max alarm limit (mdegC)
|
||||
temp1_max_alarm temperature max alarm limit exceeded
|
||||
|
||||
update_interval data conversion time (1 - 33ms), longer conversion time
|
||||
corresponds to higher effective resolution in bits
|
||||
==================== ===========================================================
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user