aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0612-drm-amd-dal-do-not-clean-dc_link-on-MST-disconnect.patch
blob: c614fd29bbefc9001eca194c024ba379939d0e8a (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
From 7cc988ac024ed34c946722e036eec93f117069bd Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Fri, 11 Dec 2015 20:28:48 +0800
Subject: [PATCH 0612/1110] drm/amd/dal: do not clean dc_link on MST disconnect

This change restores previous behaviour, because mapping between
stream and connector is needed till reset mode, where it is accessed
for payload allocation.

We currently have the following references to dc_sink:

1. Hard reference in stream. Cleaned-up when target destroyed on reset mode;
2. Hard reference in link. Clean-up on HPD disconnect event;
3. Weak reference in aconnector. Weak means it does not controlled by counter.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland<harry.wentland@amd.com>
---
 .../drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c    | 37 ++++++++++++----------
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c          | 19 ++---------
 2 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c
index 3246dcd..f2926ff 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -75,8 +75,7 @@ dm_dp_mst_detect(struct drm_connector *connector, bool force)
 			aconnector->port);
 
 	if (status == connector_status_disconnected && aconnector->dc_sink) {
-		dc_link_remove_sink(aconnector->dc_link, aconnector->dc_sink);
-		aconnector->dc_sink = NULL;
+		aconnector->edid = NULL;
 	}
 
 	return status;
@@ -170,25 +169,31 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
 
 	flush_work(&master->mst_mgr.work);
 
-	edid = drm_dp_mst_get_edid(connector, &master->mst_mgr, aconnector->port);
+	if (!aconnector->edid) {
+		edid = drm_dp_mst_get_edid(connector, &master->mst_mgr, aconnector->port);
 
-	if (!edid) {
-		drm_mode_connector_update_edid_property(
-			&aconnector->base,
-			NULL);
+		if (!edid) {
+			drm_mode_connector_update_edid_property(
+				&aconnector->base,
+				NULL);
 
-		return ret;
-	}
+			return ret;
+		}
 
-	aconnector->edid = edid;
+		aconnector->edid = edid;
 
-	if (!aconnector->dc_sink) {
-			sink = dm_dp_mst_add_mst_sink(
+		if (aconnector->dc_sink)
+			dc_link_remove_sink(
 				aconnector->dc_link,
-				(uint8_t *)edid,
-				(edid->extensions + 1) * EDID_LENGTH);
-				aconnector->dc_sink = sink;
-	}
+				aconnector->dc_sink);
+
+		sink = dm_dp_mst_add_mst_sink(
+			aconnector->dc_link,
+			(uint8_t *)edid,
+			(edid->extensions + 1) * EDID_LENGTH);
+		aconnector->dc_sink = sink;
+	} else
+		edid = aconnector->edid;
 
 	DRM_DEBUG_KMS("edid retrieved %p\n", edid);
 
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
index 5890555..add76ca 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -639,27 +639,12 @@ void dc_link_detect(const struct dc_link *dc_link)
 		switch (link->public.connector_signal) {
 		case SIGNAL_TYPE_DISPLAY_PORT:
 			dc_helpers_dp_mst_stop_top_mgr(link->ctx, &link->public);
-			/*
-			 * in this case sinks would be removed in outer level
-			 */
-
-			/*
-			 * TODO: this is the only way to understand that link
-			 * was in mst mode. Proposal for future to add
-			 * additional field to link that will show actual state.
-			 *
-			 * For the change: for mst we create sink outside, and
-			 * should remove them in the same place
-			 */
-			if (link->public.sink_count == 1 &&
-				link->public.sink[0]->sink_signal !=
-					SIGNAL_TYPE_DISPLAY_PORT_MST)
-				link_disconnect_all_sinks(link);
 			break;
 		default:
-			link_disconnect_all_sinks(link);
 			break;
 		}
+
+		link_disconnect_all_sinks(link);
 	}
 
 	LINK_INFO("link=%d, dc_sink_in=%p is now %s\n",
-- 
2.7.4