Re: [PATCH] hwmon: Add power meters to Documentation/hwmon/sysfs-interface

Shem Multinymous
2007-09-01T18:05:17Z

On 9/1/07, Pavel Machek <pavel@ucw.cz> wrote:
> > diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
> > index b3a9e1b..da546ce 100644
> > --- a/Documentation/hwmon/sysfs-interface
> > +++ b/Documentation/hwmon/sysfs-interface
> > @@ -304,6 +304,21 @@ curr[1-*]_input Current input value
> > Unit: milliampere
> > RO
> >
> > +*********
> > +* Power *
> > +*********
> > +
> > +power[1-*]_input Current power use
> > + Unit: milliWatt
> > + RO
> > +
> > +power[1-*]_max_input Historical maximum power use
> > + Unit: milliWatt
> > + RO
> > +
> > +power[1-*]_min_input Historical minimum power use
> > + Unit: milliWatt
> > + RO
>
> Should we add power?_10sec_avg_input? IIRC thinkpads export that,
> too.

Indeed, ThinkPads report both instantaneous power/current and a
rolling average (exponentially decaying, I think) over the last ~10
seconds. ACPI provides only the rolling average, and the out-of-tree
tp_smapi driver provides both.

More generally, linux/power_supply.h defines these attributes:

POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,

It would be nice if the power meter interface uses the same
conventions as the power supply interface, since the former is
essentially a subset of the latter. Userspace app that read power
meters via sysfs should work for power supplies too.

Shem