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 } 208 } 209 210 return 0; 211 212 usb_irq_failed: ··· 241 return 0; 242 } 243 244 static struct platform_driver pda_power_pdrv = { 245 .driver = { 246 .name = "pda-power", 247 }, 248 .probe = pda_power_probe, 249 .remove = pda_power_remove, 250 }; 251 252 static int __init pda_power_init(void)
··· 207 } 208 } 209 210 + device_init_wakeup(&pdev->dev, 1); 211 + 212 return 0; 213 214 usb_irq_failed: ··· 239 return 0; 240 } 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 + 271 static struct platform_driver pda_power_pdrv = { 272 .driver = { 273 .name = "pda-power", 274 }, 275 .probe = pda_power_probe, 276 .remove = pda_power_remove, 277 + .suspend = pda_power_suspend, 278 + .resume = pda_power_resume, 279 }; 280 281 static int __init pda_power_init(void)