[PATCH 0/2] hwmon: ina238: Add samples and update_interval support

Ferdinand Schwenk via B4 Relay posted 2 patches 2 days, 11 hours ago
drivers/hwmon/ina238.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 132 insertions(+), 2 deletions(-)
[PATCH 0/2] hwmon: ina238: Add samples and update_interval support
Posted by Ferdinand Schwenk via B4 Relay 2 days, 11 hours ago
This series exposes the INA238 ADC_CONFIG register's averaging count
(AVG) and conversion time fields (VBUSCT, VSHCT, VTCT) through the
standard hwmon chip-level attributes chip/samples and
chip/update_interval.

The first patch adds read/write support for both attributes using a
per-chip conversion-time lookup table to correctly handle all
supported variants: INA228, INA237, INA238, INA700, INA780 (sharing
ina238_conv_time[]) and the Silergy SQ52206 (sq52206_conv_time[]).

The second patch uses microseconds as the unit for update_interval
instead of milliseconds.  The INA238 supports conversion times as
short as 50 us; millisecond precision would make the four shortest
steps (50, 84, 150, 280 us) indistinguishable and inaccessible.
Since chip/update_interval is introduced in this same series, no
existing ABI is broken.

Signed-off-by: Ferdinand Schwenk <ferdinand.schwenk@advastore.com>
---
Ferdinand Schwenk (2):
      hwmon: ina238: add support for samples and update_interval
      hwmon: ina238: use microseconds for update_interval

 drivers/hwmon/ina238.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 2 deletions(-)
---
base-commit: 028ef9c96e96197026887c0f092424679298aae8
change-id: 20260520-hwmon-ina238-add-samples-update-interval-28761658e11f

Best regards,
-- 
Ferdinand Schwenk <ferdinand.schwenk@advastore.com>
Re: [PATCH 0/2] hwmon: ina238: Add samples and update_interval support
Posted by Guenter Roeck 2 days, 5 hours ago
On 5/22/26 00:03, Ferdinand Schwenk via B4 Relay wrote:
> This series exposes the INA238 ADC_CONFIG register's averaging count
> (AVG) and conversion time fields (VBUSCT, VSHCT, VTCT) through the
> standard hwmon chip-level attributes chip/samples and
> chip/update_interval.
> 
> The first patch adds read/write support for both attributes using a
> per-chip conversion-time lookup table to correctly handle all
> supported variants: INA228, INA237, INA238, INA700, INA780 (sharing
> ina238_conv_time[]) and the Silergy SQ52206 (sq52206_conv_time[]).
> 
> The second patch uses microseconds as the unit for update_interval
> instead of milliseconds.  The INA238 supports conversion times as
> short as 50 us; millisecond precision would make the four shortest
> steps (50, 84, 150, 280 us) indistinguishable and inaccessible.
> Since chip/update_interval is introduced in this same series, no
> existing ABI is broken.
> 

Are you serious ? The hwmon ABI says clearly that the unit is milliseconds.

What:           /sys/class/hwmon/hwmonX/update_interval
Description:
                 The interval at which the chip will update readings.
                 Unit: millisecond

It doesn't matter if attribute support is introduced with the series
or not. It is still an ABI violation.

Guenter