Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH 00/17] hwmon: (ina238) Various improvements and added chip support
@ 2025-09-05 20:41 Guenter Roeck
  2025-09-05 20:41 ` [PATCH 01/17] hwmon: (ina238) Drop platform data support Guenter Roeck
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: Guenter Roeck @ 2025-09-05 20:41 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Christian Kahr, devicetree, Krzysztof Kozlowski, Chris Packham,
	Guenter Roeck

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(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-09-07 23:32 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 20:41 [PATCH 00/17] hwmon: (ina238) Various improvements and added chip support Guenter Roeck
2025-09-05 20:41 ` [PATCH 01/17] hwmon: (ina238) Drop platform data support Guenter Roeck
2025-09-05 20:41 ` [PATCH 02/17] hwmon: (ina238) Update documentation and Kconfig entry Guenter Roeck
2025-09-05 20:41 ` [PATCH 03/17] hwmon: (ina238) Drop pointless power attribute check on attribute writes Guenter Roeck
2025-09-05 20:41 ` [PATCH 04/17] hwmon: (ina238) Rework and simplify temperature calculations Guenter Roeck
2025-09-05 20:41 ` [PATCH 05/17] hwmon: (ina238) Pre-calculate current, power, and energy LSB Guenter Roeck
2025-09-05 20:41 ` [PATCH 06/17] hwmon: (ina238) Simplify voltage register accesses Guenter Roeck
2025-09-05 20:41 ` [PATCH 07/17] hwmon: (ina238) Improve current dynamic range Guenter Roeck
2025-09-05 20:41 ` [PATCH 08/17] hwmon: (ina238) Stop using the shunt voltage register Guenter Roeck
2025-09-05 20:41 ` [PATCH 09/17] hwmon: (ina238) Add support for current limits Guenter Roeck
2025-09-05 20:41 ` [PATCH 10/17] hwmon: (ina238) Order chip information alphabetically Guenter Roeck
2025-09-05 20:41 ` [PATCH 11/17] hwmon: Introduce 64-bit energy attribute support Guenter Roeck
2025-09-05 20:41 ` [PATCH 12/17] hwmon: (ina238) Use the energy64 attribute type to report the energy Guenter Roeck
2025-09-05 20:41 ` [PATCH 13/17] hwmon: (ina238) Support active-high alert polarity Guenter Roeck
2025-09-05 20:41 ` [PATCH 14/17] hwmon: (ina238) Only configure calibration and shunt registers if needed Guenter Roeck
2025-09-05 20:41 ` [PATCH 15/17] hwmon: (ina238) Add support for INA780 Guenter Roeck
2025-09-05 20:41 ` [PATCH 16/17] dt-bindings: hwmon: ti,ina2xx: Add INA700 Guenter Roeck
2025-09-05 20:41 ` [PATCH 17/17] hwmon: (ina238) Add support for INA700 Guenter Roeck
2025-09-07 23:00 ` [PATCH 00/17] hwmon: (ina238) Various improvements and added chip support Chris Packham
2025-09-07 23:32   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox