[PATCH 1/2] drm/amd/pm: Implement notify_ac_dc callback for swsmu
Lijo Lazar <[email protected]> Tue, 4 Aug 2026 16:59:44 +0530
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <[email protected]> |
Wire up the notify_ac_dc pp_funcs callback for swsmu instead of special-casing is_support_sw_smu in the ACPI event handler. This keeps AC/DC transition notification through the same callback path as used by legacy powerplay and legacy-dpm backends. Signed-off-by: Lijo Lazar <[email protected]> --- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 3 --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 10 +++++++++- drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 -- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c index ce526db4d24a..107448fbda46 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -507,9 +507,6 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev) adev->powerplay.pp_funcs->notify_ac_dc) amdgpu_dpm_notify_ac_dc(adev); - if (is_support_sw_smu(adev)) - smu_set_ac_dc(adev->powerplay.pp_handle, true); - mutex_unlock(&adev->pm.mutex); } } diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index cca32f74abf0..84ac824837ac 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -2774,7 +2774,7 @@ static int smu_set_watermarks_for_clock_ranges(void *handle, return smu_set_watermarks_table(smu, clock_ranges); } -int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy) +static int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy) { int ret = 0; @@ -2800,6 +2800,13 @@ int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy) return 0; } +static void smu_notify_ac_dc(void *handle) +{ + struct smu_context *smu = handle; + + smu_set_ac_dc(smu, true); +} + const struct amd_ip_funcs smu_ip_funcs = { .name = "smu", .early_init = smu_early_init, @@ -4000,6 +4007,7 @@ static const struct amd_pm_funcs swsmu_pm_funcs = { .set_pp_table = smu_sys_set_pp_table, .switch_power_profile = smu_switch_power_profile, .pause_power_profile = smu_pause_power_profile, + .notify_ac_dc = smu_notify_ac_dc, /* export to amdgpu */ .dispatch_tasks = smu_handle_dpm_task, .load_firmware = smu_load_microcode, diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h index 3ec65630ab99..92658eb3886d 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h @@ -1952,8 +1952,6 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum pp_clock_type clk_type int smu_set_gfx_power_up_by_imu(struct smu_context *smu); -int smu_set_ac_dc(struct smu_context *smu, bool restore_ppt_policy); - int smu_set_xgmi_plpd_mode(struct smu_context *smu, enum pp_xgmi_plpd_mode mode); -- 2.49.0