diff options
author | Baolin Wang | 2018-11-12 18:52:37 +0800 |
---|---|---|
committer | Sebastian Reichel | 2018-12-05 23:53:14 +0100 |
commit | a8aaff6be08921f1d200170ce02d36cec0e2300d (patch) | |
tree | 627faa018a60544050ed8a673f53f98bb51f3e2c /drivers/power | |
parent | 18c807dbf9d6dabd624b2f4dcf5c668a42567c15 (diff) |
power: supply: sc2731_charger: Avoid repeated charge/discharge
Add info->charging validation to avoid repeated charge or discharge
operation.
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/sc2731_charger.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index a012d6c94bc3..49b3f0c90224 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -328,7 +328,7 @@ static void sc2731_charger_work(struct work_struct *data) mutex_lock(&info->lock); - if (info->limit > 0) { + if (info->limit > 0 && !info->charging) { /* set current limitation and start to charge */ ret = sc2731_charger_set_current_limit(info, info->limit); if (ret) @@ -343,7 +343,7 @@ static void sc2731_charger_work(struct work_struct *data) goto out; info->charging = true; - } else { + } else if (!info->limit && info->charging) { /* Stop charging */ info->charging = false; sc2731_charger_stop_charge(info); |