aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2012-07-27 01:01:34 -0400
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-08-22 23:08:28 -0400
commitdbb61fc7452632a4225b2fe3719b6c2d1306e257 (patch)
tree9104ac5f913221c52052431245bdbf3902345bae /drivers
parentc084e092e47ca2435673702c6cf6e87a731ecc6f (diff)
charger-manager: Disable regulator when charger cable is detached
This patch disable regulator for charging when charger cable is detached before stopping charging forcibly on abnormal battery state and check return value of regulator_enable/disable() function to confirm correct operation of enabling or disabling regulator for charging. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/charger-manager.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 526e5c931294..240de49934f1 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -271,9 +271,24 @@ static int try_charger_enable(struct charger_manager *cm, bool enable)
271 if (enable) { 271 if (enable) {
272 if (cm->emergency_stop) 272 if (cm->emergency_stop)
273 return -EAGAIN; 273 return -EAGAIN;
274 for (i = 0 ; i < desc->num_charger_regulators ; i++) 274 for (i = 0 ; i < desc->num_charger_regulators ; i++) {
275 regulator_enable(desc->charger_regulators[i].consumer); 275 err = regulator_enable(desc->charger_regulators[i].consumer);
276 if (err < 0) {
277 dev_warn(cm->dev,
278 "Cannot enable %s regulator\n",
279 desc->charger_regulators[i].regulator_name);
280 }
281 }
276 } else { 282 } else {
283 for (i = 0 ; i < desc->num_charger_regulators ; i++) {
284 err = regulator_disable(desc->charger_regulators[i].consumer);
285 if (err < 0) {
286 dev_warn(cm->dev,
287 "Cannot disable %s regulator\n",
288 desc->charger_regulators[i].regulator_name);
289 }
290 }
291
277 /* 292 /*
278 * Abnormal battery state - Stop charging forcibly, 293 * Abnormal battery state - Stop charging forcibly,
279 * even if charger was enabled at the other places 294 * even if charger was enabled at the other places