Re: [PATCH v1 0/3] Introduce cros_ec power monitoring
From: Daniel Balint
Date: Wed Nov 18 2026 - 15:47:33 EST
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.
If there is no objection to adding the driver to IIO, I will clean up the
custom energy_value attribute and replace it with the standard IIO
triggered buffer interface in v2, along with addressing other review
comments and including the above explanation in the v2 cover letter.
Thanks,
Daniel