aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/power
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.com>2020-05-13 20:56:10 +0200
committerSebastian Reichel <sre@kernel.org>2020-05-29 00:39:34 +0200
commitf0318bc99c8107acddde3aa99a7f696c0999f37c (patch)
tree2eed7335218492048339b99fc48643a9932c28a8 /drivers/power
parentpower: supply: sbs-battery: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED support (diff)
downloadwireguard-linux-f0318bc99c8107acddde3aa99a7f696c0999f37c.tar.xz
wireguard-linux-f0318bc99c8107acddde3aa99a7f696c0999f37c.zip
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 <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/sbs-battery.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 2a2b926ad75c..e3c685b2c247 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 */