From 589ccfa4dea1ce19f7ca96472fa32d4f3f1d39eb Mon Sep 17 00:00:00 2001 From: Jagadeesh Bhaskar Pakaravoor Date: Fri, 5 Sep 2008 14:54:46 +0530 Subject: [PATCH] rtc-twl4030: Fix periodic interrupt RTC generates an extra spurious interrupt for every actual periodic interrupt. This is due to a problem with the RTC_IT bit of REG_PWR_ISR1. It requires two writes or two reads (when COR is enabled) to clear it. Since COR is enabled and one read of the same register is done already (inside twl4030-pwrirq.c do_twl4030_pwrirq() function), we can do away with a need to add one more write into the same register inside the interrupt handler, by replacing the write currently present with just one extra read. Signed-off-by: Jagadeesh Bhaskar Pakaravoor Signed-off-by: Tony Lindgren --- drivers/rtc/rtc-twl4030.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index 98324365a91..98aea0788b7 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c @@ -322,8 +322,13 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) REG_RTC_STATUS_REG); if (res) goto out; - res = twl4030_i2c_write_u8(TWL4030_MODULE_INT, - PWR_RTC_INT_CLR, REG_PWR_ISR1); + + /* Clear on Read enabled. RTC_IT bit of REG_PWR_ISR1 needs + * 2 reads to clear the interrupt. One read is done in + * do_twl4030_pwrirq(). Doing the second read, to clear + * the bit. + */ + res = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &rd_reg, REG_PWR_ISR1); if (res) goto out; -- 2.41.0