Commit 9a5487ef authored by Tom St Denis's avatar Tom St Denis Committed by Alex Deucher

drm/amd/powerplay: Simplify vega10_patch_voltage_dependency_tables_with_lookup_table()

Signed-off-by: default avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d5884513
...@@ -591,60 +591,36 @@ static int vega10_patch_clock_voltage_limits_with_vddc_leakage( ...@@ -591,60 +591,36 @@ static int vega10_patch_clock_voltage_limits_with_vddc_leakage(
static int vega10_patch_voltage_dependency_tables_with_lookup_table( static int vega10_patch_voltage_dependency_tables_with_lookup_table(
struct pp_hwmgr *hwmgr) struct pp_hwmgr *hwmgr)
{ {
uint8_t entry_id; uint8_t entry_id, voltage_id;
uint8_t voltage_id; unsigned i;
struct phm_ppt_v2_information *table_info = struct phm_ppt_v2_information *table_info =
(struct phm_ppt_v2_information *)(hwmgr->pptable); (struct phm_ppt_v2_information *)(hwmgr->pptable);
struct phm_ppt_v1_clock_voltage_dependency_table *socclk_table =
table_info->vdd_dep_on_socclk;
struct phm_ppt_v1_clock_voltage_dependency_table *gfxclk_table =
table_info->vdd_dep_on_sclk;
struct phm_ppt_v1_clock_voltage_dependency_table *dcefclk_table =
table_info->vdd_dep_on_dcefclk;
struct phm_ppt_v1_clock_voltage_dependency_table *pixclk_table =
table_info->vdd_dep_on_pixclk;
struct phm_ppt_v1_clock_voltage_dependency_table *dspclk_table =
table_info->vdd_dep_on_dispclk;
struct phm_ppt_v1_clock_voltage_dependency_table *phyclk_table =
table_info->vdd_dep_on_phyclk;
struct phm_ppt_v1_clock_voltage_dependency_table *mclk_table =
table_info->vdd_dep_on_mclk;
struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table =
table_info->mm_dep_table; table_info->mm_dep_table;
struct phm_ppt_v1_clock_voltage_dependency_table *mclk_table =
table_info->vdd_dep_on_mclk;
for (entry_id = 0; entry_id < socclk_table->count; entry_id++) { for (i = 0; i < 6; i++) {
voltage_id = socclk_table->entries[entry_id].vddInd; struct phm_ppt_v1_clock_voltage_dependency_table *vdt;
socclk_table->entries[entry_id].vddc = switch (i) {
table_info->vddc_lookup_table->entries[voltage_id].us_vdd; case 0: vdt = table_info->vdd_dep_on_socclk; break;
} case 1: vdt = table_info->vdd_dep_on_sclk; break;
case 2: vdt = table_info->vdd_dep_on_dcefclk; break;
for (entry_id = 0; entry_id < gfxclk_table->count; entry_id++) { case 3: vdt = table_info->vdd_dep_on_pixclk; break;
voltage_id = gfxclk_table->entries[entry_id].vddInd; case 4: vdt = table_info->vdd_dep_on_dispclk; break;
gfxclk_table->entries[entry_id].vddc = case 5: vdt = table_info->vdd_dep_on_phyclk; break;
table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
}
for (entry_id = 0; entry_id < dcefclk_table->count; entry_id++) {
voltage_id = dcefclk_table->entries[entry_id].vddInd;
dcefclk_table->entries[entry_id].vddc =
table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
} }
for (entry_id = 0; entry_id < pixclk_table->count; entry_id++) { for (entry_id = 0; entry_id < vdt->count; entry_id++) {
voltage_id = pixclk_table->entries[entry_id].vddInd; voltage_id = vdt->entries[entry_id].vddInd;
pixclk_table->entries[entry_id].vddc = vdt->entries[entry_id].vddc =
table_info->vddc_lookup_table->entries[voltage_id].us_vdd; table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
} }
for (entry_id = 0; entry_id < dspclk_table->count; entry_id++) {
voltage_id = dspclk_table->entries[entry_id].vddInd;
dspclk_table->entries[entry_id].vddc =
table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
} }
for (entry_id = 0; entry_id < phyclk_table->count; entry_id++) { for (entry_id = 0; entry_id < mm_table->count; ++entry_id) {
voltage_id = phyclk_table->entries[entry_id].vddInd; voltage_id = mm_table->entries[entry_id].vddcInd;
phyclk_table->entries[entry_id].vddc = mm_table->entries[entry_id].vddc =
table_info->vddc_lookup_table->entries[voltage_id].us_vdd; table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
} }
...@@ -660,11 +636,6 @@ static int vega10_patch_voltage_dependency_tables_with_lookup_table( ...@@ -660,11 +636,6 @@ static int vega10_patch_voltage_dependency_tables_with_lookup_table(
table_info->vddmem_lookup_table->entries[voltage_id].us_vdd; table_info->vddmem_lookup_table->entries[voltage_id].us_vdd;
} }
for (entry_id = 0; entry_id < mm_table->count; ++entry_id) {
voltage_id = mm_table->entries[entry_id].vddcInd;
mm_table->entries[entry_id].vddc =
table_info->vddc_lookup_table->entries[voltage_id].us_vdd;
}
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment