rtc: omap: enable wake-up from power off
authorJohan Hovold <johan@kernel.org>
Wed, 10 Dec 2014 23:53:16 +0000 (15:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:14 +0000 (17:41 -0800)
The ALARM interrupt must not be disabled during shutdown in order to be
able to power up the system using an RTC alarm.

Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Benot Cousson <bcousson@baylibre.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Keerthy J <j-keerthy@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-omap.c

index e83f51ae7f63168c0e91c4a8097b8ab1af5f2747..0dfb0404f867d214a47078f839ac1cc6cfc3772d 100644 (file)
@@ -694,8 +694,15 @@ static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, omap_rtc_suspend, omap_rtc_resume);
 static void omap_rtc_shutdown(struct platform_device *pdev)
 {
        struct omap_rtc *rtc = platform_get_drvdata(pdev);
+       u8 mask;
 
-       rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
+       /*
+        * Keep the ALARM interrupt enabled to allow the system to power up on
+        * alarm events.
+        */
+       mask = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
+       mask &= OMAP_RTC_INTERRUPTS_IT_ALARM;
+       rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, mask);
 }
 
 static struct platform_driver omap_rtc_driver = {