From eb2343e988ab2309782e8b068d79ae20ab72d53b Mon Sep 17 00:00:00 2001 From: Lijo Lazar Date: Tue, 4 Aug 2026 16:43:39 +0530 Subject: [PATCH] drm/amd/pm: Separate PPT limit restore from smu_set_ac_dc Move the PPT limit restore out of smu_set_ac_dc. Keep smu_set_ac_dc only for switching the power source. Drop the restore ppt limit policy parameter and add the restore logic to ac/dc notification path. Signed-off-by: Lijo Lazar Reviewed-by: Asad Kamal Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 8ee1f865f9ae..3d143caecfc1 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -69,7 +69,7 @@ static int smu_handle_task(struct smu_context *smu, enum amd_dpm_forced_level level, enum amd_pp_task task_id); static int smu_reset(struct smu_context *smu); -static int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy); +static int smu_set_ac_dc(struct smu_context *smu); static int smu_set_fan_speed_pwm(void *handle, u32 speed); static int smu_set_fan_control_mode(void *handle, u32 value); static int smu_set_ppt_limit(void *handle, uint32_t limit_type, uint32_t limit); @@ -973,7 +973,7 @@ static int smu_late_init(struct amdgpu_ip_block *ip_block) * is unnecessary. */ adev->pm.ac_power = power_supply_is_system_supplied() > 0; - smu_set_ac_dc(smu, false); + smu_set_ac_dc(smu); if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 1)) || (amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 3))) @@ -2787,7 +2787,7 @@ static int smu_set_watermarks_for_clock_ranges(void *handle, return smu_set_watermarks_table(smu, clock_ranges); } -static int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy) +static int smu_set_ac_dc(struct smu_context *smu) { int ret = 0; @@ -2807,9 +2807,6 @@ static int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy) } } - if (restore_ppt_policy) - smu_restore_ppt_limits(smu, true); - return 0; } @@ -2817,7 +2814,10 @@ static void smu_notify_ac_dc(void *handle) { struct smu_context *smu = handle; - smu_set_ac_dc(smu, true); + if (smu_set_ac_dc(smu)) + return; + + smu_restore_ppt_limits(smu, true); } const struct amd_ip_funcs smu_ip_funcs = {