aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0540-drm-amd-dal-Fix-bug-for-DP-MST-audio.patch
blob: 530370ea8509f033484a816cb6a83a1d34192e08 (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
From 0c3d341226575f99ee5c9860e952bbb40e3c5cee Mon Sep 17 00:00:00 2001
From: Hersen Wu <hersenxs.wu@amd.com>
Date: Mon, 30 Nov 2015 16:31:55 -0500
Subject: [PATCH 0540/1110] drm/amd/dal: Fix bug for DP MST audio

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 .../gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_mst_types.c    | 13 +++++++++----
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c              | 18 +++++-------------
 drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c    |  4 ++--
 3 files changed, 16 insertions(+), 19 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 a08468b..86c17e6 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
@@ -24,14 +24,11 @@
  */
 
 #include "dal_services.h"
-
 #include "amdgpu.h"
-
 #include "amdgpu_dm_types.h"
-
 #include "amdgpu_dm_mst_types.h"
-
 #include "dc.h"
+#include "dc_helpers.h"
 
 static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 {
@@ -111,6 +108,7 @@ static const struct dc_sink *dm_dp_mst_add_mst_sink(
 	struct sink_init_data init_params = {
 			.link = dc_link,
 			.sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST};
+	enum dc_edid_status edid_status;
 
 	if (len > MAX_EDID_BUFFER_SIZE) {
 		DRM_ERROR("Max EDID buffer size breached!\n");
@@ -135,6 +133,13 @@ static const struct dc_sink *dm_dp_mst_add_mst_sink(
 			dc_sink))
 		goto fail;
 
+	edid_status = dc_helpers_parse_edid_caps(
+			NULL,
+			&dc_sink->dc_edid,
+			&dc_sink->edid_caps);
+	if (edid_status != EDID_OK)
+		goto fail;
+
 	/* dc_sink_retain(&core_sink->public); */
 
 	return dc_sink;
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 647d141..2ae41c7 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -367,20 +367,12 @@ static void link_unplug(struct core_link *link)
 	link->dpcd_sink_count = 0;
 }
 
-static enum dc_edid_status read_edid(struct core_link *link)
+static enum dc_edid_status read_edid(
+	struct core_link *link,
+	struct core_sink *sink)
 {
 	uint32_t edid_retry = 3;
 	enum dc_edid_status edid_status;
-	const struct dc_sink *dc_sink = link->public.sink[0];
-	struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
-
-	if (link->public.sink[0]->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
-		dal_logger_write(link->ctx->logger,
-							LOG_MAJOR_WARNING,
-							LOG_MINOR_DETECTION_EDID_PARSER,
-							"MST EDID read is not done here!\n");
-		return EDID_BAD_INPUT;
-	}
 
 	/* some dongles read edid incorrectly the first time,
 	 * do check sum and retry to make sure read correct edid.
@@ -395,7 +387,7 @@ static enum dc_edid_status read_edid(struct core_link *link)
 		dal_ddc_service_get_edid_buf(link->ddc,
 				sink->public.dc_edid.raw_edid);
 		edid_status = dc_helpers_parse_edid_caps(
-				link->ctx,
+				NULL,
 				&sink->public.dc_edid,
 				&sink->public.edid_caps);
 		--edid_retry;
@@ -580,7 +572,7 @@ void dc_link_detect(const struct dc_link *dc_link)
 		if (!dc_link_add_sink(&link->public, &sink->public))
 				BREAK_TO_DEBUGGER();
 
-		edid_status = read_edid(link);
+		edid_status = read_edid(link, sink);
 
 		switch (edid_status) {
 		case EDID_BAD_CHECKSUM:
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
index de71d39..37ffc0e 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
@@ -1044,8 +1044,8 @@ static void build_audio_output(
 	audio_output->crtc_info.calculated_pixel_clock =
 			stream->pix_clk_params.requested_pix_clk;
 
-	/* TODO: This is needed for DP */
-	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT) {
+	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT ||
+			stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
 		audio_output->pll_info.dp_dto_source_clock_in_khz =
 			dal_display_clock_get_dp_ref_clk_frequency(
 				stream->dis_clk);
-- 
2.7.4