From: Sebastian Reichel Date: Wed, 13 May 2020 18:56:10 +0000 (+0200) Subject: power: supply: sbs-battery: fix idle battery status X-Git-Tag: v5.8-rc1~70^2~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f0318bc99c8107acddde3aa99a7f696c0999f37c;p=users%2Fjedix%2Flinux-maple.git power: supply: sbs-battery: fix idle battery status A battery, that is neither charged, nor discharged is not always Full. If the charger is disabled for other reasons it might simply be idle and should be marked accordingly. Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index 2a2b926ad75c8..e3c685b2c2479 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -354,9 +354,9 @@ static int sbs_status_correct(struct i2c_client *client, int *intval) ret = (s16)ret; - /* Not drawing current means full (cannot be not charging) */ - if (ret == 0) - *intval = POWER_SUPPLY_STATUS_FULL; + /* Not drawing current -> not charging (i.e. idle) */ + if (*intval != POWER_SUPPLY_STATUS_FULL && ret == 0) + *intval = POWER_SUPPLY_STATUS_NOT_CHARGING; if (*intval == POWER_SUPPLY_STATUS_FULL) { /* Drawing or providing current when full */