aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-01-12 18:35:43 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2008-02-01 18:43:00 -0500
commit8f8e9b387e07cbb96f10936cc455229d7aff4790 (patch)
tree5daf38a1242967c64c2c627f0a2b4c984cc5fbb9 /drivers/power
parentc7cc930f9a5c26385a08cd7dc28cb5e3ed186d72 (diff)
pda_power: add suspend/resume support
Add suspend/resume/wakeup support for pda_power. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Anton Vorontsov <cbou@mail.ru>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pda_power.c33
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
212usb_irq_failed: 214usb_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
245static 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
257static 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
242static struct platform_driver pda_power_pdrv = { 273static 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
250static int __init pda_power_init(void) 283static int __init pda_power_init(void)