[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230308084419.11934-4-clamor95@gmail.com>
Date: Wed, 8 Mar 2023 10:44:18 +0200
From: Svyatoslav Ryhel <clamor95@...il.com>
To: Iskren Chernev <me@...ren.info>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Matheus Castello <matheus@...tello.eng.br>,
Sebastian Reichel <sre@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Svyatoslav Ryhel <clamor95@...il.com>
Cc: linux-pm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 3/4] power: max17040: add passing props from supplier
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@...il.com>
---
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
Powered by blists - more mailing lists