diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-sa1100.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 6f1e9a9804bc..2eb38520f0c8 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -337,6 +337,8 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
337 | if (IS_ERR(rtc)) | 337 | if (IS_ERR(rtc)) |
338 | return PTR_ERR(rtc); | 338 | return PTR_ERR(rtc); |
339 | 339 | ||
340 | device_init_wakeup(&pdev->dev, 1); | ||
341 | |||
340 | platform_set_drvdata(pdev, rtc); | 342 | platform_set_drvdata(pdev, rtc); |
341 | 343 | ||
342 | return 0; | 344 | return 0; |
@@ -352,9 +354,38 @@ static int sa1100_rtc_remove(struct platform_device *pdev) | |||
352 | return 0; | 354 | return 0; |
353 | } | 355 | } |
354 | 356 | ||
357 | #ifdef CONFIG_PM | ||
358 | static int sa1100_rtc_suspend(struct platform_device *pdev, pm_message_t state) | ||
359 | { | ||
360 | if (pdev->dev.power.power_state.event != state.event) { | ||
361 | if (state.event == PM_EVENT_SUSPEND && | ||
362 | device_may_wakeup(&pdev->dev)) | ||
363 | enable_irq_wake(IRQ_RTCAlrm); | ||
364 | |||
365 | pdev->dev.power.power_state = state; | ||
366 | } | ||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | static int sa1100_rtc_resume(struct platform_device *pdev) | ||
371 | { | ||
372 | if (pdev->dev.power.power_state.event != PM_EVENT_ON) { | ||
373 | if (device_may_wakeup(&pdev->dev)) | ||
374 | disable_irq_wake(IRQ_RTCAlrm); | ||
375 | pdev->dev.power.power_state = PMSG_ON; | ||
376 | } | ||
377 | return 0; | ||
378 | } | ||
379 | #else | ||
380 | #define sa1100_rtc_suspend NULL | ||
381 | #define sa1100_rtc_resume NULL | ||
382 | #endif | ||
383 | |||
355 | static struct platform_driver sa1100_rtc_driver = { | 384 | static struct platform_driver sa1100_rtc_driver = { |
356 | .probe = sa1100_rtc_probe, | 385 | .probe = sa1100_rtc_probe, |
357 | .remove = sa1100_rtc_remove, | 386 | .remove = sa1100_rtc_remove, |
387 | .suspend = sa1100_rtc_suspend, | ||
388 | .resume = sa1100_rtc_resume, | ||
358 | .driver = { | 389 | .driver = { |
359 | .name = "sa1100-rtc", | 390 | .name = "sa1100-rtc", |
360 | }, | 391 | }, |