On 11/02/2012 07:32 AM, Vaibhav Bedia wrote:
> From: Vaibhav Hiremath <[email protected]>
> 
> The current OMAP timer code registers two timers -
> one as clocksource and one as clockevent.
> AM33XX has only one usable timer in the WKUP domain
> so one of the timers needs suspend-resume support
> to restore the configuration to pre-suspend state.
> 
> commit adc78e6 (timekeeping: Add suspend and resume
> of clock event devices) introduced .suspend and .resume
> callbacks for clock event devices. Leverages these
> callbacks to have AM33XX clockevent timer which is
> in not in WKUP domain to behave properly across system
> suspend.
> 
> Signed-off-by: Vaibhav Hiremath <[email protected]>
> Signed-off-by: Vaibhav Bedia <[email protected]>
> ---
>  arch/arm/mach-omap2/timer.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index 6584ee0..e8781fd 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -135,6 +135,35 @@ static void omap2_gp_timer_set_mode(enum 
> clock_event_mode mode,
>       }
>  }
>  
> +static void omap_clkevt_suspend(struct clock_event_device *unused)
> +{
> +     char name[10];
> +     struct omap_hwmod *oh;
> +
> +     sprintf(name, "timer%d", 2);
> +     oh = omap_hwmod_lookup(name);
> +     if (!oh)
> +             return;
> +
> +     omap_hwmod_idle(oh);
> +}
> +
> +static void omap_clkevt_resume(struct clock_event_device *unused)
> +{
> +     char name[10];
> +     struct omap_hwmod *oh;
> +
> +     sprintf(name, "timer%d", 2);
> +     oh = omap_hwmod_lookup(name);
> +     if (!oh)
> +             return;
> +
> +     omap_hwmod_enable(oh);
> +     __omap_dm_timer_load_start(&clkev,
> +                     OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
> +     __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW);
> +}
> +
>  static struct clock_event_device clockevent_gpt = {
>       .name           = "gp_timer",
>       .features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> @@ -142,6 +171,8 @@ static struct clock_event_device clockevent_gpt = {
>       .rating         = 300,
>       .set_next_event = omap2_gp_timer_set_next_event,
>       .set_mode       = omap2_gp_timer_set_mode,
> +     .suspend        = omap_clkevt_suspend,
> +     .resume         = omap_clkevt_resume,

So these suspend/resume callbacks are going to be called for all OMAP2+
and AMxxxx devices? I don't think we want that. AFAIK OMAP timers will
idle on their own when stopped and don't require this.

Cheers
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to