Skip to content

Commit af1e62f

Browse files
mripardbebarino
authored andcommitted
clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d
The gfx3d clock is hand-crafting its own clk_rate_request in clk_gfx3d_determine_rate to pass to the parent of that clock. However, since the clk_rate_request is zero'd at creation, it will have a max_rate of 0 which will break any code depending on the clock boundaries. That includes the recent commit 948fb09 ("clk: Always clamp the rounded rate") which will clamp the rate given to clk_round_rate() to the current clock boundaries. For the gfx3d clock, it means that since both the min_rate and max_rate fields are set at zero, clk_round_rate() now always return 0. Let's initialize the min_rate and max_rate fields properly for that clock. Fixes: 948fb09 ("clk: Always clamp the rounded rate") Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220816112530.1837489-25-maxime@cerno.tech Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 2539932 commit af1e62f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/clk/qcom/clk-rcg2.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,15 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw,
908908
req->best_parent_hw = p2;
909909
}
910910

911+
clk_hw_get_rate_range(req->best_parent_hw,
912+
&parent_req.min_rate, &parent_req.max_rate);
913+
914+
if (req->min_rate > parent_req.min_rate)
915+
parent_req.min_rate = req->min_rate;
916+
917+
if (req->max_rate < parent_req.max_rate)
918+
parent_req.max_rate = req->max_rate;
919+
911920
ret = __clk_determine_rate(req->best_parent_hw, &parent_req);
912921
if (ret)
913922
return ret;

0 commit comments

Comments
 (0)