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

clk: qcom: clk-rcg2: fix gfx3d frequency calculation

Since the commit 948fb0969eae ("clk: Always clamp the rounded rate"),
the clk_core_determine_round_nolock() would clamp the requested rate
between min and max rates from the rate request. Normally these fields
would be filled by clk_core_get_boundaries() called from
clk_round_rate().

However clk_gfx3d_determine_rate() uses a manually crafted rate request,
which did not have these fields filled. Thus the requested frequency
would be clamped to 0, resulting in weird frequencies being requested
from the hardware.

Fix this by filling min_rate and max_rate to the values valid for the
respective PLLs (0 and ULONG_MAX).

Fixes: 948fb0969eae ("clk: Always clamp the rounded rate")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220419235447.1586192-1-dmitry.baryshkov@linaro.org
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reported-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Dmitry Baryshkov and committed by
Stephen Boyd
d968fda3 37843d0f

+1 -1
+1 -1
drivers/clk/qcom/clk-rcg2.c
··· 818 818 static int clk_gfx3d_determine_rate(struct clk_hw *hw, 819 819 struct clk_rate_request *req) 820 820 { 821 - struct clk_rate_request parent_req = { }; 821 + struct clk_rate_request parent_req = { .min_rate = 0, .max_rate = ULONG_MAX }; 822 822 struct clk_rcg2_gfx3d *cgfx = to_clk_rcg2_gfx3d(hw); 823 823 struct clk_hw *xo, *p0, *p1, *p2; 824 824 unsigned long p0_rate;