aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0642-drm-amd-dal-DP-MST-Detection.patch
blob: ccc717d350aac61b686054e9feecffa23a9b8694 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From a3148a748fde1246f26b494675147e2793b890f1 Mon Sep 17 00:00:00 2001
From: Chris Park <Chris.Park@amd.com>
Date: Fri, 18 Dec 2015 11:52:24 -0500
Subject: [PATCH 0642/1110] drm/amd/dal: DP MST Detection

MSTManager allows DP MST to be detected.

Signed-off-by: Chris Park <Chris.Park@amd.com>
Acked-by: Jordan Lazare <Jordan.Lazare@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dc_helpers.c |  2 --
 drivers/gpu/drm/amd/dal/dc/core/dc.c                  |  2 +-
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c             | 12 ++++--------
 drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c        |  2 --
 drivers/gpu/drm/amd/dal/dc/core/dc_target.c           |  2 +-
 drivers/gpu/drm/amd/dal/dc/dc.h                       |  1 +
 drivers/gpu/drm/amd/dal/dc/dc_helpers.h               |  2 --
 drivers/gpu/drm/amd/dal/dc/inc/core_types.h           |  2 --
 8 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dc_helpers.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dc_helpers.c
index ddc40c9..0a05774 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dc_helpers.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dc_helpers.c
@@ -499,7 +499,6 @@ void dc_helpers_dp_mst_stop_top_mgr(
 
 bool dc_helper_dp_read_dpcd(
 		struct dc_context *ctx,
-		uint8_t link_index,
 		const struct dc_link *link,
 		uint32_t address,
 		uint8_t *data,
@@ -521,7 +520,6 @@ bool dc_helper_dp_read_dpcd(
 
 bool dc_helper_dp_write_dpcd(
 		struct dc_context *ctx,
-		uint8_t link_index,
 		const struct dc_link *link,
 		uint32_t address,
 		const uint8_t *data,
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index 941d167..2c9a404 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -365,7 +365,6 @@ static void destruct(struct dc *dc)
 	dc_service_free(dc->ctx, dc->links);
 	dc->hwss.destruct_resource_pool(&dc->res_pool);
 	dal_logger_destroy(&dc->ctx->logger);
-	dc_service_free(dc->ctx, dc->ctx);
 }
 
 /*******************************************************************************
@@ -403,6 +402,7 @@ void dc_destroy(struct dc **dc)
 {
 	destruct(*dc);
 	dc_service_free((*dc)->ctx, *dc);
+	dc_service_free((*dc)->ctx, (*dc)->ctx);
 	*dc = NULL;
 }
 
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 d4b1085..5516ec7 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -647,13 +647,9 @@ void dc_link_detect(const struct dc_link *dc_link)
 		link_disconnect_all_sinks(link);
 	}
 
-	if (signal == SIGNAL_TYPE_NONE) {
-		LINK_INFO("link=%d is now Disconnected.\n",
-				link->link_index);
-	} else {
-		LINK_INFO("link=%d is now Connected. Sink ptr=%p Signal=%d\n",
-				link->link_index, &sink->public, signal);
-	}
+	LINK_INFO("link=%d, dc_sink_in=%p is now %s\n",
+		link->public.link_index, &sink->public,
+		(signal == SIGNAL_TYPE_NONE ? "Disconnected":"Connected"));
 
 	return;
 }
@@ -675,7 +671,7 @@ static bool construct(
 	link->adapter_srv = as;
 	link->connector_index = init_params->connector_index;
 	link->ctx = dc_ctx;
-	link->link_index = init_params->link_index;
+	link->public.link_index = init_params->link_index;
 
 	link->link_id = dal_adapter_service_get_connector_obj_id(
 			as,
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c
index 91aec82..727c812 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c
@@ -21,7 +21,6 @@ enum dc_status core_link_read_dpcd(
 	uint32_t size)
 {
 	if (!dc_helper_dp_read_dpcd(link->ctx,
-			link->link_index,
 			&link->public,
 			address, data, size))
 			return DC_ERROR_UNEXPECTED;
@@ -36,7 +35,6 @@ enum dc_status core_link_write_dpcd(
 	uint32_t size)
 {
 	if (!dc_helper_dp_write_dpcd(link->ctx,
-			link->link_index,
 			&link->public,
 			address, data, size))
 				return DC_ERROR_UNEXPECTED;
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
index 82cdae1..3a1f605 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
@@ -400,7 +400,7 @@ uint8_t dc_target_get_link_index(const struct dc_target *dc_target)
 	const struct core_sink *sink =
 		DC_SINK_TO_CORE(target->public.streams[0]->sink);
 
-	return sink->link->link_index;
+	return sink->link->public.link_index;
 }
 
 uint32_t dc_target_get_vblank_counter(const struct dc_target *dc_target)
diff --git a/drivers/gpu/drm/amd/dal/dc/dc.h b/drivers/gpu/drm/amd/dal/dc/dc.h
index c9cdd9c..007fdc4 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc.h
@@ -273,6 +273,7 @@ void dc_update_stream(const struct dc_stream *dc_stream,
 struct dc_link {
 	const struct dc_sink *sink[MAX_SINKS_PER_LINK];
 	unsigned int sink_count;
+	unsigned int link_index;
 	enum dc_connection_type type;
 	enum signal_type connector_signal;
 	enum dc_irq_source irq_source_hpd;
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_helpers.h b/drivers/gpu/drm/amd/dal/dc/dc_helpers.h
index fe76833..d96e907 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_helpers.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_helpers.h
@@ -77,7 +77,6 @@ void dc_helpers_dp_mst_stop_top_mgr(
  */
 bool dc_helper_dp_read_dpcd(
 		struct dc_context *ctx,
-		uint8_t link_index,
 		const struct dc_link *link,
 		uint32_t address,
 		uint8_t *data,
@@ -88,7 +87,6 @@ bool dc_helper_dp_read_dpcd(
  */
 bool dc_helper_dp_write_dpcd(
 		struct dc_context *ctx,
-		uint8_t link_index,
 		const struct dc_link *link,
 		uint32_t address,
 		const uint8_t *data,
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
index b35ec1a..194b3e0 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h
@@ -203,8 +203,6 @@ struct core_link {
 	struct dc_context *ctx; /* TODO: AUTO remove 'dal' when DC is complete*/
 
 	uint8_t connector_index; /* this will be mapped to the HPD pins */
-	uint8_t link_index; /* this is mapped to DAL display_index
-				TODO: #flip remove it as soon as possible. */
 
 	struct adapter_service *adapter_srv;
 	struct connector *connector;
-- 
2.7.4