public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc-twl4030: Fix periodic interrupt
@ 2008-09-05  9:24 Pakaravoor, Jagadeesh
  2008-09-09 17:43 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Pakaravoor, Jagadeesh @ 2008-09-05  9:24 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org

From: Jagadeesh Bhaskar Pakaravoor <j-pakaravoor@ti.com>

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 <j-pakaravoor@ti.com>
---
David Brownell reported this issue earlier. This patch fixes it.
Index: linux-omap-2.6/drivers/rtc/rtc-twl4030.c
===================================================================
--- linux-omap-2.6.orig/drivers/rtc/rtc-twl4030.c	2008-09-05 12:22:23.089855991 +0530
+++ linux-omap-2.6/drivers/rtc/rtc-twl4030.c	2008-09-05 12:49:55.634939761 +0530
@@ -446,8 +446,13 @@ static irqreturn_t twl4030_rtc_interrupt
 				   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;


--
With Regards,
Jagadeesh Bhaskar P
 
----------------------------
Some men see things as they are and say why - I dream things that never were and say why not.
- George Bernard Shaw
-------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc-twl4030: Fix periodic interrupt
  2008-09-05  9:24 [PATCH] rtc-twl4030: Fix periodic interrupt Pakaravoor, Jagadeesh
@ 2008-09-09 17:43 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2008-09-09 17:43 UTC (permalink / raw)
  To: Pakaravoor, Jagadeesh; +Cc: linux-omap@vger.kernel.org

* Pakaravoor, Jagadeesh <j-pakaravoor@ti.com> [080905 02:34]:
> From: Jagadeesh Bhaskar Pakaravoor <j-pakaravoor@ti.com>
> 
> 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.

Pushing today.

Tony

> 
> Signed-off-by: Jagadeesh Bhaskar Pakaravoor <j-pakaravoor@ti.com>
> ---
> David Brownell reported this issue earlier. This patch fixes it.
> Index: linux-omap-2.6/drivers/rtc/rtc-twl4030.c
> ===================================================================
> --- linux-omap-2.6.orig/drivers/rtc/rtc-twl4030.c	2008-09-05 12:22:23.089855991 +0530
> +++ linux-omap-2.6/drivers/rtc/rtc-twl4030.c	2008-09-05 12:49:55.634939761 +0530
> @@ -446,8 +446,13 @@ static irqreturn_t twl4030_rtc_interrupt
>  				   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;
> 
> 
> --
> With Regards,
> Jagadeesh Bhaskar P
>  
> ----------------------------
> Some men see things as they are and say why - I dream things that never were and say why not.
> - George Bernard Shaw
> -------------------
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-09 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-05  9:24 [PATCH] rtc-twl4030: Fix periodic interrupt Pakaravoor, Jagadeesh
2008-09-09 17:43 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox