Skip to content

Commit 27750e1

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Allow DTBCLK disable for DCN35
[Why] DTBCLK is enabled on idle and it will burn power. [How] There's a few issues here: - Always enabling DTBCLK on clock manager init - Setting refclk when DTBCLK is supposed to be disabled - Not applying the correct calculated version refclk, but instead the base value which might be zero On dtbclk_en change we'll message PMFW to enable or disable the clock accordingly. The DTBDTO will be then based on refclk, but it will be set to the default fixed value if there was nothing calculated in DML despite the clock being considered enabled. Reviewed-by: Charlene Liu <[email protected]> Acked-by: Tom Chung <[email protected]> Signed-off-by: Nicholas Kazlauskas <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 2161e09 commit 27750e1

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
232232
if (dc->work_arounds.skip_clock_update)
233233
return;
234234

235+
/* DTBCLK is fixed, so set a default if unspecified. */
236+
if (new_clocks->dtbclk_en && !new_clocks->ref_dtbclk_khz)
237+
new_clocks->ref_dtbclk_khz = 600000;
238+
235239
/*
236240
* if it is safe to lower, but we are already in the lower state, we don't have to do anything
237241
* also if safe to lower is false, we just go in the higher state
@@ -265,8 +269,10 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
265269

266270
if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) {
267271
dcn35_smu_set_dtbclk(clk_mgr, true);
268-
dcn35_update_clocks_update_dtb_dto(clk_mgr, context, clk_mgr_base->clks.ref_dtbclk_khz);
269272
clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en;
273+
274+
dcn35_update_clocks_update_dtb_dto(clk_mgr, context, new_clocks->ref_dtbclk_khz);
275+
clk_mgr_base->clks.ref_dtbclk_khz = new_clocks->ref_dtbclk_khz;
270276
}
271277

272278
/* check that we're not already in D0 */
@@ -314,17 +320,12 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
314320
update_dispclk = true;
315321
}
316322

317-
if (!new_clocks->dtbclk_en) {
318-
new_clocks->ref_dtbclk_khz = 600000;
319-
}
320-
321323
/* clock limits are received with MHz precision, divide by 1000 to prevent setting clocks at every call */
322324
if (!dc->debug.disable_dtb_ref_clk_switch &&
323-
should_set_clock(safe_to_lower, new_clocks->ref_dtbclk_khz / 1000, clk_mgr_base->clks.ref_dtbclk_khz / 1000)) {
324-
/* DCCG requires KHz precision for DTBCLK */
325-
dcn35_smu_set_dtbclk(clk_mgr, true);
326-
327-
dcn35_update_clocks_update_dtb_dto(clk_mgr, context, clk_mgr_base->clks.ref_dtbclk_khz);
325+
should_set_clock(safe_to_lower, new_clocks->ref_dtbclk_khz / 1000,
326+
clk_mgr_base->clks.ref_dtbclk_khz / 1000)) {
327+
dcn35_update_clocks_update_dtb_dto(clk_mgr, context, new_clocks->ref_dtbclk_khz);
328+
clk_mgr_base->clks.ref_dtbclk_khz = new_clocks->ref_dtbclk_khz;
328329
}
329330

330331
if (dpp_clock_lowered) {
@@ -1048,12 +1049,8 @@ void dcn35_clk_mgr_construct(
10481049
dcn35_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info);
10491050

10501051
clk_mgr->base.base.dprefclk_khz = dcn35_smu_get_dprefclk(&clk_mgr->base);
1051-
clk_mgr->base.base.clks.ref_dtbclk_khz = dcn35_smu_get_dtbclk(&clk_mgr->base);
1052-
1053-
if (!clk_mgr->base.base.clks.ref_dtbclk_khz)
1054-
dcn35_smu_set_dtbclk(&clk_mgr->base, true);
1052+
clk_mgr->base.base.clks.ref_dtbclk_khz = 600000;
10551053

1056-
clk_mgr->base.base.clks.dtbclk_en = true;
10571054
dce_clock_read_ss_info(&clk_mgr->base);
10581055
/*when clk src is from FCH, it could have ss, same clock src as DPREF clk*/
10591056

0 commit comments

Comments
 (0)