Skip to contentSkip to conversation

clk: qcom: Base rcg parent rate off plan frequency

PATCH Applied Evan Green 2 participants 2 messages Apr 13, 2018 – May 10, 2018

Subsystems (3)
lore
Share & tools
lore

Evan Green

author
#0 lore raw

PATCH 1/1 clk: qcom: Base rcg parent rate off plan frequency

_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.

---
 drivers/clk/qcom/clk-rcg2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/qcom/clk-rcg2.c +1 -0
index bbeaf9c09dbb..ec6cee8ff1bc 100644
@@ -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;
Signature · 1 line
2.17.0.484.g0c8726318c-goog
maintainer Applied
#1 lore raw

Quoting Evan Green (2018-04-13 13:33:36)

Quoted 10 lines

_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.

---

Applied to clk-next

This problem is ancient so I tagged it with Fixes for all the stable trees.