Hi, On Wed, Mar 08, 2023 at 10:44:18AM +0200, Svyatoslav Ryhel wrote: > Optionally pass status and health from supplier if > it supports those props. If cell is online assume it > is present as well. > > Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx> Charger health might be different from battery health, so it's not safe to inherit. Otherwise LGTM. -- Sebastian > --- > drivers/power/supply/max17040_battery.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c > index 2778ed5b5c14..6dfce7b1309e 100644 > --- a/drivers/power/supply/max17040_battery.c > +++ b/drivers/power/supply/max17040_battery.c > @@ -390,6 +390,7 @@ static int max17040_get_property(struct power_supply *psy, > > switch (psp) { > case POWER_SUPPLY_PROP_ONLINE: > + case POWER_SUPPLY_PROP_PRESENT: > val->intval = max17040_get_online(chip); > break; > case POWER_SUPPLY_PROP_VOLTAGE_NOW: > @@ -402,6 +403,10 @@ static int max17040_get_property(struct power_supply *psy, > val->intval = chip->low_soc_alert; > break; > > + case POWER_SUPPLY_PROP_STATUS: > + case POWER_SUPPLY_PROP_HEALTH: > + power_supply_get_property_from_supplier(psy, psp, val); > + break; > case POWER_SUPPLY_PROP_TECHNOLOGY: > val->intval = chip->batt_info->technology; > break; > @@ -438,10 +443,13 @@ static const struct regmap_config max17040_regmap = { > > static enum power_supply_property max17040_battery_props[] = { > POWER_SUPPLY_PROP_ONLINE, > + POWER_SUPPLY_PROP_PRESENT, > POWER_SUPPLY_PROP_VOLTAGE_NOW, > POWER_SUPPLY_PROP_CAPACITY, > POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, > POWER_SUPPLY_PROP_TECHNOLOGY, > + POWER_SUPPLY_PROP_STATUS, > + POWER_SUPPLY_PROP_HEALTH, > POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, > POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, > POWER_SUPPLY_PROP_TEMP_MIN, > -- > 2.37.2 >
Attachment:
signature.asc
Description: PGP signature