aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2017-08-02 06:37:44 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-08-15 14:46:09 -0400
commit3d4d4fd095fd91da6c9aa0301f5e553409a9e3a0 (patch)
tree12e84cc9992c470d2510b29a3c211522b2f753cb
parentb2ce723cd1b818936e584e30455afbb02666f1b3 (diff)
drm/amd/powerplay: fix set highest mclk level failed on Vega10
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>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 01ff5054041b..979cc5cc6291 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -3701,10 +3701,22 @@ static void vega10_apply_dal_minimum_voltage_request(
3701 return; 3701 return;
3702} 3702}
3703 3703
3704static int vega10_get_soc_index_for_max_uclk(struct pp_hwmgr *hwmgr)
3705{
3706 struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table_on_mclk;
3707 struct phm_ppt_v2_information *table_info =
3708 (struct phm_ppt_v2_information *)(hwmgr->pptable);
3709
3710 vdd_dep_table_on_mclk = table_info->vdd_dep_on_mclk;
3711
3712 return vdd_dep_table_on_mclk->entries[NUM_UCLK_DPM_LEVELS - 1].vddInd + 1;
3713}
3714
3704static int vega10_upload_dpm_bootup_level(struct pp_hwmgr *hwmgr) 3715static int vega10_upload_dpm_bootup_level(struct pp_hwmgr *hwmgr)
3705{ 3716{
3706 struct vega10_hwmgr *data = 3717 struct vega10_hwmgr *data =
3707 (struct vega10_hwmgr *)(hwmgr->backend); 3718 (struct vega10_hwmgr *)(hwmgr->backend);
3719 uint32_t socclk_idx;
3708 3720
3709 vega10_apply_dal_minimum_voltage_request(hwmgr); 3721 vega10_apply_dal_minimum_voltage_request(hwmgr);
3710 3722
@@ -3725,13 +3737,22 @@ static int vega10_upload_dpm_bootup_level(struct pp_hwmgr *hwmgr)
3725 if (!data->registry_data.mclk_dpm_key_disabled) { 3737 if (!data->registry_data.mclk_dpm_key_disabled) {
3726 if (data->smc_state_table.mem_boot_level != 3738 if (data->smc_state_table.mem_boot_level !=
3727 data->dpm_table.mem_table.dpm_state.soft_min_level) { 3739 data->dpm_table.mem_table.dpm_state.soft_min_level) {
3740 if (data->smc_state_table.mem_boot_level == NUM_UCLK_DPM_LEVELS - 1) {
3741 socclk_idx = vega10_get_soc_index_for_max_uclk(hwmgr);
3728 PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc_with_parameter( 3742 PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc_with_parameter(
3729 hwmgr->smumgr, 3743 hwmgr->smumgr,
3730 PPSMC_MSG_SetSoftMinUclkByIndex, 3744 PPSMC_MSG_SetSoftMinSocclkByIndex,
3731 data->smc_state_table.mem_boot_level), 3745 socclk_idx),
3732 "Failed to set soft min mclk index!", 3746 "Failed to set soft min uclk index!",
3733 return -EINVAL); 3747 return -EINVAL);
3734 3748 } else {
3749 PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc_with_parameter(
3750 hwmgr->smumgr,
3751 PPSMC_MSG_SetSoftMinUclkByIndex,
3752 data->smc_state_table.mem_boot_level),
3753 "Failed to set soft min uclk index!",
3754 return -EINVAL);
3755 }
3735 data->dpm_table.mem_table.dpm_state.soft_min_level = 3756 data->dpm_table.mem_table.dpm_state.soft_min_level =
3736 data->smc_state_table.mem_boot_level; 3757 data->smc_state_table.mem_boot_level;
3737 } 3758 }