aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0895-drm-amd-dal-simplify-suspend-resume-sequence.patch
blob: 14c8256d9b74888a5d82656afa529610771e0200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
From 417422b7f5a2f0e37d178939a809f9dfc0ade509 Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Tue, 8 Mar 2016 05:11:36 -0500
Subject: [PATCH 0895/1110] drm/amd/dal: simplify suspend/resume sequence

Code that changes state to reset modes on suspend is removed
as reset mode already called from dc_set_power_state

Removed userspace notification from DM code, as one already
done in the end of base driver resume sequence

Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c | 71 +--------------------------
 1 file changed, 1 insertion(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
index c06f126..20654b9 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
@@ -424,86 +424,19 @@ static int dm_hw_fini(void *handle)
 	return 0;
 }
 
-static int dm_display_suspend(struct drm_device *ddev)
-{
-	struct drm_mode_config *config = &ddev->mode_config;
-	struct drm_modeset_acquire_ctx *ctx = config->acquire_ctx;
-	struct drm_atomic_state *state;
-	struct drm_crtc *crtc;
-	unsigned crtc_mask = 0;
-	int ret = 0;
-
-	if (WARN_ON(!ctx))
-		return 0;
-
-	lockdep_assert_held(&ctx->ww_ctx);
-
-	state = drm_atomic_state_alloc(ddev);
-	if (WARN_ON(!state))
-		return -ENOMEM;
-
-	state->acquire_ctx = ctx;
-	state->allow_modeset = true;
-
-	/* Set all active crtcs to inactive, to turn off displays*/
-	list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head) {
-		struct drm_crtc_state *crtc_state =
-			drm_atomic_get_crtc_state(state, crtc);
-
-		ret = PTR_ERR_OR_ZERO(crtc_state);
-		if (ret)
-			goto free;
-
-		if (!crtc_state->active)
-			continue;
-
-		crtc_state->active = false;
-		crtc_mask |= (1 << drm_crtc_index(crtc));
-	}
-
-	if (crtc_mask) {
-		ret = drm_atomic_commit(state);
-
-		/* In case of failure, revert everything we did*/
-		if (!ret) {
-			list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head)
-				if (crtc_mask & (1 << drm_crtc_index(crtc)))
-					crtc->state->active = true;
-
-			return ret;
-		}
-	}
-
-free:
-	if (ret) {
-		DRM_ERROR("Suspending crtc's failed with %i\n", ret);
-		drm_atomic_state_free(state);
-		return ret;
-	}
-
-	return 0;
-}
 static int dm_suspend(void *handle)
 {
 	struct amdgpu_device *adev = handle;
 	struct amdgpu_display_manager *dm = &adev->dm;
-	struct drm_device *ddev = adev->ddev;
 	int ret = 0;
 
-	drm_modeset_lock_all(ddev);
-	ret = dm_display_suspend(ddev);
-	drm_modeset_unlock_all(ddev);
-
-	if (ret)
-		goto fail;
-
 	dc_set_power_state(
 		dm->dc,
 		DC_ACPI_CM_POWER_STATE_D3,
 		DC_VIDEO_POWER_SUSPEND);
 
 	amdgpu_dm_irq_suspend(adev);
-fail:
+
 	return ret;
 }
 
@@ -613,8 +546,6 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev )
 	ret = dm_display_resume(ddev);
 	drm_modeset_unlock_all(ddev);
 
-	drm_kms_helper_hotplug_event(ddev);
-
 	amdgpu_dm_irq_resume(adev);
 
 	return ret;
-- 
2.7.4