summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorYuanjiang Yu <yuanjiang.yu@unisoc.com>2019-07-31 18:00:27 +0800
committerSebastian Reichel <sebastian.reichel@collabora.com>2019-09-02 22:55:24 +0200
commitff062d06948c012cbfd6f5947b599be5ea1c3799 (patch)
tree858f03b18f4f0447316e5b8a49a37a97e7c32a85 /drivers/power
parent7384b0e7668f722fcf7abe56f61a7212debd0180 (diff)
downloadlinux-ff062d06948c012cbfd6f5947b599be5ea1c3799.tar.gz
linux-ff062d06948c012cbfd6f5947b599be5ea1c3799.tar.bz2
linux-ff062d06948c012cbfd6f5947b599be5ea1c3799.zip
power: supply: sc27xx: Make sure the alarm capacity is larger than 0
We must make sure the alarm capacity is larger than 0, to help to calibrate the low battery capacity. Signed-off-by: Yuanjiang Yu <yuanjiang.yu@unisoc.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/sc27xx_fuel_gauge.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index 6a29f00aec48..096da951f465 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -858,6 +858,8 @@ static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
data->alarm_cap = power_supply_ocv2cap_simple(data->cap_table,
data->table_len,
data->min_volt);
+ if (!data->alarm_cap)
+ data->alarm_cap += 1;
power_supply_put_battery_info(data->battery, &info);