Commit f4b782af authored by Svyatoslav Ryhel's avatar Svyatoslav Ryhel Committed by Sebastian Reichel

power: max17040: pass status property from supplier

Optionally pass status property from supplier if has support
for it. If cell is online assume it is present as well.
Signed-off-by: default avatarSvyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: default avatarIskren Chernev <me@iskren.info>
Link: https://lore.kernel.org/r/20230731073613.10394-3-clamor95@gmail.comSigned-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent ddf5bbee
...@@ -389,6 +389,7 @@ static int max17040_get_property(struct power_supply *psy, ...@@ -389,6 +389,7 @@ static int max17040_get_property(struct power_supply *psy,
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_ONLINE: case POWER_SUPPLY_PROP_ONLINE:
case POWER_SUPPLY_PROP_PRESENT:
val->intval = max17040_get_online(chip); val->intval = max17040_get_online(chip);
break; break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW: case POWER_SUPPLY_PROP_VOLTAGE_NOW:
...@@ -400,6 +401,9 @@ static int max17040_get_property(struct power_supply *psy, ...@@ -400,6 +401,9 @@ static int max17040_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN: case POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN:
val->intval = chip->low_soc_alert; val->intval = chip->low_soc_alert;
break; break;
case POWER_SUPPLY_PROP_STATUS:
power_supply_get_property_from_supplier(psy, psp, val);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -415,9 +419,11 @@ static const struct regmap_config max17040_regmap = { ...@@ -415,9 +419,11 @@ static const struct regmap_config max17040_regmap = {
static enum power_supply_property max17040_battery_props[] = { static enum power_supply_property max17040_battery_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN,
POWER_SUPPLY_PROP_STATUS,
}; };
static const struct power_supply_desc max17040_battery_desc = { static const struct power_supply_desc max17040_battery_desc = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment