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


Groups > linux.kernel > #1227365

Re: [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared branches

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared branches
Date 2015-09-17 21:40 +0200
Message-ID <q9Ncf-4WP-31@gated-at.bofh.it> (permalink)
References <q9KxH-W9-3@gated-at.bofh.it> <q9KxI-W9-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v5 0/4] Add support for more MSM8916 clocks Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-17 18:50 +0200
  [PATCH v5 4/4] clk: qcom: Add MSM8916 audio clocks Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-17 18:50 +0200
  [PATCH v5 3/4] clk: qcom: Add MSM8916 gpu clocks Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-17 18:50 +0200
  [PATCH v5 1/4] clk: qcom: Add MSM8916 iommu clocks Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-17 18:50 +0200
  [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared branches Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-17 18:50 +0200
    Re: [PATCH v5 2/4] clk: qcom: Add support for RCGs with shared  branches Stephen Boyd <sboyd@codeaurora.org> - 2015-09-17 21:40 +0200
  Re: [PATCH v5 0/4] Add support for more MSM8916 clocks Stephen Boyd <sboyd@codeaurora.org> - 2015-09-18 00:30 +0200
    Re: [PATCH v5 0/4] Add support for more MSM8916 clocks Georgi Djakov <georgi.djakov@linaro.org> - 2015-09-18 17:30 +0200

csiph-web