]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/rtc/rtc-twl4030.c
Don't mask rtc-twl4030 alarm interrupts on shutdown
[linux-2.6-omap-h63xx.git] / drivers / rtc / rtc-twl4030.c
index 53c67c636ce547c9ec09157f4735e187f13a5ab6..d933d097c38b3e1fe00eef7e4e74842ea0ecc6b4 100644 (file)
@@ -337,7 +337,7 @@ static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
 }
 
 #else
-#define        omap_rtc_ioctl  NULL
+#define        twl4030_rtc_ioctl       NULL
 #endif
 
 static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
@@ -347,6 +347,14 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
        int res;
        u8 rd_reg;
 
+#ifdef CONFIG_LOCKDEP
+       /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
+        * we don't want and can't tolerate.  Although it might be
+        * friendlier not to borrow this thread context...
+        */
+       local_irq_enable();
+#endif
+
        res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
        if (res)
                goto out;
@@ -439,7 +447,8 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
                goto out1;
 
        ret = request_irq(irq, twl4030_rtc_interrupt,
-                               0, rtc->dev.bus_id, rtc);
+                               IRQF_TRIGGER_RISING,
+                               rtc->dev.bus_id, rtc);
        if (ret < 0) {
                dev_err(&pdev->dev, "IRQ is not free.\n");
                goto out1;
@@ -458,22 +467,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
                        goto out2;
        }
 
-       /* FIXME stop touching MODULE_INT registers; there's already
-        * driver code responsible for them.
-        */
-
-       /* use rising edge detection for RTC alarm */
-       ret = twl4030_i2c_read_u8(TWL4030_MODULE_INT,
-                       &rd_reg, TWL4030_INT_PWR_EDR1);
-       if (ret < 0)
-               goto out2;
-
-       rd_reg |= BIT(3);
-       ret = twl4030_i2c_write_u8(TWL4030_MODULE_INT,
-                       rd_reg, TWL4030_INT_PWR_EDR1);
-       if (ret < 0)
-               goto out2;
-
        /* init cached IRQ enable bits */
        ret = twl4030_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
        if (ret < 0)
@@ -512,8 +505,9 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev)
 
 static void twl4030_rtc_shutdown(struct platform_device *pdev)
 {
-       mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M |
-                        BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+       /* mask timer interrupts, but leave alarm interrupts on to enable
+          power-on when alarm is triggered */
+       mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
 }
 
 #ifdef CONFIG_PM