Commit a8aaff6b authored by Baolin Wang's avatar Baolin Wang Committed by Sebastian Reichel

power: supply: sc2731_charger: Avoid repeated charge/discharge

Add info->charging validation to avoid repeated charge or discharge
operation.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 18c807db
...@@ -328,7 +328,7 @@ static void sc2731_charger_work(struct work_struct *data) ...@@ -328,7 +328,7 @@ static void sc2731_charger_work(struct work_struct *data)
mutex_lock(&info->lock); mutex_lock(&info->lock);
if (info->limit > 0) { if (info->limit > 0 && !info->charging) {
/* set current limitation and start to charge */ /* set current limitation and start to charge */
ret = sc2731_charger_set_current_limit(info, info->limit); ret = sc2731_charger_set_current_limit(info, info->limit);
if (ret) if (ret)
...@@ -343,7 +343,7 @@ static void sc2731_charger_work(struct work_struct *data) ...@@ -343,7 +343,7 @@ static void sc2731_charger_work(struct work_struct *data)
goto out; goto out;
info->charging = true; info->charging = true;
} else { } else if (!info->limit && info->charging) {
/* Stop charging */ /* Stop charging */
info->charging = false; info->charging = false;
sc2731_charger_stop_charge(info); sc2731_charger_stop_charge(info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment