Skip to content

Commit 82120fe

Browse files
Fangzhi Zuogregkh
authored andcommitted
drm/amd/display: Prevent Gating DTBCLK before It Is Properly Latched
[ Upstream commit cfa0904a35fd0231f4d05da0190f0a22ed881cce ] [why] 1. With allow_0_dtb_clk enabled, the time required to latch DTBCLK to 600 MHz depends on the SMU. If DTBCLK is not latched to 600 MHz before set_mode completes, gating DTBCLK causes the DP2 sink to lose its clock source. 2. The existing DTBCLK gating sequence ungates DTBCLK based on both pix_clk and ref_dtbclk, but gates DTBCLK when either pix_clk or ref_dtbclk is zero. pix_clk can be zero outside the set_mode sequence before DTBCLK is properly latched, which can lead to DTBCLK being gated by mistake. [how] Consider both pixel_clk and ref_dtbclk when determining when it is safe to gate DTBCLK; this is more accurate. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4701 Fixes: 5949e7c4890c ("drm/amd/display: Enable Dynamic DTBCLK Switch") Reviewed-by: Charlene Liu <[email protected]> Reviewed-by: Aurabindo Pillai <[email protected]> Signed-off-by: Fangzhi Zuo <[email protected]> Signed-off-by: Roman Li <[email protected]> Tested-by: Dan Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit d04eb0c402780ca037b62a6aecf23b863545ebca) Cc: [email protected] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b3f2853 commit 82120fe

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
394394
display_count = dcn35_get_active_display_cnt_wa(dc, context, &all_active_disps);
395395
if (new_clocks->dtbclk_en && !new_clocks->ref_dtbclk_khz)
396396
new_clocks->ref_dtbclk_khz = 600000;
397+
else if (!new_clocks->dtbclk_en && new_clocks->ref_dtbclk_khz > 590000)
398+
new_clocks->ref_dtbclk_khz = 0;
397399

398400
/*
399401
* if it is safe to lower, but we are already in the lower state, we don't have to do anything
@@ -435,7 +437,7 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
435437

436438
actual_dtbclk = REG_READ(CLK1_CLK4_CURRENT_CNT);
437439

438-
if (actual_dtbclk) {
440+
if (actual_dtbclk > 590000) {
439441
clk_mgr_base->clks.ref_dtbclk_khz = new_clocks->ref_dtbclk_khz;
440442
clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en;
441443
}

drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ static void dccg35_set_dtbclk_dto(
14111411
__func__, params->otg_inst, params->pixclk_khz,
14121412
params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo);
14131413

1414-
} else {
1414+
} else if (!params->ref_dtbclk_khz && !req_dtbclk_khz) {
14151415
switch (params->otg_inst) {
14161416
case 0:
14171417
REG_UPDATE(DCCG_GATE_DISABLE_CNTL5, DTBCLK_P0_GATE_DISABLE, 0);

0 commit comments

Comments
 (0)