diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2017-08-25 04:58:10 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-29 15:28:01 -0400 |
commit | 841e3be124b58c6e86fe288bce4dfe58d5574fd3 (patch) | |
tree | 4f9fe952a35d0bf9c3746b342196c2463825ac04 /drivers/gpu/drm/amd | |
parent | 3b4ca9e6494d19b152d1833fede533835e7b7c18 (diff) |
drm/amd/powerplay: notify smu once display changed on Rv.
when User turn off display or screen idle timeout,
smu need this message to start S0i2 entry.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 43 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 |
4 files changed, 43 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c index fcc722ea7649..967f50f54384 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | |||
@@ -323,6 +323,9 @@ int phm_check_states_equal(struct pp_hwmgr *hwmgr, | |||
323 | int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr, | 323 | int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr, |
324 | const struct amd_pp_display_configuration *display_config) | 324 | const struct amd_pp_display_configuration *display_config) |
325 | { | 325 | { |
326 | int index = 0; | ||
327 | int number_of_active_display = 0; | ||
328 | |||
326 | PHM_FUNC_CHECK(hwmgr); | 329 | PHM_FUNC_CHECK(hwmgr); |
327 | 330 | ||
328 | if (display_config == NULL) | 331 | if (display_config == NULL) |
@@ -330,6 +333,17 @@ int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr, | |||
330 | 333 | ||
331 | hwmgr->display_config = *display_config; | 334 | hwmgr->display_config = *display_config; |
332 | 335 | ||
336 | if (NULL != hwmgr->hwmgr_func->set_deep_sleep_dcefclk) | ||
337 | hwmgr->hwmgr_func->set_deep_sleep_dcefclk(hwmgr, hwmgr->display_config.min_dcef_deep_sleep_set_clk); | ||
338 | |||
339 | for (index = 0; index < hwmgr->display_config.num_path_including_non_display; index++) { | ||
340 | if (hwmgr->display_config.displays[index].controller_id != 0) | ||
341 | number_of_active_display++; | ||
342 | } | ||
343 | |||
344 | if (NULL != hwmgr->hwmgr_func->set_active_display_count) | ||
345 | hwmgr->hwmgr_func->set_active_display_count(hwmgr, number_of_active_display); | ||
346 | |||
333 | if (hwmgr->hwmgr_func->store_cc6_data == NULL) | 347 | if (hwmgr->hwmgr_func->store_cc6_data == NULL) |
334 | return -EINVAL; | 348 | return -EINVAL; |
335 | 349 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c index 3e443c11f47b..441a916ba3d6 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | |||
@@ -76,6 +76,9 @@ static int rv_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
76 | rv_hwmgr->is_nb_dpm_enabled = 1; | 76 | rv_hwmgr->is_nb_dpm_enabled = 1; |
77 | rv_hwmgr->dpm_flags = 1; | 77 | rv_hwmgr->dpm_flags = 1; |
78 | rv_hwmgr->gfx_off_controled_by_driver = false; | 78 | rv_hwmgr->gfx_off_controled_by_driver = false; |
79 | rv_hwmgr->need_min_deep_sleep_dcefclk = true; | ||
80 | rv_hwmgr->num_active_display = 0; | ||
81 | rv_hwmgr->deep_sleep_dcefclk = 0; | ||
79 | 82 | ||
80 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, | 83 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, |
81 | PHM_PlatformCaps_SclkDeepSleep); | 84 | PHM_PlatformCaps_SclkDeepSleep); |
@@ -162,21 +165,12 @@ static int rv_tf_set_clock_limit(struct pp_hwmgr *hwmgr, void *input, | |||
162 | struct pp_display_clock_request clock_req; | 165 | struct pp_display_clock_request clock_req; |
163 | 166 | ||
164 | clocks.dcefClock = hwmgr->display_config.min_dcef_set_clk; | 167 | clocks.dcefClock = hwmgr->display_config.min_dcef_set_clk; |
165 | clocks.dcefClockInSR = hwmgr->display_config.min_dcef_deep_sleep_set_clk; | ||
166 | clock_req.clock_type = amd_pp_dcf_clock; | 168 | clock_req.clock_type = amd_pp_dcf_clock; |
167 | clock_req.clock_freq_in_khz = clocks.dcefClock * 10; | 169 | clock_req.clock_freq_in_khz = clocks.dcefClock * 10; |
168 | 170 | ||
169 | if (clocks.dcefClock == 0 && clocks.dcefClockInSR == 0) | ||
170 | clock_req.clock_freq_in_khz = rv_data->dcf_actual_hard_min_freq; | ||
171 | |||
172 | PP_ASSERT_WITH_CODE(!rv_display_clock_voltage_request(hwmgr, &clock_req), | 171 | PP_ASSERT_WITH_CODE(!rv_display_clock_voltage_request(hwmgr, &clock_req), |
173 | "Attempt to set DCF Clock Failed!", return -EINVAL); | 172 | "Attempt to set DCF Clock Failed!", return -EINVAL); |
174 | 173 | ||
175 | if(rv_data->need_min_deep_sleep_dcefclk && 0 != clocks.dcefClockInSR) | ||
176 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | ||
177 | PPSMC_MSG_SetMinDeepSleepDcefclk, | ||
178 | clocks.dcefClockInSR / 100); | ||
179 | |||
180 | if (((hwmgr->uvd_arbiter.vclk_soft_min / 100) != rv_data->vclk_soft_min) || | 174 | if (((hwmgr->uvd_arbiter.vclk_soft_min / 100) != rv_data->vclk_soft_min) || |
181 | ((hwmgr->uvd_arbiter.dclk_soft_min / 100) != rv_data->dclk_soft_min)) { | 175 | ((hwmgr->uvd_arbiter.dclk_soft_min / 100) != rv_data->dclk_soft_min)) { |
182 | rv_data->vclk_soft_min = hwmgr->uvd_arbiter.vclk_soft_min / 100; | 176 | rv_data->vclk_soft_min = hwmgr->uvd_arbiter.vclk_soft_min / 100; |
@@ -213,26 +207,35 @@ static int rv_tf_set_clock_limit(struct pp_hwmgr *hwmgr, void *input, | |||
213 | return 0; | 207 | return 0; |
214 | } | 208 | } |
215 | 209 | ||
216 | 210 | static int rv_set_deep_sleep_dcefclk(struct pp_hwmgr *hwmgr, uint32_t clock) | |
217 | static int rv_tf_set_num_active_display(struct pp_hwmgr *hwmgr, void *input, | ||
218 | void *output, void *storage, int result) | ||
219 | { | 211 | { |
220 | uint32_t num_of_active_displays = 0; | 212 | struct rv_hwmgr *rv_data = (struct rv_hwmgr *)(hwmgr->backend); |
221 | struct cgs_display_info info = {0}; | ||
222 | 213 | ||
223 | cgs_get_active_displays_info(hwmgr->device, &info); | 214 | if (rv_data->need_min_deep_sleep_dcefclk && rv_data->deep_sleep_dcefclk != clock/100) { |
224 | num_of_active_displays = info.display_count; | 215 | rv_data->deep_sleep_dcefclk = clock/100; |
216 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | ||
217 | PPSMC_MSG_SetMinDeepSleepDcefclk, | ||
218 | rv_data->deep_sleep_dcefclk); | ||
219 | } | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static int rv_set_active_display_count(struct pp_hwmgr *hwmgr, uint32_t count) | ||
224 | { | ||
225 | struct rv_hwmgr *rv_data = (struct rv_hwmgr *)(hwmgr->backend); | ||
225 | 226 | ||
226 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | 227 | if (rv_data->num_active_display != count) { |
228 | rv_data->num_active_display = count; | ||
229 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | ||
227 | PPSMC_MSG_SetDisplayCount, | 230 | PPSMC_MSG_SetDisplayCount, |
228 | num_of_active_displays); | 231 | rv_data->num_active_display); |
232 | } | ||
229 | 233 | ||
230 | return 0; | 234 | return 0; |
231 | } | 235 | } |
232 | 236 | ||
233 | static const struct phm_master_table_item rv_set_power_state_list[] = { | 237 | static const struct phm_master_table_item rv_set_power_state_list[] = { |
234 | { NULL, rv_tf_set_clock_limit }, | 238 | { NULL, rv_tf_set_clock_limit }, |
235 | { NULL, rv_tf_set_num_active_display }, | ||
236 | { } | 239 | { } |
237 | }; | 240 | }; |
238 | 241 | ||
@@ -955,6 +958,8 @@ static const struct pp_hwmgr_func rv_hwmgr_funcs = { | |||
955 | .get_clock_by_type_with_voltage = rv_get_clock_by_type_with_voltage, | 958 | .get_clock_by_type_with_voltage = rv_get_clock_by_type_with_voltage, |
956 | .get_max_high_clocks = rv_get_max_high_clocks, | 959 | .get_max_high_clocks = rv_get_max_high_clocks, |
957 | .read_sensor = rv_read_sensor, | 960 | .read_sensor = rv_read_sensor, |
961 | .set_active_display_count = rv_set_active_display_count, | ||
962 | .set_deep_sleep_dcefclk = rv_set_deep_sleep_dcefclk, | ||
958 | }; | 963 | }; |
959 | 964 | ||
960 | int rv_init_function_pointers(struct pp_hwmgr *hwmgr) | 965 | int rv_init_function_pointers(struct pp_hwmgr *hwmgr) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.h index 2472b50e54cf..68d61bd95ca0 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.h | |||
@@ -293,7 +293,9 @@ struct rv_hwmgr { | |||
293 | DpmClocks_t clock_table; | 293 | DpmClocks_t clock_table; |
294 | 294 | ||
295 | uint32_t active_process_mask; | 295 | uint32_t active_process_mask; |
296 | bool need_min_deep_sleep_dcefclk; /* disabled by default */ | 296 | bool need_min_deep_sleep_dcefclk; |
297 | uint32_t deep_sleep_dcefclk; | ||
298 | uint32_t num_active_display; | ||
297 | }; | 299 | }; |
298 | 300 | ||
299 | struct pp_hwmgr; | 301 | struct pp_hwmgr; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 91b0105e8240..b1a6372608de 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | |||
@@ -378,6 +378,8 @@ struct pp_hwmgr_func { | |||
378 | struct amd_pp_profile *request); | 378 | struct amd_pp_profile *request); |
379 | int (*avfs_control)(struct pp_hwmgr *hwmgr, bool enable); | 379 | int (*avfs_control)(struct pp_hwmgr *hwmgr, bool enable); |
380 | int (*disable_smc_firmware_ctf)(struct pp_hwmgr *hwmgr); | 380 | int (*disable_smc_firmware_ctf)(struct pp_hwmgr *hwmgr); |
381 | int (*set_active_display_count)(struct pp_hwmgr *hwmgr, uint32_t count); | ||
382 | int (*set_deep_sleep_dcefclk)(struct pp_hwmgr *hwmgr, uint32_t clock); | ||
381 | }; | 383 | }; |
382 | 384 | ||
383 | struct pp_table_func { | 385 | struct pp_table_func { |