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>

authored by Dmitry Baryshkov and committed by Anton Vorontsov 8f8e9b38 c7cc930f

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