Re: [PATCH v1 0/3] Introduce cros_ec power monitoring

From: Guenter Roeck

Date: Wed Nov 18 2026 - 18:00:36 EST


On 11/18/26 12:45, Daniel Balint wrote:
On Sat, 7 Nov 2026 01:03:56 +0000
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

Hi Daniel

I'm not necessarily against this but when adding monitoring components
to IIO the usual question is why not hwmon? What features are not
well supported by that framework?

Note historically I suspect we accepted one or two drives into IIO that
would have fitted better there so precedence isn't a strong argument.

Convention for these somewhat borderline case is +CC hmwon maintainer
and list as well as IIO with that explanation in the cover letter.
That avoids any last minute surprises!

Hi Jonathan,

Thanks for taking a look!
The main reason for choosing IIO over hwmon is that for On-Device Power
Monitoring, userspace needs an atomic, untorn snapshot across all rails
(up to 64) over the same integration window, triggered on demand from
userspace and read out in a single buffer read rather than repeated
per-channel sysfs reads.

Reflecting that requirement, EC_PWRMON_LATCH on the EC is a global,
stateful command: a single latch simultaneously snapshots all onboard
power accumulators and resets their accumulation window on the EC, so
individual channels cannot be latched independently. As far as I know,
hwmon only exposes independent per-channel sysfs attributes with no
multi-channel buffer or on-demand trigger ABI, whereas IIO's triggered
buffer interface is well suited for this kind of pattern.

CC'ing hwmon maintainer and list to keep me honest.


You could accomplish that the same way many hwmon drivers are doing it:
Read all attributes in one go from the hardware, then cache it for a period
of time.

Having said that, my experience is that people wanting to implement IIO
drivers instead of hardware monitoring drivers keep finding reasons,
so I won't object to an IIO implementation.

Guenter