linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
@ 2014-12-18 14:05 Nicolas Ferre
  2015-01-12 14:04 ` Nicolas Ferre
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Ferre @ 2014-12-18 14:05 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Rochet <sylvain.rochet@finsecur.com>

Waiting for PIT to stop counting takes a long time:
  1/(Master clock/prescaler/PIVR)
= 1/(133 MHz     /16       /2^20)
= 126 ms

Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
of the unused PIT device reduce (suspend time + resume time) from ~140 ms
to ~17 ms.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
[nicolas.ferre at atmel.com: move to newer clocksource driver]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
---
Hi Sylvain,

I re-worked (and "Acked") your patch so it can be applied on the newer Mainline
kernels. Beware, I changed the "subject line" as well. The PIT driver moved
recently (3.18).

Daniel,
Can you take this patch in your tree?

Thanks, bye.
  Nicolas.

 drivers/clocksource/timer-atmel-pit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index b5b4d4585c9a..5408bc7c68d8 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -123,6 +123,10 @@ static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
 {
 	struct pit_data *data = clkevt_to_pit_data(cedev);
 
+	/* Don't suspend PIT if unused */
+	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
+		return;
+
 	/* Disable timer */
 	pit_write(data->base, AT91_PIT_MR, 0);
 }
@@ -145,6 +149,10 @@ static void at91sam926x_pit_resume(struct clock_event_device *cedev)
 {
 	struct pit_data *data = clkevt_to_pit_data(cedev);
 
+	/* Don't resume PIT if unused */
+	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
+		return;
+
 	at91sam926x_pit_reset(data);
 }
 
-- 
2.1.3

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2014-12-18 14:05 [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused Nicolas Ferre
@ 2015-01-12 14:04 ` Nicolas Ferre
  2015-01-12 14:22   ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Ferre @ 2015-01-12 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
> From: Sylvain Rochet <sylvain.rochet@finsecur.com>
> 
> Waiting for PIT to stop counting takes a long time:
>   1/(Master clock/prescaler/PIVR)
> = 1/(133 MHz     /16       /2^20)
> = 126 ms
> 
> Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
> of the unused PIT device reduce (suspend time + resume time) from ~140 ms
> to ~17 ms.
> 
> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> [nicolas.ferre at atmel.com: move to newer clocksource driver]
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> Hi Sylvain,
> 
> I re-worked (and "Acked") your patch so it can be applied on the newer Mainline
> kernels. Beware, I changed the "subject line" as well. The PIT driver moved
> recently (3.18).
> 
> Daniel,
> Can you take this patch in your tree?

Hi Daniel,

Anything prevents this patch from being merged (aka ping ;-))?

Bye,


> Thanks, bye.
>   Nicolas.
> 
>  drivers/clocksource/timer-atmel-pit.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index b5b4d4585c9a..5408bc7c68d8 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -123,6 +123,10 @@ static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
>  {
>  	struct pit_data *data = clkevt_to_pit_data(cedev);
>  
> +	/* Don't suspend PIT if unused */
> +	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
> +		return;
> +
>  	/* Disable timer */
>  	pit_write(data->base, AT91_PIT_MR, 0);
>  }
> @@ -145,6 +149,10 @@ static void at91sam926x_pit_resume(struct clock_event_device *cedev)
>  {
>  	struct pit_data *data = clkevt_to_pit_data(cedev);
>  
> +	/* Don't resume PIT if unused */
> +	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
> +		return;
> +
>  	at91sam926x_pit_reset(data);
>  }
>  
> 


-- 
Nicolas Ferre

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2015-01-12 14:04 ` Nicolas Ferre
@ 2015-01-12 14:22   ` Daniel Lezcano
  2015-01-13 10:47     ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2015-01-12 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/12/2015 03:04 PM, Nicolas Ferre wrote:
> Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
>> From: Sylvain Rochet <sylvain.rochet@finsecur.com>
>>
>> Waiting for PIT to stop counting takes a long time:
>>    1/(Master clock/prescaler/PIVR)
>> = 1/(133 MHz     /16       /2^20)
>> = 126 ms
>>
>> Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
>> of the unused PIT device reduce (suspend time + resume time) from ~140 ms
>> to ~17 ms.
>>
>> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
>> [nicolas.ferre at atmel.com: move to newer clocksource driver]
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>> Hi Sylvain,
>>
>> I re-worked (and "Acked") your patch so it can be applied on the newer Mainline
>> kernels. Beware, I changed the "subject line" as well. The PIT driver moved
>> recently (3.18).
>>
>> Daniel,
>> Can you take this patch in your tree?
>
> Hi Daniel,
>
> Anything prevents this patch from being merged (aka ping ;-))?

[Cc'ed tglx].

Hi Nico,

thanks for the head up.

Nothing prevents it but I am wondering if this change shouldn't be in 
the generic framework (kernel/time/clocksource.c and 
kernel/time/clockevents.c), so all drivers will benefit this change ?


>> Thanks, bye.
>>    Nicolas.
>>
>>   drivers/clocksource/timer-atmel-pit.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
>> index b5b4d4585c9a..5408bc7c68d8 100644
>> --- a/drivers/clocksource/timer-atmel-pit.c
>> +++ b/drivers/clocksource/timer-atmel-pit.c
>> @@ -123,6 +123,10 @@ static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
>>   {
>>   	struct pit_data *data = clkevt_to_pit_data(cedev);
>>
>> +	/* Don't suspend PIT if unused */
>> +	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
>> +		return;
>> +
>>   	/* Disable timer */
>>   	pit_write(data->base, AT91_PIT_MR, 0);
>>   }
>> @@ -145,6 +149,10 @@ static void at91sam926x_pit_resume(struct clock_event_device *cedev)
>>   {
>>   	struct pit_data *data = clkevt_to_pit_data(cedev);
>>
>> +	/* Don't resume PIT if unused */
>> +	if (cedev->mode == CLOCK_EVT_MODE_UNUSED)
>> +		return;
>> +
>>   	at91sam926x_pit_reset(data);
>>   }
>>
>>
>
>


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2015-01-12 14:22   ` Daniel Lezcano
@ 2015-01-13 10:47     ` Thomas Gleixner
  2015-01-15 11:41       ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2015-01-13 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 12 Jan 2015, Daniel Lezcano wrote:

> On 01/12/2015 03:04 PM, Nicolas Ferre wrote:
> > Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
> > > From: Sylvain Rochet <sylvain.rochet@finsecur.com>
> > > 
> > > Waiting for PIT to stop counting takes a long time:
> > >    1/(Master clock/prescaler/PIVR)
> > > = 1/(133 MHz     /16       /2^20)
> > > = 126 ms
> > > 
> > > Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
> > > of the unused PIT device reduce (suspend time + resume time) from ~140 ms
> > > to ~17 ms.
> > > 
> > > Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> > > [nicolas.ferre at atmel.com: move to newer clocksource driver]
> > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> > > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > ---
> > > Hi Sylvain,
> > > 
> > > I re-worked (and "Acked") your patch so it can be applied on the newer
> > > Mainline
> > > kernels. Beware, I changed the "subject line" as well. The PIT driver
> > > moved
> > > recently (3.18).
> > > 
> > > Daniel,
> > > Can you take this patch in your tree?
> > 
> > Hi Daniel,
> > 
> > Anything prevents this patch from being merged (aka ping ;-))?
> 
> [Cc'ed tglx].
> 
> Hi Nico,
> 
> thanks for the head up.
> 
> Nothing prevents it but I am wondering if this change shouldn't be in the
> generic framework (kernel/time/clocksource.c and kernel/time/clockevents.c),
> so all drivers will benefit this change ?

Indeed. There is no point in calling suspend/resume for unused
clockevents. They should be stopped and disabled already.

Now with clocksources this might be different. We have no explicit
state for this, but its trivial to add one at least for those
clocksources which have enable/disable callbacks. For the other ones
not so much.

Thanks,

	tglx

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2015-01-13 10:47     ` Thomas Gleixner
@ 2015-01-15 11:41       ` Daniel Lezcano
  2015-01-15 11:52         ` Alexandre Belloni
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2015-01-15 11:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/13/2015 11:47 AM, Thomas Gleixner wrote:
> On Mon, 12 Jan 2015, Daniel Lezcano wrote:
>
>> On 01/12/2015 03:04 PM, Nicolas Ferre wrote:
>>> Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
>>>> From: Sylvain Rochet <sylvain.rochet@finsecur.com>
>>>>
>>>> Waiting for PIT to stop counting takes a long time:
>>>>     1/(Master clock/prescaler/PIVR)
>>>> = 1/(133 MHz     /16       /2^20)
>>>> = 126 ms
>>>>
>>>> Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
>>>> of the unused PIT device reduce (suspend time + resume time) from ~140 ms
>>>> to ~17 ms.
>>>>
>>>> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
>>>> [nicolas.ferre at atmel.com: move to newer clocksource driver]
>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>> ---
>>>> Hi Sylvain,
>>>>
>>>> I re-worked (and "Acked") your patch so it can be applied on the newer
>>>> Mainline
>>>> kernels. Beware, I changed the "subject line" as well. The PIT driver
>>>> moved
>>>> recently (3.18).
>>>>
>>>> Daniel,
>>>> Can you take this patch in your tree?
>>>
>>> Hi Daniel,
>>>
>>> Anything prevents this patch from being merged (aka ping ;-))?
>>
>> [Cc'ed tglx].
>>
>> Hi Nico,
>>
>> thanks for the head up.
>>
>> Nothing prevents it but I am wondering if this change shouldn't be in the
>> generic framework (kernel/time/clocksource.c and kernel/time/clockevents.c),
>> so all drivers will benefit this change ?
>
> Indeed. There is no point in calling suspend/resume for unused
> clockevents. They should be stopped and disabled already.

Hi Nico,

are you planning to do the change in the generic framework ?

Thanks
   -- Daniel

> Now with clocksources this might be different. We have no explicit
> state for this, but its trivial to add one at least for those
> clocksources which have enable/disable callbacks. For the other ones
> not so much.





-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2015-01-15 11:41       ` Daniel Lezcano
@ 2015-01-15 11:52         ` Alexandre Belloni
  2015-01-15 12:23           ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Belloni @ 2015-01-15 11:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I'll do it but only if you review my other series :)

On 15/01/2015 at 12:41:27 +0100, Daniel Lezcano wrote :
> On 01/13/2015 11:47 AM, Thomas Gleixner wrote:
> >On Mon, 12 Jan 2015, Daniel Lezcano wrote:
> >
> >>On 01/12/2015 03:04 PM, Nicolas Ferre wrote:
> >>>Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
> >>>>From: Sylvain Rochet <sylvain.rochet@finsecur.com>
> >>>>
> >>>>Waiting for PIT to stop counting takes a long time:
> >>>>    1/(Master clock/prescaler/PIVR)
> >>>>= 1/(133 MHz     /16       /2^20)
> >>>>= 126 ms
> >>>>
> >>>>Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
> >>>>of the unused PIT device reduce (suspend time + resume time) from ~140 ms
> >>>>to ~17 ms.
> >>>>
> >>>>Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> >>>>[nicolas.ferre at atmel.com: move to newer clocksource driver]
> >>>>Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> >>>>Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> >>>>---
> >>>>Hi Sylvain,
> >>>>
> >>>>I re-worked (and "Acked") your patch so it can be applied on the newer
> >>>>Mainline
> >>>>kernels. Beware, I changed the "subject line" as well. The PIT driver
> >>>>moved
> >>>>recently (3.18).
> >>>>
> >>>>Daniel,
> >>>>Can you take this patch in your tree?
> >>>
> >>>Hi Daniel,
> >>>
> >>>Anything prevents this patch from being merged (aka ping ;-))?
> >>
> >>[Cc'ed tglx].
> >>
> >>Hi Nico,
> >>
> >>thanks for the head up.
> >>
> >>Nothing prevents it but I am wondering if this change shouldn't be in the
> >>generic framework (kernel/time/clocksource.c and kernel/time/clockevents.c),
> >>so all drivers will benefit this change ?
> >
> >Indeed. There is no point in calling suspend/resume for unused
> >clockevents. They should be stopped and disabled already.
> 
> Hi Nico,
> 
> are you planning to do the change in the generic framework ?
> 
> Thanks
>   -- Daniel
> 
> >Now with clocksources this might be different. We have no explicit
> >state for this, but its trivial to add one at least for those
> >clocksources which have enable/disable callbacks. For the other ones
> >not so much.
> 
> 
> 
> 
> 
> -- 
>  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
> 
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused
  2015-01-15 11:52         ` Alexandre Belloni
@ 2015-01-15 12:23           ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2015-01-15 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/15/2015 12:52 PM, Alexandre Belloni wrote:
> Hi,
>
> I'll do it but only if you review my other series :)

deal ! ;)

   -- Daniel


>
> On 15/01/2015 at 12:41:27 +0100, Daniel Lezcano wrote :
>> On 01/13/2015 11:47 AM, Thomas Gleixner wrote:
>>> On Mon, 12 Jan 2015, Daniel Lezcano wrote:
>>>
>>>> On 01/12/2015 03:04 PM, Nicolas Ferre wrote:
>>>>> Le 18/12/2014 15:05, Nicolas Ferre a ?crit :
>>>>>> From: Sylvain Rochet <sylvain.rochet@finsecur.com>
>>>>>>
>>>>>> Waiting for PIT to stop counting takes a long time:
>>>>>>     1/(Master clock/prescaler/PIVR)
>>>>>> = 1/(133 MHz     /16       /2^20)
>>>>>> = 126 ms
>>>>>>
>>>>>> Up to 126 ms if master clock is set to 133 MHz, skipping suspend/resume
>>>>>> of the unused PIT device reduce (suspend time + resume time) from ~140 ms
>>>>>> to ~17 ms.
>>>>>>
>>>>>> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
>>>>>> [nicolas.ferre at atmel.com: move to newer clocksource driver]
>>>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>>>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>>>> ---
>>>>>> Hi Sylvain,
>>>>>>
>>>>>> I re-worked (and "Acked") your patch so it can be applied on the newer
>>>>>> Mainline
>>>>>> kernels. Beware, I changed the "subject line" as well. The PIT driver
>>>>>> moved
>>>>>> recently (3.18).
>>>>>>
>>>>>> Daniel,
>>>>>> Can you take this patch in your tree?
>>>>>
>>>>> Hi Daniel,
>>>>>
>>>>> Anything prevents this patch from being merged (aka ping ;-))?
>>>>
>>>> [Cc'ed tglx].
>>>>
>>>> Hi Nico,
>>>>
>>>> thanks for the head up.
>>>>
>>>> Nothing prevents it but I am wondering if this change shouldn't be in the
>>>> generic framework (kernel/time/clocksource.c and kernel/time/clockevents.c),
>>>> so all drivers will benefit this change ?
>>>
>>> Indeed. There is no point in calling suspend/resume for unused
>>> clockevents. They should be stopped and disabled already.
>>
>> Hi Nico,
>>
>> are you planning to do the change in the generic framework ?
>>
>> Thanks
>>    -- Daniel
>>
>>> Now with clocksources this might be different. We have no explicit
>>> state for this, but its trivial to add one at least for those
>>> clocksources which have enable/disable callbacks. For the other ones
>>> not so much.
>>
>>
>>
>>
>>
>> --
>>   <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
>>
>> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
>> <http://twitter.com/#!/linaroorg> Twitter |
>> <http://www.linaro.org/linaro-blog/> Blog
>>
>


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2015-01-15 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18 14:05 [PATCH] clocksource: timer-atmel-pit: don't suspend/resume if unused Nicolas Ferre
2015-01-12 14:04 ` Nicolas Ferre
2015-01-12 14:22   ` Daniel Lezcano
2015-01-13 10:47     ` Thomas Gleixner
2015-01-15 11:41       ` Daniel Lezcano
2015-01-15 11:52         ` Alexandre Belloni
2015-01-15 12:23           ` Daniel Lezcano

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).