aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-omap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index dff9ff476b0d..600971407aac 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25#include <linux/pm_runtime.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27 28
@@ -364,6 +365,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
364 goto fail; 365 goto fail;
365 } 366 }
366 367
368 /* Enable the clock/module so that we can access the registers */
369 pm_runtime_enable(&pdev->dev);
370 pm_runtime_get_sync(&pdev->dev);
371
367 id_entry = platform_get_device_id(pdev); 372 id_entry = platform_get_device_id(pdev);
368 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) { 373 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) {
369 rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG); 374 rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
@@ -448,6 +453,8 @@ fail1:
448fail0: 453fail0:
449 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) 454 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
450 rtc_writel(0, OMAP_RTC_KICK0_REG); 455 rtc_writel(0, OMAP_RTC_KICK0_REG);
456 pm_runtime_put_sync(&pdev->dev);
457 pm_runtime_disable(&pdev->dev);
451 iounmap(rtc_base); 458 iounmap(rtc_base);
452fail: 459fail:
453 release_mem_region(mem->start, resource_size(mem)); 460 release_mem_region(mem->start, resource_size(mem));
@@ -474,6 +481,11 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
474 rtc_device_unregister(rtc); 481 rtc_device_unregister(rtc);
475 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) 482 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
476 rtc_writel(0, OMAP_RTC_KICK0_REG); 483 rtc_writel(0, OMAP_RTC_KICK0_REG);
484
485 /* Disable the clock/module */
486 pm_runtime_put_sync(&pdev->dev);
487 pm_runtime_disable(&pdev->dev);
488
477 iounmap(rtc_base); 489 iounmap(rtc_base);
478 release_mem_region(mem->start, resource_size(mem)); 490 release_mem_region(mem->start, resource_size(mem));
479 return 0; 491 return 0;
@@ -496,11 +508,17 @@ static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
496 else 508 else
497 rtc_write(0, OMAP_RTC_INTERRUPTS_REG); 509 rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
498 510
511 /* Disable the clock/module */
512 pm_runtime_put_sync(&pdev->dev);
513
499 return 0; 514 return 0;
500} 515}
501 516
502static int omap_rtc_resume(struct platform_device *pdev) 517static int omap_rtc_resume(struct platform_device *pdev)
503{ 518{
519 /* Enable the clock/module so that we can access the registers */
520 pm_runtime_get_sync(&pdev->dev);
521
504 if (device_may_wakeup(&pdev->dev)) 522 if (device_may_wakeup(&pdev->dev))
505 disable_irq_wake(omap_rtc_alarm); 523 disable_irq_wake(omap_rtc_alarm);
506 else 524 else