Re: [PATCH v4 2/4] power_supply: Add additional health properties to the header

Sandeep Patil
2020-03-06T23:56:52Z

Hi Sebastian,

On Fri, Jan 17, 2020 at 02:06:58AM +0100, Sebastian Reichel wrote:
> Hi,
>
> On Thu, Jan 16, 2020 at 11:50:37AM -0600, Dan Murphy wrote:
> > Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum.
> >
> > Signed-off-by: Dan Murphy <dmurphy@ti.com>
> > ---
>
> Looks good. But I will not merge it without a user and have comments
> for the driver.

Android has been looking for these properties for a while now [1].
It was added[2] when we saw that the manufacturers were implementing these
properties in the driver. I didn't know the properties were absent upstream
until yesterday. Somebody pointed out in our ongoing effort to make sure
all core kernel changes that android depends on are present upstream.

I think those values are also propagated in application facing APIs in
Android (but I am not sure yet, let me know if that's something you want
to find out).

I wanted to chime in and present you a 'user' for this if that helps.

Cc: kernel-team@android.com

- ssp

1. https://android.googlesource.com/platform/system/core/+/refs/heads/master/healthd/BatteryMonitor.cpp#162
2. https://android-review.googlesource.com/c/platform/system/core/+/414481

>
> -- Sebastian
>
> > Documentation/ABI/testing/sysfs-class-power | 2 +-
> > drivers/power/supply/power_supply_sysfs.c | 2 +-
> > include/linux/power_supply.h | 3 +++
> > 3 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
> > index bf3b48f022dc..9f3fd01a9373 100644
> > --- a/Documentation/ABI/testing/sysfs-class-power
> > +++ b/Documentation/ABI/testing/sysfs-class-power
> > @@ -190,7 +190,7 @@ Description:
> > Valid values: "Unknown", "Good", "Overheat", "Dead",
> > "Over voltage", "Unspecified failure", "Cold",
> > "Watchdog timer expire", "Safety timer expire",
> > - "Over current"
> > + "Over current", "Warm", "Cool", "Hot"
> >
> > What: /sys/class/power_supply/<supply_name>/precharge_current
> > Date: June 2017
> > diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> > index f37ad4eae60b..d0d549611794 100644
> > --- a/drivers/power/supply/power_supply_sysfs.c
> > +++ b/drivers/power/supply/power_supply_sysfs.c
> > @@ -61,7 +61,7 @@ static const char * const power_supply_charge_type_text[] = {
> > static const char * const power_supply_health_text[] = {
> > "Unknown", "Good", "Overheat", "Dead", "Over voltage",
> > "Unspecified failure", "Cold", "Watchdog timer expire",
> > - "Safety timer expire", "Over current"
> > + "Safety timer expire", "Over current", "Warm", "Cool", "Hot"
> > };
> >
> > static const char * const power_supply_technology_text[] = {
> > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> > index 28413f737e7d..bd0d3225f245 100644
> > --- a/include/linux/power_supply.h
> > +++ b/include/linux/power_supply.h
> > @@ -61,6 +61,9 @@ enum {
> > POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
> > POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
> > POWER_SUPPLY_HEALTH_OVERCURRENT,
> > + POWER_SUPPLY_HEALTH_WARM,
> > + POWER_SUPPLY_HEALTH_COOL,
> > + POWER_SUPPLY_HEALTH_HOT,
> > };
> >
> > enum {
> > --
> > 2.25.0
> >