linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Georgi Djakov <georgi.djakov@linaro.org>
Cc: mturquette@linaro.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] clk: qcom: Fix parent_map translations
Date: Mon, 06 Apr 2015 13:57:55 -0700	[thread overview]
Message-ID: <5522F353.90705@codeaurora.org> (raw)
In-Reply-To: <1428069603-2641-1-git-send-email-georgi.djakov@linaro.org>

On 04/03/15 07:00, Georgi Djakov wrote:
> When we introduced the parent_map tables, we missed to update some
> of the functions where mapping is translated. Fix this.
>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
> ---
>  drivers/clk/qcom/clk-rcg.c  |   13 ++++++++++---
>  drivers/clk/qcom/clk-rcg2.c |   20 +++++++++++++++-----
>  2 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c
> index 8f2f48071a7a..e30821a3ba68 100644
> --- a/drivers/clk/qcom/clk-rcg.c
> +++ b/drivers/clk/qcom/clk-rcg.c
> @@ -319,7 +319,7 @@ static int clk_dyn_rcg_set_parent(struct clk_hw *hw, u8 index)
>  	if (banked_p)
>  		f.pre_div = ns_to_pre_div(&rcg->p[bank], ns) + 1;
>  
> -	f.src = index;
> +	f.src = qcom_find_src_index(hw, rcg->s[bank].parent_map, index);
>  	return configure_bank(rcg, &f);
>  }
>  
> @@ -411,13 +411,19 @@ static long _freq_tbl_determine_rate(struct clk_hw *hw,
>  {
>  	unsigned long clk_flags;
>  	struct clk *p;
> +	struct clk_rcg *rcg = to_clk_rcg(hw);

This function is called by both clk_dyn_rcg_determine_rate() and
clk_rcg_determine_rate() which means struct clk_hw is wrapped by
different structs. The to_clk_rcg() is wrong here. How about we pass the
parent map to this function?

> +	int index;
>  
>  	f = qcom_find_freq(f, rate);
>  	if (!f)
>  		return -EINVAL;
>  
> +	index = qcom_find_src_index(hw, rcg->s.parent_map, f->src);
> +	if (index < 0)
> +		return index;
> +
>  	clk_flags = __clk_get_flags(hw->clk);
> -	p = clk_get_parent_by_index(hw->clk, f->src);
> +	p = clk_get_parent_by_index(hw->clk, index);
>  	if (clk_flags & CLK_SET_RATE_PARENT) {
>  		rate = rate * f->pre_div;
>  		if (f->n) {
>
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

      parent reply	other threads:[~2015-04-06 20:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03 14:00 [PATCH] clk: qcom: Fix parent_map translations Georgi Djakov
2015-04-03 14:14 ` Nicolas Dechesne
2015-04-06 20:57 ` Stephen Boyd [this message]

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=5522F353.90705@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=georgi.djakov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).