aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2018-03-27 01:32:02 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-04-11 14:07:52 -0400
commit555fd70c59bc7f7acd8bc429d92bd59a66a7b83b (patch)
tree7a774fbdf96b4ff14252384b6047c8e43f22a623
parentd91ea4969bc5edbbe3bd723a1b3ae7d947f62a5a (diff)
drm/amd/pp: Not call cgs interface to get display info
DC/Non DC all will update display configuration when the display state changed No need to get display info through cgs interface Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/amd_powerplay.c1
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c56
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c14
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c51
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c29
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/hwmgr.h2
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c6
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c12
13 files changed, 61 insertions, 136 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index b91ef113a490..1ca6a13be6a3 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -54,6 +54,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
54 hwmgr->chip_family = adev->family; 54 hwmgr->chip_family = adev->family;
55 hwmgr->chip_id = adev->asic_type; 55 hwmgr->chip_id = adev->asic_type;
56 hwmgr->feature_mask = amdgpu_pp_feature_mask; 56 hwmgr->feature_mask = amdgpu_pp_feature_mask;
57 hwmgr->display_config = &adev->pm.pm_display_cfg;
57 adev->powerplay.pp_handle = hwmgr; 58 adev->powerplay.pp_handle = hwmgr;
58 adev->powerplay.pp_funcs = &pp_dpm_funcs; 59 adev->powerplay.pp_funcs = &pp_dpm_funcs;
59 return 0; 60 return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
index dcceadb2e172..e411012b3dcb 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
@@ -265,13 +265,11 @@ int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr,
265 if (display_config == NULL) 265 if (display_config == NULL)
266 return -EINVAL; 266 return -EINVAL;
267 267
268 hwmgr->display_config = *display_config;
269
270 if (NULL != hwmgr->hwmgr_func->set_deep_sleep_dcefclk) 268 if (NULL != hwmgr->hwmgr_func->set_deep_sleep_dcefclk)
271 hwmgr->hwmgr_func->set_deep_sleep_dcefclk(hwmgr, hwmgr->display_config.min_dcef_deep_sleep_set_clk); 269 hwmgr->hwmgr_func->set_deep_sleep_dcefclk(hwmgr, display_config->min_dcef_deep_sleep_set_clk);
272 270
273 for (index = 0; index < hwmgr->display_config.num_path_including_non_display; index++) { 271 for (index = 0; index < display_config->num_path_including_non_display; index++) {
274 if (hwmgr->display_config.displays[index].controller_id != 0) 272 if (display_config->displays[index].controller_id != 0)
275 number_of_active_display++; 273 number_of_active_display++;
276 } 274 }
277 275
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
index 10253b89b3d8..055358b95fdf 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
@@ -161,7 +161,7 @@ static int smu10_set_clock_limit(struct pp_hwmgr *hwmgr, const void *input)
161 struct PP_Clocks clocks = {0}; 161 struct PP_Clocks clocks = {0};
162 struct pp_display_clock_request clock_req; 162 struct pp_display_clock_request clock_req;
163 163
164 clocks.dcefClock = hwmgr->display_config.min_dcef_set_clk; 164 clocks.dcefClock = hwmgr->display_config->min_dcef_set_clk;
165 clock_req.clock_type = amd_pp_dcf_clock; 165 clock_req.clock_type = amd_pp_dcf_clock;
166 clock_req.clock_freq_in_khz = clocks.dcefClock * 10; 166 clock_req.clock_freq_in_khz = clocks.dcefClock * 10;
167 167
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 9087ef91b50b..14332159227e 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -2777,8 +2777,6 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
2777 struct PP_Clocks minimum_clocks = {0}; 2777 struct PP_Clocks minimum_clocks = {0};
2778 bool disable_mclk_switching; 2778 bool disable_mclk_switching;
2779 bool disable_mclk_switching_for_frame_lock; 2779 bool disable_mclk_switching_for_frame_lock;
2780 struct cgs_display_info info = {0};
2781 struct cgs_mode_info mode_info = {0};
2782 const struct phm_clock_and_voltage_limits *max_limits; 2780 const struct phm_clock_and_voltage_limits *max_limits;
2783 uint32_t i; 2781 uint32_t i;
2784 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 2782 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
@@ -2787,7 +2785,6 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
2787 int32_t count; 2785 int32_t count;
2788 int32_t stable_pstate_sclk = 0, stable_pstate_mclk = 0; 2786 int32_t stable_pstate_sclk = 0, stable_pstate_mclk = 0;
2789 2787
2790 info.mode_info = &mode_info;
2791 data->battery_state = (PP_StateUILabel_Battery == 2788 data->battery_state = (PP_StateUILabel_Battery ==
2792 request_ps->classification.ui_label); 2789 request_ps->classification.ui_label);
2793 2790
@@ -2809,10 +2806,8 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
2809 } 2806 }
2810 } 2807 }
2811 2808
2812 cgs_get_active_displays_info(hwmgr->device, &info); 2809 minimum_clocks.engineClock = hwmgr->display_config->min_core_set_clock;
2813 2810 minimum_clocks.memoryClock = hwmgr->display_config->min_mem_set_clock;
2814 minimum_clocks.engineClock = hwmgr->display_config.min_core_set_clock;
2815 minimum_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock;
2816 2811
2817 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 2812 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
2818 PHM_PlatformCaps_StablePState)) { 2813 PHM_PlatformCaps_StablePState)) {
@@ -2843,12 +2838,12 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
2843 PHM_PlatformCaps_DisableMclkSwitchingForFrameLock); 2838 PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
2844 2839
2845 2840
2846 if (info.display_count == 0) 2841 if (hwmgr->display_config->num_display == 0)
2847 disable_mclk_switching = false; 2842 disable_mclk_switching = false;
2848 else 2843 else
2849 disable_mclk_switching = ((1 < info.display_count) || 2844 disable_mclk_switching = ((1 < hwmgr->display_config->num_display) ||
2850 disable_mclk_switching_for_frame_lock || 2845 disable_mclk_switching_for_frame_lock ||
2851 smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us)); 2846 smu7_vblank_too_short(hwmgr, hwmgr->display_config->min_vblank_time));
2852 2847
2853 sclk = smu7_ps->performance_levels[0].engine_clock; 2848 sclk = smu7_ps->performance_levels[0].engine_clock;
2854 mclk = smu7_ps->performance_levels[0].memory_clock; 2849 mclk = smu7_ps->performance_levels[0].memory_clock;
@@ -3479,7 +3474,6 @@ static int smu7_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, cons
3479 [smu7_ps->performance_level_count - 1].memory_clock; 3474 [smu7_ps->performance_level_count - 1].memory_clock;
3480 struct PP_Clocks min_clocks = {0}; 3475 struct PP_Clocks min_clocks = {0};
3481 uint32_t i; 3476 uint32_t i;
3482 struct cgs_display_info info = {0};
3483 3477
3484 for (i = 0; i < sclk_table->count; i++) { 3478 for (i = 0; i < sclk_table->count; i++) {
3485 if (sclk == sclk_table->dpm_levels[i].value) 3479 if (sclk == sclk_table->dpm_levels[i].value)
@@ -3506,9 +3500,8 @@ static int smu7_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, cons
3506 if (i >= mclk_table->count) 3500 if (i >= mclk_table->count)
3507 data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_MCLK; 3501 data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_MCLK;
3508 3502
3509 cgs_get_active_displays_info(hwmgr->device, &info);
3510 3503
3511 if (data->display_timing.num_existing_displays != info.display_count) 3504 if (data->display_timing.num_existing_displays != hwmgr->display_config->num_display)
3512 data->need_update_smu7_dpm_table |= DPMTABLE_UPDATE_MCLK; 3505 data->need_update_smu7_dpm_table |= DPMTABLE_UPDATE_MCLK;
3513 3506
3514 return 0; 3507 return 0;
@@ -3907,15 +3900,8 @@ smu7_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display)
3907static int 3900static int
3908smu7_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr) 3901smu7_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
3909{ 3902{
3910 uint32_t num_active_displays = 0; 3903 if (hwmgr->display_config->num_display > 1 &&
3911 struct cgs_display_info info = {0}; 3904 !hwmgr->display_config->multi_monitor_in_sync)
3912
3913 info.mode_info = NULL;
3914 cgs_get_active_displays_info(hwmgr->device, &info);
3915
3916 num_active_displays = info.display_count;
3917
3918 if (num_active_displays > 1 && hwmgr->display_config.multi_monitor_in_sync != true)
3919 smu7_notify_smc_display_change(hwmgr, false); 3905 smu7_notify_smc_display_change(hwmgr, false);
3920 3906
3921 return 0; 3907 return 0;
@@ -3930,33 +3916,24 @@ smu7_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwmgr)
3930static int smu7_program_display_gap(struct pp_hwmgr *hwmgr) 3916static int smu7_program_display_gap(struct pp_hwmgr *hwmgr)
3931{ 3917{
3932 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 3918 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
3933 uint32_t num_active_displays = 0;
3934 uint32_t display_gap = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL); 3919 uint32_t display_gap = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL);
3935 uint32_t display_gap2; 3920 uint32_t display_gap2;
3936 uint32_t pre_vbi_time_in_us; 3921 uint32_t pre_vbi_time_in_us;
3937 uint32_t frame_time_in_us; 3922 uint32_t frame_time_in_us;
3938 uint32_t ref_clock; 3923 uint32_t ref_clock, refresh_rate;
3939 uint32_t refresh_rate = 0;
3940 struct cgs_display_info info = {0};
3941 struct cgs_mode_info mode_info = {0};
3942 3924
3943 info.mode_info = &mode_info; 3925 display_gap = PHM_SET_FIELD(display_gap, CG_DISPLAY_GAP_CNTL, DISP_GAP, (hwmgr->display_config->num_display > 0) ? DISPLAY_GAP_VBLANK_OR_WM : DISPLAY_GAP_IGNORE);
3944 cgs_get_active_displays_info(hwmgr->device, &info);
3945 num_active_displays = info.display_count;
3946
3947 display_gap = PHM_SET_FIELD(display_gap, CG_DISPLAY_GAP_CNTL, DISP_GAP, (num_active_displays > 0) ? DISPLAY_GAP_VBLANK_OR_WM : DISPLAY_GAP_IGNORE);
3948 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL, display_gap); 3926 cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL, display_gap);
3949 3927
3950 ref_clock = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev); 3928 ref_clock = amdgpu_asic_get_xclk((struct amdgpu_device *)hwmgr->adev);
3951 3929 refresh_rate = hwmgr->display_config->vrefresh;
3952 refresh_rate = mode_info.refresh_rate;
3953 3930
3954 if (0 == refresh_rate) 3931 if (0 == refresh_rate)
3955 refresh_rate = 60; 3932 refresh_rate = 60;
3956 3933
3957 frame_time_in_us = 1000000 / refresh_rate; 3934 frame_time_in_us = 1000000 / refresh_rate;
3958 3935
3959 pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us; 3936 pre_vbi_time_in_us = frame_time_in_us - 200 - hwmgr->display_config->min_vblank_time;
3960 3937
3961 data->frame_time_x2 = frame_time_in_us * 2 / 100; 3938 data->frame_time_x2 = frame_time_in_us * 2 / 100;
3962 3939
@@ -4036,17 +4013,14 @@ smu7_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)
4036{ 4013{
4037 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 4014 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
4038 bool is_update_required = false; 4015 bool is_update_required = false;
4039 struct cgs_display_info info = {0, 0, NULL};
4040
4041 cgs_get_active_displays_info(hwmgr->device, &info);
4042 4016
4043 if (data->display_timing.num_existing_displays != info.display_count) 4017 if (data->display_timing.num_existing_displays != hwmgr->display_config->num_display)
4044 is_update_required = true; 4018 is_update_required = true;
4045 4019
4046 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) { 4020 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) {
4047 if (data->display_timing.min_clock_in_sr != hwmgr->display_config.min_core_set_clock_in_sr && 4021 if (data->display_timing.min_clock_in_sr != hwmgr->display_config->min_core_set_clock_in_sr &&
4048 (data->display_timing.min_clock_in_sr >= SMU7_MINIMUM_ENGINE_CLOCK || 4022 (data->display_timing.min_clock_in_sr >= SMU7_MINIMUM_ENGINE_CLOCK ||
4049 hwmgr->display_config.min_core_set_clock_in_sr >= SMU7_MINIMUM_ENGINE_CLOCK)) 4023 hwmgr->display_config->min_core_set_clock_in_sr >= SMU7_MINIMUM_ENGINE_CLOCK))
4050 is_update_required = true; 4024 is_update_required = true;
4051 } 4025 }
4052 return is_update_required; 4026 return is_update_required;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
index 3ac07fabbe5c..c2f93aa1d2e8 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -693,7 +693,7 @@ static int smu8_update_sclk_limit(struct pp_hwmgr *hwmgr)
693 else 693 else
694 data->sclk_dpm.soft_max_clk = table->entries[table->count - 1].clk; 694 data->sclk_dpm.soft_max_clk = table->entries[table->count - 1].clk;
695 695
696 clock = hwmgr->display_config.min_core_set_clock; 696 clock = hwmgr->display_config->min_core_set_clock;
697 if (clock == 0) 697 if (clock == 0)
698 pr_debug("min_core_set_clock not set\n"); 698 pr_debug("min_core_set_clock not set\n");
699 699
@@ -748,7 +748,7 @@ static int smu8_set_deep_sleep_sclk_threshold(struct pp_hwmgr *hwmgr)
748{ 748{
749 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 749 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
750 PHM_PlatformCaps_SclkDeepSleep)) { 750 PHM_PlatformCaps_SclkDeepSleep)) {
751 uint32_t clks = hwmgr->display_config.min_core_set_clock_in_sr; 751 uint32_t clks = hwmgr->display_config->min_core_set_clock_in_sr;
752 if (clks == 0) 752 if (clks == 0)
753 clks = SMU8_MIN_DEEP_SLEEP_SCLK; 753 clks = SMU8_MIN_DEEP_SLEEP_SCLK;
754 754
@@ -1040,25 +1040,21 @@ static int smu8_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
1040 struct smu8_hwmgr *data = hwmgr->backend; 1040 struct smu8_hwmgr *data = hwmgr->backend;
1041 struct PP_Clocks clocks = {0, 0, 0, 0}; 1041 struct PP_Clocks clocks = {0, 0, 0, 0};
1042 bool force_high; 1042 bool force_high;
1043 uint32_t num_of_active_displays = 0;
1044 struct cgs_display_info info = {0};
1045 1043
1046 smu8_ps->need_dfs_bypass = true; 1044 smu8_ps->need_dfs_bypass = true;
1047 1045
1048 data->battery_state = (PP_StateUILabel_Battery == prequest_ps->classification.ui_label); 1046 data->battery_state = (PP_StateUILabel_Battery == prequest_ps->classification.ui_label);
1049 1047
1050 clocks.memoryClock = hwmgr->display_config.min_mem_set_clock != 0 ? 1048 clocks.memoryClock = hwmgr->display_config->min_mem_set_clock != 0 ?
1051 hwmgr->display_config.min_mem_set_clock : 1049 hwmgr->display_config->min_mem_set_clock :
1052 data->sys_info.nbp_memory_clock[1]; 1050 data->sys_info.nbp_memory_clock[1];
1053 1051
1054 cgs_get_active_displays_info(hwmgr->device, &info);
1055 num_of_active_displays = info.display_count;
1056 1052
1057 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) 1053 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState))
1058 clocks.memoryClock = hwmgr->dyn_state.max_clock_voltage_on_ac.mclk; 1054 clocks.memoryClock = hwmgr->dyn_state.max_clock_voltage_on_ac.mclk;
1059 1055
1060 force_high = (clocks.memoryClock > data->sys_info.nbp_memory_clock[SMU8_NUM_NBPMEMORYCLOCK - 1]) 1056 force_high = (clocks.memoryClock > data->sys_info.nbp_memory_clock[SMU8_NUM_NBPMEMORYCLOCK - 1])
1061 || (num_of_active_displays >= 3); 1057 || (hwmgr->display_config->num_display >= 3);
1062 1058
1063 smu8_ps->action = smu8_current_ps->action; 1059 smu8_ps->action = smu8_current_ps->action;
1064 1060
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 7cbb56ba6fab..c9fb4b2cf5c6 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -3028,7 +3028,6 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
3028 bool disable_mclk_switching_for_frame_lock; 3028 bool disable_mclk_switching_for_frame_lock;
3029 bool disable_mclk_switching_for_vr; 3029 bool disable_mclk_switching_for_vr;
3030 bool force_mclk_high; 3030 bool force_mclk_high;
3031 struct cgs_display_info info = {0};
3032 const struct phm_clock_and_voltage_limits *max_limits; 3031 const struct phm_clock_and_voltage_limits *max_limits;
3033 uint32_t i; 3032 uint32_t i;
3034 struct vega10_hwmgr *data = hwmgr->backend; 3033 struct vega10_hwmgr *data = hwmgr->backend;
@@ -3063,11 +3062,9 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
3063 } 3062 }
3064 } 3063 }
3065 3064
3066 cgs_get_active_displays_info(hwmgr->device, &info);
3067
3068 /* result = PHM_CheckVBlankTime(hwmgr, &vblankTooShort);*/ 3065 /* result = PHM_CheckVBlankTime(hwmgr, &vblankTooShort);*/
3069 minimum_clocks.engineClock = hwmgr->display_config.min_core_set_clock; 3066 minimum_clocks.engineClock = hwmgr->display_config->min_core_set_clock;
3070 minimum_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock; 3067 minimum_clocks.memoryClock = hwmgr->display_config->min_mem_set_clock;
3071 3068
3072 if (PP_CAP(PHM_PlatformCaps_StablePState)) { 3069 if (PP_CAP(PHM_PlatformCaps_StablePState)) {
3073 stable_pstate_sclk_dpm_percentage = 3070 stable_pstate_sclk_dpm_percentage =
@@ -3107,10 +3104,10 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
3107 PP_CAP(PHM_PlatformCaps_DisableMclkSwitchForVR); 3104 PP_CAP(PHM_PlatformCaps_DisableMclkSwitchForVR);
3108 force_mclk_high = PP_CAP(PHM_PlatformCaps_ForceMclkHigh); 3105 force_mclk_high = PP_CAP(PHM_PlatformCaps_ForceMclkHigh);
3109 3106
3110 if (info.display_count == 0) 3107 if (hwmgr->display_config->num_display == 0)
3111 disable_mclk_switching = false; 3108 disable_mclk_switching = false;
3112 else 3109 else
3113 disable_mclk_switching = (info.display_count > 1) || 3110 disable_mclk_switching = (hwmgr->display_config->num_display > 1) ||
3114 disable_mclk_switching_for_frame_lock || 3111 disable_mclk_switching_for_frame_lock ||
3115 disable_mclk_switching_for_vr || 3112 disable_mclk_switching_for_vr ||
3116 force_mclk_high; 3113 force_mclk_high;
@@ -3186,7 +3183,6 @@ static int vega10_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, co
3186 [vega10_ps->performance_level_count - 1].mem_clock; 3183 [vega10_ps->performance_level_count - 1].mem_clock;
3187 struct PP_Clocks min_clocks = {0}; 3184 struct PP_Clocks min_clocks = {0};
3188 uint32_t i; 3185 uint32_t i;
3189 struct cgs_display_info info = {0};
3190 3186
3191 data->need_update_dpm_table = 0; 3187 data->need_update_dpm_table = 0;
3192 3188
@@ -3211,10 +3207,8 @@ static int vega10_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, co
3211 data->need_update_dpm_table |= DPMTABLE_UPDATE_SCLK; 3207 data->need_update_dpm_table |= DPMTABLE_UPDATE_SCLK;
3212 } 3208 }
3213 3209
3214 cgs_get_active_displays_info(hwmgr->device, &info);
3215
3216 if (data->display_timing.num_existing_displays != 3210 if (data->display_timing.num_existing_displays !=
3217 info.display_count) 3211 hwmgr->display_config->num_display)
3218 data->need_update_dpm_table |= DPMTABLE_UPDATE_MCLK; 3212 data->need_update_dpm_table |= DPMTABLE_UPDATE_MCLK;
3219 } else { 3213 } else {
3220 for (i = 0; i < sclk_table->count; i++) { 3214 for (i = 0; i < sclk_table->count; i++) {
@@ -3242,13 +3236,11 @@ static int vega10_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, co
3242 break; 3236 break;
3243 } 3237 }
3244 3238
3245 cgs_get_active_displays_info(hwmgr->device, &info);
3246
3247 if (i >= mclk_table->count) 3239 if (i >= mclk_table->count)
3248 data->need_update_dpm_table |= DPMTABLE_OD_UPDATE_MCLK; 3240 data->need_update_dpm_table |= DPMTABLE_OD_UPDATE_MCLK;
3249 3241
3250 if (data->display_timing.num_existing_displays != 3242 if (data->display_timing.num_existing_displays !=
3251 info.display_count || 3243 hwmgr->display_config->num_display ||
3252 i >= mclk_table->count) 3244 i >= mclk_table->count)
3253 data->need_update_dpm_table |= DPMTABLE_UPDATE_MCLK; 3245 data->need_update_dpm_table |= DPMTABLE_UPDATE_MCLK;
3254 } 3246 }
@@ -3956,26 +3948,18 @@ static int vega10_notify_smc_display_config_after_ps_adjustment(
3956 (struct phm_ppt_v2_information *)hwmgr->pptable; 3948 (struct phm_ppt_v2_information *)hwmgr->pptable;
3957 struct phm_ppt_v1_clock_voltage_dependency_table *mclk_table = table_info->vdd_dep_on_mclk; 3949 struct phm_ppt_v1_clock_voltage_dependency_table *mclk_table = table_info->vdd_dep_on_mclk;
3958 uint32_t idx; 3950 uint32_t idx;
3959 uint32_t num_active_disps = 0;
3960 struct cgs_display_info info = {0};
3961 struct PP_Clocks min_clocks = {0}; 3951 struct PP_Clocks min_clocks = {0};
3962 uint32_t i; 3952 uint32_t i;
3963 struct pp_display_clock_request clock_req; 3953 struct pp_display_clock_request clock_req;
3964 3954
3965 info.mode_info = NULL; 3955 if (hwmgr->display_config->num_display > 1)
3966
3967 cgs_get_active_displays_info(hwmgr->device, &info);
3968
3969 num_active_disps = info.display_count;
3970
3971 if (num_active_disps > 1)
3972 vega10_notify_smc_display_change(hwmgr, false); 3956 vega10_notify_smc_display_change(hwmgr, false);
3973 else 3957 else
3974 vega10_notify_smc_display_change(hwmgr, true); 3958 vega10_notify_smc_display_change(hwmgr, true);
3975 3959
3976 min_clocks.dcefClock = hwmgr->display_config.min_dcef_set_clk; 3960 min_clocks.dcefClock = hwmgr->display_config->min_dcef_set_clk;
3977 min_clocks.dcefClockInSR = hwmgr->display_config.min_dcef_deep_sleep_set_clk; 3961 min_clocks.dcefClockInSR = hwmgr->display_config->min_dcef_deep_sleep_set_clk;
3978 min_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock; 3962 min_clocks.memoryClock = hwmgr->display_config->min_mem_set_clock;
3979 3963
3980 for (i = 0; i < dpm_table->count; i++) { 3964 for (i = 0; i < dpm_table->count; i++) {
3981 if (dpm_table->dpm_levels[i].value == min_clocks.dcefClock) 3965 if (dpm_table->dpm_levels[i].value == min_clocks.dcefClock)
@@ -4501,10 +4485,8 @@ static int vega10_print_clock_levels(struct pp_hwmgr *hwmgr,
4501static int vega10_display_configuration_changed_task(struct pp_hwmgr *hwmgr) 4485static int vega10_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
4502{ 4486{
4503 struct vega10_hwmgr *data = hwmgr->backend; 4487 struct vega10_hwmgr *data = hwmgr->backend;
4504 int result = 0;
4505 uint32_t num_turned_on_displays = 1;
4506 Watermarks_t *wm_table = &(data->smc_state_table.water_marks_table); 4488 Watermarks_t *wm_table = &(data->smc_state_table.water_marks_table);
4507 struct cgs_display_info info = {0}; 4489 int result = 0;
4508 4490
4509 if ((data->water_marks_bitmap & WaterMarksExist) && 4491 if ((data->water_marks_bitmap & WaterMarksExist) &&
4510 !(data->water_marks_bitmap & WaterMarksLoaded)) { 4492 !(data->water_marks_bitmap & WaterMarksLoaded)) {
@@ -4514,10 +4496,8 @@ static int vega10_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
4514 } 4496 }
4515 4497
4516 if (data->water_marks_bitmap & WaterMarksLoaded) { 4498 if (data->water_marks_bitmap & WaterMarksLoaded) {
4517 cgs_get_active_displays_info(hwmgr->device, &info);
4518 num_turned_on_displays = info.display_count;
4519 smum_send_msg_to_smc_with_parameter(hwmgr, 4499 smum_send_msg_to_smc_with_parameter(hwmgr,
4520 PPSMC_MSG_NumOfDisplays, num_turned_on_displays); 4500 PPSMC_MSG_NumOfDisplays, hwmgr->display_config->num_display);
4521 } 4501 }
4522 4502
4523 return result; 4503 return result;
@@ -4603,15 +4583,12 @@ vega10_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmg
4603{ 4583{
4604 struct vega10_hwmgr *data = hwmgr->backend; 4584 struct vega10_hwmgr *data = hwmgr->backend;
4605 bool is_update_required = false; 4585 bool is_update_required = false;
4606 struct cgs_display_info info = {0, 0, NULL};
4607
4608 cgs_get_active_displays_info(hwmgr->device, &info);
4609 4586
4610 if (data->display_timing.num_existing_displays != info.display_count) 4587 if (data->display_timing.num_existing_displays != hwmgr->display_config->num_display)
4611 is_update_required = true; 4588 is_update_required = true;
4612 4589
4613 if (PP_CAP(PHM_PlatformCaps_SclkDeepSleep)) { 4590 if (PP_CAP(PHM_PlatformCaps_SclkDeepSleep)) {
4614 if (data->display_timing.min_clock_in_sr != hwmgr->display_config.min_core_set_clock_in_sr) 4591 if (data->display_timing.min_clock_in_sr != hwmgr->display_config->min_core_set_clock_in_sr)
4615 is_update_required = true; 4592 is_update_required = true;
4616 } 4593 }
4617 4594
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
index 200de46bd06b..6a85238ae20f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
@@ -1260,23 +1260,18 @@ static int vega12_notify_smc_display_config_after_ps_adjustment(
1260{ 1260{
1261 struct vega12_hwmgr *data = 1261 struct vega12_hwmgr *data =
1262 (struct vega12_hwmgr *)(hwmgr->backend); 1262 (struct vega12_hwmgr *)(hwmgr->backend);
1263 uint32_t num_active_disps = 0;
1264 struct cgs_display_info info = {0};
1265 struct PP_Clocks min_clocks = {0}; 1263 struct PP_Clocks min_clocks = {0};
1266 struct pp_display_clock_request clock_req; 1264 struct pp_display_clock_request clock_req;
1267 uint32_t clk_request; 1265 uint32_t clk_request;
1268 1266
1269 info.mode_info = NULL; 1267 if (hwmgr->display_config->num_display > 1)
1270 cgs_get_active_displays_info(hwmgr->device, &info);
1271 num_active_disps = info.display_count;
1272 if (num_active_disps > 1)
1273 vega12_notify_smc_display_change(hwmgr, false); 1268 vega12_notify_smc_display_change(hwmgr, false);
1274 else 1269 else
1275 vega12_notify_smc_display_change(hwmgr, true); 1270 vega12_notify_smc_display_change(hwmgr, true);
1276 1271
1277 min_clocks.dcefClock = hwmgr->display_config.min_dcef_set_clk; 1272 min_clocks.dcefClock = hwmgr->display_config->min_dcef_set_clk;
1278 min_clocks.dcefClockInSR = hwmgr->display_config.min_dcef_deep_sleep_set_clk; 1273 min_clocks.dcefClockInSR = hwmgr->display_config->min_dcef_deep_sleep_set_clk;
1279 min_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock; 1274 min_clocks.memoryClock = hwmgr->display_config->min_mem_set_clock;
1280 1275
1281 if (data->smu_features[GNLD_DPM_DCEFCLK].supported) { 1276 if (data->smu_features[GNLD_DPM_DCEFCLK].supported) {
1282 clock_req.clock_type = amd_pp_dcef_clock; 1277 clock_req.clock_type = amd_pp_dcef_clock;
@@ -1832,9 +1827,7 @@ static int vega12_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
1832{ 1827{
1833 struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend); 1828 struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
1834 int result = 0; 1829 int result = 0;
1835 uint32_t num_turned_on_displays = 1;
1836 Watermarks_t *wm_table = &(data->smc_state_table.water_marks_table); 1830 Watermarks_t *wm_table = &(data->smc_state_table.water_marks_table);
1837 struct cgs_display_info info = {0};
1838 1831
1839 if ((data->water_marks_bitmap & WaterMarksExist) && 1832 if ((data->water_marks_bitmap & WaterMarksExist) &&
1840 !(data->water_marks_bitmap & WaterMarksLoaded)) { 1833 !(data->water_marks_bitmap & WaterMarksLoaded)) {
@@ -1846,12 +1839,9 @@ static int vega12_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
1846 1839
1847 if ((data->water_marks_bitmap & WaterMarksExist) && 1840 if ((data->water_marks_bitmap & WaterMarksExist) &&
1848 data->smu_features[GNLD_DPM_DCEFCLK].supported && 1841 data->smu_features[GNLD_DPM_DCEFCLK].supported &&
1849 data->smu_features[GNLD_DPM_SOCCLK].supported) { 1842 data->smu_features[GNLD_DPM_SOCCLK].supported)
1850 cgs_get_active_displays_info(hwmgr->device, &info);
1851 num_turned_on_displays = info.display_count;
1852 smum_send_msg_to_smc_with_parameter(hwmgr, 1843 smum_send_msg_to_smc_with_parameter(hwmgr,
1853 PPSMC_MSG_NumOfDisplays, num_turned_on_displays); 1844 PPSMC_MSG_NumOfDisplays, hwmgr->display_config->num_display);
1854 }
1855 1845
1856 return result; 1846 return result;
1857} 1847}
@@ -1894,15 +1884,12 @@ vega12_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmg
1894{ 1884{
1895 struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend); 1885 struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
1896 bool is_update_required = false; 1886 bool is_update_required = false;
1897 struct cgs_display_info info = {0, 0, NULL};
1898
1899 cgs_get_active_displays_info(hwmgr->device, &info);
1900 1887
1901 if (data->display_timing.num_existing_displays != info.display_count) 1888 if (data->display_timing.num_existing_displays != hwmgr->display_config->num_display)
1902 is_update_required = true; 1889 is_update_required = true;
1903 1890
1904 if (data->registry_data.gfx_clk_deep_sleep_support) { 1891 if (data->registry_data.gfx_clk_deep_sleep_support) {
1905 if (data->display_timing.min_clock_in_sr != hwmgr->display_config.min_core_set_clock_in_sr) 1892 if (data->display_timing.min_clock_in_sr != hwmgr->display_config->min_core_set_clock_in_sr)
1906 is_update_required = true; 1893 is_update_required = true;
1907 } 1894 }
1908 1895
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index d5cadc61c9b3..e450ec74d6ed 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -765,7 +765,7 @@ struct pp_hwmgr {
765 struct pp_power_state *request_ps; 765 struct pp_power_state *request_ps;
766 struct pp_power_state *boot_ps; 766 struct pp_power_state *boot_ps;
767 struct pp_power_state *uvd_ps; 767 struct pp_power_state *uvd_ps;
768 struct amd_pp_display_configuration display_config; 768 const struct amd_pp_display_configuration *display_config;
769 uint32_t feature_mask; 769 uint32_t feature_mask;
770 bool avfs_supported; 770 bool avfs_supported;
771 /* UMD Pstate */ 771 /* UMD Pstate */
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index e30a2eea1fba..c28b95fd1c85 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -1182,7 +1182,6 @@ static int ci_populate_single_memory_level(
1182 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 1182 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
1183 int result = 0; 1183 int result = 0;
1184 bool dll_state_on; 1184 bool dll_state_on;
1185 struct cgs_display_info info = {0};
1186 uint32_t mclk_edc_wr_enable_threshold = 40000; 1185 uint32_t mclk_edc_wr_enable_threshold = 40000;
1187 uint32_t mclk_edc_enable_threshold = 40000; 1186 uint32_t mclk_edc_enable_threshold = 40000;
1188 uint32_t mclk_strobe_mode_threshold = 40000; 1187 uint32_t mclk_strobe_mode_threshold = 40000;
@@ -1236,8 +1235,7 @@ static int ci_populate_single_memory_level(
1236 /* default set to low watermark. Highest level will be set to high later.*/ 1235 /* default set to low watermark. Highest level will be set to high later.*/
1237 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; 1236 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW;
1238 1237
1239 cgs_get_active_displays_info(hwmgr->device, &info); 1238 data->display_timing.num_existing_displays = hwmgr->display_config->num_display;
1240 data->display_timing.num_existing_displays = info.display_count;
1241 1239
1242 /* stutter mode not support on ci */ 1240 /* stutter mode not support on ci */
1243 1241
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index 1eec527add99..d023494c3eae 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -988,11 +988,11 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr,
988 988
989 threshold = clock * data->fast_watermark_threshold / 100; 989 threshold = clock * data->fast_watermark_threshold / 100;
990 990
991 data->display_timing.min_clock_in_sr = hwmgr->display_config.min_core_set_clock_in_sr; 991 data->display_timing.min_clock_in_sr = hwmgr->display_config->min_core_set_clock_in_sr;
992 992
993 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) 993 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep))
994 level->DeepSleepDivId = smu7_get_sleep_divider_id_from_clock(clock, 994 level->DeepSleepDivId = smu7_get_sleep_divider_id_from_clock(clock,
995 hwmgr->display_config.min_core_set_clock_in_sr); 995 hwmgr->display_config->min_core_set_clock_in_sr);
996 996
997 997
998 /* Default to slow, highest DPM level will be 998 /* Default to slow, highest DPM level will be
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
index d4bb934e7334..bc05e355012d 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
@@ -932,7 +932,7 @@ static int iceland_populate_single_graphic_level(struct pp_hwmgr *hwmgr,
932 graphic_level->PowerThrottle = 0; 932 graphic_level->PowerThrottle = 0;
933 933
934 data->display_timing.min_clock_in_sr = 934 data->display_timing.min_clock_in_sr =
935 hwmgr->display_config.min_core_set_clock_in_sr; 935 hwmgr->display_config->min_core_set_clock_in_sr;
936 936
937 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 937 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
938 PHM_PlatformCaps_SclkDeepSleep)) 938 PHM_PlatformCaps_SclkDeepSleep))
@@ -1236,7 +1236,6 @@ static int iceland_populate_single_memory_level(
1236 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 1236 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
1237 int result = 0; 1237 int result = 0;
1238 bool dll_state_on; 1238 bool dll_state_on;
1239 struct cgs_display_info info = {0};
1240 uint32_t mclk_edc_wr_enable_threshold = 40000; 1239 uint32_t mclk_edc_wr_enable_threshold = 40000;
1241 uint32_t mclk_edc_enable_threshold = 40000; 1240 uint32_t mclk_edc_enable_threshold = 40000;
1242 uint32_t mclk_strobe_mode_threshold = 40000; 1241 uint32_t mclk_strobe_mode_threshold = 40000;
@@ -1283,8 +1282,7 @@ static int iceland_populate_single_memory_level(
1283 /* default set to low watermark. Highest level will be set to high later.*/ 1282 /* default set to low watermark. Highest level will be set to high later.*/
1284 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; 1283 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW;
1285 1284
1286 cgs_get_active_displays_info(hwmgr->device, &info); 1285 data->display_timing.num_existing_displays = hwmgr->display_config->num_display;
1287 data->display_timing.num_existing_displays = info.display_count;
1288 1286
1289 /* stutter mode not support on iceland */ 1287 /* stutter mode not support on iceland */
1290 1288
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index 05e60e8fee0b..d9192286099d 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -942,11 +942,11 @@ static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr,
942 level->DownHyst = data->current_profile_setting.sclk_down_hyst; 942 level->DownHyst = data->current_profile_setting.sclk_down_hyst;
943 level->VoltageDownHyst = 0; 943 level->VoltageDownHyst = 0;
944 level->PowerThrottle = 0; 944 level->PowerThrottle = 0;
945 data->display_timing.min_clock_in_sr = hwmgr->display_config.min_core_set_clock_in_sr; 945 data->display_timing.min_clock_in_sr = hwmgr->display_config->min_core_set_clock_in_sr;
946 946
947 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) 947 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep))
948 level->DeepSleepDivId = smu7_get_sleep_divider_id_from_clock(clock, 948 level->DeepSleepDivId = smu7_get_sleep_divider_id_from_clock(clock,
949 hwmgr->display_config.min_core_set_clock_in_sr); 949 hwmgr->display_config->min_core_set_clock_in_sr);
950 950
951 /* Default to slow, highest DPM level will be 951 /* Default to slow, highest DPM level will be
952 * set to PPSMC_DISPLAY_WATERMARK_LOW later. 952 * set to PPSMC_DISPLAY_WATERMARK_LOW later.
@@ -1076,11 +1076,9 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr,
1076 struct phm_ppt_v1_information *table_info = 1076 struct phm_ppt_v1_information *table_info =
1077 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1077 (struct phm_ppt_v1_information *)(hwmgr->pptable);
1078 int result = 0; 1078 int result = 0;
1079 struct cgs_display_info info = {0, 0, NULL};
1080 uint32_t mclk_stutter_mode_threshold = 40000; 1079 uint32_t mclk_stutter_mode_threshold = 40000;
1081 phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; 1080 phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL;
1082 1081
1083 cgs_get_active_displays_info(hwmgr->device, &info);
1084 1082
1085 if (hwmgr->od_enabled) 1083 if (hwmgr->od_enabled)
1086 vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_mclk; 1084 vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_mclk;
@@ -1106,7 +1104,7 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr,
1106 mem_level->StutterEnable = false; 1104 mem_level->StutterEnable = false;
1107 mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; 1105 mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW;
1108 1106
1109 data->display_timing.num_existing_displays = info.display_count; 1107 data->display_timing.num_existing_displays = hwmgr->display_config->num_display;
1110 1108
1111 if (mclk_stutter_mode_threshold && 1109 if (mclk_stutter_mode_threshold &&
1112 (clock <= mclk_stutter_mode_threshold) && 1110 (clock <= mclk_stutter_mode_threshold) &&
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
index 2ba05d2b4302..94ba304ff52e 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
@@ -650,7 +650,7 @@ static int tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr,
650 graphic_level->PowerThrottle = 0; 650 graphic_level->PowerThrottle = 0;
651 651
652 data->display_timing.min_clock_in_sr = 652 data->display_timing.min_clock_in_sr =
653 hwmgr->display_config.min_core_set_clock_in_sr; 653 hwmgr->display_config->min_core_set_clock_in_sr;
654 654
655 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, 655 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
656 PHM_PlatformCaps_SclkDeepSleep)) 656 PHM_PlatformCaps_SclkDeepSleep))
@@ -956,18 +956,17 @@ static int tonga_populate_single_memory_level(
956 SMU72_Discrete_MemoryLevel *memory_level 956 SMU72_Discrete_MemoryLevel *memory_level
957 ) 957 )
958{ 958{
959 uint32_t mvdd = 0;
960 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 959 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
961 struct phm_ppt_v1_information *pptable_info = 960 struct phm_ppt_v1_information *pptable_info =
962 (struct phm_ppt_v1_information *)(hwmgr->pptable); 961 (struct phm_ppt_v1_information *)(hwmgr->pptable);
963 int result = 0;
964 bool dll_state_on;
965 struct cgs_display_info info = {0};
966 uint32_t mclk_edc_wr_enable_threshold = 40000; 962 uint32_t mclk_edc_wr_enable_threshold = 40000;
967 uint32_t mclk_stutter_mode_threshold = 30000; 963 uint32_t mclk_stutter_mode_threshold = 30000;
968 uint32_t mclk_edc_enable_threshold = 40000; 964 uint32_t mclk_edc_enable_threshold = 40000;
969 uint32_t mclk_strobe_mode_threshold = 40000; 965 uint32_t mclk_strobe_mode_threshold = 40000;
970 phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; 966 phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL;
967 int result = 0;
968 bool dll_state_on;
969 uint32_t mvdd = 0;
971 970
972 if (hwmgr->od_enabled) 971 if (hwmgr->od_enabled)
973 vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_mclk; 972 vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_mclk;
@@ -1008,8 +1007,7 @@ static int tonga_populate_single_memory_level(
1008 /* default set to low watermark. Highest level will be set to high later.*/ 1007 /* default set to low watermark. Highest level will be set to high later.*/
1009 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; 1008 memory_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW;
1010 1009
1011 cgs_get_active_displays_info(hwmgr->device, &info); 1010 data->display_timing.num_existing_displays = hwmgr->display_config->num_display;
1012 data->display_timing.num_existing_displays = info.display_count;
1013 1011
1014 if ((mclk_stutter_mode_threshold != 0) && 1012 if ((mclk_stutter_mode_threshold != 0) &&
1015 (memory_clock <= mclk_stutter_mode_threshold) && 1013 (memory_clock <= mclk_stutter_mode_threshold) &&