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@baylibre.com, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared branches
Date: Thu, 17 Sep 2015 12:31:37 -0700	[thread overview]
Message-ID: <20150917193137.GU23081@codeaurora.org> (raw)
In-Reply-To: <1442507969-18062-3-git-send-email-georgi.djakov@linaro.org>

On 09/17, Georgi Djakov wrote:
> +
> +static unsigned long
> +clk_rcg2_shared_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
> +{
> +	struct clk_rcg2 *rcg = to_clk_rcg2(hw);
> +	unsigned long rate;
> +	u32 cfg, hid_div, mask;
> +
> +	regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
> +
> +	mask = BIT(rcg->hid_width) - 1;
> +	hid_div = cfg >> CFG_SRC_DIV_SHIFT;
> +	hid_div &= mask;
> +
> +	rate = (parent_rate * 2) / (hid_div + 1);
> +
> +	rcg->current_freq = rate;
> +

We didn't need to copy/paste/hack the clk_rcg2_recalc_rate()
code. I squashed this in.

diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index c7b9b32742e5..b544bb302f79 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -350,20 +350,8 @@ static unsigned long
 clk_rcg2_shared_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
 {
 	struct clk_rcg2 *rcg = to_clk_rcg2(hw);
-	unsigned long rate;
-	u32 cfg, hid_div, mask;
 
-	regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
-
-	mask = BIT(rcg->hid_width) - 1;
-	hid_div = cfg >> CFG_SRC_DIV_SHIFT;
-	hid_div &= mask;
-
-	rate = (parent_rate * 2) / (hid_div + 1);
-
-	rcg->current_freq = rate;
-
-	return rate;
+	return rcg->current_freq = clk_rcg2_recalc_rate(hw, parent_rate);
 }
 
 static int clk_rcg2_shared_enable(struct clk_hw *hw)
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-09-17 19:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 16:39 [PATCH v5 0/4] Add support for more MSM8916 clocks Georgi Djakov
2015-09-17 16:39 ` [PATCH v5 1/4] clk: qcom: Add MSM8916 iommu clocks Georgi Djakov
2015-09-17 16:39 ` [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared branches Georgi Djakov
2015-09-17 19:31   ` Stephen Boyd [this message]
2015-09-17 16:39 ` [PATCH v5 3/4] clk: qcom: Add MSM8916 gpu clocks Georgi Djakov
2015-09-17 16:39 ` [PATCH v5 4/4] clk: qcom: Add MSM8916 audio clocks Georgi Djakov
2015-09-17 22:23 ` [PATCH v5 0/4] Add support for more MSM8916 clocks Stephen Boyd
2015-09-18 15:26   ` Georgi Djakov

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=20150917193137.GU23081@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@baylibre.com \
    /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).