Skip to content

Commit 9f90fd6

Browse files
nunojsagroeck
authored andcommitted
hwmon: Add support for ltc2947
The ltc2947 is a high precision power and energy monitor with an internal sense resistor supporting up to +/- 30A. Three internal no Latency ADCs ensure accurate measurement of voltage and current, while high-bandwidth analog multiplication of voltage and current provides accurate power measurement in a wide range of applications. Internal or external clocking options enable precise charge and energy measurements. Signed-off-by: Nuno Sá <[email protected]> Link: https://lore.kernel.org/r/[email protected] [groeck: Removed unnecessary checks when reading temperature and energy; PAGE{0,1} -> LTC2947_PAGE_{0,1}] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 2057bdf commit 9f90fd6

File tree

9 files changed

+1435
-0
lines changed

9 files changed

+1435
-0
lines changed

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Hardware Monitoring Kernel Drivers
9090
lm95245
9191
lochnagar
9292
ltc2945
93+
ltc2947
9394
ltc2978
9495
ltc2990
9596
ltc3815

Documentation/hwmon/ltc2947.rst

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
Kernel drivers ltc2947-i2c and ltc2947-spi
2+
==========================================
3+
4+
Supported chips:
5+
6+
* Analog Devices LTC2947
7+
8+
Prefix: 'ltc2947'
9+
10+
Addresses scanned: -
11+
12+
Datasheet:
13+
14+
https://www.analog.com/media/en/technical-documentation/data-sheets/LTC2947.pdf
15+
16+
Author: Nuno Sá <[email protected]>
17+
18+
Description
19+
___________
20+
21+
The LTC2947 is a high precision power and energy monitor that measures current,
22+
voltage, power, temperature, charge and energy. The device supports both SPI
23+
and I2C depending on the chip configuration.
24+
The device also measures accumulated quantities as energy. It has two banks of
25+
register's to read/set energy related values. These banks can be configured
26+
independently to have setups like: energy1 accumulates always and enrgy2 only
27+
accumulates if current is positive (to check battery charging efficiency for
28+
example). The device also supports a GPIO pin that can be configured as output
29+
to control a fan as a function of measured temperature. Then, the GPIO becomes
30+
active as soon as a temperature reading is higher than a defined threshold. The
31+
temp2 channel is used to control this thresholds and to read the respective
32+
alarms.
33+
34+
Sysfs entries
35+
_____________
36+
37+
The following attributes are supported. Limits are read-write, reset_history
38+
is write-only and all the other attributes are read-only.
39+
40+
======================= ==========================================
41+
in0_input VP-VM voltage (mV).
42+
in0_min Undervoltage threshold
43+
in0_max Overvoltage threshold
44+
in0_lowest Lowest measured voltage
45+
in0_highest Highest measured voltage
46+
in0_reset_history Write 1 to reset in1 history
47+
in0_min_alarm Undervoltage alarm
48+
in0_max_alarm Overvoltage alarm
49+
in0_label Channel label (VP-VM)
50+
51+
in1_input DVCC voltage (mV)
52+
in1_min Undervoltage threshold
53+
in1_max Overvoltage threshold
54+
in1_lowest Lowest measured voltage
55+
in1_highest Highest measured voltage
56+
in1_reset_history Write 1 to reset in2 history
57+
in1_min_alarm Undervoltage alarm
58+
in1_max_alarm Overvoltage alarm
59+
in1_label Channel label (DVCC)
60+
61+
curr1_input IP-IM Sense current (mA)
62+
curr1_min Undercurrent threshold
63+
curr1_max Overcurrent threshold
64+
curr1_lowest Lowest measured current
65+
curr1_highest Highest measured current
66+
curr1_reset_history Write 1 to reset curr1 history
67+
curr1_min_alarm Undercurrent alarm
68+
curr1_max_alarm Overcurrent alarm
69+
curr1_label Channel label (IP-IM)
70+
71+
power1_input Power (in uW)
72+
power1_min Low power threshold
73+
power1_max High power threshold
74+
power1_input_lowest Historical minimum power use
75+
power1_input_highest Historical maximum power use
76+
power1_reset_history Write 1 to reset power1 history
77+
power1_min_alarm Low power alarm
78+
power1_max_alarm High power alarm
79+
power1_label Channel label (Power)
80+
81+
temp1_input Chip Temperature (in milliC)
82+
temp1_min Low temperature threshold
83+
temp1_max High temperature threshold
84+
temp1_input_lowest Historical minimum temperature use
85+
temp1_input_highest Historical maximum temperature use
86+
temp1_reset_history Write 1 to reset temp1 history
87+
temp1_min_alarm Low temperature alarm
88+
temp1_max_alarm High temperature alarm
89+
temp1_label Channel label (Ambient)
90+
91+
temp2_min Low temperature threshold for fan control
92+
temp2_max High temperature threshold for fan control
93+
temp2_min_alarm Low temperature fan control alarm
94+
temp2_max_alarm High temperature fan control alarm
95+
temp2_label Channel label (TEMPFAN)
96+
97+
energy1_input Measured energy over time (in microJoule)
98+
99+
energy2_input Measured energy over time (in microJoule)
100+
======================= ==========================================

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9630,6 +9630,16 @@ S: Maintained
96309630
F: Documentation/hwmon/ltc4261.rst
96319631
F: drivers/hwmon/ltc4261.c
96329632

9633+
LTC2947 HARDWARE MONITOR DRIVER
9634+
M: Nuno Sá <[email protected]>
9635+
W: http://ez.analog.com/community/linux-device-drivers
9636+
9637+
S: Supported
9638+
F: drivers/hwmon/ltc2947-core.c
9639+
F: drivers/hwmon/ltc2947-spi.c
9640+
F: drivers/hwmon/ltc2947-i2c.c
9641+
F: drivers/hwmon/ltc2947.h
9642+
96339643
LTC4306 I2C MULTIPLEXER DRIVER
96349644
M: Michael Hennerich <[email protected]>
96359645
W: http://ez.analog.com/community/linux-device-drivers

drivers/hwmon/Kconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,33 @@ config SENSORS_LTC2945
726726
This driver can also be built as a module. If so, the module will
727727
be called ltc2945.
728728

729+
config SENSORS_LTC2947
730+
tristate
731+
732+
config SENSORS_LTC2947_I2C
733+
tristate "Analog Devices LTC2947 High Precision Power and Energy Monitor over I2C"
734+
depends on I2C
735+
select REGMAP_I2C
736+
select SENSORS_LTC2947
737+
help
738+
If you say yes here you get support for Linear Technology LTC2947
739+
I2C High Precision Power and Energy Monitor
740+
741+
This driver can also be built as a module. If so, the module will
742+
be called ltc2947-i2c.
743+
744+
config SENSORS_LTC2947_SPI
745+
tristate "Analog Devices LTC2947 High Precision Power and Energy Monitor over SPI"
746+
depends on SPI_MASTER
747+
select REGMAP_SPI
748+
select SENSORS_LTC2947
749+
help
750+
If you say yes here you get support for Linear Technology LTC2947
751+
SPI High Precision Power and Energy Monitor
752+
753+
This driver can also be built as a module. If so, the module will
754+
be called ltc2947-spi.
755+
729756
config SENSORS_LTC2990
730757
tristate "Linear Technology LTC2990"
731758
depends on I2C

drivers/hwmon/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ obj-$(CONFIG_SENSORS_LM95234) += lm95234.o
106106
obj-$(CONFIG_SENSORS_LM95241) += lm95241.o
107107
obj-$(CONFIG_SENSORS_LM95245) += lm95245.o
108108
obj-$(CONFIG_SENSORS_LTC2945) += ltc2945.o
109+
obj-$(CONFIG_SENSORS_LTC2947) += ltc2947-core.o
110+
obj-$(CONFIG_SENSORS_LTC2947_I2C) += ltc2947-i2c.o
111+
obj-$(CONFIG_SENSORS_LTC2947_SPI) += ltc2947-spi.o
109112
obj-$(CONFIG_SENSORS_LTC2990) += ltc2990.o
110113
obj-$(CONFIG_SENSORS_LTC4151) += ltc4151.o
111114
obj-$(CONFIG_SENSORS_LTC4215) += ltc4215.o

0 commit comments

Comments
 (0)