diff options
author | Rong Dian <b38775@freescale.com> | 2012-09-03 18:37:43 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-09-05 19:20:17 +0800 |
commit | a825494f676a3d2dbeeaddaa6824698f63c291e9 (patch) | |
tree | 1171e30894f979a02d5851f017aa5f8bf24e2936 /drivers/power | |
parent | 74885ebbcd09600aff184202d051d9244e900cec (diff) |
ENGR00222078 power battery:fix charger attach detect missing after resume
1.config gpio dok for AC charger as wake up irq, config gpio uok
for USB charger as wake up irq.
2.add AC/USB charger detect in resume,fix charger detect status update
missing after attach AC/USB charger and resume system
Signed-off-by: Rong Dian <b38775@freescale.com>
Diffstat (limited to 'drivers/power')
-rwxr-xr-x | drivers/power/sabresd_battery.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/drivers/power/sabresd_battery.c b/drivers/power/sabresd_battery.c index 516fbd806b64..c7318a6eb02c 100755 --- a/drivers/power/sabresd_battery.c +++ b/drivers/power/sabresd_battery.c @@ -884,16 +884,52 @@ static int max8903_suspend(struct platform_device *pdev, pm_message_t state) { struct max8903_data *data = platform_get_drvdata(pdev); - - cancel_delayed_work(&data->work); + int irq; + if (data) { + struct max8903_pdata *pdata = data->pdata; + if (pdata) { + irq = gpio_to_irq(pdata->dok); + enable_irq_wake(irq); + irq = gpio_to_irq(pdata->uok); + enable_irq_wake(irq); + cancel_delayed_work(&data->work); + } + } return 0; } static int max8903_resume(struct platform_device *pdev) { struct max8903_data *data = platform_get_drvdata(pdev); - - schedule_delayed_work(&data->work, BATTERY_UPDATE_INTERVAL); + bool ta_in; + bool usb_in; + int irq; + if (data) { + struct max8903_pdata *pdata = data->pdata; + if (pdata) { + ta_in = gpio_get_value(pdata->dok) ? false : true; + usb_in = gpio_get_value(pdata->uok) ? false : true; + if (ta_in != data->ta_in) { + data->ta_in = ta_in; + pr_info("TA(DC-IN) Charger %s.\n", ta_in ? + "Connected" : "Disconnected"); + max8903_charger_update_status(data); + power_supply_changed(&data->psy); + } + if (usb_in != data->usb_in) { + data->usb_in = usb_in; + pr_info("USB Charger %s.\n", usb_in ? + "Connected" : "Disconnected"); + max8903_charger_update_status(data); + power_supply_changed(&data->usb); + } + irq = gpio_to_irq(pdata->dok); + disable_irq_wake(irq); + irq = gpio_to_irq(pdata->uok); + disable_irq_wake(irq); + schedule_delayed_work(&data->work, BATTERY_UPDATE_INTERVAL); + } + } return 0; } |