diff mbox

clk: qcom: Base rcg parent rate off plan frequency

Message ID 20180413203336.134364-1-evgreen@chromium.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Evan Green April 13, 2018, 8:33 p.m. UTC
_freq_tbl_determine_rate uses the pre_div found in the clock plan
multiplied by the requested rate from the caller to determine the
best parent rate to set. If the requested rate is not exactly equal
to the rate that was found in the clock plan, then using the requested
rate in parent rate calculations is incorrect. For instance, if 150MHz
was requested, but 200MHz was the match found, and that plan had a
pre_div of 3, then the parent should be set to 600MHz, not 450MHz.

Signed-off-by: Evan Green <evgreen@chromium.org>
---
 drivers/clk/qcom/clk-rcg2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stephen Boyd May 10, 2018, 6:46 p.m. UTC | #1
Quoting Evan Green (2018-04-13 13:33:36)
> _freq_tbl_determine_rate uses the pre_div found in the clock plan
> multiplied by the requested rate from the caller to determine the
> best parent rate to set. If the requested rate is not exactly equal
> to the rate that was found in the clock plan, then using the requested
> rate in parent rate calculations is incorrect. For instance, if 150MHz
> was requested, but 200MHz was the match found, and that plan had a
> pre_div of 3, then the parent should be set to 600MHz, not 450MHz.
> 
> Signed-off-by: Evan Green <evgreen@chromium.org>
> ---

Applied to clk-next

This problem is ancient so I tagged it with Fixes for all the stable
trees.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index bbeaf9c09dbb..ec6cee8ff1bc 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -211,6 +211,7 @@  static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
 	clk_flags = clk_hw_get_flags(hw);
 	p = clk_hw_get_parent_by_index(hw, index);
 	if (clk_flags & CLK_SET_RATE_PARENT) {
+		rate = f->freq;
 		if (f->pre_div) {
 			rate /= 2;
 			rate *= f->pre_div + 1;