drm/amd/pp: delete repeated call of force_dpm_level
authorRex Zhu <Rex.Zhu@amd.com>
Mon, 18 Dec 2017 11:48:00 +0000 (19:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Dec 2017 17:11:58 +0000 (12:11 -0500)
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>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c

index 9d3bdada79d5e74843b58cdea7b7936bd644393d..fa9d1615a2cc5c2aa2cb40c3e28ce57300f54d00 100644 (file)
@@ -389,20 +389,12 @@ static int pp_dpm_force_performance_level(void *handle,
        if (level == hwmgr->dpm_level)
                return 0;
 
-       if (hwmgr->hwmgr_func->force_dpm_level == NULL) {
-               pr_info("%s was not implemented.\n", __func__);
-               return 0;
-       }
-
        mutex_lock(&pp_handle->pp_lock);
        pp_dpm_en_umd_pstate(hwmgr, &level);
        hwmgr->request_dpm_level = level;
        hwmgr_handle_task(pp_handle, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
-       ret = hwmgr->hwmgr_func->force_dpm_level(hwmgr, level);
-       if (!ret)
-               hwmgr->dpm_level = hwmgr->request_dpm_level;
-
        mutex_unlock(&pp_handle->pp_lock);
+
        return 0;
 }
 
index ce59e0e67cb22d632b27c3dce86708bd19a7fa4a..0229f774f7a93262196d4136a3ffa415b6940904 100644 (file)
@@ -149,6 +149,7 @@ int hwmgr_early_init(struct pp_instance *handle)
        hwmgr->power_source = PP_PowerSource_AC;
        hwmgr->pp_table_version = PP_TABLE_V1;
        hwmgr->dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
+       hwmgr->request_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
        hwmgr_init_default_caps(hwmgr);
        hwmgr_set_user_specify_caps(hwmgr);
        hwmgr->fan_ctrl_is_in_default_mode = true;
index f9ff40928ea9ecf9c37290e3863737ab6acc4d65..95ab772e0c3e3c3b1eacd4b95b1844ccbdd1cbbd 100644 (file)
@@ -244,8 +244,11 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,
        }
 
        phm_notify_smc_display_config_after_ps_adjustment(hwmgr);
-       phm_force_dpm_levels(hwmgr, hwmgr->dpm_level);
+       if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
+               hwmgr->dpm_level = hwmgr->request_dpm_level;
+
        phm_reset_power_profile_state(hwmgr);
+
        return 0;
 }