summaryrefslogtreecommitdiff
path: root/drivers/power/supply/cpcap-battery.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2019-04-07 21:12:49 +0300
committerSebastian Reichel <sebastian.reichel@collabora.com>2019-04-15 23:51:44 +0300
commit1a9aadc86ad45f5281ea633c244b6b770dc85b5b (patch)
tree8f27bd3fe59b0506d62afc5206e09d268fb046e6 /drivers/power/supply/cpcap-battery.c
parent6f76aa94e1d2f4e8758f65fd3ea08006303a1582 (diff)
downloadlinux-1a9aadc86ad45f5281ea633c244b6b770dc85b5b.tar.xz
power: supply: cpcap-battery: Fix low battery check
We need to check current instead of the charge counter to see if a charger is connected. The charge counter shows the cumulated value instead of the current charge current and can be negative or positive. Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/cpcap-battery.c')
-rw-r--r--drivers/power/supply/cpcap-battery.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index 6887870ba32c..d8855078dc1e 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -562,11 +562,11 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data)
switch (d->action) {
case CPCAP_BATTERY_IRQ_ACTION_BATTERY_LOW:
- if (latest->counter_uah >= 0)
+ if (latest->current_ua >= 0)
dev_warn(ddata->dev, "Battery low at 3.3V!\n");
break;
case CPCAP_BATTERY_IRQ_ACTION_POWEROFF:
- if (latest->counter_uah >= 0) {
+ if (latest->current_ua >= 0) {
dev_emerg(ddata->dev,
"Battery empty at 3.1V, powering off\n");
orderly_poweroff(true);