Skip to content

Commit efd164b

Browse files
Jeffrey Hugobebarino
authored andcommitted
clk: qcom: Allow constant ratio freq tables for rcg
Some RCGs (the gfx_3d_src_clk in msm8998 for example) are basically just some constant ratio from the input across the entire frequency range. It would be great if we could specify the frequency table as a single entry constant ratio instead of a long list, ie: { .src = P_GPUPLL0_OUT_EVEN, .pre_div = 3 }, { } So, lets support that. We need to fix a corner case in qcom_find_freq() where if the freq table is non-null, but has no frequencies, we end up returning an "entry" before the table array, which is bad. Then, we need ignore the freq from the table, and instead base everything on the requested freq. Suggested-by: Stephen Boyd <[email protected]> Signed-off-by: Jeffrey Hugo <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent ba1d366 commit efd164b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/clk/qcom/clk-rcg2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
220220
if (clk_flags & CLK_SET_RATE_PARENT) {
221221
rate = f->freq;
222222
if (f->pre_div) {
223+
if (!rate)
224+
rate = req->rate;
223225
rate /= 2;
224226
rate *= f->pre_div + 1;
225227
}

drivers/clk/qcom/common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)
2929
if (!f)
3030
return NULL;
3131

32+
if (!f->freq)
33+
return f;
34+
3235
for (; f->freq; f++)
3336
if (rate <= f->freq)
3437
return f;

0 commit comments

Comments
 (0)