aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/qcom/clk-rcg2.c
diff options
context:
space:
mode:
authorJeffrey Hugo <jeffrey.l.hugo@gmail.com>2019-10-31 11:57:15 -0700
committerStephen Boyd <sboyd@kernel.org>2019-11-07 13:43:19 -0800
commitefd164b5520afd6fb2883b68e0d408a7de29c491 (patch)
treee915653e4bb197023e57455cfa36d61a753577c2 /drivers/clk/qcom/clk-rcg2.c
parentclk: qcom: smd: Add missing pnoc clock (diff)
downloadlinux-dev-efd164b5520afd6fb2883b68e0d408a7de29c491.tar.xz
linux-dev-efd164b5520afd6fb2883b68e0d408a7de29c491.zip
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 <sboyd@kernel.org> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com> Link: https://lkml.kernel.org/r/20191031185715.15504-1-jeffrey.l.hugo@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/qcom/clk-rcg2.c')
-rw-r--r--drivers/clk/qcom/clk-rcg2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index 99c4bfa5365f..8f4b9bec2956 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -220,6 +220,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
if (clk_flags & CLK_SET_RATE_PARENT) {
rate = f->freq;
if (f->pre_div) {
+ if (!rate)
+ rate = req->rate;
rate /= 2;
rate *= f->pre_div + 1;
}