It looks like this was written for an old version of DC (DAL)
and was never adapted afterwards. This was non-functional
because it relied on the "dal_power_level" field which was
never assigned anywhere in the code base.

Also, it was not implemented for CI ASICs.

Now superseded by the newer voltage dependency on display
clock table added by the previous commit, let's remove.

Signed-off-by: Timur Kristóf <[email protected]>
---
 .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c   |  9 --
 .../drm/amd/pm/powerplay/hwmgr/smu_helper.c   | 84 -------------------
 .../drm/amd/pm/powerplay/hwmgr/smu_helper.h   |  2 -
 drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h  |  1 -
 4 files changed, 96 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index 338d651bca4dd..c357b1f638cfb 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -2794,10 +2794,6 @@ static int 
smu7_patch_dependency_tables_with_leakage(struct pp_hwmgr *hwmgr)
        if (tmp)
                return -EINVAL;
 
-       tmp = smu7_patch_vddc(hwmgr, hwmgr->dyn_state.vddc_dep_on_dal_pwrl);
-       if (tmp)
-               return -EINVAL;
-
        tmp = smu7_patch_vddci(hwmgr, 
hwmgr->dyn_state.vddci_dependency_on_mclk);
        if (tmp)
                return -EINVAL;
@@ -2887,8 +2883,6 @@ static int 
smu7_set_private_data_based_on_pptable_v0(struct pp_hwmgr *hwmgr)
 
 static int smu7_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
 {
-       kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl);
-       hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL;
        kfree(hwmgr->dyn_state.vddc_dependency_on_display_clock);
        hwmgr->dyn_state.vddc_dependency_on_display_clock = NULL;
        kfree(hwmgr->backend);
@@ -3046,9 +3040,6 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
                smu7_set_private_data_based_on_pptable_v0(hwmgr);
        }
 
-       /* Initalize Dynamic State Adjustment Rule Settings */
-       result = phm_initializa_dynamic_state_adjustment_rule_settings(hwmgr);
-
        if (result)
                goto fail;
 
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
index c305ea4ec17d2..5d454b18905ce 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
@@ -485,53 +485,6 @@ int phm_get_sclk_for_voltage_evv(struct pp_hwmgr *hwmgr,
        return 0;
 }
 
-/**
- * phm_initializa_dynamic_state_adjustment_rule_settings - Initialize Dynamic 
State Adjustment Rule Settings
- *
- * @hwmgr:  the address of the powerplay hardware manager.
- */
-int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr 
*hwmgr)
-{
-       struct phm_clock_voltage_dependency_table *table_clk_vlt;
-       struct phm_ppt_v1_information *pptable_info = (struct 
phm_ppt_v1_information *)(hwmgr->pptable);
-
-       /* initialize vddc_dep_on_dal_pwrl table */
-       table_clk_vlt = kzalloc(struct_size(table_clk_vlt, entries, 4),
-                               GFP_KERNEL);
-
-       if (NULL == table_clk_vlt) {
-               pr_err("Can not allocate space for vddc_dep_on_dal_pwrl! \n");
-               return -ENOMEM;
-       } else {
-               table_clk_vlt->count = 4;
-               table_clk_vlt->entries[0].clk = PP_DAL_POWERLEVEL_ULTRALOW;
-               if (hwmgr->chip_id >= CHIP_POLARIS10 &&
-                   hwmgr->chip_id <= CHIP_VEGAM)
-                       table_clk_vlt->entries[0].v = 700;
-               else
-                       table_clk_vlt->entries[0].v = 0;
-               table_clk_vlt->entries[1].clk = PP_DAL_POWERLEVEL_LOW;
-               if (hwmgr->chip_id >= CHIP_POLARIS10 &&
-                   hwmgr->chip_id <= CHIP_VEGAM)
-                       table_clk_vlt->entries[1].v = 740;
-               else
-                       table_clk_vlt->entries[1].v = 720;
-               table_clk_vlt->entries[2].clk = PP_DAL_POWERLEVEL_NOMINAL;
-               if (hwmgr->chip_id >= CHIP_POLARIS10 &&
-                   hwmgr->chip_id <= CHIP_VEGAM)
-                       table_clk_vlt->entries[2].v = 800;
-               else
-                       table_clk_vlt->entries[2].v = 810;
-               table_clk_vlt->entries[3].clk = PP_DAL_POWERLEVEL_PERFORMANCE;
-               table_clk_vlt->entries[3].v = 900;
-               if (pptable_info != NULL)
-                       pptable_info->vddc_dep_on_dal_pwrl = table_clk_vlt;
-               hwmgr->dyn_state.vddc_dep_on_dal_pwrl = table_clk_vlt;
-       }
-
-       return 0;
-}
-
 uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t mask)
 {
        uint32_t level = 0;
@@ -542,43 +495,6 @@ uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr 
*hwmgr, uint32_t mask)
        return level;
 }
 
-void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
-{
-       struct phm_ppt_v1_information *table_info =
-                       (struct phm_ppt_v1_information *)hwmgr->pptable;
-       struct phm_clock_voltage_dependency_table *table =
-                               table_info->vddc_dep_on_dal_pwrl;
-       struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table;
-       enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;
-       uint32_t req_vddc = 0, req_volt, i;
-
-       if (!table || table->count <= 0
-               || dal_power_level < PP_DAL_POWERLEVEL_ULTRALOW
-               || dal_power_level > PP_DAL_POWERLEVEL_PERFORMANCE)
-               return;
-
-       for (i = 0; i < table->count; i++) {
-               if (dal_power_level == table->entries[i].clk) {
-                       req_vddc = table->entries[i].v;
-                       break;
-               }
-       }
-
-       vddc_table = table_info->vdd_dep_on_sclk;
-       for (i = 0; i < vddc_table->count; i++) {
-               if (req_vddc <= vddc_table->entries[i].vddc) {
-                       req_volt = (((uint32_t)vddc_table->entries[i].vddc) * 
VOLTAGE_SCALE);
-                       smum_send_msg_to_smc_with_parameter(hwmgr,
-                                       PPSMC_MSG_VddC_Request,
-                                       req_volt,
-                                       NULL);
-                       return;
-               }
-       }
-       pr_err("DAL requested level can not"
-                       " found a available voltage in VDDC DPM Table \n");
-}
-
 int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
                                uint32_t sclk, uint16_t id, uint16_t *voltage)
 {
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
index 83b3c9315143e..d370bfd0764d8 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.h
@@ -87,9 +87,7 @@ extern uint16_t phm_find_closest_vddci(struct 
pp_atomctrl_voltage_table *vddci_t
 extern int phm_find_boot_level(void *table, uint32_t value, uint32_t 
*boot_level);
 extern int phm_get_sclk_for_voltage_evv(struct pp_hwmgr *hwmgr, 
phm_ppt_v1_voltage_lookup_table *lookup_table,
                                                                uint16_t 
virtual_voltage_id, int32_t *sclk);
-extern int phm_initializa_dynamic_state_adjustment_rule_settings(struct 
pp_hwmgr *hwmgr);
 extern uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t 
mask);
-extern void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr);
 
 extern int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t 
voltage_type,
                                uint32_t sclk, uint16_t id, uint16_t *voltage);
diff --git a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h 
b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
index 2f49c95342a14..3ae45eac0c5ca 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
@@ -773,7 +773,6 @@ struct pp_hwmgr {
        const struct pp_smumgr_func *smumgr_funcs;
        bool is_kicker;
 
-       enum PP_DAL_POWERLEVEL dal_power_level;
        struct phm_dynamic_state_info dyn_state;
        const struct pp_hwmgr_func *hwmgr_func;
        const struct pp_table_func *pptable_func;
-- 
2.53.0

Reply via email to