mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ferdinand Schwenk <ferdinand.schwenk@advastore.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"richard.leitner@linux.dev" <richard.leitner@linux.dev>
Subject: AW: [PATCH 0/2] hwmon: ina238: Add samples and update_interval support
Date: Tue, 26 May 2026 09:08:18 +0000	[thread overview]
Message-ID: <FR0P281MB28617450903B76C97BF62011E00B2@FR0P281MB2861.DEUP281.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <7af1292b-e61a-4cbc-8353-dcbc6dfce3b6@roeck-us.net>

On 5/22/26 13:18, Guenter Roeck wrote:
> 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

Thanks for the clarification. I understand and accept that update_interval must
be in milliseconds.

This raises the question of how to handle hardware whose native resolution
falls below one millisecond. The INA238 has eight conversion steps from 50 µs
to 4120 µs — atmillisecond resolution the four shortest steps (50, 84, 150,
280 µs) collapse to 1 ms and become indistinguishable from userspace. The same
issue already affects the ina3221 driver in mainline, whose conversion time
table starts at 140, 204, 332 µs.

Would adding a `update_interval_us` attribute alongside `update_interval` be an
acceptable path for hwmon? This pattern has precedent in the kernel: the 1-Wire
subsystem added `w1_master_timeout_us` alongside the existing
`w1_master_timeout` when hardware required finer resolution (commit c30983569272).

Ferdinand

  reply	other threads:[~2026-05-26  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  7:03 Ferdinand Schwenk via B4 Relay
2026-05-22  7:03 ` [PATCH 1/2] hwmon: ina238: add support for samples and update_interval Ferdinand Schwenk via B4 Relay
2026-05-22  7:03 ` [PATCH 2/2] hwmon: ina238: use microseconds for update_interval Ferdinand Schwenk via B4 Relay
2026-05-22 13:18 ` [PATCH 0/2] hwmon: ina238: Add samples and update_interval support Guenter Roeck
2026-05-26  9:08   ` Ferdinand Schwenk [this message]
2026-05-28  4:01     ` AW: " Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FR0P281MB28617450903B76C97BF62011E00B2@FR0P281MB2861.DEUP281.PROD.OUTLOOK.COM \
    --to=ferdinand.schwenk@advastore.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=richard.leitner@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®