From: Baolin Wang <baolin.wang@linaro.org>
To: sre@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
yuanjiang.yu@unisoc.com, baolin.wang@linaro.org,
broonie@kernel.org
Subject: [PATCH 3/4] power: supply: sc2731_charger: Avoid repeated charge/discharge
Date: Mon, 12 Nov 2018 18:52:37 +0800 [thread overview]
Message-ID: <2298d92a4156f331f9e317d6bc6eed0ff88677bb.1542019800.git.baolin.wang@linaro.org> (raw)
In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org>
In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org>
Add info->charging validation to avoid repeated charge or discharge
operation.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
drivers/power/supply/sc2731_charger.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c
index a012d6c..49b3f0c 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);
--
1.7.9.5
next prev parent reply other threads:[~2018-11-12 10:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 10:52 [PATCH 1/4] power: supply: sc2731_charger: Add one work to charge/discharge Baolin Wang
2018-11-12 10:52 ` [PATCH 2/4] power: supply: sc2731_charger: Add charger status detection Baolin Wang
2018-11-12 10:52 ` Baolin Wang [this message]
2018-11-12 10:52 ` [PATCH 4/4] power: supply: sc2731_charger: Free battery information Baolin Wang
2018-12-05 23:08 ` [PATCH 1/4] power: supply: sc2731_charger: Add one work to charge/discharge Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2298d92a4156f331f9e317d6bc6eed0ff88677bb.1542019800.git.baolin.wang@linaro.org \
--to=baolin.wang@linaro.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
--cc=yuanjiang.yu@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®