From: "Mario Limonciello" <mario.limoncie...@amd.com>

[Why]
dm_prepare_suspend() was added in commit 50e0bae34fa6b
("drm/amd/display: Add and use new dm_prepare_suspend() callback")
to allow display to turn off earlier in the suspend sequence.

This caused a regression that HDMI audio sometimes didn't work
properly after resume unless audio was playing during suspend.

[How]
Drop dm_prepare_suspend() callback. All code in it will still run
during dm_suspend(). Also drop unnecessary dm_complete() callback.
dm_complete() was used for failed prepare and also for any case
of successful resume.  The code in it already runs in dm_resume().

This change will introduce more time that the display is turned on
during suspend sequence. The compositor can turn it off sooner if
desired.

Cc: Harry Wentland <harry.wentl...@amd.com>
Reported-by: Przemysław Kopa <prz.k...@gmail.com>
Closes: 
https://lore.kernel.org/amd-gfx/1cea0d56-7739-4ad9-bf8e-c9330faea...@kernel.org/T/#m383d9c08397043a271b36c32b64bb80e524e4b0f
Tested-by: Przemysław Kopa <prz.k...@gmail.com>
Reported-by: Kalvin <hikaph+...@gmail.com>
Closes: https://github.com/alsa-project/alsa-lib/issues/465
Closes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4809
Cc: sta...@vger.kernel.org
Fixes: 50e0bae34fa6b ("drm/amd/display: Add and use new dm_prepare_suspend() 
callback")
Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com>
---
NOTE: The complete pmops callback is still present but does nothing right now.
It's left for completeness sake in case another IP needs to do something in 
prepare()
and undo it in a failure with complete().

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 21 -------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e34d98a945f2..fadc6098eaee 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3182,25 +3182,6 @@ static void dm_destroy_cached_state(struct amdgpu_device 
*adev)
        dm->cached_state = NULL;
 }
 
-static void dm_complete(struct amdgpu_ip_block *ip_block)
-{
-       struct amdgpu_device *adev = ip_block->adev;
-
-       dm_destroy_cached_state(adev);
-}
-
-static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
-{
-       struct amdgpu_device *adev = ip_block->adev;
-
-       if (amdgpu_in_reset(adev))
-               return 0;
-
-       WARN_ON(adev->dm.cached_state);
-
-       return dm_cache_state(adev);
-}
-
 static int dm_suspend(struct amdgpu_ip_block *ip_block)
 {
        struct amdgpu_device *adev = ip_block->adev;
@@ -3626,10 +3607,8 @@ static const struct amd_ip_funcs amdgpu_dm_funcs = {
        .early_fini = amdgpu_dm_early_fini,
        .hw_init = dm_hw_init,
        .hw_fini = dm_hw_fini,
-       .prepare_suspend = dm_prepare_suspend,
        .suspend = dm_suspend,
        .resume = dm_resume,
-       .complete = dm_complete,
        .is_idle = dm_is_idle,
        .wait_for_idle = dm_wait_for_idle,
        .check_soft_reset = dm_check_soft_reset,
-- 
2.49.0

Reply via email to