From: Jonghwa Lee <jonghwa3.lee@samsung.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, sre@kernel.org, dbaryshkov@gmail.com,
dwmw2@infradead.org, anton@enomsg.org, pavel@ucw.cz,
myungjoo.ham@samsung.com, cw00.choi@samsung.com,
Jonghwa Lee <jonghwa3.lee@samsung.com>
Subject: [PATCH V3 06/11] power: charger-manager: Concentrate scattered power_supply_changed() calls.
Date: Fri, 19 Dec 2014 17:55:18 +0900 [thread overview]
Message-ID: <1418979323-7188-7-git-send-email-jonghwa3.lee@samsung.com> (raw)
In-Reply-To: <1418979323-7188-1-git-send-email-jonghwa3.lee@samsung.com>
Current charger-manager calls power_suuply_changed() whenever charging
status is changed. This patch removes seperated power_supply_changed()
use and let it be called at end of try_charger_enable() function which
is called to set charging/discharging.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
---
drivers/power/charger-manager.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 7bbaef6..d29155d 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -382,8 +382,10 @@ static int try_charger_enable(struct charger_manager *cm, bool enable)
}
}
- if (!err)
+ if (!err) {
cm->charger_enabled = enable;
+ power_supply_changed(&cm->charger_psy);
+ }
return err;
}
@@ -436,10 +438,8 @@ static void fullbatt_vchk(struct charger_manager *cm)
dev_info(cm->dev, "VBATT dropped %duV after full-batt\n", diff);
- if (diff > desc->fullbatt_vchkdrop_uV) {
+ if (diff > desc->fullbatt_vchkdrop_uV)
try_charger_restart(cm);
- power_supply_changed(&cm->charger_psy);
- }
}
/**
@@ -469,7 +469,6 @@ static int check_charging_duration(struct charger_manager *cm)
if (duration > desc->charging_max_duration_ms) {
dev_info(cm->dev, "Charging duration exceed %ums\n",
desc->charging_max_duration_ms);
- power_supply_changed(&cm->charger_psy);
try_charger_enable(cm, false);
ret = true;
}
@@ -480,7 +479,6 @@ static int check_charging_duration(struct charger_manager *cm)
is_ext_pwr_online(cm)) {
dev_info(cm->dev, "Discharging duration exceed %ums\n",
desc->discharging_max_duration_ms);
- power_supply_changed(&cm->charger_psy);
try_charger_enable(cm, true);
ret = true;
}
@@ -561,8 +559,7 @@ static bool _cm_monitor(struct charger_manager *cm)
*/
if (temp_alrt) {
cm->emergency_stop = temp_alrt;
- if (!try_charger_enable(cm, false))
- power_supply_changed(&cm->charger_psy);
+ try_charger_enable(cm, false);
/*
* Check whole charging duration and discharing duration
@@ -587,16 +584,13 @@ static bool _cm_monitor(struct charger_manager *cm)
} else if (!cm->emergency_stop && is_full_charged(cm) &&
cm->charger_enabled) {
dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n");
- power_supply_changed(&cm->charger_psy);
-
try_charger_enable(cm, false);
fullbatt_vchk(cm);
} else {
cm->emergency_stop = 0;
if (is_ext_pwr_online(cm)) {
- if (!try_charger_enable(cm, true))
- power_supply_changed(&cm->charger_psy);
+ try_charger_enable(cm, true);
}
}
--
1.7.9.5
next prev parent reply other threads:[~2014-12-19 8:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 8:55 [PATCH V3 0/11] Improve charger manager driver for optimized operation Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 01/11] power: charger-manager: Use alarmtimer for battery monitoring in suspend Jonghwa Lee
2014-12-20 0:21 ` Pavel Machek
2015-01-21 20:44 ` Sebastian Reichel
2014-12-19 8:55 ` [PATCH V3 02/11] power: charger-manager: Use thermal subsystem interface only to get temperature Jonghwa Lee
2015-01-21 22:38 ` Sebastian Reichel
2014-12-19 8:55 ` [PATCH V3 03/11] power: charger-manager: Use power_supply_changed() not private uevent Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 04/11] power: charger-manager: Remove deprecated function, cm_notify_event() Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 05/11] power: charger-manager: Fix to use CHARGE_NOW/FULL property correctly Jonghwa Lee
2014-12-19 8:55 ` Jonghwa Lee [this message]
2014-12-19 8:55 ` [PATCH V3 07/11] power: charger-manager: Get external power souce information only from EXTCON Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 08/11] power: charger-manager: Make chraging decision focusing on battery status Jonghwa Lee
2014-12-20 0:24 ` Pavel Machek
2014-12-22 2:10 ` jonghwa3.lee
2014-12-19 8:55 ` [PATCH V3 09/11] power: charger-manager: Not to start charging directly in cable nofitication Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 10/11] power: charger-manager: Support different polling mode for sleep state Jonghwa Lee
2014-12-19 8:55 ` [PATCH V3 11/11] power: charger-manager: Support to change polling rate in runtime Jonghwa Lee
2014-12-20 0:29 ` Pavel Machek
2014-12-22 1:57 ` jonghwa3.lee
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=1418979323-7188-7-git-send-email-jonghwa3.lee@samsung.com \
--to=jonghwa3.lee@samsung.com \
--cc=anton@enomsg.org \
--cc=cw00.choi@samsung.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=pavel@ucw.cz \
--cc=sre@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).