aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2379-drm-amd-display-To-prevent-detecting-new-sink-from-s.patch
blob: 2cfae996d93e5a44f1a5d5e053afc571a59e542a (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
From da4f01f0c820e6d59dd5f77e433c35ddd7e769ba Mon Sep 17 00:00:00 2001
From: Martin Tsai <martin.tsai@amd.com>
Date: Thu, 7 Sep 2017 13:02:05 +0800
Subject: [PATCH 2379/4131] drm/amd/display: To prevent detecting new sink from
 spurious HPD

Signed-off-by: Martin Tsai <martin.tsai@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 48 +++++++++++++++++++--------
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 845ec42..9127431 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -565,8 +565,6 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 			link->local_sink)
 		return true;
 
-	link_disconnect_sink(link);
-
 	if (new_connection_type != dc_connection_none) {
 		link->type = new_connection_type;
 
@@ -638,8 +636,8 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 		if (link->dpcd_caps.sink_count.bits.SINK_COUNT)
 			link->dpcd_sink_count = link->dpcd_caps.sink_count.
 					bits.SINK_COUNT;
-			else
-				link->dpcd_sink_count = 1;
+		else
+			link->dpcd_sink_count = 1;
 
 		dal_ddc_service_set_transaction_type(
 						link->ddc,
@@ -651,16 +649,24 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 		sink_init_data.link = link;
 		sink_init_data.sink_signal = sink_caps.signal;
 
-		sink = dc_sink_create(&sink_init_data);
-		if (!sink) {
-			DC_ERROR("Failed to create sink!\n");
-			return false;
-		}
+		if (link->local_sink)	{
+			sink = link->local_sink;
+		} else {
+			link_disconnect_sink(link);
+
+			sink_init_data.link = link;
+			sink_init_data.sink_signal = sink_caps.signal;
 
-		sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
-		sink->converter_disable_audio = converter_disable_audio;
+			sink = dc_sink_create(&sink_init_data);
+			if (!sink) {
+				DC_ERROR("Failed to create sink!\n");
+				return false;
+			}
+			sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
+			sink->converter_disable_audio = converter_disable_audio;
 
-		link->local_sink = sink;
+			link->local_sink = sink;
+		}
 
 		edid_status = dm_helpers_read_local_edid(
 				link->ctx,
@@ -752,8 +758,22 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 			memset(link->mst_stream_alloc_table.stream_allocations, 0, sizeof(link->mst_stream_alloc_table.stream_allocations));
 		}
 
-		link->type = dc_connection_none;
-		sink_caps.signal = SIGNAL_TYPE_NONE;
+		if (link->local_sink) {
+			sink = link->local_sink;
+			edid_status = dm_helpers_read_local_edid(
+						link->ctx,
+						link,
+						sink);
+			if (edid_status != EDID_OK) {
+				link_disconnect_sink(link);
+				link->type = dc_connection_none;
+				sink_caps.signal = SIGNAL_TYPE_NONE;
+			}
+		} else {
+			link_disconnect_sink(link);
+			link->type = dc_connection_none;
+			sink_caps.signal = SIGNAL_TYPE_NONE;
+		}
 	}
 
 	LINK_INFO("link=%d, dc_sink_in=%p is now %s\n",
-- 
2.7.4