diff options
-rw-r--r-- | drivers/power/pda_power.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index d98622f9f31d..35dc25973f33 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c | |||
@@ -207,6 +207,8 @@ static int pda_power_probe(struct platform_device *pdev) | |||
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | device_init_wakeup(&pdev->dev, 1); | ||
211 | |||
210 | return 0; | 212 | return 0; |
211 | 213 | ||
212 | usb_irq_failed: | 214 | usb_irq_failed: |
@@ -239,12 +241,43 @@ static int pda_power_remove(struct platform_device *pdev) | |||
239 | return 0; | 241 | return 0; |
240 | } | 242 | } |
241 | 243 | ||
244 | #ifdef CONFIG_PM | ||
245 | static int pda_power_suspend(struct platform_device *pdev, pm_message_t state) | ||
246 | { | ||
247 | if (device_may_wakeup(&pdev->dev)) { | ||
248 | if (ac_irq) | ||
249 | enable_irq_wake(ac_irq->start); | ||
250 | if (usb_irq) | ||
251 | enable_irq_wake(usb_irq->start); | ||
252 | } | ||
253 | |||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static int pda_power_resume(struct platform_device *pdev) | ||
258 | { | ||
259 | if (device_may_wakeup(&pdev->dev)) { | ||
260 | if (usb_irq) | ||
261 | disable_irq_wake(usb_irq->start); | ||
262 | if (ac_irq) | ||
263 | disable_irq_wake(ac_irq->start); | ||
264 | } | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | #else | ||
269 | #define pda_power_suspend NULL | ||
270 | #define pda_power_resume NULL | ||
271 | #endif /* CONFIG_PM */ | ||
272 | |||
242 | static struct platform_driver pda_power_pdrv = { | 273 | static struct platform_driver pda_power_pdrv = { |
243 | .driver = { | 274 | .driver = { |
244 | .name = "pda-power", | 275 | .name = "pda-power", |
245 | }, | 276 | }, |
246 | .probe = pda_power_probe, | 277 | .probe = pda_power_probe, |
247 | .remove = pda_power_remove, | 278 | .remove = pda_power_remove, |
279 | .suspend = pda_power_suspend, | ||
280 | .resume = pda_power_resume, | ||
248 | }; | 281 | }; |
249 | 282 | ||
250 | static int __init pda_power_init(void) | 283 | static int __init pda_power_init(void) |