diff options
author | Benson Leung <bleung@chromium.org> | 2011-04-06 19:55:20 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-04-20 09:48:48 -0400 |
commit | f10513de2a6036742b55e23278f0322f2e5c3772 (patch) | |
tree | b6dbabbc55df2715e02871fc83a2c4bd742564e2 /drivers/power | |
parent | b14a9ccc1ddddfbc76b7cae06d02db4adf0ae1db (diff) |
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 <bleung@chromium.org>
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/gpio-charger.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c index 25b88ac1d44c..718f2c537827 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) | |||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | #ifdef CONFIG_PM_SLEEP | ||
165 | static int gpio_charger_resume(struct device *dev) | ||
166 | { | ||
167 | struct platform_device *pdev = to_platform_device(dev); | ||
168 | struct gpio_charger *gpio_charger = platform_get_drvdata(pdev); | ||
169 | |||
170 | power_supply_changed(&gpio_charger->charger); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | #endif | ||
175 | |||
176 | static SIMPLE_DEV_PM_OPS(gpio_charger_pm_ops, NULL, gpio_charger_resume); | ||
177 | |||
164 | static struct platform_driver gpio_charger_driver = { | 178 | static struct platform_driver gpio_charger_driver = { |
165 | .probe = gpio_charger_probe, | 179 | .probe = gpio_charger_probe, |
166 | .remove = __devexit_p(gpio_charger_remove), | 180 | .remove = __devexit_p(gpio_charger_remove), |
167 | .driver = { | 181 | .driver = { |
168 | .name = "gpio-charger", | 182 | .name = "gpio-charger", |
169 | .owner = THIS_MODULE, | 183 | .owner = THIS_MODULE, |
184 | .pm = &gpio_charger_pm_ops, | ||
170 | }, | 185 | }, |
171 | }; | 186 | }; |
172 | 187 | ||