]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
power: supply: sbs-battery: fix idle battery status
authorSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 13 May 2020 18:56:10 +0000 (20:56 +0200)
committerSebastian Reichel <sre@kernel.org>
Thu, 28 May 2020 22:39:34 +0000 (00:39 +0200)
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 <sebastian.reichel@collabora.com>
drivers/power/supply/sbs-battery.c

index 2a2b926ad75c89c3782e6dc4133e8b9ee3caad0e..e3c685b2c24794da6ba924356470ce700f2531b5 100644 (file)
@@ -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 */