[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230515224145.u2fos4ln3n6hb567@mercury.elektranox.org>
Date: Tue, 16 May 2023 00:41:45 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Svyatoslav Ryhel <clamor95@...il.com>
Cc: Iskren Chernev <me@...ren.info>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Matheus Castello <matheus@...tello.eng.br>,
Rob Herring <robh+dt@...nel.org>, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 3/4] power: max17040: add passing props from supplier
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@...il.com>
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
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists