aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0720-drm-amd-display-Move-audio-to-stream_res.patch
blob: 3f83abc19bf90bff488499e31e6c83db15e213fc (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
From 8b93495cdd2e741273ad96dcd93c873a5773cf24 Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Sun, 30 Jul 2017 14:59:17 -0400
Subject: [PATCH 0720/4131] drm/amd/display: Move audio to stream_res

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipes->audio/pipes->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i
's/pipe_with_clk_src->audio/pipe_with_clk_src->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/ctx->audio->/ctx->stream_res\.audio->/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipe->audio/pipe->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipe_ctx->audio/pipe_ctx->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[pipe_offset\]\.audio/pipe_ctx\[pipe_offset\]\.stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[i\]->audio/grouped_pipes\[i\]->stream_^Cs\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[0\]->audio/grouped_pipes\[0\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[1\]->audio/grouped_pipes\[1\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[i\]->audio/pipe_ctx\[i\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx_old->audio/pipe_ctx_old->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_set\[j\]->audio/pipe_set\[j\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[i\]\.audio/pipe_ctx\[i\]\.stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipes\[i\]\.audio/pipes\[i\]\.stream_res\.audio/g'

Signed-off-by: Harry Wentland <harry.wentland@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      |  4 +--
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 12 ++++----
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 32 +++++++++++-----------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  3 +-
 4 files changed, 25 insertions(+), 26 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 6a3d2ad..9665fc1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1305,9 +1305,9 @@ static enum dc_status enable_link(struct pipe_ctx *pipe_ctx)
 		break;
 	}
 
-	if (pipe_ctx->audio && status == DC_OK) {
+	if (pipe_ctx->stream_res.audio && status == DC_OK) {
 		/* notify audio driver for audio modes of monitor */
-		pipe_ctx->audio->funcs->az_enable(pipe_ctx->audio);
+		pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio);
 
 		/* un-mute audio */
 		/* TODO: audio should be per stream rather than per link */
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 31a3535..8bfaca7 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1097,7 +1097,7 @@ bool resource_attach_surfaces_to_context(
 			free_pipe->stream_res.tg = tail_pipe->stream_res.tg;
 			free_pipe->stream_res.opp = tail_pipe->stream_res.opp;
 			free_pipe->stream_res.stream_enc = tail_pipe->stream_res.stream_enc;
-			free_pipe->audio = tail_pipe->audio;
+			free_pipe->stream_res.audio = tail_pipe->stream_res.audio;
 			free_pipe->clock_source = tail_pipe->clock_source;
 			free_pipe->top_pipe = tail_pipe;
 			tail_pipe->bottom_pipe = free_pipe;
@@ -1481,7 +1481,7 @@ enum dc_status resource_map_pool_resources(
 				pipe_ctx->clock_source);
 
 			set_audio_in_use(&context->res_ctx, pool,
-					pipe_ctx->audio);
+					pipe_ctx->stream_res.audio);
 		}
 	}
 
@@ -1518,7 +1518,7 @@ enum dc_status resource_map_pool_resources(
 		if (!stream->sink->converter_disable_audio &&
 			dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
 			stream->audio_info.mode_count) {
-			pipe_ctx->audio = find_first_free_audio(
+			pipe_ctx->stream_res.audio = find_first_free_audio(
 				&context->res_ctx, pool);
 
 			/*
@@ -1526,10 +1526,10 @@ enum dc_status resource_map_pool_resources(
 			 * There are asics which has number of audio
 			 * resources less then number of pipes
 			 */
-			if (pipe_ctx->audio)
+			if (pipe_ctx->stream_res.audio)
 				set_audio_in_use(
 					&context->res_ctx, pool,
-					pipe_ctx->audio);
+					pipe_ctx->stream_res.audio);
 		}
 
 		context->stream_status[i].primary_otg_inst = pipe_ctx->stream_res.tg->inst;
@@ -2375,7 +2375,7 @@ bool pipe_need_reprogram(
 	if (pipe_ctx_old->stream->signal != pipe_ctx->stream->signal)
 		return true;
 
-	if (pipe_ctx_old->audio != pipe_ctx->audio)
+	if (pipe_ctx_old->stream_res.audio != pipe_ctx->stream_res.audio)
 		return true;
 
 	if (pipe_ctx_old->clock_source != pipe_ctx->clock_source
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 48d1510..ef5d496 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -729,7 +729,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
 	tg->funcs->set_early_control(tg, early_control);
 
 	/* enable audio only within mode set */
-	if (pipe_ctx->audio != NULL) {
+	if (pipe_ctx->stream_res.audio != NULL) {
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			pipe_ctx->stream_res.stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_res.stream_enc);
 	}
@@ -748,8 +748,8 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 	struct dc_stream_state *stream = pipe_ctx->stream;
 	struct dc_link *link = stream->sink->link;
 
-	if (pipe_ctx->audio) {
-		pipe_ctx->audio->funcs->az_disable(pipe_ctx->audio);
+	if (pipe_ctx->stream_res.audio) {
+		pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
 
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			pipe_ctx->stream_res.stream_enc->funcs->dp_audio_disable(
@@ -758,7 +758,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 			pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_disable(
 					pipe_ctx->stream_res.stream_enc);
 
-		pipe_ctx->audio = NULL;
+		pipe_ctx->stream_res.audio = NULL;
 
 		/* TODO: notify audio driver for if audio modes list changed
 		 * add audio mode list change flag */
@@ -1094,7 +1094,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 			pipe_ctx->stream_res.stream_enc,
 			&stream->timing,
 			stream->phy_pix_clk,
-			pipe_ctx->audio != NULL);
+			pipe_ctx->stream_res.audio != NULL);
 
 	if (dc_is_dvi_signal(pipe_ctx->stream->signal))
 		pipe_ctx->stream_res.stream_enc->funcs->dvi_set_stream_attribute(
@@ -1792,13 +1792,13 @@ enum dc_status dce110_apply_ctx_to_hw(
 		if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
 			continue;
 
-		if (pipe_ctx->audio != NULL) {
+		if (pipe_ctx->stream_res.audio != NULL) {
 			struct audio_output audio_output;
 
 			build_audio_output(pipe_ctx, &audio_output);
 
-			pipe_ctx->audio->funcs->wall_dto_setup(
-				pipe_ctx->audio,
+			pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
+				pipe_ctx->stream_res.audio,
 				pipe_ctx->stream->signal,
 				&audio_output.crtc_info,
 				&audio_output.pll_info);
@@ -1820,13 +1820,13 @@ enum dc_status dce110_apply_ctx_to_hw(
 			if (!dc_is_dp_signal(pipe_ctx->stream->signal))
 				continue;
 
-			if (pipe_ctx->audio != NULL) {
+			if (pipe_ctx->stream_res.audio != NULL) {
 				struct audio_output audio_output;
 
 				build_audio_output(pipe_ctx, &audio_output);
 
-				pipe_ctx->audio->funcs->wall_dto_setup(
-					pipe_ctx->audio,
+				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
+					pipe_ctx->stream_res.audio,
 					pipe_ctx->stream->signal,
 					&audio_output.crtc_info,
 					&audio_output.pll_info);
@@ -1853,7 +1853,7 @@ enum dc_status dce110_apply_ctx_to_hw(
 		if (pipe_ctx->top_pipe)
 			continue;
 
-		if (context->res_ctx.pipe_ctx[i].audio != NULL) {
+		if (context->res_ctx.pipe_ctx[i].stream_res.audio != NULL) {
 
 			struct audio_output audio_output;
 
@@ -1862,17 +1862,17 @@ enum dc_status dce110_apply_ctx_to_hw(
 			if (dc_is_dp_signal(pipe_ctx->stream->signal))
 				pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup(
 						pipe_ctx->stream_res.stream_enc,
-						pipe_ctx->audio->inst,
+						pipe_ctx->stream_res.audio->inst,
 						&pipe_ctx->stream->audio_info);
 			else
 				pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup(
 						pipe_ctx->stream_res.stream_enc,
-						pipe_ctx->audio->inst,
+						pipe_ctx->stream_res.audio->inst,
 						&pipe_ctx->stream->audio_info,
 						&audio_output.crtc_info);
 
-			pipe_ctx->audio->funcs->az_configure(
-					pipe_ctx->audio,
+			pipe_ctx->stream_res.audio->funcs->az_configure(
+					pipe_ctx->stream_res.audio,
 					pipe_ctx->stream->signal,
 					&audio_output.crtc_info,
 					&pipe_ctx->stream->audio_info);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 4d35c6d..6f09653 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -156,6 +156,7 @@ struct stream_resource {
 	struct output_pixel_processor *opp;
 	struct timing_generator *tg;
 	struct stream_encoder *stream_enc;
+	struct audio *audio;
 };
 
 struct plane_resource {
@@ -176,8 +177,6 @@ struct pipe_ctx {
 	struct display_clock *dis_clk;
 	struct clock_source *clock_source;
 
-	struct audio *audio;
-
 	struct pixel_clk_params pix_clk_params;
 	struct pll_settings pll_settings;
 
-- 
2.7.4