drm/amd/display: Fix compile error from TO_CLK_MGR_INTERNAL
authorLeo Li <sunpeng.li@amd.com>
Thu, 24 Feb 2022 21:30:41 +0000 (16:30 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Mar 2022 18:25:16 +0000 (14:25 -0400)
[Why]

On LNX, TO_CLK_MGR_INTERNAL() only works to get clk_mgr_internal from a
given clk_mgr. In clk_mgr_dcn316 struct, the clk_mgr_internal is already
a memeber by the alias 'base'

[How]

Use &clk_mgr->base instead.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Leo Li <sunpeng.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.h

index 43120a8..702d00c 100644 (file)
@@ -683,8 +683,11 @@ void dcn316_clk_mgr_construct(
        }
 
        clk_mgr->base.base.dprefclk_khz = 600000;
-       clk_mgr->base.dccg->ref_dtbclk_khz = 600000;
+       clk_mgr->base.base.dprefclk_khz = dcn316_smu_get_dpref_clk(&clk_mgr->base);
+       clk_mgr->base.dccg->ref_dtbclk_khz = clk_mgr->base.base.dprefclk_khz;
        dce_clock_read_ss_info(&clk_mgr->base);
+       clk_mgr->base.dccg->ref_dtbclk_khz =
+       dce_adjust_dp_ref_freq_for_ss(&clk_mgr->base, clk_mgr->base.base.dprefclk_khz);
 
        clk_mgr->base.base.bw_params = &dcn316_bw_params;
 
index 128614d..dceec4b 100644 (file)
@@ -310,3 +310,29 @@ void dcn316_smu_set_dtbclk(struct clk_mgr_internal *clk_mgr, bool enable)
                        VBIOSSMC_MSG_SetDtbclkFreq,
                        enable);
 }
+
+int dcn316_smu_get_dpref_clk(struct clk_mgr_internal *clk_mgr)
+{
+       int dprefclk_get_mhz = -1;
+
+       if (clk_mgr->smu_present) {
+               dprefclk_get_mhz = dcn316_smu_send_msg_with_param(
+                       clk_mgr,
+                       VBIOSSMC_MSG_GetDprefclkFreq,
+                       0);
+       }
+       return (dprefclk_get_mhz * 1000);
+}
+
+int dcn316_smu_get_smu_fclk(struct clk_mgr_internal *clk_mgr)
+{
+       int fclk_get_mhz = -1;
+
+       if (clk_mgr->smu_present) {
+               fclk_get_mhz = dcn316_smu_send_msg_with_param(
+                       clk_mgr,
+                       VBIOSSMC_MSG_GetFclkFrequency,
+                       0);
+       }
+       return (fclk_get_mhz * 1000);
+}
index 658b36d..2a7293f 100644 (file)
@@ -133,5 +133,7 @@ void dcn316_smu_transfer_wm_table_dram_2_smu(struct clk_mgr_internal *clk_mgr);
 void dcn316_smu_request_voltage_via_phyclk(struct clk_mgr_internal *clk_mgr, int requested_phyclk_khz);
 void dcn316_smu_enable_pme_wa(struct clk_mgr_internal *clk_mgr);
 void dcn316_smu_set_dtbclk(struct clk_mgr_internal *clk_mgr, bool enable);
+int dcn316_smu_get_dpref_clk(struct clk_mgr_internal *clk_mgr);
+int dcn316_smu_get_smu_fclk(struct clk_mgr_internal *clk_mgr);
 
 #endif /* DAL_DC_316_SMU_H_ */