diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-01-17 03:49:29 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:18:19 -0500 |
commit | 49fd66e5d50477c7c54df4a2006c5ccb125420fd (patch) | |
tree | 7d00159717fb1325d295c4ef3ba9b50932f031b8 /drivers/gpu | |
parent | 5e4d4fbea55730362c2e6a68360a7444cb765c46 (diff) |
drm/amd/pp: Update smu7 dpm table with OD clock/voltage
Delete old OD type code path when populate clk.
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 | 124 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c | 18 |
4 files changed, 71 insertions, 107 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 3ed4b4acf90b..cab1cf4fd4f2 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -3482,8 +3482,6 @@ static int smu7_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, cons | |||
3482 | uint32_t i; | 3482 | uint32_t i; |
3483 | struct cgs_display_info info = {0}; | 3483 | struct cgs_display_info info = {0}; |
3484 | 3484 | ||
3485 | data->need_update_smu7_dpm_table = 0; | ||
3486 | |||
3487 | for (i = 0; i < sclk_table->count; i++) { | 3485 | for (i = 0; i < sclk_table->count; i++) { |
3488 | if (sclk == sclk_table->dpm_levels[i].value) | 3486 | if (sclk == sclk_table->dpm_levels[i].value) |
3489 | break; | 3487 | break; |
@@ -3625,106 +3623,27 @@ static int smu7_populate_and_upload_sclk_mclk_dpm_levels( | |||
3625 | struct pp_hwmgr *hwmgr, const void *input) | 3623 | struct pp_hwmgr *hwmgr, const void *input) |
3626 | { | 3624 | { |
3627 | int result = 0; | 3625 | int result = 0; |
3628 | const struct phm_set_power_state_input *states = | ||
3629 | (const struct phm_set_power_state_input *)input; | ||
3630 | const struct smu7_power_state *smu7_ps = | ||
3631 | cast_const_phw_smu7_power_state(states->pnew_state); | ||
3632 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 3626 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
3633 | uint32_t sclk = smu7_ps->performance_levels | ||
3634 | [smu7_ps->performance_level_count - 1].engine_clock; | ||
3635 | uint32_t mclk = smu7_ps->performance_levels | ||
3636 | [smu7_ps->performance_level_count - 1].memory_clock; | ||
3637 | struct smu7_dpm_table *dpm_table = &data->dpm_table; | 3627 | struct smu7_dpm_table *dpm_table = &data->dpm_table; |
3638 | 3628 | uint32_t count; | |
3639 | struct smu7_dpm_table *golden_dpm_table = &data->golden_dpm_table; | 3629 | struct smu7_odn_dpm_table *odn_table = &(data->odn_dpm_table); |
3640 | uint32_t dpm_count, clock_percent; | 3630 | struct phm_odn_clock_levels *odn_sclk_table = &(odn_table->odn_core_clock_dpm_levels); |
3641 | uint32_t i; | 3631 | struct phm_odn_clock_levels *odn_mclk_table = &(odn_table->odn_memory_clock_dpm_levels); |
3642 | 3632 | ||
3643 | if (0 == data->need_update_smu7_dpm_table) | 3633 | if (0 == data->need_update_smu7_dpm_table) |
3644 | return 0; | 3634 | return 0; |
3645 | 3635 | ||
3646 | if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_SCLK) { | 3636 | if (hwmgr->od_enabled && data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_SCLK) { |
3647 | dpm_table->sclk_table.dpm_levels | 3637 | for (count = 0; count < dpm_table->sclk_table.count; count++) { |
3648 | [dpm_table->sclk_table.count - 1].value = sclk; | 3638 | dpm_table->sclk_table.dpm_levels[count].enabled = odn_sclk_table->entries[count].enabled; |
3649 | 3639 | dpm_table->sclk_table.dpm_levels[count].value = odn_sclk_table->entries[count].clock; | |
3650 | if (hwmgr->od_enabled) { | ||
3651 | /* Need to do calculation based on the golden DPM table | ||
3652 | * as the Heatmap GPU Clock axis is also based on the default values | ||
3653 | */ | ||
3654 | PP_ASSERT_WITH_CODE( | ||
3655 | (golden_dpm_table->sclk_table.dpm_levels | ||
3656 | [golden_dpm_table->sclk_table.count - 1].value != 0), | ||
3657 | "Divide by 0!", | ||
3658 | return -EINVAL); | ||
3659 | dpm_count = dpm_table->sclk_table.count < 2 ? 0 : dpm_table->sclk_table.count - 2; | ||
3660 | |||
3661 | for (i = dpm_count; i > 1; i--) { | ||
3662 | if (sclk > golden_dpm_table->sclk_table.dpm_levels[golden_dpm_table->sclk_table.count-1].value) { | ||
3663 | clock_percent = | ||
3664 | ((sclk | ||
3665 | - golden_dpm_table->sclk_table.dpm_levels[golden_dpm_table->sclk_table.count-1].value | ||
3666 | ) * 100) | ||
3667 | / golden_dpm_table->sclk_table.dpm_levels[golden_dpm_table->sclk_table.count-1].value; | ||
3668 | |||
3669 | dpm_table->sclk_table.dpm_levels[i].value = | ||
3670 | golden_dpm_table->sclk_table.dpm_levels[i].value + | ||
3671 | (golden_dpm_table->sclk_table.dpm_levels[i].value * | ||
3672 | clock_percent)/100; | ||
3673 | |||
3674 | } else if (golden_dpm_table->sclk_table.dpm_levels[dpm_table->sclk_table.count-1].value > sclk) { | ||
3675 | clock_percent = | ||
3676 | ((golden_dpm_table->sclk_table.dpm_levels[golden_dpm_table->sclk_table.count - 1].value | ||
3677 | - sclk) * 100) | ||
3678 | / golden_dpm_table->sclk_table.dpm_levels[golden_dpm_table->sclk_table.count-1].value; | ||
3679 | |||
3680 | dpm_table->sclk_table.dpm_levels[i].value = | ||
3681 | golden_dpm_table->sclk_table.dpm_levels[i].value - | ||
3682 | (golden_dpm_table->sclk_table.dpm_levels[i].value * | ||
3683 | clock_percent) / 100; | ||
3684 | } else | ||
3685 | dpm_table->sclk_table.dpm_levels[i].value = | ||
3686 | golden_dpm_table->sclk_table.dpm_levels[i].value; | ||
3687 | } | ||
3688 | } | 3640 | } |
3689 | } | 3641 | } |
3690 | 3642 | ||
3691 | if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK) { | 3643 | if (hwmgr->od_enabled && data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK) { |
3692 | dpm_table->mclk_table.dpm_levels | 3644 | for (count = 0; count < dpm_table->mclk_table.count; count++) { |
3693 | [dpm_table->mclk_table.count - 1].value = mclk; | 3645 | dpm_table->mclk_table.dpm_levels[count].enabled = odn_mclk_table->entries[count].enabled; |
3694 | 3646 | dpm_table->mclk_table.dpm_levels[count].value = odn_mclk_table->entries[count].clock; | |
3695 | if (hwmgr->od_enabled) { | ||
3696 | |||
3697 | PP_ASSERT_WITH_CODE( | ||
3698 | (golden_dpm_table->mclk_table.dpm_levels | ||
3699 | [golden_dpm_table->mclk_table.count-1].value != 0), | ||
3700 | "Divide by 0!", | ||
3701 | return -EINVAL); | ||
3702 | dpm_count = dpm_table->mclk_table.count < 2 ? 0 : dpm_table->mclk_table.count - 2; | ||
3703 | for (i = dpm_count; i > 1; i--) { | ||
3704 | if (golden_dpm_table->mclk_table.dpm_levels[golden_dpm_table->mclk_table.count-1].value < mclk) { | ||
3705 | clock_percent = ((mclk - | ||
3706 | golden_dpm_table->mclk_table.dpm_levels[golden_dpm_table->mclk_table.count-1].value) * 100) | ||
3707 | / golden_dpm_table->mclk_table.dpm_levels[golden_dpm_table->mclk_table.count-1].value; | ||
3708 | |||
3709 | dpm_table->mclk_table.dpm_levels[i].value = | ||
3710 | golden_dpm_table->mclk_table.dpm_levels[i].value + | ||
3711 | (golden_dpm_table->mclk_table.dpm_levels[i].value * | ||
3712 | clock_percent) / 100; | ||
3713 | |||
3714 | } else if (golden_dpm_table->mclk_table.dpm_levels[dpm_table->mclk_table.count-1].value > mclk) { | ||
3715 | clock_percent = ( | ||
3716 | (golden_dpm_table->mclk_table.dpm_levels[golden_dpm_table->mclk_table.count-1].value - mclk) | ||
3717 | * 100) | ||
3718 | / golden_dpm_table->mclk_table.dpm_levels[golden_dpm_table->mclk_table.count-1].value; | ||
3719 | |||
3720 | dpm_table->mclk_table.dpm_levels[i].value = | ||
3721 | golden_dpm_table->mclk_table.dpm_levels[i].value - | ||
3722 | (golden_dpm_table->mclk_table.dpm_levels[i].value * | ||
3723 | clock_percent) / 100; | ||
3724 | } else | ||
3725 | dpm_table->mclk_table.dpm_levels[i].value = | ||
3726 | golden_dpm_table->mclk_table.dpm_levels[i].value; | ||
3727 | } | ||
3728 | } | 3647 | } |
3729 | } | 3648 | } |
3730 | 3649 | ||
@@ -3846,7 +3765,7 @@ static int smu7_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) | |||
3846 | return -EINVAL); | 3765 | return -EINVAL); |
3847 | } | 3766 | } |
3848 | 3767 | ||
3849 | data->need_update_smu7_dpm_table = 0; | 3768 | data->need_update_smu7_dpm_table &= DPMTABLE_OD_UPDATE_VDDC; |
3850 | 3769 | ||
3851 | return 0; | 3770 | return 0; |
3852 | } | 3771 | } |
@@ -4114,6 +4033,7 @@ static int smu7_check_states_equal(struct pp_hwmgr *hwmgr, | |||
4114 | const struct smu7_power_state *psa; | 4033 | const struct smu7_power_state *psa; |
4115 | const struct smu7_power_state *psb; | 4034 | const struct smu7_power_state *psb; |
4116 | int i; | 4035 | int i; |
4036 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | ||
4117 | 4037 | ||
4118 | if (pstate1 == NULL || pstate2 == NULL || equal == NULL) | 4038 | if (pstate1 == NULL || pstate2 == NULL || equal == NULL) |
4119 | return -EINVAL; | 4039 | return -EINVAL; |
@@ -4138,6 +4058,10 @@ static int smu7_check_states_equal(struct pp_hwmgr *hwmgr, | |||
4138 | *equal = ((psa->uvd_clks.vclk == psb->uvd_clks.vclk) && (psa->uvd_clks.dclk == psb->uvd_clks.dclk)); | 4058 | *equal = ((psa->uvd_clks.vclk == psb->uvd_clks.vclk) && (psa->uvd_clks.dclk == psb->uvd_clks.dclk)); |
4139 | *equal &= ((psa->vce_clks.evclk == psb->vce_clks.evclk) && (psa->vce_clks.ecclk == psb->vce_clks.ecclk)); | 4059 | *equal &= ((psa->vce_clks.evclk == psb->vce_clks.evclk) && (psa->vce_clks.ecclk == psb->vce_clks.ecclk)); |
4140 | *equal &= (psa->sclk_threshold == psb->sclk_threshold); | 4060 | *equal &= (psa->sclk_threshold == psb->sclk_threshold); |
4061 | /* For OD call, set value based on flag */ | ||
4062 | *equal &= !(data->need_update_smu7_dpm_table & (DPMTABLE_OD_UPDATE_SCLK | | ||
4063 | DPMTABLE_OD_UPDATE_MCLK | | ||
4064 | DPMTABLE_OD_UPDATE_VDDC)); | ||
4141 | 4065 | ||
4142 | return 0; | 4066 | return 0; |
4143 | } | 4067 | } |
@@ -4887,21 +4811,25 @@ static void smu7_check_dpm_table_updated(struct pp_hwmgr *hwmgr) | |||
4887 | dep_table = table_info->vdd_dep_on_mclk; | 4811 | dep_table = table_info->vdd_dep_on_mclk; |
4888 | odn_dep_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)&(odn_table->vdd_dependency_on_mclk); | 4812 | odn_dep_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)&(odn_table->vdd_dependency_on_mclk); |
4889 | 4813 | ||
4890 | for (i=0; i<dep_table->count; i++) { | 4814 | for (i=0; i < dep_table->count; i++) { |
4891 | if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) { | 4815 | if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) { |
4892 | data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC; | 4816 | data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC; |
4893 | return; | 4817 | break; |
4894 | } | 4818 | } |
4895 | } | 4819 | } |
4820 | if (i == dep_table->count) | ||
4821 | data->need_update_smu7_dpm_table &= ~DPMTABLE_OD_UPDATE_VDDC; | ||
4896 | 4822 | ||
4897 | dep_table = table_info->vdd_dep_on_sclk; | 4823 | dep_table = table_info->vdd_dep_on_sclk; |
4898 | odn_dep_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)&(odn_table->vdd_dependency_on_sclk); | 4824 | odn_dep_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)&(odn_table->vdd_dependency_on_sclk); |
4899 | for (i=0; i<dep_table->count; i++) { | 4825 | for (i=0; i < dep_table->count; i++) { |
4900 | if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) { | 4826 | if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) { |
4901 | data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC; | 4827 | data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC; |
4902 | return; | 4828 | break; |
4903 | } | 4829 | } |
4904 | } | 4830 | } |
4831 | if (i == dep_table->count) | ||
4832 | data->need_update_smu7_dpm_table &= ~DPMTABLE_OD_UPDATE_VDDC; | ||
4905 | } | 4833 | } |
4906 | 4834 | ||
4907 | static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, | 4835 | static int smu7_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c index 7d9e2cbd3866..73c6020bab76 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | |||
@@ -981,12 +981,18 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
981 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 981 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
982 | struct phm_ppt_v1_information *table_info = | 982 | struct phm_ppt_v1_information *table_info = |
983 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 983 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
984 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
984 | 985 | ||
985 | result = fiji_calculate_sclk_params(hwmgr, clock, level); | 986 | result = fiji_calculate_sclk_params(hwmgr, clock, level); |
986 | 987 | ||
988 | if (hwmgr->od_enabled) | ||
989 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
990 | else | ||
991 | vdd_dep_table = table_info->vdd_dep_on_sclk; | ||
992 | |||
987 | /* populate graphics levels */ | 993 | /* populate graphics levels */ |
988 | result = fiji_get_dependency_volt_by_clk(hwmgr, | 994 | result = fiji_get_dependency_volt_by_clk(hwmgr, |
989 | table_info->vdd_dep_on_sclk, clock, | 995 | vdd_dep_table, clock, |
990 | (uint32_t *)(&level->MinVoltage), &mvdd); | 996 | (uint32_t *)(&level->MinVoltage), &mvdd); |
991 | PP_ASSERT_WITH_CODE((0 == result), | 997 | PP_ASSERT_WITH_CODE((0 == result), |
992 | "can not find VDDC voltage value for " | 998 | "can not find VDDC voltage value for " |
@@ -1202,10 +1208,16 @@ static int fiji_populate_single_memory_level(struct pp_hwmgr *hwmgr, | |||
1202 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 1208 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
1203 | int result = 0; | 1209 | int result = 0; |
1204 | uint32_t mclk_stutter_mode_threshold = 60000; | 1210 | uint32_t mclk_stutter_mode_threshold = 60000; |
1211 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
1212 | |||
1213 | if (hwmgr->od_enabled) | ||
1214 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
1215 | else | ||
1216 | vdd_dep_table = table_info->vdd_dep_on_mclk; | ||
1205 | 1217 | ||
1206 | if (table_info->vdd_dep_on_mclk) { | 1218 | if (vdd_dep_table) { |
1207 | result = fiji_get_dependency_volt_by_clk(hwmgr, | 1219 | result = fiji_get_dependency_volt_by_clk(hwmgr, |
1208 | table_info->vdd_dep_on_mclk, clock, | 1220 | vdd_dep_table, clock, |
1209 | (uint32_t *)(&mem_level->MinVoltage), &mem_level->MinMvdd); | 1221 | (uint32_t *)(&mem_level->MinVoltage), &mem_level->MinMvdd); |
1210 | PP_ASSERT_WITH_CODE((0 == result), | 1222 | PP_ASSERT_WITH_CODE((0 == result), |
1211 | "can not find MinVddc voltage value from memory " | 1223 | "can not find MinVddc voltage value from memory " |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c index f1a3bc885703..a760a82ebc15 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | |||
@@ -948,12 +948,18 @@ static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
948 | struct phm_ppt_v1_information *table_info = | 948 | struct phm_ppt_v1_information *table_info = |
949 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 949 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
950 | SMU_SclkSetting curr_sclk_setting = { 0 }; | 950 | SMU_SclkSetting curr_sclk_setting = { 0 }; |
951 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
951 | 952 | ||
952 | result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting); | 953 | result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting); |
953 | 954 | ||
955 | if (hwmgr->od_enabled) | ||
956 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
957 | else | ||
958 | vdd_dep_table = table_info->vdd_dep_on_sclk; | ||
959 | |||
954 | /* populate graphics levels */ | 960 | /* populate graphics levels */ |
955 | result = polaris10_get_dependency_volt_by_clk(hwmgr, | 961 | result = polaris10_get_dependency_volt_by_clk(hwmgr, |
956 | table_info->vdd_dep_on_sclk, clock, | 962 | vdd_dep_table, clock, |
957 | &level->MinVoltage, &mvdd); | 963 | &level->MinVoltage, &mvdd); |
958 | 964 | ||
959 | PP_ASSERT_WITH_CODE((0 == result), | 965 | PP_ASSERT_WITH_CODE((0 == result), |
@@ -1107,12 +1113,18 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, | |||
1107 | int result = 0; | 1113 | int result = 0; |
1108 | struct cgs_display_info info = {0, 0, NULL}; | 1114 | struct cgs_display_info info = {0, 0, NULL}; |
1109 | uint32_t mclk_stutter_mode_threshold = 40000; | 1115 | uint32_t mclk_stutter_mode_threshold = 40000; |
1116 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
1110 | 1117 | ||
1111 | cgs_get_active_displays_info(hwmgr->device, &info); | 1118 | cgs_get_active_displays_info(hwmgr->device, &info); |
1112 | 1119 | ||
1113 | if (table_info->vdd_dep_on_mclk) { | 1120 | if (hwmgr->od_enabled) |
1121 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
1122 | else | ||
1123 | vdd_dep_table = table_info->vdd_dep_on_mclk; | ||
1124 | |||
1125 | if (vdd_dep_table) { | ||
1114 | result = polaris10_get_dependency_volt_by_clk(hwmgr, | 1126 | result = polaris10_get_dependency_volt_by_clk(hwmgr, |
1115 | table_info->vdd_dep_on_mclk, clock, | 1127 | vdd_dep_table, clock, |
1116 | &mem_level->MinVoltage, &mem_level->MinMvdd); | 1128 | &mem_level->MinVoltage, &mem_level->MinMvdd); |
1117 | PP_ASSERT_WITH_CODE((0 == result), | 1129 | PP_ASSERT_WITH_CODE((0 == result), |
1118 | "can not find MinVddc voltage value from memory " | 1130 | "can not find MinVddc voltage value from memory " |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c index a03a34511cab..4b3fd04780d5 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c | |||
@@ -620,12 +620,18 @@ static int tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
620 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 620 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
621 | struct phm_ppt_v1_information *pptable_info = | 621 | struct phm_ppt_v1_information *pptable_info = |
622 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 622 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
623 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
623 | 624 | ||
624 | result = tonga_calculate_sclk_params(hwmgr, engine_clock, graphic_level); | 625 | result = tonga_calculate_sclk_params(hwmgr, engine_clock, graphic_level); |
625 | 626 | ||
627 | if (hwmgr->od_enabled) | ||
628 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
629 | else | ||
630 | vdd_dep_table = pptable_info->vdd_dep_on_sclk; | ||
631 | |||
626 | /* populate graphics levels*/ | 632 | /* populate graphics levels*/ |
627 | result = tonga_get_dependency_volt_by_clk(hwmgr, | 633 | result = tonga_get_dependency_volt_by_clk(hwmgr, |
628 | pptable_info->vdd_dep_on_sclk, engine_clock, | 634 | vdd_dep_table, engine_clock, |
629 | &graphic_level->MinVoltage, &mvdd); | 635 | &graphic_level->MinVoltage, &mvdd); |
630 | PP_ASSERT_WITH_CODE((!result), | 636 | PP_ASSERT_WITH_CODE((!result), |
631 | "can not find VDDC voltage value for VDDC " | 637 | "can not find VDDC voltage value for VDDC " |
@@ -966,10 +972,16 @@ static int tonga_populate_single_memory_level( | |||
966 | uint32_t mclk_stutter_mode_threshold = 30000; | 972 | uint32_t mclk_stutter_mode_threshold = 30000; |
967 | uint32_t mclk_edc_enable_threshold = 40000; | 973 | uint32_t mclk_edc_enable_threshold = 40000; |
968 | uint32_t mclk_strobe_mode_threshold = 40000; | 974 | uint32_t mclk_strobe_mode_threshold = 40000; |
975 | phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table = NULL; | ||
976 | |||
977 | if (hwmgr->od_enabled) | ||
978 | vdd_dep_table = (phm_ppt_v1_clock_voltage_dependency_table *)&data->odn_dpm_table.vdd_dependency_on_sclk; | ||
979 | else | ||
980 | vdd_dep_table = pptable_info->vdd_dep_on_mclk; | ||
969 | 981 | ||
970 | if (NULL != pptable_info->vdd_dep_on_mclk) { | 982 | if (NULL != vdd_dep_table) { |
971 | result = tonga_get_dependency_volt_by_clk(hwmgr, | 983 | result = tonga_get_dependency_volt_by_clk(hwmgr, |
972 | pptable_info->vdd_dep_on_mclk, | 984 | vdd_dep_table, |
973 | memory_clock, | 985 | memory_clock, |
974 | &memory_level->MinVoltage, &mvdd); | 986 | &memory_level->MinVoltage, &mvdd); |
975 | PP_ASSERT_WITH_CODE( | 987 | PP_ASSERT_WITH_CODE( |