use pp_set_power_profile_mode to support kfd's gfx/compute profiling mode switch Change-Id: I351cd23a8394c7b0c7945e6875c2ccb29968712e Signed-off-by: Rex Zhu <Rex.Zhu at amd.com> --- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 376ed2d..5feb91b 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -1187,19 +1187,29 @@ static int pp_dpm_switch_power_profile(void *handle, enum amd_pp_profile_type type) { struct pp_hwmgr *hwmgr; - struct amd_pp_profile request = {0}; struct pp_instance *pp_handle = (struct pp_instance *)handle; + long *workload; if (pp_check(pp_handle)) return -EINVAL; hwmgr = pp_handle->hwmgr; - if (hwmgr->current_power_profile != type) { - request.type = type; - pp_dpm_set_power_profile_state(handle, &request); + mutex_lock(&pp_handle->pp_lock); + + if (type == AMD_PP_GFX_PROFILE) { + if (hwmgr->power_profile_mode != hwmgr->default_power_profile_mode) + pp_dpm_force_performance_level(handle, AMD_DPM_FORCED_LEVEL_AUTO); + } else { + if (hwmgr->power_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE) { + *workload = PP_SMC_POWER_PROFILE_COMPUTE; + pp_dpm_force_performance_level(handle, AMD_DPM_FORCED_LEVEL_MANUAL); + pp_set_power_profile_mode(handle, workload, 0); + } } + mutex_unlock(&pp_handle->pp_lock); + return 0; } -- 1.9.1