drm/amd/display: Stop storing failures into adev->dm.cached_state

If drm_atomic_helper_suspend() has failed for any reason, it's stored
in adev->dm.cached_state.  This isn't expected because the resume
(or complete()) sequence will attempt to use the stored state to
resume.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Link: https://lore.kernel.org/r/20250602014432.3538345-3-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Mario Limonciello
2025-06-01 20:44:31 -05:00
committed by Alex Deucher
parent 64c3e4a868
commit 709a37ab9c

View File

@@ -3063,6 +3063,19 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
}
}
static int dm_cache_state(struct amdgpu_device *adev)
{
int r;
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
if (IS_ERR(adev->dm.cached_state)) {
r = PTR_ERR(adev->dm.cached_state);
adev->dm.cached_state = NULL;
}
return adev->dm.cached_state ? 0 : r;
}
static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
@@ -3071,11 +3084,8 @@ static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
return 0;
WARN_ON(adev->dm.cached_state);
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
if (IS_ERR(adev->dm.cached_state))
return PTR_ERR(adev->dm.cached_state);
return 0;
return dm_cache_state(adev);
}
static int dm_suspend(struct amdgpu_ip_block *ip_block)
@@ -3109,9 +3119,10 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
}
if (!adev->dm.cached_state) {
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
if (IS_ERR(adev->dm.cached_state))
return PTR_ERR(adev->dm.cached_state);
int r = dm_cache_state(adev);
if (r)
return r;
}
s3_handle_hdmi_cec(adev_to_drm(adev), true);