public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: jon-hunter@ti•com (Jon Hunter)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC v2 12/18] ARM: OMAP2+: timer: Add suspend-resume callbacks for clockevent device
Date: Wed, 30 Jan 2013 11:46:34 -0600	[thread overview]
Message-ID: <51095C7A.9080904@ti.com> (raw)
In-Reply-To: <B5906170F1614E41A8A28DE3B8D121433ECF0B60@DBDE01.ent.ti.com>


On 01/21/2013 01:22 AM, Bedia, Vaibhav wrote:
> On Fri, Jan 18, 2013 at 10:55:43, Shilimkar, Santosh wrote:
>> On Friday 18 January 2013 12:15 AM, Jon Hunter wrote:
>>>
>>> On 01/10/2013 10:37 PM, Bedia, Vaibhav wrote:
>>>> On Tue, Jan 08, 2013 at 20:45:10, Shilimkar, Santosh wrote:
>>>>> On Monday 31 December 2012 06:37 PM, Vaibhav Bedia wrote:
>>>>>> 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 Bedia <vaibhav.bedia@ti•com>
>>>>>> Cc: Santosh Shilimkar <santosh.shilimkar@ti•com>
>>>>>> Cc: Benoit Cousson <b-cousson@ti•com>
>>>>>> Cc: Paul Walmsley <paul@pwsan•com>
>>>>>> Cc: Kevin Hilman <khilman@deeprootsystems•com>
>>>>>> Cc: Vaibhav Hiremath <hvaibhav@ti•com>
>>>>>> Cc: Jon Hunter <jon-hunter@ti•com>
>>>>>> ---
>>>>>> v1->v2:
>>>>>> 	Get rid of harcoded timer id.
>>>>>> 	Note: since a platform device is not created for these timer
>>>>>> 	instances and because there's very minimal change needed for
>>>>>> 	restarting the timer a full blown context save and restore
>>>>>> 	has been skipped.
>>>>>>
>>>>>>    arch/arm/mach-omap2/timer.c |   33 +++++++++++++++++++++++++++++++++
>>>>>>    1 files changed, 33 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>>>>>> index 691aa67..38f9cbc 100644
>>>>>> --- a/arch/arm/mach-omap2/timer.c
>>>>>> +++ b/arch/arm/mach-omap2/timer.c
>>>>>> @@ -128,6 +128,36 @@ 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", clkev.id);
>>>>>> +	oh = omap_hwmod_lookup(name);
>>>>>> +	if (!oh)
>>>>>> +		return;
>>>>>> +
>>>>>> +	__omap_dm_timer_stop(&clkev, 1, clkev.rate);
>>>>>> +	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", clkev.id);
>>>>>> +	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);
>>>>>> +}
>>>>>> +
>>>>> Am still bit uncomfortable with direct hwmod usage in the suspend/resmue
>>>>> hooks.
>>>>>
>>>>> Jon, Any alternatives you can think of ?
>>>>>
>>>>
>>>> Jon,
>>>>
>>>> Any suggestions here?
>>>
>>> Sorry completed this missed this!
>>>
>>> Unfortunately, I don't have any good suggestions here. However, I am
>>> wondering if the suspend/resume handlers can just be calls to
>>> omap_hwmod_idle/enable and we can remove these __omap_dm_timer_xxxx
>>> calls (I don't think they are needed). Furthermore, my understanding is
>>> this is only needed for AM335x (per the changelog), and so we should not
>>> add suspend/resume handlers for all OMAP2+ based devices.
>>>
>> I agree with the direction.
>>
> 
> I need to retain the call to enable the interrupt but the others can be dropped.
> Will take care of this and the comment on invoking the suspend/resume handlers
> only for AM335x in the next version.

Ok fair enough. By the way, I posted a patch today [1] that will use the
hwmod name as the clockevent timer name. Care to try on top of that
patch and then we can eliminate the sprintf.

Cheers
Jon

[1] http://www.spinics.net/lists/arm-kernel/msg221262.html

  reply	other threads:[~2013-01-30 17:46 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-31 13:06 [RFC v2 00/18] ARM: OMAP2+: AM33XX: Add suspend-resume support Vaibhav Bedia
2012-12-31 13:06 ` [RFC v2 01/18] mailbox: OMAP2+: Add support for AM33XX Vaibhav Bedia
2013-01-01 18:25   ` Tony Lindgren
2013-01-02 11:09     ` Bedia, Vaibhav
2013-01-08 13:53   ` Santosh Shilimkar
2013-01-09  5:16     ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 02/18] mailbox: Add an API for flushing the FIFO Vaibhav Bedia
2013-01-08 13:56   ` Santosh Shilimkar
2013-01-09  5:16     ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 03/18] memory: emif: Move EMIF related header file to include/linux/ Vaibhav Bedia
2013-01-08 14:04   ` Santosh Shilimkar
2013-01-09  5:31     ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 04/18] ARM: OMAP2+: AM33XX: CM: Get rid of unncessary header inclusions Vaibhav Bedia
2013-01-08 15:00   ` Santosh Shilimkar
2012-12-31 13:06 ` [RFC v2 05/18] ARM: OMAP2+: AM33XX: CM/PRM: Use __ASSEMBLER__ macros in header files Vaibhav Bedia
2013-01-08 15:01   ` Santosh Shilimkar
2013-01-09  5:31     ` Bedia, Vaibhav
2012-12-31 13:06 ` [RFC v2 06/18] ARM: OMAP2+: AM33XX: hwmod: Register OCMC RAM hwmod Vaibhav Bedia
2013-01-08 15:04   ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 07/18] ARM: OMAP2+: AM33XX: hwmod: Update TPTC0 hwmod with the right flags Vaibhav Bedia
2013-01-08 15:05   ` Santosh Shilimkar
2013-01-09  6:02     ` Bedia, Vaibhav
2013-02-11 23:33   ` Kevin Hilman
2013-02-13 10:56     ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 08/18] ARM: OMAP2+: AM33XX: hwmod: Fixup cpgmac0 hwmod entry Vaibhav Bedia
2013-01-08 15:08   ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 09/18] ARM: OMAP2+: AM33XX: hwmod: Update the WKUP-M3 hwmod with reset status bit Vaibhav Bedia
2013-01-08 15:09   ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 10/18] ARM: OMAP2+: AM33XX: Update the hardreset API Vaibhav Bedia
2013-01-08 15:10   ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 11/18] ARM: DTS: AM33XX: Add nodes for OCMC RAM and WKUP-M3 Vaibhav Bedia
2013-01-08 15:12   ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 12/18] ARM: OMAP2+: timer: Add suspend-resume callbacks for clockevent device Vaibhav Bedia
2013-01-08 15:15   ` Santosh Shilimkar
2013-01-11  4:37     ` Bedia, Vaibhav
2013-01-17 18:45       ` Jon Hunter
2013-01-18  5:25         ` Santosh Shilimkar
2013-01-21  7:22           ` Bedia, Vaibhav
2013-01-30 17:46             ` Jon Hunter [this message]
2013-01-31 11:17               ` Bedia, Vaibhav
2013-01-17 18:40   ` Jon Hunter
2013-01-21  7:22     ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 13/18] ARM: OMAP2+: AM33XX: timer: Interchance clkevt and clksrc timers Vaibhav Bedia
2013-01-08 15:17   ` Santosh Shilimkar
2013-01-09  5:31     ` Bedia, Vaibhav
2013-01-17 19:09   ` Jon Hunter
2013-01-24 22:30   ` Jon Hunter
2013-01-30 17:48     ` Jon Hunter
2013-01-30 17:49       ` Jon Hunter
2013-01-31 11:29         ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 14/18] ARM: OMAP2+: AM33XX: control: Add some control module registers and APIs Vaibhav Bedia
2013-01-08 15:21   ` Santosh Shilimkar
2013-01-09  5:38     ` Bedia, Vaibhav
2013-01-09  7:31       ` Santosh Shilimkar
2013-01-09  9:37         ` Bedia, Vaibhav
2013-01-09  9:53           ` Santosh Shilimkar
2012-12-31 13:07 ` [RFC v2 15/18] ARM: OMAP2+: AM33XX: Add assembly code for PM operations Vaibhav Bedia
2012-12-31 13:07 ` [RFC v2 16/18] ARM: OMAP2+: AM33XX: Basic suspend resume support Vaibhav Bedia
2013-01-17 14:27   ` Peter Korsgaard
2013-01-21 10:37     ` Bedia, Vaibhav
2013-01-22 12:50       ` Peter Korsgaard
2013-02-12  1:27   ` Kevin Hilman
2013-02-13 13:43     ` Bedia, Vaibhav
2013-02-18 16:11       ` Kevin Hilman
2013-02-20  9:21         ` Bedia, Vaibhav
2013-02-20 14:30           ` Kevin Hilman
2013-04-03 11:52   ` Daniel Mack
2013-04-04  8:47     ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 17/18] ARM: OMAP2+: AM33XX: Select Mailbox when PM is enabled Vaibhav Bedia
2013-01-08 15:22   ` Santosh Shilimkar
2013-01-09  5:38     ` Bedia, Vaibhav
2012-12-31 13:07 ` [RFC v2 18/18] ARM: OMAP2+: AM33XX: Hookup AM33XX PM code into OMAP builds Vaibhav Bedia
2013-01-08 15:31 ` [RFC v2 00/18] ARM: OMAP2+: AM33XX: Add suspend-resume support Santosh Shilimkar
2013-01-09  5:38   ` Bedia, Vaibhav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51095C7A.9080904@ti.com \
    --to=jon-hunter@ti$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox