Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343568

Re: [PATCH v2] clk: check the actual phase if get_phase is provided

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] clk: check the actual phase if get_phase is provided
Date 2016-02-26 00:20 +0100
Message-ID <r6dmp-2FR-5@gated-at.bofh.it> (permalink)
References <r3lTc-6Da-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/18, Shawn Lin wrote:
> set_phase does sanity checking of degree and ask sub-driver
> to set the degree. If set_phase is limited to support the
> degree what the caller need, sub-driver may select a
> approximate value and return success state. In this case, it's
> inappropriate to assign the degree directly to clk->core->phase.
> We should ask sub-driver to decide the strategy. If sub-driver just
> want to support accurate degree, it can fail the set_phase. Otherwise,
> store the actual degree provided by sub-driver into clk->core->phase
> if get_phase is provided. Another improvemnt by this patch is that
> we can avoid to do unnecessary set_phase if the request defrees is
> already there.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> 
> ---

Knee jerk reaction is why does the provider code set a phase that
isn't requested? Do we need some sort of clk_round_phase() API
that parallels clk_round_rate() so that drivers know what phase
they're going to get? Or do drivers not care what phase they get
when they call clk_set_phase()?

> 
> Changes in v2:
> - remove actual_degree to simplify the changes
> - bail early if nothing to to
> 
>  drivers/clk/clk.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index b4db67a..275e70f 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1902,6 +1902,10 @@ int clk_set_phase(struct clk *clk, int degrees)
>  
>  	clk_prepare_lock();
>  
> +	/* bail early if nothing to do */
> +	if (degrees == clk->core->phase)
> +		goto out;
> +

This could be split out into a different "optimization" patch and
applied today.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2] clk: check the actual phase if get_phase is provided Stephen Boyd <sboyd@codeaurora.org> - 2016-02-26 00:20 +0100
  Re: [PATCH v2] clk: check the actual phase if get_phase is provided Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-26 02:30 +0100
    Re: [PATCH v2] clk: check the actual phase if get_phase is provided Stephen Boyd <sboyd@codeaurora.org> - 2016-02-27 01:20 +0100
      Re: [PATCH v2] clk: check the actual phase if get_phase is provided Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-29 02:20 +0100

csiph-web