diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-01-02 02:20:55 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:18:20 -0500 |
commit | 3c9d1fde7f63b6f7f30e9a5366fbc2fe249e0b74 (patch) | |
tree | 022392e8d9914d7b2485ce878f0cf5d5fa17b283 /drivers/gpu | |
parent | 49fd66e5d50477c7c54df4a2006c5ccb125420fd (diff) |
drm/amd/pp: Add update_avfs call when set_power_state
when Overdrive voltage, need to disable AVFS.
when OverDriv engine clock, need to recalculate
AVFS voltage by disable/enable avfs feature.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 85 |
1 files changed, 57 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index cab1cf4fd4f2..54f569c8e31a 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -91,7 +91,6 @@ enum DPM_EVENT_SRC { | |||
91 | DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4 | 91 | DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4 |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable); | ||
95 | static const unsigned long PhwVIslands_Magic = (unsigned long)(PHM_VIslands_Magic); | 94 | static const unsigned long PhwVIslands_Magic = (unsigned long)(PHM_VIslands_Magic); |
96 | static int smu7_force_clock_level(struct pp_hwmgr *hwmgr, | 95 | static int smu7_force_clock_level(struct pp_hwmgr *hwmgr, |
97 | enum pp_clock_type type, uint32_t mask); | 96 | enum pp_clock_type type, uint32_t mask); |
@@ -1351,6 +1350,58 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr) | |||
1351 | return 0; | 1350 | return 0; |
1352 | } | 1351 | } |
1353 | 1352 | ||
1353 | static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable) | ||
1354 | { | ||
1355 | struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend); | ||
1356 | |||
1357 | if (smu_data == NULL) | ||
1358 | return -EINVAL; | ||
1359 | |||
1360 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) | ||
1361 | return 0; | ||
1362 | |||
1363 | if (enable) { | ||
1364 | if (!PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, | ||
1365 | CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) { | ||
1366 | PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc( | ||
1367 | hwmgr, PPSMC_MSG_EnableAvfs), | ||
1368 | "Failed to enable AVFS!", | ||
1369 | return -EINVAL); | ||
1370 | } | ||
1371 | } else if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, | ||
1372 | CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) { | ||
1373 | PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc( | ||
1374 | hwmgr, PPSMC_MSG_DisableAvfs), | ||
1375 | "Failed to disable AVFS!", | ||
1376 | return -EINVAL); | ||
1377 | } | ||
1378 | |||
1379 | return 0; | ||
1380 | } | ||
1381 | |||
1382 | static int smu7_update_avfs(struct pp_hwmgr *hwmgr) | ||
1383 | { | ||
1384 | struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend); | ||
1385 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | ||
1386 | |||
1387 | if (smu_data == NULL) | ||
1388 | return -EINVAL; | ||
1389 | |||
1390 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) | ||
1391 | return 0; | ||
1392 | |||
1393 | if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_VDDC) { | ||
1394 | smu7_avfs_control(hwmgr, false); | ||
1395 | } else if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_SCLK) { | ||
1396 | smu7_avfs_control(hwmgr, false); | ||
1397 | smu7_avfs_control(hwmgr, true); | ||
1398 | } else { | ||
1399 | smu7_avfs_control(hwmgr, true); | ||
1400 | } | ||
1401 | |||
1402 | return 0; | ||
1403 | } | ||
1404 | |||
1354 | int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr) | 1405 | int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr) |
1355 | { | 1406 | { |
1356 | int tmp_result, result = 0; | 1407 | int tmp_result, result = 0; |
@@ -3842,6 +3893,11 @@ static int smu7_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input) | |||
3842 | "Failed to populate and upload SCLK MCLK DPM levels!", | 3893 | "Failed to populate and upload SCLK MCLK DPM levels!", |
3843 | result = tmp_result); | 3894 | result = tmp_result); |
3844 | 3895 | ||
3896 | tmp_result = smu7_update_avfs(hwmgr); | ||
3897 | PP_ASSERT_WITH_CODE((0 == tmp_result), | ||
3898 | "Failed to update avfs voltages!", | ||
3899 | result = tmp_result); | ||
3900 | |||
3845 | tmp_result = smu7_generate_dpm_level_enable_mask(hwmgr, input); | 3901 | tmp_result = smu7_generate_dpm_level_enable_mask(hwmgr, input); |
3846 | PP_ASSERT_WITH_CODE((0 == tmp_result), | 3902 | PP_ASSERT_WITH_CODE((0 == tmp_result), |
3847 | "Failed to generate DPM level enabled mask!", | 3903 | "Failed to generate DPM level enabled mask!", |
@@ -4626,33 +4682,6 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr, | |||
4626 | return result; | 4682 | return result; |
4627 | } | 4683 | } |
4628 | 4684 | ||
4629 | static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable) | ||
4630 | { | ||
4631 | struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend); | ||
4632 | |||
4633 | if (smu_data == NULL) | ||
4634 | return -EINVAL; | ||
4635 | |||
4636 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) | ||
4637 | return 0; | ||
4638 | |||
4639 | if (enable) { | ||
4640 | if (!PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, | ||
4641 | CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) | ||
4642 | PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc( | ||
4643 | hwmgr, PPSMC_MSG_EnableAvfs), | ||
4644 | "Failed to enable AVFS!", | ||
4645 | return -EINVAL); | ||
4646 | } else if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, | ||
4647 | CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) | ||
4648 | PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc( | ||
4649 | hwmgr, PPSMC_MSG_DisableAvfs), | ||
4650 | "Failed to disable AVFS!", | ||
4651 | return -EINVAL); | ||
4652 | |||
4653 | return 0; | ||
4654 | } | ||
4655 | |||
4656 | static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, | 4685 | static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, |
4657 | uint32_t virtual_addr_low, | 4686 | uint32_t virtual_addr_low, |
4658 | uint32_t virtual_addr_hi, | 4687 | uint32_t virtual_addr_hi, |