Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: clk-krait: switch to .determine_rate

.determine_rate is meant to replace .round_rate. The former comes with a
benefit which is especially relevant on 32-bit systems: since
.determine_rate uses an "unsigned long" (compared to a "signed long"
which is used by .round_rate) the maximum value on 32-bit systems
increases from 2^31 (or approx. 2.14GHz) to 2^32 (or approx. 4.29GHz).

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Tested-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230212-clk-qcom-determine_rate-v1-1-b4e447d4926e@z3ntu.xyz

authored by

Luca Weiss and committed by
Bjorn Andersson
a7074c3e 092209f1

+5 -5
+5 -5
drivers/clk/qcom/clk-krait.c
··· 97 97 EXPORT_SYMBOL_GPL(krait_mux_clk_ops); 98 98 99 99 /* The divider can divide by 2, 4, 6 and 8. But we only really need div-2. */ 100 - static long krait_div2_round_rate(struct clk_hw *hw, unsigned long rate, 101 - unsigned long *parent_rate) 100 + static int krait_div2_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) 102 101 { 103 - *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), rate * 2); 104 - return DIV_ROUND_UP(*parent_rate, 2); 102 + req->best_parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), req->rate * 2); 103 + req->rate = DIV_ROUND_UP(req->best_parent_rate, 2); 104 + return 0; 105 105 } 106 106 107 107 static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate, ··· 142 142 } 143 143 144 144 const struct clk_ops krait_div2_clk_ops = { 145 - .round_rate = krait_div2_round_rate, 145 + .determine_rate = krait_div2_determine_rate, 146 146 .set_rate = krait_div2_set_rate, 147 147 .recalc_rate = krait_div2_recalc_rate, 148 148 };