From: Benson Leung Date: Wed, 6 Apr 2011 23:55:20 +0000 (-0700) Subject: gpio-charger: Add gpio_charger_resume X-Git-Tag: v3.0-rc1~49^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f10513de2a6036742b55e23278f0322f2e5c3772;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git gpio-charger: Add gpio_charger_resume Gpio charger should notify if the gpio state had changed during suspend. This will send a CHANGED event each time the system resumes, ensuring a plug/unplug of the charger is not missed. Signed-off-by: Benson Leung Acked-By: Lars-Peter Clausen Signed-off-by: Anton Vorontsov --- diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c index 25b88ac..718f2c5 100644 --- a/drivers/power/gpio-charger.c +++ b/drivers/power/gpio-charger.c @@ -161,12 +161,27 @@ static int __devexit gpio_charger_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int gpio_charger_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct gpio_charger *gpio_charger = platform_get_drvdata(pdev); + + power_supply_changed(&gpio_charger->charger); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(gpio_charger_pm_ops, NULL, gpio_charger_resume); + static struct platform_driver gpio_charger_driver = { .probe = gpio_charger_probe, .remove = __devexit_p(gpio_charger_remove), .driver = { .name = "gpio-charger", .owner = THIS_MODULE, + .pm = &gpio_charger_pm_ops, }, };