linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OMAP: DMTIMER: Ack pending interrupt always when stopping a timer
@ 2010-05-25 14:17 Tero Kristo
  2010-05-25 16:10 ` Kevin Hilman
  0 siblings, 1 reply; 3+ messages in thread
From: Tero Kristo @ 2010-05-25 14:17 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

The kernel timer queue is being run currently from a GP timer running in a one
shot mode, which works in a way that when it expires, it will also stop.
Usually during this situation, the interrupt handler will ack the interrupt,
load a new value to the timer and start it again. During suspend, the
situation is slightly different, as we disable interrupts just before
timekeeping is suspended, which leaves a small window where the timer can
expire before it is stopped, and will leave the interrupt flag pending.
This pending interrupt will prevent ARM sleep entry, thus now we ack it always
when we are attempting to stop a timer.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/plat-omap/dmtimer.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index c64875f..023d664 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -541,11 +541,13 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
 		  * timer is stopped
 		  */
 		udelay(3500000 / clk_get_rate(timer->fclk) + 1);
-		/* Ack possibly pending interrupt */
-		omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
-				OMAP_TIMER_INT_OVERFLOW);
 #endif
 	}
+#ifdef CONFIG_ARCH_OMAP2PLUS
+	/* Ack possibly pending interrupt */
+	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
+			OMAP_TIMER_INT_OVERFLOW);
+#endif
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
-- 
1.5.4.3


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

* Re: [PATCH] OMAP: DMTIMER: Ack pending interrupt always when stopping a timer
  2010-05-25 14:17 [PATCH] OMAP: DMTIMER: Ack pending interrupt always when stopping a timer Tero Kristo
@ 2010-05-25 16:10 ` Kevin Hilman
  2010-06-01  7:40   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hilman @ 2010-05-25 16:10 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-omap

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> The kernel timer queue is being run currently from a GP timer running in a one
> shot mode, which works in a way that when it expires, it will also stop.
> Usually during this situation, the interrupt handler will ack the interrupt,
> load a new value to the timer and start it again. During suspend, the
> situation is slightly different, as we disable interrupts just before
> timekeeping is suspended, which leaves a small window where the timer can
> expire before it is stopped, and will leave the interrupt flag pending.
> This pending interrupt will prevent ARM sleep entry, thus now we ack it always
> when we are attempting to stop a timer.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

Acked-by: Kevin Hilman <khilman@deeprootsystems.com>

> ---
>  arch/arm/plat-omap/dmtimer.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> index c64875f..023d664 100644
> --- a/arch/arm/plat-omap/dmtimer.c
> +++ b/arch/arm/plat-omap/dmtimer.c
> @@ -541,11 +541,13 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
>  		  * timer is stopped
>  		  */
>  		udelay(3500000 / clk_get_rate(timer->fclk) + 1);
> -		/* Ack possibly pending interrupt */
> -		omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
> -				OMAP_TIMER_INT_OVERFLOW);
>  #endif
>  	}
> +#ifdef CONFIG_ARCH_OMAP2PLUS
> +	/* Ack possibly pending interrupt */
> +	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
> +			OMAP_TIMER_INT_OVERFLOW);
> +#endif
>  }
>  EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
>  
> -- 
> 1.5.4.3
>
> --
> 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] 3+ messages in thread

* Re: [PATCH] OMAP: DMTIMER: Ack pending interrupt always when stopping a timer
  2010-05-25 16:10 ` Kevin Hilman
@ 2010-06-01  7:40   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2010-06-01  7:40 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: Tero Kristo, linux-omap

* Kevin Hilman <khilman@deeprootsystems.com> [100525 19:07]:
> Tero Kristo <tero.kristo@nokia.com> writes:
> 
> > From: Tero Kristo <tero.kristo@nokia.com>
> >
> > The kernel timer queue is being run currently from a GP timer running in a one
> > shot mode, which works in a way that when it expires, it will also stop.
> > Usually during this situation, the interrupt handler will ack the interrupt,
> > load a new value to the timer and start it again. During suspend, the
> > situation is slightly different, as we disable interrupts just before
> > timekeeping is suspended, which leaves a small window where the timer can
> > expire before it is stopped, and will leave the interrupt flag pending.
> > This pending interrupt will prevent ARM sleep entry, thus now we ack it always
> > when we are attempting to stop a timer.
> >
> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> 
> Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
> 
> > ---
> >  arch/arm/plat-omap/dmtimer.c |    8 +++++---
> >  1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> > index c64875f..023d664 100644
> > --- a/arch/arm/plat-omap/dmtimer.c
> > +++ b/arch/arm/plat-omap/dmtimer.c
> > @@ -541,11 +541,13 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
> >  		  * timer is stopped
> >  		  */
> >  		udelay(3500000 / clk_get_rate(timer->fclk) + 1);
> > -		/* Ack possibly pending interrupt */
> > -		omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
> > -				OMAP_TIMER_INT_OVERFLOW);
> >  #endif
> >  	}
> > +#ifdef CONFIG_ARCH_OMAP2PLUS
> > +	/* Ack possibly pending interrupt */
> > +	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
> > +			OMAP_TIMER_INT_OVERFLOW);
> > +#endif
> >  }
> >  EXPORT_SYMBOL_GPL(omap_dm_timer_stop);

I'll add this to omap-fixes queue, but will remove the
ifdef CONFIG_ARCH_OMAP2PLUS around clearing the interrupt
as the situation would be the same for omap1 if ever used
the same way.

Regards,

Tony

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

end of thread, other threads:[~2010-06-01  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 14:17 [PATCH] OMAP: DMTIMER: Ack pending interrupt always when stopping a timer Tero Kristo
2010-05-25 16:10 ` Kevin Hilman
2010-06-01  7:40   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).