Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: Save and restore all limit types

Vangogh has separate limits for default PPT and fast PPT. Add
infrastructure to save both of these limits and restore both of them.

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mario Limonciello and committed by
Alex Deucher
3cd7ceee 56a207c3

+14 -8
+12 -7
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 508 508 /* Enable restore flag */ 509 509 smu->user_dpm_profile.flags |= SMU_DPM_USER_PROFILE_RESTORE; 510 510 511 - /* set the user dpm power limit */ 512 - if (smu->user_dpm_profile.power_limit) { 513 - ret = smu_set_power_limit(smu, SMU_DEFAULT_PPT_LIMIT, smu->current_power_limit); 511 + /* set the user dpm power limits */ 512 + for (int i = SMU_DEFAULT_PPT_LIMIT; i < SMU_LIMIT_TYPE_COUNT; i++) { 513 + if (!smu->user_dpm_profile.power_limits[i]) 514 + continue; 515 + ret = smu_set_power_limit(smu, i, 516 + smu->user_dpm_profile.power_limits[i]); 514 517 if (ret) 515 - dev_err(smu->adev->dev, "Failed to set power limit value\n"); 518 + dev_err(smu->adev->dev, "Failed to set %d power limit value\n", i); 516 519 } 517 520 518 521 /* set the user dpm clock configurations */ ··· 2982 2979 2983 2980 if (smu->ppt_funcs->set_power_limit) { 2984 2981 ret = smu->ppt_funcs->set_power_limit(smu, limit_type, limit); 2985 - if (!ret && !(smu->user_dpm_profile.flags & SMU_DPM_USER_PROFILE_RESTORE)) 2986 - smu->user_dpm_profile.power_limit = limit; 2982 + if (ret) 2983 + return ret; 2984 + if (!(smu->user_dpm_profile.flags & SMU_DPM_USER_PROFILE_RESTORE)) 2985 + smu->user_dpm_profile.power_limits[limit_type] = limit; 2987 2986 } 2988 2987 2989 - return ret; 2988 + return 0; 2990 2989 } 2991 2990 2992 2991 static int smu_print_smuclk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf)
+2 -1
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
··· 212 212 enum smu_ppt_limit_type { 213 213 SMU_DEFAULT_PPT_LIMIT = 0, 214 214 SMU_FAST_PPT_LIMIT, 215 + SMU_LIMIT_TYPE_COUNT, 215 216 }; 216 217 217 218 enum smu_ppt_limit_level { ··· 232 231 233 232 struct smu_user_dpm_profile { 234 233 uint32_t fan_mode; 235 - uint32_t power_limit; 234 + uint32_t power_limits[SMU_LIMIT_TYPE_COUNT]; 236 235 uint32_t fan_speed_pwm; 237 236 uint32_t fan_speed_rpm; 238 237 uint32_t flags;