Re: [PATCH v4 2/4] power: supply: core: add input voltage/current measurements
From: Michał Mirosław
Date: Sat May 02 2020 - 18:45:45 EST
On Sun, May 03, 2020 at 12:23:49AM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Fri, May 01, 2020 at 05:11:18PM +0200, Michał Mirosław wrote:
> > Introduce input voltage and current limits and measurements.
> > This makes room for e.g. VBUS measurements in USB chargers.
> We already have properties for charger input voltage/current.
> Unfortunately the naming is not as straight forward, as it
> could be. Basically the properties have been added over time
> and are ABI now. Things are documented in
>
> Documentation/ABI/testing/sysfs-class-power
>
> I provided the relevant properties below.
Hmm. Looks like there is no battery current/voltage properties then?
This is different from IBUS (input current), as IBUS = charging
current + system load. Documentation/power/power_supply_class.rst is
missing descriptions for the properties you mention.
[...]
> > --- a/include/linux/power_supply.h
> > +++ b/include/linux/power_supply.h
> > @@ -127,7 +127,9 @@ enum power_supply_property {
> > POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
> > POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */
> > POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */
> > + POWER_SUPPLY_PROP_INPUT_CURRENT_NOW,
>
> What: /sys/class/power_supply/<supply_name>/current_avg
> Date: May 2007
> Contact: linux-pm@xxxxxxxxxxxxxxx
> Description:
> Reports an average IBUS current reading over a fixed period.
> Normally devices will provide a fixed interval in which they
> average readings to smooth out the reported value.
>
> Access: Read
> Valid values: Represented in microamps
>
There are two entries for /sys/class/power_supply/<supply_name>/current_avg
in the file, the other one mentions IBAT instead. "voltage_now" has the
same problem. There seems to be a split-personality disorder present in
the kernel ABI. ;-)
Best Regards,
Michał Mirosław