[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200503211432.dvwm5whaeim5krz3@earth.universe>
Date: Sun, 3 May 2020 23:14:32 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc: Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH v2 07/11] power: bq25890: implement CHARGE_TYPE property
Hi,
On Sun, May 03, 2020 at 05:21:12PM +0200, Michał Mirosław wrote:
> Report charging type based on recently read state.
>
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@...labora.com>
-- Sebastian
> drivers/power/supply/bq25890_charger.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index e4368d01396a..ad0901fdceb6 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -429,6 +429,18 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
>
> break;
>
> + case POWER_SUPPLY_PROP_CHARGE_TYPE:
> + if (!state.online || state.chrg_status == STATUS_NOT_CHARGING ||
> + state.chrg_status == STATUS_TERMINATION_DONE)
> + val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
> + else if (state.chrg_status == STATUS_PRE_CHARGING)
> + val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
> + else if (state.chrg_status == STATUS_FAST_CHARGING)
> + val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
> + else /* unreachable */
> + val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
> + break;
> +
> case POWER_SUPPLY_PROP_MANUFACTURER:
> val->strval = BQ25890_MANUFACTURER;
> break;
> @@ -670,6 +682,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
> POWER_SUPPLY_PROP_MANUFACTURER,
> POWER_SUPPLY_PROP_MODEL_NAME,
> POWER_SUPPLY_PROP_STATUS,
> + POWER_SUPPLY_PROP_CHARGE_TYPE,
> POWER_SUPPLY_PROP_ONLINE,
> POWER_SUPPLY_PROP_HEALTH,
> POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
> --
> 2.20.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists