diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-02-13 06:39:19 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-03-06 23:35:40 -0500 |
commit | 8891716e24d7b0f4b1c3b4fdff641bcb1fb282c4 (patch) | |
tree | 4f5fbc4035d59faab6d6defee2e6f51f2bde021b /drivers/power/abx500_chargalg.c | |
parent | 789ca7b46877f29b2aaa94401319c50be35b184f (diff) |
ab8500-bm: Charge only mode fixes for the ab9540
Fix for charging not getting enabled in charge only mode by
external charger.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/power/abx500_chargalg.c')
-rw-r--r-- | drivers/power/abx500_chargalg.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index 8ab65a3a8190..a876976678ab 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/mfd/abx500.h> | 26 | #include <linux/mfd/abx500.h> |
27 | #include <linux/mfd/abx500/ux500_chargalg.h> | 27 | #include <linux/mfd/abx500/ux500_chargalg.h> |
28 | #include <linux/mfd/abx500/ab8500-bm.h> | 28 | #include <linux/mfd/abx500/ab8500-bm.h> |
29 | #include <linux/notifier.h> | ||
29 | 30 | ||
30 | /* Watchdog kick interval */ | 31 | /* Watchdog kick interval */ |
31 | #define CHG_WD_INTERVAL (6 * HZ) | 32 | #define CHG_WD_INTERVAL (6 * HZ) |
@@ -243,6 +244,9 @@ struct abx500_chargalg { | |||
243 | struct kobject chargalg_kobject; | 244 | struct kobject chargalg_kobject; |
244 | }; | 245 | }; |
245 | 246 | ||
247 | /*External charger prepare notifier*/ | ||
248 | BLOCKING_NOTIFIER_HEAD(charger_notifier_list); | ||
249 | |||
246 | /* Main battery properties */ | 250 | /* Main battery properties */ |
247 | static enum power_supply_property abx500_chargalg_props[] = { | 251 | static enum power_supply_property abx500_chargalg_props[] = { |
248 | POWER_SUPPLY_PROP_STATUS, | 252 | POWER_SUPPLY_PROP_STATUS, |
@@ -503,6 +507,8 @@ static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di) | |||
503 | static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, | 507 | static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, |
504 | int vset, int iset) | 508 | int vset, int iset) |
505 | { | 509 | { |
510 | static int abx500_chargalg_ex_ac_enable_toggle; | ||
511 | |||
506 | if (!di->ac_chg || !di->ac_chg->ops.enable) | 512 | if (!di->ac_chg || !di->ac_chg->ops.enable) |
507 | return -ENXIO; | 513 | return -ENXIO; |
508 | 514 | ||
@@ -515,6 +521,14 @@ static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, | |||
515 | di->chg_info.ac_iset = iset; | 521 | di->chg_info.ac_iset = iset; |
516 | di->chg_info.ac_vset = vset; | 522 | di->chg_info.ac_vset = vset; |
517 | 523 | ||
524 | /* Enable external charger */ | ||
525 | if (enable && di->ac_chg->external && | ||
526 | !abx500_chargalg_ex_ac_enable_toggle) { | ||
527 | blocking_notifier_call_chain(&charger_notifier_list, | ||
528 | 0, di->dev); | ||
529 | abx500_chargalg_ex_ac_enable_toggle++; | ||
530 | } | ||
531 | |||
518 | return di->ac_chg->ops.enable(di->ac_chg, enable, vset, iset); | 532 | return di->ac_chg->ops.enable(di->ac_chg, enable, vset, iset); |
519 | } | 533 | } |
520 | 534 | ||