diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2014-02-19 19:48:58 +0530 |
---|---|---|
committer | Laxman Dewangan <ldewangan@nvidia.com> | 2014-02-25 06:25:18 -0800 |
commit | dd7d4a1a00322fbd47b9d7e4d1193e529ead2aac (patch) | |
tree | ffd1fe1f6370955027778756e6605b2fd4582ec6 /drivers/power | |
parent | 22fd2ba354071237fe4c199e10b6d284b03d29a5 (diff) |
power: bq2419x: release wakelock on cable disconnect
When high-charging current charger connected then system
does not enter into suspend. When charger disconnected then
allow system to enter into suspend.
bug 1464193
Change-Id: I60b71650c50a432e4f0213461811b32204a1f978
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/374166
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/bq2419x-charger.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/power/bq2419x-charger.c b/drivers/power/bq2419x-charger.c index 0fbd0af21aac..c9bbbeb67cd0 100644 --- a/drivers/power/bq2419x-charger.c +++ b/drivers/power/bq2419x-charger.c @@ -381,6 +381,7 @@ static int bq2419x_set_charging_current(struct regulator_dev *rdev, { struct bq2419x_chip *bq2419x = rdev_get_drvdata(rdev); int in_current_limit; + int old_current_limit; int ret = 0; int val; @@ -401,6 +402,7 @@ static int bq2419x_set_charging_current(struct regulator_dev *rdev, if (max_uA == 0 && val != 0) return ret; + old_current_limit = bq2419x->in_current_limit; bq2419x->last_charging_current = max_uA; if ((val & BQ2419x_VBUS_STAT) == BQ2419x_VBUS_UNKNOWN) { battery_charging_restart_cancel(bq2419x->bc_dev); @@ -421,9 +423,13 @@ static int bq2419x_set_charging_current(struct regulator_dev *rdev, goto error; battery_charging_status_update(bq2419x->bc_dev, bq2419x->chg_status); - if (bq2419x->disable_suspend_during_charging && - bq2419x->cable_connected && in_current_limit > 500) + if (bq2419x->disable_suspend_during_charging) { + if (bq2419x->cable_connected && in_current_limit > 500) battery_charger_acquire_wake_lock(bq2419x->bc_dev); + else if (!bq2419x->cable_connected && old_current_limit > 500) + battery_charger_release_wake_lock(bq2419x->bc_dev); + } + return 0; error: dev_err(bq2419x->dev, "Charger enable failed, err = %d\n", ret); |