Skip to content

Commit 2bba67f

Browse files
Nicholas Kazlauskasgregkh
authored andcommitted
drm/amd/display: Guard against setting dispclk low when active
[ Upstream commit 72d7a7f ] [Why] We should never apply a minimum dispclk value while in prepare_bandwidth or while displays are active. This is always an optimization for when all displays are disabled. [How] Defer dispclk optimization until safe_to_lower = true and display_count reaches 0. Since 0 has a special value in this logic (ie. no dispclk required) we also need adjust the logic that clamps it for the actual request to PMFW. Reviewed-by: Gabe Teeger <gabe.teeger@amd.com> Reviewed-by: Leo Chen <leo.chen@amd.com> Reviewed-by: Syed Hassan <syed.hassan@amd.com> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Roman Li <roman.li@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b02b561 commit 2bba67f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,19 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
452452
update_dppclk = true;
453453
}
454454

455-
if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
455+
if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz) &&
456+
(new_clocks->dispclk_khz > 0 || (safe_to_lower && display_count == 0))) {
457+
int requested_dispclk_khz = new_clocks->dispclk_khz;
458+
456459
dcn35_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true);
457460

458-
if (dc->debug.min_disp_clk_khz > 0 && new_clocks->dispclk_khz < dc->debug.min_disp_clk_khz)
459-
new_clocks->dispclk_khz = dc->debug.min_disp_clk_khz;
461+
/* Clamp the requested clock to PMFW based on their limit. */
462+
if (dc->debug.min_disp_clk_khz > 0 && requested_dispclk_khz < dc->debug.min_disp_clk_khz)
463+
requested_dispclk_khz = dc->debug.min_disp_clk_khz;
460464

465+
dcn35_smu_set_dispclk(clk_mgr, requested_dispclk_khz);
461466
clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
462-
dcn35_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
467+
463468
dcn35_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false);
464469

465470
update_dispclk = true;

0 commit comments

Comments
 (0)