aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0882-drm-amd-dal-Move-hw_init-into-hwss.patch
blob: 13174eb21ed471bd89c1ee8fdaf53bd963c7e2c9 (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
283
284
285
286
287
288
289
290
291
From 8bea7ee56f14f0cfcc25373b35cc5907a1f03f79 Mon Sep 17 00:00:00 2001
From: Jordan Lazare <Jordan.Lazare@amd.com>
Date: Mon, 7 Mar 2016 13:53:12 -0500
Subject: [PATCH 0882/1110] drm/amd/dal: Move hw_init into hwss

Also move hwss creation to the bottom of dc_resource

Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc.c               | 81 ++++------------------
 .../gpu/drm/amd/dal/dc/dce100/dce100_resource.c    |  4 ++
 .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c    | 57 ++++++++++++++-
 .../gpu/drm/amd/dal/dc/dce110/dce110_resource.c    |  4 ++
 drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c  |  4 ++
 drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h      |  2 +
 6 files changed, 82 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index 3a6d0c1..f6eccbd 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -163,59 +163,7 @@ failed_alloc:
 	return false;
 }
 
-static void init_hw(struct core_dc *dc)
-{
-	int i;
-	struct dc_bios *bp;
-	struct transform *xfm;
-
-	bp = dc->ctx->dc_bios;
-	for (i = 0; i < dc->res_pool.pipe_count; i++) {
-		xfm = dc->res_pool.transforms[i];
-
-		dc->hwss.enable_display_power_gating(
-				dc->ctx, i, bp,
-				PIPE_GATING_CONTROL_INIT);
-		dc->hwss.enable_display_power_gating(
-				dc->ctx, i, bp,
-				PIPE_GATING_CONTROL_DISABLE);
-		xfm->funcs->transform_power_up(xfm);
-		dc->hwss.enable_display_pipe_clock_gating(
-			dc->ctx,
-			true);
-	}
-
-	dc->hwss.clock_gating_power_up(dc->ctx, false);
-	bp->funcs->power_up(bp);
-	/***************************************/
 
-	for (i = 0; i < dc->link_count; i++) {
-		/****************************************/
-		/* Power up AND update implementation according to the
-		 * required signal (which may be different from the
-		 * default signal on connector). */
-		struct core_link *link = dc->links[i];
-		link->link_enc->funcs->hw_init(link->link_enc);
-	}
-
-	for (i = 0; i < dc->res_pool.pipe_count; i++) {
-		struct timing_generator *tg = dc->res_pool.timing_generators[i];
-
-		tg->funcs->disable_vga(tg);
-
-		/* Blank controller using driver code instead of
-		 * command table. */
-		tg->funcs->set_blank(tg, true);
-	}
-
-	for(i = 0; i < dc->res_pool.audio_count; i++) {
-		struct audio *audio = dc->res_pool.audios[i];
-
-		if (dal_audio_power_up(audio) != AUDIO_RESULT_OK)
-			dm_error("Failed audio power up!\n");
-	}
-
-}
 
 static struct adapter_service *create_as(
 		const struct dc_init_data *init,
@@ -351,10 +299,6 @@ static bool construct(struct core_dc *dc, const struct dc_init_data *init_params
 
 		dc_ctx->dc_bios = dal_adapter_service_get_bios_parser(as);
 
-		/* Create hardware sequencer */
-		if (!dc_construct_hw_sequencer(as, dc))
-			goto hwss_fail;
-
 		if (!dc_construct_resource_pool(
 			as, dc, init_params->num_virtual_links, dc_version))
 			goto construct_resource_fail;
@@ -388,7 +332,6 @@ create_links_fail:
 as_fail:
 	dal_logger_destroy(&dc_ctx->logger);
 logger_fail:
-hwss_fail:
 	dm_free(dc_ctx);
 ctx_fail:
 	return false;
@@ -480,31 +423,31 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 		.driver_context = init_params->driver,
 		.cgs_device = init_params->cgs_device
 	};
-	struct core_dc *dc = dm_alloc(sizeof(*dc));
+	struct core_dc *core_dc = dm_alloc(sizeof(*core_dc));
 
-	if (NULL == dc)
+	if (NULL == core_dc)
 		goto alloc_fail;
 
-	ctx.dc = &dc->public;
-	if (false == construct(dc, init_params))
+	ctx.dc = &core_dc->public;
+	if (false == construct(core_dc, init_params))
 		goto construct_fail;
 
 	/*TODO: separate HW and SW initialization*/
-	init_hw(dc);
+	core_dc->hwss.init_hw(core_dc);
 
-	dc->public.caps.max_targets = dc->res_pool.pipe_count;
-	dc->public.caps.max_links = dc->link_count;
-	dc->public.caps.max_audios = dc->res_pool.audio_count;
+	core_dc->public.caps.max_targets = core_dc->res_pool.pipe_count;
+	core_dc->public.caps.max_links = core_dc->link_count;
+	core_dc->public.caps.max_audios = core_dc->res_pool.audio_count;
 
-	dal_logger_write(dc->ctx->logger,
+	dal_logger_write(core_dc->ctx->logger,
 			LOG_MAJOR_INTERFACE_TRACE,
 			LOG_MINOR_COMPONENT_DC,
 			"Display Core initialized\n");
 
-	return &dc->public;
+	return &core_dc->public;
 
 construct_fail:
-	dm_free(dc);
+	dm_free(core_dc);
 
 alloc_fail:
 	return NULL;
@@ -1182,7 +1125,7 @@ void dc_set_power_state(
 
 	switch (power_state) {
 	case DC_ACPI_CM_POWER_STATE_D0:
-		init_hw(core_dc);
+		core_dc->hwss.init_hw(core_dc);
 		break;
 	default:
 		/* NULL means "reset/release all DC targets" */
diff --git a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
index 6b8ae77..1911bbb 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
@@ -1050,6 +1050,10 @@ bool dce100_construct_resource_pool(
 		pool->stream_enc_count++;
 	}
 
+	/* Create hardware sequencer */
+	if (!dc_construct_hw_sequencer(as, dc))
+		goto stream_enc_create_fail;
+
 	return true;
 
 stream_enc_create_fail:
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
index e6d1c3a..defaac4 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
@@ -1593,7 +1593,62 @@ static void enable_timing_synchronization(
 	DC_SYNC_INFO("GSL: Set-up complete.\n");
 }
 
+static void init_hw(struct core_dc *dc)
+{
+	int i;
+	struct dc_bios *bp;
+	struct transform *xfm;
+
+	bp = dc->ctx->dc_bios;
+	for (i = 0; i < dc->res_pool.pipe_count; i++) {
+		xfm = dc->res_pool.transforms[i];
+
+		dc->hwss.enable_display_power_gating(
+				dc->ctx, i, bp,
+				PIPE_GATING_CONTROL_INIT);
+		dc->hwss.enable_display_power_gating(
+				dc->ctx, i, bp,
+				PIPE_GATING_CONTROL_DISABLE);
+		xfm->funcs->transform_power_up(xfm);
+		dc->hwss.enable_display_pipe_clock_gating(
+			dc->ctx,
+			true);
+	}
+
+	dc->hwss.clock_gating_power_up(dc->ctx, false);
+	bp->funcs->power_up(bp);
+	/***************************************/
+
+	for (i = 0; i < dc->link_count; i++) {
+		/****************************************/
+		/* Power up AND update implementation according to the
+		 * required signal (which may be different from the
+		 * default signal on connector). */
+		struct core_link *link = dc->links[i];
+		link->link_enc->funcs->hw_init(link->link_enc);
+	}
+
+	for (i = 0; i < dc->res_pool.pipe_count; i++) {
+		struct timing_generator *tg = dc->res_pool.timing_generators[i];
+
+		tg->funcs->disable_vga(tg);
+
+		/* Blank controller using driver code instead of
+		 * command table. */
+		tg->funcs->set_blank(tg, true);
+	}
+
+	for (i = 0; i < dc->res_pool.audio_count; i++) {
+		struct audio *audio = dc->res_pool.audios[i];
+
+		if (dal_audio_power_up(audio) != AUDIO_RESULT_OK)
+			dm_error("Failed audio power up!\n");
+	}
+
+}
+
 static const struct hw_sequencer_funcs dce110_funcs = {
+	.init_hw = init_hw,
 	.apply_ctx_to_hw = apply_ctx_to_hw,
 	.reset_hw_ctx = reset_hw_ctx,
 	.set_plane_config = set_plane_config,
@@ -1613,7 +1668,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.set_blender_mode = dce110_set_blender_mode,
 	.clock_gating_power_up = dal_dc_clock_gating_dce110_power_up,/*todo*/
 	.set_display_clock = set_display_clock,
-	.set_displaymarks = set_displaymarks,
+	.set_displaymarks = set_displaymarks
 };
 
 bool dce110_hw_sequencer_construct(struct core_dc *dc)
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 b39e2af..ef3f502 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
@@ -1188,6 +1188,10 @@ bool dce110_construct_resource_pool(
 		pool->stream_enc_count++;
 	}
 
+	/* Create hardware sequencer */
+	if (!dc_construct_hw_sequencer(as, dc))
+		goto stream_enc_create_fail;
+
 	return true;
 
 stream_enc_create_fail:
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
index 3b70643..078183b 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
@@ -1157,6 +1157,10 @@ bool dce80_construct_resource_pool(
 		pool->stream_enc_count++;
 	}
 
+	/* Create hardware sequencer */
+	if (!dc_construct_hw_sequencer(as, dc))
+		goto stream_enc_create_fail;
+
 	return true;
 
 stream_enc_create_fail:
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
index 490ee10..d801a60 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
@@ -37,6 +37,8 @@ enum pipe_gating_control {
 
 struct hw_sequencer_funcs {
 
+	void (*init_hw)(struct core_dc *dc);
+
 	enum dc_status (*apply_ctx_to_hw)(
 			struct core_dc *dc, struct validate_context *context);
 
-- 
2.7.4