linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] clk: ux500: add range to usleep_range
@ 2019-04-11 11:04 Nicholas Mc Guire
  2019-04-11 11:07 ` Ulf Hansson
  2019-04-11 18:47 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2019-04-11 11:04 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Michael Turquette, Stephen Boyd, linux-arm-kernel, linux-clk,
	linux-kernel, Nicholas Mc Guire

Providing a range for usleep_range() allows the hrtimer subsystem to
coalesce timers - the delay is runtime configurable so a factor 2
is taken to provide the range. With the expected range for
enable_delay_us being milliseconds, the range should lie in the 250us
range which is sufficient for hrtimer optimization.

Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
---

Problem located with an experimental coccinelle script                                    
V2: As clarified by Ulf Hansson <ulf.hansson@linaro.org> the delays
    here are typically in the millisecond range - so as proposed
    replace the factor 2 by a 25% increase of max.

Patch was compile tested with: u8500_defconfig (implies COMMON_CLK=y)
(with some unrelated sparse warnings about not implemented system calls)                            
Patch is against 5.1-rc4 (localversion-next is next=20190410)

 drivers/clk/ux500/clk-sysctrl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 7c0403b..698306f 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -42,7 +42,8 @@ static int clk_sysctrl_prepare(struct clk_hw *hw)
 				clk->reg_bits[0]);
 
 	if (!ret && clk->enable_delay_us)
-		usleep_range(clk->enable_delay_us, clk->enable_delay_us);
+		usleep_range(clk->enable_delay_us, clk->enable_delay_us +
+			     (clk->enable_delay_us >> 2));
 
 	return ret;
 }
-- 
2.1.4


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

* Re: [PATCH V2] clk: ux500: add range to usleep_range
  2019-04-11 11:04 [PATCH V2] clk: ux500: add range to usleep_range Nicholas Mc Guire
@ 2019-04-11 11:07 ` Ulf Hansson
  2019-04-11 18:47 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2019-04-11 11:07 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Michael Turquette, Stephen Boyd, Linux ARM, linux-clk,
	Linux Kernel Mailing List

On Thu, 11 Apr 2019 at 13:04, Nicholas Mc Guire <hofrat@opentech.at> wrote:
>
> Providing a range for usleep_range() allows the hrtimer subsystem to
> coalesce timers - the delay is runtime configurable so a factor 2
> is taken to provide the range. With the expected range for
> enable_delay_us being milliseconds, the range should lie in the 250us
> range which is sufficient for hrtimer optimization.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>
> Problem located with an experimental coccinelle script
> V2: As clarified by Ulf Hansson <ulf.hansson@linaro.org> the delays
>     here are typically in the millisecond range - so as proposed
>     replace the factor 2 by a 25% increase of max.
>
> Patch was compile tested with: u8500_defconfig (implies COMMON_CLK=y)
> (with some unrelated sparse warnings about not implemented system calls)
> Patch is against 5.1-rc4 (localversion-next is next=20190410)
>
>  drivers/clk/ux500/clk-sysctrl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 7c0403b..698306f 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -42,7 +42,8 @@ static int clk_sysctrl_prepare(struct clk_hw *hw)
>                                 clk->reg_bits[0]);
>
>         if (!ret && clk->enable_delay_us)
> -               usleep_range(clk->enable_delay_us, clk->enable_delay_us);
> +               usleep_range(clk->enable_delay_us, clk->enable_delay_us +
> +                            (clk->enable_delay_us >> 2));
>
>         return ret;
>  }
> --
> 2.1.4
>

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

* Re: [PATCH V2] clk: ux500: add range to usleep_range
  2019-04-11 11:04 [PATCH V2] clk: ux500: add range to usleep_range Nicholas Mc Guire
  2019-04-11 11:07 ` Ulf Hansson
@ 2019-04-11 18:47 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2019-04-11 18:47 UTC (permalink / raw)
  To: Nicholas Mc Guire, Ulf Hansson
  Cc: Michael Turquette, linux-arm-kernel, linux-clk, linux-kernel,
	Nicholas Mc Guire

Quoting Nicholas Mc Guire (2019-04-11 04:04:11)
> Providing a range for usleep_range() allows the hrtimer subsystem to
> coalesce timers - the delay is runtime configurable so a factor 2
> is taken to provide the range. With the expected range for
> enable_delay_us being milliseconds, the range should lie in the 250us
> range which is sufficient for hrtimer optimization.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
> ---

Applied to clk-next


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

end of thread, other threads:[~2019-04-11 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 11:04 [PATCH V2] clk: ux500: add range to usleep_range Nicholas Mc Guire
2019-04-11 11:07 ` Ulf Hansson
2019-04-11 18:47 ` Stephen Boyd

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