Skip to content

Commit 50e0bae

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/display: Add and use new dm_prepare_suspend() callback
[Why] The displays currently don't get turned off until after other IP blocks have been suspended. However turning off the displays first gives a very visible response that the system is on it's way down. [How] Turn off displays in a prepare_suspend() callback instead when possible. This will help for suspend and hibernate sequences. The shutdown sequence however will not call prepare() so check whether the state has been already saved to decide what to do. Acked-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Tom Chung <chiahsuan.chung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 5e19e2b commit 50e0bae

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,6 +3141,21 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
31413141
}
31423142
}
31433143

3144+
static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
3145+
{
3146+
struct amdgpu_device *adev = ip_block->adev;
3147+
3148+
if (amdgpu_in_reset(adev))
3149+
return 0;
3150+
3151+
WARN_ON(adev->dm.cached_state);
3152+
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
3153+
if (IS_ERR(adev->dm.cached_state))
3154+
return PTR_ERR(adev->dm.cached_state);
3155+
3156+
return 0;
3157+
}
3158+
31443159
static int dm_suspend(struct amdgpu_ip_block *ip_block)
31453160
{
31463161
struct amdgpu_device *adev = ip_block->adev;
@@ -3171,10 +3186,11 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
31713186
return 0;
31723187
}
31733188

3174-
WARN_ON(adev->dm.cached_state);
3175-
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
3176-
if (IS_ERR(adev->dm.cached_state))
3177-
return PTR_ERR(adev->dm.cached_state);
3189+
if (!adev->dm.cached_state) {
3190+
adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
3191+
if (IS_ERR(adev->dm.cached_state))
3192+
return PTR_ERR(adev->dm.cached_state);
3193+
}
31783194

31793195
s3_handle_hdmi_cec(adev_to_drm(adev), true);
31803196

@@ -3606,6 +3622,7 @@ static const struct amd_ip_funcs amdgpu_dm_funcs = {
36063622
.early_fini = amdgpu_dm_early_fini,
36073623
.hw_init = dm_hw_init,
36083624
.hw_fini = dm_hw_fini,
3625+
.prepare_suspend = dm_prepare_suspend,
36093626
.suspend = dm_suspend,
36103627
.resume = dm_resume,
36113628
.is_idle = dm_is_idle,

0 commit comments

Comments
 (0)