aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-omap.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index a1f9d30e162b..4e1bdb832e37 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -464,11 +464,10 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
464 return 0; 464 return 0;
465} 465}
466 466
467#ifdef CONFIG_PM 467#ifdef CONFIG_PM_SLEEP
468
469static u8 irqstat; 468static u8 irqstat;
470 469
471static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state) 470static int omap_rtc_suspend(struct device *dev)
472{ 471{
473 irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG); 472 irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
474 473
@@ -476,34 +475,32 @@ static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
476 * source, and in fact this enable() call is just saving a flag 475 * source, and in fact this enable() call is just saving a flag
477 * that's never used... 476 * that's never used...
478 */ 477 */
479 if (device_may_wakeup(&pdev->dev)) 478 if (device_may_wakeup(dev))
480 enable_irq_wake(omap_rtc_alarm); 479 enable_irq_wake(omap_rtc_alarm);
481 else 480 else
482 rtc_write(0, OMAP_RTC_INTERRUPTS_REG); 481 rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
483 482
484 /* Disable the clock/module */ 483 /* Disable the clock/module */
485 pm_runtime_put_sync(&pdev->dev); 484 pm_runtime_put_sync(dev);
486 485
487 return 0; 486 return 0;
488} 487}
489 488
490static int omap_rtc_resume(struct platform_device *pdev) 489static int omap_rtc_resume(struct device *dev)
491{ 490{
492 /* Enable the clock/module so that we can access the registers */ 491 /* Enable the clock/module so that we can access the registers */
493 pm_runtime_get_sync(&pdev->dev); 492 pm_runtime_get_sync(dev);
494 493
495 if (device_may_wakeup(&pdev->dev)) 494 if (device_may_wakeup(dev))
496 disable_irq_wake(omap_rtc_alarm); 495 disable_irq_wake(omap_rtc_alarm);
497 else 496 else
498 rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG); 497 rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG);
499 return 0; 498 return 0;
500} 499}
501
502#else
503#define omap_rtc_suspend NULL
504#define omap_rtc_resume NULL
505#endif 500#endif
506 501
502static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, omap_rtc_suspend, omap_rtc_resume);
503
507static void omap_rtc_shutdown(struct platform_device *pdev) 504static void omap_rtc_shutdown(struct platform_device *pdev)
508{ 505{
509 rtc_write(0, OMAP_RTC_INTERRUPTS_REG); 506 rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
@@ -512,12 +509,11 @@ static void omap_rtc_shutdown(struct platform_device *pdev)
512MODULE_ALIAS("platform:omap_rtc"); 509MODULE_ALIAS("platform:omap_rtc");
513static struct platform_driver omap_rtc_driver = { 510static struct platform_driver omap_rtc_driver = {
514 .remove = __exit_p(omap_rtc_remove), 511 .remove = __exit_p(omap_rtc_remove),
515 .suspend = omap_rtc_suspend,
516 .resume = omap_rtc_resume,
517 .shutdown = omap_rtc_shutdown, 512 .shutdown = omap_rtc_shutdown,
518 .driver = { 513 .driver = {
519 .name = DRIVER_NAME, 514 .name = DRIVER_NAME,
520 .owner = THIS_MODULE, 515 .owner = THIS_MODULE,
516 .pm = &omap_rtc_pm_ops,
521 .of_match_table = of_match_ptr(omap_rtc_of_match), 517 .of_match_table = of_match_ptr(omap_rtc_of_match),
522 }, 518 },
523 .id_table = omap_rtc_devtype, 519 .id_table = omap_rtc_devtype,