]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm/smu7: Fix AC/DC switch notification
authorTimur Kristóf <timur.kristof@gmail.com>
Sun, 12 Jul 2026 17:39:28 +0000 (19:39 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Jul 2026 21:40:43 +0000 (17:40 -0400)
There were two mistakes in the previous implementation:

The check for AutomaticDCTransition should be inverted.
We recently learned that the kernel should send
PPSMC_MSG_RunningOnAC when the flag is set, and not the
other way around.

The clocks also need to be recomputed, because the code in
the smu7_apply_state_adjust_rules() function selects
different limits on AC and DC.

Fixes: 96da0d86614e ("drm/amd/pm/smu7: Notify SMU7 of DC->AC switch")
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 516f8fc30a1b56af03f39e93c18707d13419fb1f)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c

index 95bf187f02a5e5d63d253a56c50acf454478f704..bc82ba2e4c9bae9a0f299f4c08d36766c98657c8 100644 (file)
@@ -5857,15 +5857,19 @@ static int smu7_power_off_asic(struct pp_hwmgr *hwmgr)
 static void smu7_notify_ac_dc(struct pp_hwmgr *hwmgr)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
+       const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
 
-       /* Check if the platform already manages the AC/DC switch via dedicated GPIO. */
-       if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+       /*
+        * Check if the platform already manages the AC/DC switch via dedicated GPIO.
+        * Otherwise SMU automatically notices DC, but needs to be notified of AC.
+        */
+       if (adev->pm.ac_power &&
+           phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
                            PHM_PlatformCaps_AutomaticDCTransition))
-               return;
-
-       /* The SMU automatically notices DC, but needs to be notified when switching to AC. */
-       if (adev->pm.ac_power)
                smum_send_msg_to_smc(hwmgr, PPSMC_MSG_RunningOnAC, NULL);
+
+       /* Recompute clocks with updated max_limits. */
+       pp_funcs->pm_compute_clocks(adev->powerplay.pp_handle);
 }
 
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {