From: Alvin Lee <[email protected]> [Why] The DMUB timer reference clock can differ from the crystal frequency, so it should be tracked separately from the other reference clocks.
[How] Add dmub_timer_refclk_khz to resource_pool ref_clocks. DCN3.0, 3.1, 3.2, 3.5, 4.01, 4.2 and 5.0 set it in init_hw from the crystal frequency, next to xtalin_clock_inKhz, so their behavior does not change. DCN6.0 sets it to a fixed 100 MHz (DCN60_DMUB_TIMER_REFCLK_KHZ) in dcn60_resource_construct instead of using the crystal frequency. Other init paths, such as DCN1.0, DCN2.01, DCN6.0 init_hw and the core and bls_builder init, are not changed by this patch and leave the field unset. Cc: Nicholas Kazlauskas <[email protected]> Signed-off-by: Alvin Lee <[email protected]> Signed-off-by: Chenyu Chen <[email protected]> --- drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 + .../gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c | 4 ++++ 9 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c index 35d5cce0a791..c4500617dc85 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c @@ -686,6 +686,8 @@ void dcn30_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c index 7acf6af7e472..e90afdd6f1c9 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c @@ -138,6 +138,8 @@ void dcn31_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c index b78041ba94e9..945052b1808f 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c @@ -848,6 +848,8 @@ void dcn32_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c index 564ffd61f391..d24569870a2d 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c @@ -171,6 +171,8 @@ void dcn35_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c index c39189deb244..7b1eca0e2b57 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c @@ -178,6 +178,8 @@ void dcn401_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c index b1cc09df5e63..62876d489b8e 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c @@ -103,6 +103,8 @@ void dcn42_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c index 151ec838f613..2986eaa73eae 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c @@ -582,6 +582,8 @@ void dcn50_init_hw(struct dc *dc) if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; + res_pool->ref_clocks.dmub_timer_refclk_khz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency; if (res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h index f1b6053fa5c6..09395f5d4e13 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h +++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h @@ -317,6 +317,7 @@ struct resource_pool { unsigned int xtalin_clock_inKhz; unsigned int dccg_ref_clock_inKhz; unsigned int dchub_ref_clock_inKhz; + unsigned int dmub_timer_refclk_khz; } ref_clocks; unsigned int timing_generator_count; unsigned int mpcc_count; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c index 1d7074451ac1..7fa1bcbd00ef 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c @@ -107,6 +107,8 @@ enum dcn60_clk_src_array_id { static const uint32_t MCACHE_ID_UNASSIGNED = 0xF; static const uint32_t SPLIT_LOCATION_UNDEFINED = 0xFFFF; +#define DCN60_DMUB_TIMER_REFCLK_KHZ 100000 + /* DCN */ #define BASE_INNER(seg) ctx->dcn_reg_offsets[seg] @@ -2010,6 +2012,8 @@ static bool dcn60_resource_construct( pool->base.res_cap = &res_cap_dcn6_0; + pool->base.ref_clocks.dmub_timer_refclk_khz = DCN60_DMUB_TIMER_REFCLK_KHZ; + /* max number of pipes for ASIC before checking for pipe fuses */ num_pipes = pool->base.res_cap->num_timing_generator; pipe_fuses = read_pipe_fuses(ctx); -- 2.43.0
