Skip to content

hwmon: (ina238) Various improvements and added chip support

Guenter Roeck linux-devicetree linux-hwmon 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17hwmon: (ina238) Drop platform data supportDocumentation/hwmon/ina238.rst drivers/hwmon/ina238.c+6 -100 replies
2/17hwmon: (ina238) Update documentation and Kconfig entryDocumentation/hwmon/ina238.rst drivers/hwmon/Kconfig+35 -130 replies
3/17hwmon: (ina238) Drop pointless power attribute check on attribute writesdrivers/hwmon/ina238.c+2 -50 replies
4/17hwmon: (ina238) Rework and simplify temperature calculationsdrivers/hwmon/ina238.c+24 -280 replies
5/17hwmon: (ina238) Pre-calculate current, power, and energy LSBdrivers/hwmon/ina238.c+27 -200 replies
6/17hwmon: (ina238) Simplify voltage register accessesdrivers/hwmon/ina238.c+53 -1080 replies
7/17hwmon: (ina238) Improve current dynamic rangedrivers/hwmon/ina238.c+19 -320 replies
8/17hwmon: (ina238) Stop using the shunt voltage registerdrivers/hwmon/ina238.c+1 -10 replies
9/17hwmon: (ina238) Add support for current limitsDocumentation/hwmon/ina238.rst drivers/hwmon/ina238.c+87 -220 replies
10/17hwmon: (ina238) Order chip information alphabeticallydrivers/hwmon/ina238.c+12 -120 replies
11/17hwmon: Introduce 64-bit energy attribute supportDocumentation/hwmon/hwmon-kernel-api.rst drivers/hwmon/hwmon.c include/linux/hwmon.h +1 more+20 -100 replies
12/17hwmon: (ina238) Use the energy64 attribute type to report the energydrivers/hwmon/ina238.c+15 -190 replies
13/17hwmon: (ina238) Support active-high alert polaritydrivers/hwmon/ina238.c+6 -20 replies
14/17hwmon: (ina238) Only configure calibration and shunt registers if neededdrivers/hwmon/ina238.c+42 -400 replies
15/17hwmon: (ina238) Add support for INA780Documentation/hwmon/ina238.rst drivers/hwmon/Kconfig drivers/hwmon/ina238.c+28 -50 replies
16/17dt-bindings: hwmon: ti,ina2xx: Add INA700Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml+4 -00 replies
17/17hwmon: (ina238) Add support for INA700Documentation/hwmon/ina238.rst drivers/hwmon/Kconfig drivers/hwmon/ina238.c+26 -60 replies

Reviews trailers per patch

1 of 17 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKrzysztof KozlowskiChris Packham
SeriesR-b T-b
1/17
2/17
3/17
4/17
5/17
6/17
7/17
8/17
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17R-b
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/17] hwmon: (ina238) Various improvements and added chip support

Add support for INA700 and INA780 to the ina238 driver.

To prepare for this, implement various improvements.

- Update documention and Kconfig entry to list all supported chips.

- Drop platform data support. The driver supports device properties, and there are no in-tree platform data users.

- Stop checking the attribute value when writing the power_max attribute as unnecessary.

- Simplify temperature calculations. Instead of shift and lsb, only require the resulution and use it to calculate temperatures.

- Pre-calculate voltage, current, power and energy LSB. The values don't change during runtime and can therefore be pre-calculated. Also use the equations provided in the dataasheets to calculate power and energy LSB from the current LSB instead of calculating it from scratch.

- Use ROUND_CLOSEST operations instead of divide operations to reduce rounding errors.

- Improve current dynamic range by matching shunt voltage and current register values. With that, the dynamic range is always the full 16 bit provided by the ADC.

- Stop using the shunt voltage register. With shunt and current register values now always matching, it is unnecessary to read both.

- Provide current limits from shunt voltage limit registers. After all, there is no difference for the ADC, so the shunt voltage limits translate into current limits.

- Order chip information alphabetically. No functional change, it just simplifies adding support for new chips.

- Add 64-bit energy attribute support to the hwmon core.

- Use the hwmon core to report 64-bit energy values.

- Add support for active-high alert polarity

- Limit shunt and calibration register writes to chips requiring/supporting it.

- Add support for INA700 and INA780. Both chips have internal shunt resistors and do not explicitly report the shunt voltage.

This patch series was inspired by Chris Packham's initial patch set of a new INA780 driver, by his subsequent patch set adding support for that chip to the ina238 driver, and by Christian Kahr's submission of a new INA700 driver.

The series was tested with INA228, INA237, INA238, and INA780 evaluation boards as well as with unit test code.

----------------------------------------------------------------
Guenter Roeck (17):
hwmon: (ina238) Drop platform data support
hwmon: (ina238) Update documentation and Kconfig entry
hwmon: (ina238) Drop pointless power attribute check on attribute writes
hwmon: (ina238) Rework and simplify temperature calculations
hwmon: (ina238) Pre-calculate current, power, and energy LSB
hwmon: (ina238) Simplify voltage register accesses
hwmon: (ina238) Improve current dynamic range
hwmon: (ina238) Stop using the shunt voltage register
hwmon: (ina238) Add support for current limits
hwmon: (ina238) Order chip information alphabetically
hwmon: Introduce 64-bit energy attribute support
hwmon: (ina238) Use the energy64 attribute type to report the energy
hwmon: (ina238) Support active-high alert polarity
hwmon: (ina238) Only configure calibration and shunt registers if needed
hwmon: (ina238) Add support for INA780
dt-bindings: hwmon: ti,ina2xx: Add INA700
hwmon: (ina238) Add support for INA700

 .../devicetree/bindings/hwmon/ti,ina2xx.yaml       |   4 +
 Documentation/hwmon/hwmon-kernel-api.rst           |   3 +
 Documentation/hwmon/ina238.rst                     |  64 ++-
 drivers/hwmon/Kconfig                              |   9 +-
 drivers/hwmon/hwmon.c                              |  16 +-
 drivers/hwmon/ina238.c                             | 583 +++++++++++----------
 include/linux/hwmon.h                              |   1 +
 include/trace/events/hwmon.h                       |  10 +-
 8 files changed, 382 insertions(+), 308 deletions(-)