aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0555-drm-amd-dal-Simplify-return-value-for-HW-programming.patch
blob: c261c9f803cd824afb21604e272e63f7e4b847a2 (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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
From e329df58f0107375dd3d19c4405113a25e884912 Mon Sep 17 00:00:00 2001
From: Chris Park <Chris.Park@amd.com>
Date: Tue, 1 Dec 2015 15:04:11 -0500
Subject: [PATCH 0555/1110] drm/amd/dal: Simplify return value for HW
 programming

Only OK & ERROR used.  Replace with bool.

Signed-off-by: Chris Park <Chris.Park@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc.c               |  2 +-
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c          |  8 +--
 drivers/gpu/drm/amd/dal/dc/core/dc_link_hwss.c     |  4 +-
 drivers/gpu/drm/amd/dal/dc/dc_types.h              |  8 ---
 .../drm/amd/dal/dc/dce110/dce110_link_encoder.c    | 58 +++++++++++-----------
 .../drm/amd/dal/dc/dce110/dce110_link_encoder.h    | 18 +++----
 .../gpu/drm/amd/dal/dc/dce110/dce110_resource.c    |  5 +-
 drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h      |  8 +--
 8 files changed, 51 insertions(+), 60 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index 01e961a..14e10b9 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -162,7 +162,7 @@ static void init_hw(struct dc *dc)
 		 * required signal (which may be different from the
 		 * default signal on connector). */
 		struct core_link *link = dc->links[i];
-		if (dc->hwss.encoder_power_up(link->link_enc) != ENCODER_RESULT_OK) {
+		if (!dc->hwss.encoder_power_up(link->link_enc)) {
 			dal_error("Failed link encoder power up!\n");
 			return;
 		}
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 f0719e9..58eac92 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -977,14 +977,14 @@ static enum dc_status enable_link_hdmi(struct core_stream *stream)
 		(stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK)
 					? LANE_COUNT_EIGHT : LANE_COUNT_FOUR;
 
-	if (link->ctx->dc->hwss.encoder_enable_output(
+	if (!link->ctx->dc->hwss.encoder_enable_output(
 			stream->sink->link->link_enc,
 			&stream->sink->link->cur_link_settings,
 			stream->stream_enc->id,
 			dal_clock_source_get_id(stream->clock_source),
 			stream->signal,
 			stream->public.timing.display_color_depth,
-			stream->public.timing.pix_clk_khz) != ENCODER_RESULT_OK)
+			stream->public.timing.pix_clk_khz))
 		status = DC_ERROR_UNEXPECTED;
 
 	if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)
@@ -1052,8 +1052,8 @@ enum dc_status core_link_disable(struct core_stream *stream)
 		}
 	}
 
-	else if (ENCODER_RESULT_OK != dc->hwss.encoder_disable_output(
-					stream->sink->link->link_enc, stream->signal))
+	else if (!dc->hwss.encoder_disable_output(
+				stream->sink->link->link_enc, stream->signal))
 		status = DC_ERROR_UNEXPECTED;
 
 	return status;
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 7961a4e..054b0a3 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
@@ -54,14 +54,14 @@ enum dc_status dp_enable_link_phy(
 {
 	enum dc_status status = DC_OK;
 
-	if (link->dc->hwss.encoder_enable_output(
+	if (!link->dc->hwss.encoder_enable_output(
 					link->link_enc,
 					link_settings,
 					engine,
 					CLOCK_SOURCE_ID_EXTERNAL,
 					signal,
 					COLOR_DEPTH_UNDEFINED,
-					0) != ENCODER_RESULT_OK)
+					0))
 		status = DC_ERROR_UNEXPECTED;
 
 	if (status == DC_OK)
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_types.h b/drivers/gpu/drm/amd/dal/dc/dc_types.h
index db7608e..b6526e9 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_types.h
@@ -672,14 +672,6 @@ struct dc_csc_adjustments {
 	struct fixed31_32 hue;
 };
 
-enum dc_encoder_result {
-	ENCODER_RESULT_OK,
-	ENCODER_RESULT_ERROR,
-	ENCODER_RESULT_NOBANDWIDTH,
-	ENCODER_RESULT_SINKCONNECTIVITYCHANGED
-#endif
-};
-
 #include "dc_temp.h"
 
 #endif /* DC_TYPES_H_ */
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
index cf6da5a..63e8c47 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.c
@@ -640,7 +640,7 @@ static bool is_panel_powered_on(struct dce110_link_encoder *enc110)
  * @brief
  * eDP only. Control the power of the eDP panel.
  */
-static enum dc_encoder_result link_encoder_edp_power_control(
+static bool link_encoder_edp_power_control(
 	struct dce110_link_encoder *enc110,
 	bool power_up)
 {
@@ -651,7 +651,7 @@ static enum dc_encoder_result link_encoder_edp_power_control(
 	if (dal_graphics_object_id_get_connector_id(enc110->base.connector) !=
 		CONNECTOR_ID_EDP) {
 		BREAK_TO_DEBUGGER();
-		return ENCODER_RESULT_ERROR;
+		return false;
 	}
 
 	if ((power_up && !is_panel_powered_on(enc110)) ||
@@ -694,7 +694,7 @@ static enum dc_encoder_result link_encoder_edp_power_control(
 				__func__, (power_up ? "On":"Off"));
 	}
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 /*
@@ -810,7 +810,7 @@ static bool is_panel_backlight_on(struct dce110_link_encoder *enc110)
  * @brief
  * eDP only. Control the backlight of the eDP panel
  */
-static enum dc_encoder_result link_encoder_edp_backlight_control(
+static bool link_encoder_edp_backlight_control(
 	struct dce110_link_encoder *enc110,
 	bool enable)
 {
@@ -820,7 +820,7 @@ static enum dc_encoder_result link_encoder_edp_backlight_control(
 	if (dal_graphics_object_id_get_connector_id(enc110->base.connector)
 		!= CONNECTOR_ID_EDP) {
 		BREAK_TO_DEBUGGER();
-		return ENCODER_RESULT_ERROR;
+		return false;
 	}
 
 	if (enable && is_panel_backlight_on(enc110)) {
@@ -829,7 +829,7 @@ static enum dc_encoder_result link_encoder_edp_backlight_control(
 				LOG_MINOR_HW_TRACE_RESUME_S3,
 				"%s: panel already powered up. Do nothing.\n",
 				__func__);
-		return ENCODER_RESULT_OK;
+		return true;
 	}
 
 	if (!enable && !is_panel_powered_on(enc110)) {
@@ -838,7 +838,7 @@ static enum dc_encoder_result link_encoder_edp_backlight_control(
 				LOG_MINOR_HW_TRACE_RESUME_S3,
 				"%s: panel already powered down. Do nothing.\n",
 				__func__);
-		return ENCODER_RESULT_OK;
+		return true;
 	}
 
 	/* Send VBIOS command to control eDP panel backlight */
@@ -875,7 +875,7 @@ static enum dc_encoder_result link_encoder_edp_backlight_control(
 		dal_adapter_service_get_bios_parser(
 			enc110->base.adapter_service), &cntl);
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 static bool is_dig_enabled(const struct dce110_link_encoder *enc110)
@@ -1239,7 +1239,7 @@ void dce110_link_encoder_destroy(struct link_encoder **enc)
 	*enc = NULL;
 }
 
-enum dc_encoder_result dce110_link_encoder_validate_output_with_stream(
+bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
 	const struct core_stream *stream)
 {
@@ -1282,10 +1282,10 @@ enum dc_encoder_result dce110_link_encoder_validate_output_with_stream(
 	break;
 	}
 
-	return is_valid ? ENCODER_RESULT_OK : ENCODER_RESULT_ERROR;
+	return is_valid;
 }
 
-enum dc_encoder_result dce110_link_encoder_power_up(
+bool dce110_link_encoder_power_up(
 	struct link_encoder *enc)
 {
 	struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
@@ -1314,7 +1314,7 @@ enum dc_encoder_result dce110_link_encoder_power_up(
 			"%s: Failed to execute VBIOS command table!\n",
 			__func__);
 		BREAK_TO_DEBUGGER();
-		return ENCODER_RESULT_ERROR;
+		return false;
 	}
 
 	if (enc110->base.connector.id == CONNECTOR_ID_LVDS) {
@@ -1342,7 +1342,7 @@ enum dc_encoder_result dce110_link_encoder_power_up(
 	 * So this routine must be called first. */
 	hpd_initialize(enc110);
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 void dce110_link_encoder_setup(
@@ -1386,47 +1386,47 @@ void dce110_link_encoder_setup(
 	dal_write_reg(ctx, addr, value);
 }
 
-enum dc_encoder_result dce110_link_encoder_enable_tmds_output(
+bool dce110_link_encoder_enable_tmds_output(
 	struct link_encoder *enc,
 	enum clock_source_id clock_source,
 	enum dc_color_depth color_depth,
 	uint32_t pixel_clock)
 {
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
-enum dc_encoder_result dce110_link_encoder_enable_dual_link_tmds_output(
+bool dce110_link_encoder_enable_dual_link_tmds_output(
 	struct link_encoder *enc,
 	enum clock_source_id clock_source,
 	enum dc_color_depth color_depth,
 	uint32_t pixel_clock)
 {
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 /* enables DP PHY output */
-enum dc_encoder_result dce110_link_encoder_enable_dp_output(
+bool dce110_link_encoder_enable_dp_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum clock_source_id clock_source)
 {
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 /* enables DP PHY output in MST mode */
-enum dc_encoder_result dce110_link_encoder_enable_dp_mst_output(
+bool dce110_link_encoder_enable_dp_mst_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum clock_source_id clock_source)
 {
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 /*
  * @brief
  * Disable transmitter and its encoder
  */
-enum dc_encoder_result dce110_link_encoder_disable_output(
+bool dce110_link_encoder_disable_output(
 	struct link_encoder *enc,
 	enum signal_type signal)
 {
@@ -1444,7 +1444,7 @@ enum dc_encoder_result dce110_link_encoder_disable_output(
 		dal_adapter_service_should_optimize(
 			enc110->base.adapter_service,
 			OF_SKIP_POWER_DOWN_INACTIVE_ENCODER)) {
-		return ENCODER_RESULT_OK;
+		return true;
 	}
 	/* Power-down RX and disable GPU PHY should be paired.
 	 * Disabling PHY without powering down RX may cause
@@ -1485,10 +1485,10 @@ enum dc_encoder_result dce110_link_encoder_disable_output(
 				link_enc, false); */
 	}
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
-enum dc_encoder_result dce110_link_encoder_dp_set_lane_settings(
+bool dce110_link_encoder_dp_set_lane_settings(
 	struct link_encoder *enc,
 	const struct link_training_settings *link_settings)
 {
@@ -1499,7 +1499,7 @@ enum dc_encoder_result dce110_link_encoder_dp_set_lane_settings(
 
 	if (!link_settings) {
 		BREAK_TO_DEBUGGER();
-		return ENCODER_RESULT_ERROR;
+		return false;
 	}
 
 	cntl.action = TRANSMITTER_CONTROL_SET_VOLTAGE_AND_PREEMPASIS;
@@ -1537,7 +1537,7 @@ enum dc_encoder_result dce110_link_encoder_dp_set_lane_settings(
 				enc110->base.adapter_service), &cntl);
 	}
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 /* set DP PHY test and training patterns */
@@ -1848,7 +1848,7 @@ void dce110_link_encoder_set_lcd_backlight_level(
  * Configure digital transmitter and enable both encoder and transmitter
  * Actual output will be available after calling unblank()
  */
-enum dc_encoder_result dce110_link_encoder_enable_output(
+bool dce110_link_encoder_enable_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum engine_id engine,
@@ -1905,7 +1905,7 @@ enum dc_encoder_result dce110_link_encoder_enable_output(
 			enc110->base.adapter_service),
 		&cntl);
 
-	return ENCODER_RESULT_OK;
+	return true;
 }
 
 void dce110_link_encoder_connect_dig_be_to_fe(
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.h b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.h
index 064e50c..334cc1f 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.h
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_link_encoder.h
@@ -46,14 +46,14 @@ struct link_encoder *dce110_link_encoder_create(
 
 void dce110_link_encoder_destroy(struct link_encoder **enc);
 
-enum dc_encoder_result dce110_link_encoder_validate_output_with_stream(
+bool dce110_link_encoder_validate_output_with_stream(
 	struct link_encoder *enc,
 	const struct core_stream *stream);
 
 /****************** HW programming ************************/
 
 /* initialize HW */  /* why do we initialze aux in here? */
-enum dc_encoder_result dce110_link_encoder_power_up(struct link_encoder *enc);
+bool dce110_link_encoder_power_up(struct link_encoder *enc);
 
 /* program DIG_MODE in DIG_BE */
 /* TODO can this be combined with enable_output? */
@@ -63,7 +63,7 @@ void dce110_link_encoder_setup(
 
 /* enables TMDS PHY output */
 /* TODO: still need depth or just pass in adjusted pixel clock? */
-enum dc_encoder_result dce110_link_encoder_enable_tmds_output(
+bool dce110_link_encoder_enable_tmds_output(
 	struct link_encoder *enc,
 	enum clock_source_id clock_source,
 	enum dc_color_depth color_depth,
@@ -71,31 +71,31 @@ enum dc_encoder_result dce110_link_encoder_enable_tmds_output(
 
 /* enables TMDS PHY output */
 /* TODO: still need this or just pass in adjusted pixel clock? */
-enum dc_encoder_result dce110_link_encoder_enable_dual_link_tmds_output(
+bool dce110_link_encoder_enable_dual_link_tmds_output(
 	struct link_encoder *enc,
 	enum clock_source_id clock_source,
 	enum dc_color_depth color_depth,
 	uint32_t pixel_clock);
 
 /* enables DP PHY output */
-enum dc_encoder_result dce110_link_encoder_enable_dp_output(
+bool dce110_link_encoder_enable_dp_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum clock_source_id clock_source);
 
 /* enables DP PHY output in MST mode */
-enum dc_encoder_result dce110_link_encoder_enable_dp_mst_output(
+bool dce110_link_encoder_enable_dp_mst_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum clock_source_id clock_source);
 
 /* disable PHY output */
-enum dc_encoder_result dce110_link_encoder_disable_output(
+bool dce110_link_encoder_disable_output(
 	struct link_encoder *enc,
 	enum signal_type signal);
 
 /* set DP lane settings */
-enum dc_encoder_result dce110_link_encoder_dp_set_lane_settings(
+bool dce110_link_encoder_dp_set_lane_settings(
 	struct link_encoder *enc,
 	const struct link_training_settings *link_settings);
 
@@ -112,7 +112,7 @@ void dce110_link_encoder_set_lcd_backlight_level(
 	struct link_encoder *enc,
 	uint32_t level);
 
-enum dc_encoder_result dce110_link_encoder_enable_output(
+bool dce110_link_encoder_enable_output(
 	struct link_encoder *enc,
 	const struct link_settings *link_settings,
 	enum engine_id engine,
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 6ad681b..e206802 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c
@@ -474,10 +474,9 @@ static enum dc_status validate_mapped_resource(
 				return DC_FAIL_CONTROLLER_VALIDATE;
 
 
-			if (dce110_link_encoder_validate_output_with_stream(
+			if (!dce110_link_encoder_validate_output_with_stream(
 					link->link_enc,
-					stream)
-							!= ENCODER_RESULT_OK)
+					stream))
 				return DC_FAIL_ENC_VALIDATE;
 
 			/* TODO: validate audio ASIC caps, encoder */
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 c4151c1..e414021 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw_sequencer.h
@@ -90,10 +90,10 @@ struct hw_sequencer_funcs {
 
 	void (*encoder_destroy)(struct link_encoder **enc);
 
-	enum dc_encoder_result (*encoder_power_up)(
+	bool (*encoder_power_up)(
 					struct link_encoder *enc);
 
-	enum dc_encoder_result (*encoder_enable_output)(
+	bool (*encoder_enable_output)(
 					struct link_encoder *enc,
 					const struct link_settings *link_settings,
 					enum engine_id engine,
@@ -102,7 +102,7 @@ struct hw_sequencer_funcs {
 					enum dc_color_depth color_depth,
 					uint32_t pixel_clock);
 
-	enum dc_encoder_result (*encoder_disable_output)(
+	bool (*encoder_disable_output)(
 					struct link_encoder *enc,
 					enum signal_type signal);
 
@@ -110,7 +110,7 @@ struct hw_sequencer_funcs {
 					struct link_encoder *enc,
 					const struct encoder_set_dp_phy_pattern_param *param);
 
-	enum dc_encoder_result (*encoder_dp_set_lane_settings)(
+	bool (*encoder_dp_set_lane_settings)(
 					struct link_encoder *enc,
 					const struct link_training_settings *link_settings);
 
-- 
2.7.4