diff options
author | Yue Hin Lau <Yuehin.Lau@amd.com> | 2017-11-22 16:48:35 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-14 10:57:29 -0500 |
commit | 40e045a9733f3c032ff957d9663c106c82fd5343 (patch) | |
tree | f04e43baa02270fdd7feebf3113474384138292d | |
parent | 79086a55defa83c0735c5a3ee30e573f5076eb66 (diff) |
drm/amd/display: OPTC cleanup/implementation
Signed-off-by: Yue Hin Lau <Yuehin.Lau@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>
4 files changed, 244 insertions, 174 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 39a4d1a86583..7ec87fcb22be 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | |||
@@ -159,7 +159,7 @@ void dcn10_log_hw_state(struct dc *dc) | |||
159 | struct timing_generator *tg = pool->timing_generators[i]; | 159 | struct timing_generator *tg = pool->timing_generators[i]; |
160 | struct dcn_otg_state s = {0}; | 160 | struct dcn_otg_state s = {0}; |
161 | 161 | ||
162 | tgn10_read_otg_state(DCN10TG_FROM_TG(tg), &s); | 162 | optc1_read_otg_state(DCN10TG_FROM_TG(tg), &s); |
163 | 163 | ||
164 | //only print if OTG master is enabled | 164 | //only print if OTG master is enabled |
165 | if ((s.otg_enabled & 1) == 0) | 165 | if ((s.otg_enabled & 1) == 0) |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c index a9a5d176cb70..65ce96ba6443 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | |||
@@ -348,18 +348,18 @@ static const struct dcn_mpc_mask mpc_mask = { | |||
348 | #define tg_regs(id)\ | 348 | #define tg_regs(id)\ |
349 | [id] = {TG_COMMON_REG_LIST_DCN1_0(id)} | 349 | [id] = {TG_COMMON_REG_LIST_DCN1_0(id)} |
350 | 350 | ||
351 | static const struct dcn_tg_registers tg_regs[] = { | 351 | static const struct dcn_optc_registers tg_regs[] = { |
352 | tg_regs(0), | 352 | tg_regs(0), |
353 | tg_regs(1), | 353 | tg_regs(1), |
354 | tg_regs(2), | 354 | tg_regs(2), |
355 | tg_regs(3), | 355 | tg_regs(3), |
356 | }; | 356 | }; |
357 | 357 | ||
358 | static const struct dcn_tg_shift tg_shift = { | 358 | static const struct dcn_optc_shift tg_shift = { |
359 | TG_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT) | 359 | TG_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT) |
360 | }; | 360 | }; |
361 | 361 | ||
362 | static const struct dcn_tg_mask tg_mask = { | 362 | static const struct dcn_optc_mask tg_mask = { |
363 | TG_COMMON_MASK_SH_LIST_DCN1_0(_MASK) | 363 | TG_COMMON_MASK_SH_LIST_DCN1_0(_MASK) |
364 | }; | 364 | }; |
365 | 365 | ||
@@ -553,8 +553,8 @@ static struct timing_generator *dcn10_timing_generator_create( | |||
553 | struct dc_context *ctx, | 553 | struct dc_context *ctx, |
554 | uint32_t instance) | 554 | uint32_t instance) |
555 | { | 555 | { |
556 | struct dcn10_timing_generator *tgn10 = | 556 | struct optc *tgn10 = |
557 | kzalloc(sizeof(struct dcn10_timing_generator), GFP_KERNEL); | 557 | kzalloc(sizeof(struct optc), GFP_KERNEL); |
558 | 558 | ||
559 | if (!tgn10) | 559 | if (!tgn10) |
560 | return NULL; | 560 | return NULL; |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c index 4940fdbc6e80..f73752c7de1a 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c | |||
@@ -28,14 +28,14 @@ | |||
28 | #include "dc.h" | 28 | #include "dc.h" |
29 | 29 | ||
30 | #define REG(reg)\ | 30 | #define REG(reg)\ |
31 | tgn10->tg_regs->reg | 31 | optc1->tg_regs->reg |
32 | 32 | ||
33 | #define CTX \ | 33 | #define CTX \ |
34 | tgn10->base.ctx | 34 | optc1->base.ctx |
35 | 35 | ||
36 | #undef FN | 36 | #undef FN |
37 | #define FN(reg_name, field_name) \ | 37 | #define FN(reg_name, field_name) \ |
38 | tgn10->tg_shift->field_name, tgn10->tg_mask->field_name | 38 | optc1->tg_shift->field_name, optc1->tg_mask->field_name |
39 | 39 | ||
40 | #define STATIC_SCREEN_EVENT_MASK_RANGETIMING_DOUBLE_BUFFER_UPDATE_EN 0x100 | 40 | #define STATIC_SCREEN_EVENT_MASK_RANGETIMING_DOUBLE_BUFFER_UPDATE_EN 0x100 |
41 | 41 | ||
@@ -45,8 +45,8 @@ | |||
45 | * This is a workaround for a bug that has existed since R5xx and has not been | 45 | * This is a workaround for a bug that has existed since R5xx and has not been |
46 | * fixed keep Front porch at minimum 2 for Interlaced mode or 1 for progressive. | 46 | * fixed keep Front porch at minimum 2 for Interlaced mode or 1 for progressive. |
47 | */ | 47 | */ |
48 | static void tgn10_apply_front_porch_workaround( | 48 | static void optc1_apply_front_porch_workaround( |
49 | struct timing_generator *tg, | 49 | struct timing_generator *optc, |
50 | struct dc_crtc_timing *timing) | 50 | struct dc_crtc_timing *timing) |
51 | { | 51 | { |
52 | if (timing->flags.INTERLACE == 1) { | 52 | if (timing->flags.INTERLACE == 1) { |
@@ -58,30 +58,30 @@ static void tgn10_apply_front_porch_workaround( | |||
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | static void tgn10_program_global_sync( | 61 | void optc1_program_global_sync( |
62 | struct timing_generator *tg) | 62 | struct timing_generator *optc) |
63 | { | 63 | { |
64 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 64 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
65 | 65 | ||
66 | if (tg->dlg_otg_param.vstartup_start == 0) { | 66 | if (optc->dlg_otg_param.vstartup_start == 0) { |
67 | BREAK_TO_DEBUGGER(); | 67 | BREAK_TO_DEBUGGER(); |
68 | return; | 68 | return; |
69 | } | 69 | } |
70 | 70 | ||
71 | REG_SET(OTG_VSTARTUP_PARAM, 0, | 71 | REG_SET(OTG_VSTARTUP_PARAM, 0, |
72 | VSTARTUP_START, tg->dlg_otg_param.vstartup_start); | 72 | VSTARTUP_START, optc->dlg_otg_param.vstartup_start); |
73 | 73 | ||
74 | REG_SET_2(OTG_VUPDATE_PARAM, 0, | 74 | REG_SET_2(OTG_VUPDATE_PARAM, 0, |
75 | VUPDATE_OFFSET, tg->dlg_otg_param.vupdate_offset, | 75 | VUPDATE_OFFSET, optc->dlg_otg_param.vupdate_offset, |
76 | VUPDATE_WIDTH, tg->dlg_otg_param.vupdate_width); | 76 | VUPDATE_WIDTH, optc->dlg_otg_param.vupdate_width); |
77 | 77 | ||
78 | REG_SET(OTG_VREADY_PARAM, 0, | 78 | REG_SET(OTG_VREADY_PARAM, 0, |
79 | VREADY_OFFSET, tg->dlg_otg_param.vready_offset); | 79 | VREADY_OFFSET, optc->dlg_otg_param.vready_offset); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void tgn10_disable_stereo(struct timing_generator *tg) | 82 | static void optc1_disable_stereo(struct timing_generator *optc) |
83 | { | 83 | { |
84 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 84 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
85 | 85 | ||
86 | REG_SET(OTG_STEREO_CONTROL, 0, | 86 | REG_SET(OTG_STEREO_CONTROL, 0, |
87 | OTG_STEREO_EN, 0); | 87 | OTG_STEREO_EN, 0); |
@@ -102,8 +102,8 @@ static void tgn10_disable_stereo(struct timing_generator *tg) | |||
102 | * Program CRTC Timing Registers - OTG_H_*, OTG_V_*, Pixel repetition. | 102 | * Program CRTC Timing Registers - OTG_H_*, OTG_V_*, Pixel repetition. |
103 | * Including SYNC. Call BIOS command table to program Timings. | 103 | * Including SYNC. Call BIOS command table to program Timings. |
104 | */ | 104 | */ |
105 | static void tgn10_program_timing( | 105 | void optc1_program_timing( |
106 | struct timing_generator *tg, | 106 | struct timing_generator *optc, |
107 | const struct dc_crtc_timing *dc_crtc_timing, | 107 | const struct dc_crtc_timing *dc_crtc_timing, |
108 | bool use_vbios) | 108 | bool use_vbios) |
109 | { | 109 | { |
@@ -121,10 +121,10 @@ static void tgn10_program_timing( | |||
121 | uint32_t h_div_2; | 121 | uint32_t h_div_2; |
122 | int32_t vertical_line_start; | 122 | int32_t vertical_line_start; |
123 | 123 | ||
124 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 124 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
125 | 125 | ||
126 | patched_crtc_timing = *dc_crtc_timing; | 126 | patched_crtc_timing = *dc_crtc_timing; |
127 | tgn10_apply_front_porch_workaround(tg, &patched_crtc_timing); | 127 | optc1_apply_front_porch_workaround(optc, &patched_crtc_timing); |
128 | 128 | ||
129 | /* Load horizontal timing */ | 129 | /* Load horizontal timing */ |
130 | 130 | ||
@@ -217,7 +217,7 @@ static void tgn10_program_timing( | |||
217 | /* Use OTG_VERTICAL_INTERRUPT2 replace VUPDATE interrupt, | 217 | /* Use OTG_VERTICAL_INTERRUPT2 replace VUPDATE interrupt, |
218 | * program the reg for interrupt postition. | 218 | * program the reg for interrupt postition. |
219 | */ | 219 | */ |
220 | vertical_line_start = asic_blank_end - tg->dlg_otg_param.vstartup_start + 1; | 220 | vertical_line_start = asic_blank_end - optc->dlg_otg_param.vstartup_start + 1; |
221 | if (vertical_line_start < 0) { | 221 | if (vertical_line_start < 0) { |
222 | ASSERT(0); | 222 | ASSERT(0); |
223 | vertical_line_start = 0; | 223 | vertical_line_start = 0; |
@@ -233,23 +233,23 @@ static void tgn10_program_timing( | |||
233 | OTG_V_SYNC_A_POL, v_sync_polarity); | 233 | OTG_V_SYNC_A_POL, v_sync_polarity); |
234 | 234 | ||
235 | v_init = asic_blank_start; | 235 | v_init = asic_blank_start; |
236 | if (tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT || | 236 | if (optc->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT || |
237 | tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT_MST || | 237 | optc->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT_MST || |
238 | tg->dlg_otg_param.signal == SIGNAL_TYPE_EDP) { | 238 | optc->dlg_otg_param.signal == SIGNAL_TYPE_EDP) { |
239 | start_point = 1; | 239 | start_point = 1; |
240 | if (patched_crtc_timing.flags.INTERLACE == 1) | 240 | if (patched_crtc_timing.flags.INTERLACE == 1) |
241 | field_num = 1; | 241 | field_num = 1; |
242 | } | 242 | } |
243 | v_fp2 = 0; | 243 | v_fp2 = 0; |
244 | if (tg->dlg_otg_param.vstartup_start > asic_blank_end) | 244 | if (optc->dlg_otg_param.vstartup_start > asic_blank_end) |
245 | v_fp2 = tg->dlg_otg_param.vstartup_start > asic_blank_end; | 245 | v_fp2 = optc->dlg_otg_param.vstartup_start > asic_blank_end; |
246 | 246 | ||
247 | /* Interlace */ | 247 | /* Interlace */ |
248 | if (patched_crtc_timing.flags.INTERLACE == 1) { | 248 | if (patched_crtc_timing.flags.INTERLACE == 1) { |
249 | REG_UPDATE(OTG_INTERLACE_CONTROL, | 249 | REG_UPDATE(OTG_INTERLACE_CONTROL, |
250 | OTG_INTERLACE_ENABLE, 1); | 250 | OTG_INTERLACE_ENABLE, 1); |
251 | v_init = v_init / 2; | 251 | v_init = v_init / 2; |
252 | if ((tg->dlg_otg_param.vstartup_start/2)*2 > asic_blank_end) | 252 | if ((optc->dlg_otg_param.vstartup_start/2)*2 > asic_blank_end) |
253 | v_fp2 = v_fp2 / 2; | 253 | v_fp2 = v_fp2 / 2; |
254 | } | 254 | } |
255 | else | 255 | else |
@@ -270,13 +270,13 @@ static void tgn10_program_timing( | |||
270 | OTG_START_POINT_CNTL, start_point, | 270 | OTG_START_POINT_CNTL, start_point, |
271 | OTG_FIELD_NUMBER_CNTL, field_num); | 271 | OTG_FIELD_NUMBER_CNTL, field_num); |
272 | 272 | ||
273 | tgn10_program_global_sync(tg); | 273 | optc1_program_global_sync(optc); |
274 | 274 | ||
275 | /* TODO | 275 | /* TODO |
276 | * patched_crtc_timing.flags.HORZ_COUNT_BY_TWO == 1 | 276 | * patched_crtc_timing.flags.HORZ_COUNT_BY_TWO == 1 |
277 | * program_horz_count_by_2 | 277 | * program_horz_count_by_2 |
278 | * for DVI 30bpp mode, 0 otherwise | 278 | * for DVI 30bpp mode, 0 otherwise |
279 | * program_horz_count_by_2(tg, &patched_crtc_timing); | 279 | * program_horz_count_by_2(optc, &patched_crtc_timing); |
280 | */ | 280 | */ |
281 | 281 | ||
282 | /* Enable stereo - only when we need to pack 3D frame. Other types | 282 | /* Enable stereo - only when we need to pack 3D frame. Other types |
@@ -290,9 +290,9 @@ static void tgn10_program_timing( | |||
290 | 290 | ||
291 | } | 291 | } |
292 | 292 | ||
293 | static void tgn10_set_blank_data_double_buffer(struct timing_generator *tg, bool enable) | 293 | static void optc1_set_blank_data_double_buffer(struct timing_generator *optc, bool enable) |
294 | { | 294 | { |
295 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 295 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
296 | 296 | ||
297 | uint32_t blank_data_double_buffer_enable = enable ? 1 : 0; | 297 | uint32_t blank_data_double_buffer_enable = enable ? 1 : 0; |
298 | 298 | ||
@@ -304,9 +304,9 @@ static void tgn10_set_blank_data_double_buffer(struct timing_generator *tg, bool | |||
304 | * unblank_crtc | 304 | * unblank_crtc |
305 | * Call ASIC Control Object to UnBlank CRTC. | 305 | * Call ASIC Control Object to UnBlank CRTC. |
306 | */ | 306 | */ |
307 | static void tgn10_unblank_crtc(struct timing_generator *tg) | 307 | static void optc1_unblank_crtc(struct timing_generator *optc) |
308 | { | 308 | { |
309 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 309 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
310 | uint32_t vertical_interrupt_enable = 0; | 310 | uint32_t vertical_interrupt_enable = 0; |
311 | 311 | ||
312 | REG_GET(OTG_VERTICAL_INTERRUPT2_CONTROL, | 312 | REG_GET(OTG_VERTICAL_INTERRUPT2_CONTROL, |
@@ -316,7 +316,7 @@ static void tgn10_unblank_crtc(struct timing_generator *tg) | |||
316 | * this check will be removed. | 316 | * this check will be removed. |
317 | */ | 317 | */ |
318 | if (vertical_interrupt_enable) | 318 | if (vertical_interrupt_enable) |
319 | tgn10_set_blank_data_double_buffer(tg, true); | 319 | optc1_set_blank_data_double_buffer(optc, true); |
320 | 320 | ||
321 | REG_UPDATE_2(OTG_BLANK_CONTROL, | 321 | REG_UPDATE_2(OTG_BLANK_CONTROL, |
322 | OTG_BLANK_DATA_EN, 0, | 322 | OTG_BLANK_DATA_EN, 0, |
@@ -328,29 +328,29 @@ static void tgn10_unblank_crtc(struct timing_generator *tg) | |||
328 | * Call ASIC Control Object to Blank CRTC. | 328 | * Call ASIC Control Object to Blank CRTC. |
329 | */ | 329 | */ |
330 | 330 | ||
331 | static void tgn10_blank_crtc(struct timing_generator *tg) | 331 | static void optc1_blank_crtc(struct timing_generator *optc) |
332 | { | 332 | { |
333 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 333 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
334 | 334 | ||
335 | REG_UPDATE_2(OTG_BLANK_CONTROL, | 335 | REG_UPDATE_2(OTG_BLANK_CONTROL, |
336 | OTG_BLANK_DATA_EN, 1, | 336 | OTG_BLANK_DATA_EN, 1, |
337 | OTG_BLANK_DE_MODE, 0); | 337 | OTG_BLANK_DE_MODE, 0); |
338 | 338 | ||
339 | tgn10_set_blank_data_double_buffer(tg, false); | 339 | optc1_set_blank_data_double_buffer(optc, false); |
340 | } | 340 | } |
341 | 341 | ||
342 | static void tgn10_set_blank(struct timing_generator *tg, | 342 | void optc1_set_blank(struct timing_generator *optc, |
343 | bool enable_blanking) | 343 | bool enable_blanking) |
344 | { | 344 | { |
345 | if (enable_blanking) | 345 | if (enable_blanking) |
346 | tgn10_blank_crtc(tg); | 346 | optc1_blank_crtc(optc); |
347 | else | 347 | else |
348 | tgn10_unblank_crtc(tg); | 348 | optc1_unblank_crtc(optc); |
349 | } | 349 | } |
350 | 350 | ||
351 | static bool tgn10_is_blanked(struct timing_generator *tg) | 351 | bool optc1_is_blanked(struct timing_generator *optc) |
352 | { | 352 | { |
353 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 353 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
354 | uint32_t blank_en; | 354 | uint32_t blank_en; |
355 | uint32_t blank_state; | 355 | uint32_t blank_state; |
356 | 356 | ||
@@ -361,9 +361,9 @@ static bool tgn10_is_blanked(struct timing_generator *tg) | |||
361 | return blank_en && blank_state; | 361 | return blank_en && blank_state; |
362 | } | 362 | } |
363 | 363 | ||
364 | static void tgn10_enable_optc_clock(struct timing_generator *tg, bool enable) | 364 | void optc1_enable_optc_clock(struct timing_generator *optc, bool enable) |
365 | { | 365 | { |
366 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 366 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
367 | 367 | ||
368 | if (enable) { | 368 | if (enable) { |
369 | REG_UPDATE_2(OPTC_INPUT_CLOCK_CONTROL, | 369 | REG_UPDATE_2(OPTC_INPUT_CLOCK_CONTROL, |
@@ -396,19 +396,19 @@ static void tgn10_enable_optc_clock(struct timing_generator *tg, bool enable) | |||
396 | * Enable CRTC | 396 | * Enable CRTC |
397 | * Enable CRTC - call ASIC Control Object to enable Timing generator. | 397 | * Enable CRTC - call ASIC Control Object to enable Timing generator. |
398 | */ | 398 | */ |
399 | static bool tgn10_enable_crtc(struct timing_generator *tg) | 399 | static bool optc1_enable_crtc(struct timing_generator *optc) |
400 | { | 400 | { |
401 | /* TODO FPGA wait for answer | 401 | /* TODO FPGA wait for answer |
402 | * OTG_MASTER_UPDATE_MODE != CRTC_MASTER_UPDATE_MODE | 402 | * OTG_MASTER_UPDATE_MODE != CRTC_MASTER_UPDATE_MODE |
403 | * OTG_MASTER_UPDATE_LOCK != CRTC_MASTER_UPDATE_LOCK | 403 | * OTG_MASTER_UPDATE_LOCK != CRTC_MASTER_UPDATE_LOCK |
404 | */ | 404 | */ |
405 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 405 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
406 | 406 | ||
407 | /* opp instance for OTG. For DCN1.0, ODM is remoed. | 407 | /* opp instance for OTG. For DCN1.0, ODM is remoed. |
408 | * OPP and OPTC should 1:1 mapping | 408 | * OPP and OPTC should 1:1 mapping |
409 | */ | 409 | */ |
410 | REG_UPDATE(OPTC_DATA_SOURCE_SELECT, | 410 | REG_UPDATE(OPTC_DATA_SOURCE_SELECT, |
411 | OPTC_SRC_SEL, tg->inst); | 411 | OPTC_SRC_SEL, optc->inst); |
412 | 412 | ||
413 | /* VTG enable first is for HW workaround */ | 413 | /* VTG enable first is for HW workaround */ |
414 | REG_UPDATE(CONTROL, | 414 | REG_UPDATE(CONTROL, |
@@ -423,9 +423,9 @@ static bool tgn10_enable_crtc(struct timing_generator *tg) | |||
423 | } | 423 | } |
424 | 424 | ||
425 | /* disable_crtc - call ASIC Control Object to disable Timing generator. */ | 425 | /* disable_crtc - call ASIC Control Object to disable Timing generator. */ |
426 | static bool tgn10_disable_crtc(struct timing_generator *tg) | 426 | bool optc1_disable_crtc(struct timing_generator *optc) |
427 | { | 427 | { |
428 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 428 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
429 | 429 | ||
430 | /* disable otg request until end of the first line | 430 | /* disable otg request until end of the first line |
431 | * in the vertical blank region | 431 | * in the vertical blank region |
@@ -446,11 +446,11 @@ static bool tgn10_disable_crtc(struct timing_generator *tg) | |||
446 | } | 446 | } |
447 | 447 | ||
448 | 448 | ||
449 | static void tgn10_program_blank_color( | 449 | void optc1_program_blank_color( |
450 | struct timing_generator *tg, | 450 | struct timing_generator *optc, |
451 | const struct tg_color *black_color) | 451 | const struct tg_color *black_color) |
452 | { | 452 | { |
453 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 453 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
454 | 454 | ||
455 | REG_SET_3(OTG_BLACK_COLOR, 0, | 455 | REG_SET_3(OTG_BLACK_COLOR, 0, |
456 | OTG_BLACK_COLOR_B_CB, black_color->color_b_cb, | 456 | OTG_BLACK_COLOR_B_CB, black_color->color_b_cb, |
@@ -458,15 +458,15 @@ static void tgn10_program_blank_color( | |||
458 | OTG_BLACK_COLOR_R_CR, black_color->color_r_cr); | 458 | OTG_BLACK_COLOR_R_CR, black_color->color_r_cr); |
459 | } | 459 | } |
460 | 460 | ||
461 | static bool tgn10_validate_timing( | 461 | bool optc1_validate_timing( |
462 | struct timing_generator *tg, | 462 | struct timing_generator *optc, |
463 | const struct dc_crtc_timing *timing) | 463 | const struct dc_crtc_timing *timing) |
464 | { | 464 | { |
465 | uint32_t interlace_factor; | 465 | uint32_t interlace_factor; |
466 | uint32_t v_blank; | 466 | uint32_t v_blank; |
467 | uint32_t h_blank; | 467 | uint32_t h_blank; |
468 | uint32_t min_v_blank; | 468 | uint32_t min_v_blank; |
469 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 469 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
470 | 470 | ||
471 | ASSERT(timing != NULL); | 471 | ASSERT(timing != NULL); |
472 | 472 | ||
@@ -496,19 +496,19 @@ static bool tgn10_validate_timing( | |||
496 | * needs more than 8192 horizontal and | 496 | * needs more than 8192 horizontal and |
497 | * more than 8192 vertical total pixels) | 497 | * more than 8192 vertical total pixels) |
498 | */ | 498 | */ |
499 | if (timing->h_total > tgn10->max_h_total || | 499 | if (timing->h_total > optc1->max_h_total || |
500 | timing->v_total > tgn10->max_v_total) | 500 | timing->v_total > optc1->max_v_total) |
501 | return false; | 501 | return false; |
502 | 502 | ||
503 | 503 | ||
504 | if (h_blank < tgn10->min_h_blank) | 504 | if (h_blank < optc1->min_h_blank) |
505 | return false; | 505 | return false; |
506 | 506 | ||
507 | if (timing->h_sync_width < tgn10->min_h_sync_width || | 507 | if (timing->h_sync_width < optc1->min_h_sync_width || |
508 | timing->v_sync_width < tgn10->min_v_sync_width) | 508 | timing->v_sync_width < optc1->min_v_sync_width) |
509 | return false; | 509 | return false; |
510 | 510 | ||
511 | min_v_blank = timing->flags.INTERLACE?tgn10->min_v_blank_interlace:tgn10->min_v_blank; | 511 | min_v_blank = timing->flags.INTERLACE?optc1->min_v_blank_interlace:optc1->min_v_blank; |
512 | 512 | ||
513 | if (v_blank < min_v_blank) | 513 | if (v_blank < min_v_blank) |
514 | return false; | 514 | return false; |
@@ -525,15 +525,15 @@ static bool tgn10_validate_timing( | |||
525 | * holds the counter of frames. | 525 | * holds the counter of frames. |
526 | * | 526 | * |
527 | * @param | 527 | * @param |
528 | * struct timing_generator *tg - [in] timing generator which controls the | 528 | * struct timing_generator *optc - [in] timing generator which controls the |
529 | * desired CRTC | 529 | * desired CRTC |
530 | * | 530 | * |
531 | * @return | 531 | * @return |
532 | * Counter of frames, which should equal to number of vblanks. | 532 | * Counter of frames, which should equal to number of vblanks. |
533 | */ | 533 | */ |
534 | static uint32_t tgn10_get_vblank_counter(struct timing_generator *tg) | 534 | uint32_t optc1_get_vblank_counter(struct timing_generator *optc) |
535 | { | 535 | { |
536 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 536 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
537 | uint32_t frame_count; | 537 | uint32_t frame_count; |
538 | 538 | ||
539 | REG_GET(OTG_STATUS_FRAME_COUNT, | 539 | REG_GET(OTG_STATUS_FRAME_COUNT, |
@@ -542,34 +542,34 @@ static uint32_t tgn10_get_vblank_counter(struct timing_generator *tg) | |||
542 | return frame_count; | 542 | return frame_count; |
543 | } | 543 | } |
544 | 544 | ||
545 | static void tgn10_lock(struct timing_generator *tg) | 545 | void optc1_lock(struct timing_generator *optc) |
546 | { | 546 | { |
547 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 547 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
548 | 548 | ||
549 | REG_SET(OTG_GLOBAL_CONTROL0, 0, | 549 | REG_SET(OTG_GLOBAL_CONTROL0, 0, |
550 | OTG_MASTER_UPDATE_LOCK_SEL, tg->inst); | 550 | OTG_MASTER_UPDATE_LOCK_SEL, optc->inst); |
551 | REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | 551 | REG_SET(OTG_MASTER_UPDATE_LOCK, 0, |
552 | OTG_MASTER_UPDATE_LOCK, 1); | 552 | OTG_MASTER_UPDATE_LOCK, 1); |
553 | 553 | ||
554 | /* Should be fast, status does not update on maximus */ | 554 | /* Should be fast, status does not update on maximus */ |
555 | if (tg->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS) | 555 | if (optc->ctx->dce_environment != DCE_ENV_FPGA_MAXIMUS) |
556 | REG_WAIT(OTG_MASTER_UPDATE_LOCK, | 556 | REG_WAIT(OTG_MASTER_UPDATE_LOCK, |
557 | UPDATE_LOCK_STATUS, 1, | 557 | UPDATE_LOCK_STATUS, 1, |
558 | 1, 10); | 558 | 1, 10); |
559 | } | 559 | } |
560 | 560 | ||
561 | static void tgn10_unlock(struct timing_generator *tg) | 561 | void optc1_unlock(struct timing_generator *optc) |
562 | { | 562 | { |
563 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 563 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
564 | 564 | ||
565 | REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | 565 | REG_SET(OTG_MASTER_UPDATE_LOCK, 0, |
566 | OTG_MASTER_UPDATE_LOCK, 0); | 566 | OTG_MASTER_UPDATE_LOCK, 0); |
567 | } | 567 | } |
568 | 568 | ||
569 | static void tgn10_get_position(struct timing_generator *tg, | 569 | void optc1_get_position(struct timing_generator *optc, |
570 | struct crtc_position *position) | 570 | struct crtc_position *position) |
571 | { | 571 | { |
572 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 572 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
573 | 573 | ||
574 | REG_GET_2(OTG_STATUS_POSITION, | 574 | REG_GET_2(OTG_STATUS_POSITION, |
575 | OTG_HORZ_COUNT, &position->horizontal_count, | 575 | OTG_HORZ_COUNT, &position->horizontal_count, |
@@ -579,12 +579,12 @@ static void tgn10_get_position(struct timing_generator *tg, | |||
579 | OTG_VERT_COUNT_NOM, &position->nominal_vcount); | 579 | OTG_VERT_COUNT_NOM, &position->nominal_vcount); |
580 | } | 580 | } |
581 | 581 | ||
582 | static bool tgn10_is_counter_moving(struct timing_generator *tg) | 582 | bool optc1_is_counter_moving(struct timing_generator *optc) |
583 | { | 583 | { |
584 | struct crtc_position position1, position2; | 584 | struct crtc_position position1, position2; |
585 | 585 | ||
586 | tg->funcs->get_position(tg, &position1); | 586 | optc->funcs->get_position(optc, &position1); |
587 | tg->funcs->get_position(tg, &position2); | 587 | optc->funcs->get_position(optc, &position2); |
588 | 588 | ||
589 | if (position1.horizontal_count == position2.horizontal_count && | 589 | if (position1.horizontal_count == position2.horizontal_count && |
590 | position1.vertical_count == position2.vertical_count) | 590 | position1.vertical_count == position2.vertical_count) |
@@ -593,10 +593,10 @@ static bool tgn10_is_counter_moving(struct timing_generator *tg) | |||
593 | return true; | 593 | return true; |
594 | } | 594 | } |
595 | 595 | ||
596 | static bool tgn10_did_triggered_reset_occur( | 596 | bool optc1_did_triggered_reset_occur( |
597 | struct timing_generator *tg) | 597 | struct timing_generator *optc) |
598 | { | 598 | { |
599 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 599 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
600 | uint32_t occurred_force, occurred_vsync; | 600 | uint32_t occurred_force, occurred_vsync; |
601 | 601 | ||
602 | REG_GET(OTG_FORCE_COUNT_NOW_CNTL, | 602 | REG_GET(OTG_FORCE_COUNT_NOW_CNTL, |
@@ -608,9 +608,9 @@ static bool tgn10_did_triggered_reset_occur( | |||
608 | return occurred_vsync != 0 || occurred_force != 0; | 608 | return occurred_vsync != 0 || occurred_force != 0; |
609 | } | 609 | } |
610 | 610 | ||
611 | static void tgn10_disable_reset_trigger(struct timing_generator *tg) | 611 | void optc1_disable_reset_trigger(struct timing_generator *optc) |
612 | { | 612 | { |
613 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 613 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
614 | 614 | ||
615 | REG_WRITE(OTG_TRIGA_CNTL, 0); | 615 | REG_WRITE(OTG_TRIGA_CNTL, 0); |
616 | 616 | ||
@@ -621,9 +621,9 @@ static void tgn10_disable_reset_trigger(struct timing_generator *tg) | |||
621 | OTG_FORCE_VSYNC_NEXT_LINE_CLEAR, 1); | 621 | OTG_FORCE_VSYNC_NEXT_LINE_CLEAR, 1); |
622 | } | 622 | } |
623 | 623 | ||
624 | static void tgn10_enable_reset_trigger(struct timing_generator *tg, int source_tg_inst) | 624 | void optc1_enable_reset_trigger(struct timing_generator *optc, int source_tg_inst) |
625 | { | 625 | { |
626 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 626 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
627 | uint32_t falling_edge; | 627 | uint32_t falling_edge; |
628 | 628 | ||
629 | REG_GET(OTG_V_SYNC_A_CNTL, | 629 | REG_GET(OTG_V_SYNC_A_CNTL, |
@@ -655,12 +655,12 @@ static void tgn10_enable_reset_trigger(struct timing_generator *tg, int source_t | |||
655 | OTG_FORCE_COUNT_NOW_MODE, 2); | 655 | OTG_FORCE_COUNT_NOW_MODE, 2); |
656 | } | 656 | } |
657 | 657 | ||
658 | void tgn10_enable_crtc_reset( | 658 | void optc1_enable_crtc_reset( |
659 | struct timing_generator *tg, | 659 | struct timing_generator *optc, |
660 | int source_tg_inst, | 660 | int source_tg_inst, |
661 | struct crtc_trigger_info *crtc_tp) | 661 | struct crtc_trigger_info *crtc_tp) |
662 | { | 662 | { |
663 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 663 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
664 | uint32_t falling_edge = 0; | 664 | uint32_t falling_edge = 0; |
665 | uint32_t rising_edge = 0; | 665 | uint32_t rising_edge = 0; |
666 | 666 | ||
@@ -700,10 +700,10 @@ void tgn10_enable_crtc_reset( | |||
700 | } | 700 | } |
701 | } | 701 | } |
702 | 702 | ||
703 | static void tgn10_wait_for_state(struct timing_generator *tg, | 703 | void optc1_wait_for_state(struct timing_generator *optc, |
704 | enum crtc_state state) | 704 | enum crtc_state state) |
705 | { | 705 | { |
706 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 706 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
707 | 707 | ||
708 | switch (state) { | 708 | switch (state) { |
709 | case CRTC_STATE_VBLANK: | 709 | case CRTC_STATE_VBLANK: |
@@ -723,8 +723,8 @@ static void tgn10_wait_for_state(struct timing_generator *tg, | |||
723 | } | 723 | } |
724 | } | 724 | } |
725 | 725 | ||
726 | static void tgn10_set_early_control( | 726 | void optc1_set_early_control( |
727 | struct timing_generator *tg, | 727 | struct timing_generator *optc, |
728 | uint32_t early_cntl) | 728 | uint32_t early_cntl) |
729 | { | 729 | { |
730 | /* asic design change, do not need this control | 730 | /* asic design change, do not need this control |
@@ -733,11 +733,11 @@ static void tgn10_set_early_control( | |||
733 | } | 733 | } |
734 | 734 | ||
735 | 735 | ||
736 | static void tgn10_set_static_screen_control( | 736 | void optc1_set_static_screen_control( |
737 | struct timing_generator *tg, | 737 | struct timing_generator *optc, |
738 | uint32_t value) | 738 | uint32_t value) |
739 | { | 739 | { |
740 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 740 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
741 | 741 | ||
742 | /* Bit 8 is no longer applicable in RV for PSR case, | 742 | /* Bit 8 is no longer applicable in RV for PSR case, |
743 | * set bit 8 to 0 if given | 743 | * set bit 8 to 0 if given |
@@ -762,11 +762,11 @@ static void tgn10_set_static_screen_control( | |||
762 | * | 762 | * |
763 | ***************************************************************************** | 763 | ***************************************************************************** |
764 | */ | 764 | */ |
765 | static void tgn10_set_drr( | 765 | void optc1_set_drr( |
766 | struct timing_generator *tg, | 766 | struct timing_generator *optc, |
767 | const struct drr_params *params) | 767 | const struct drr_params *params) |
768 | { | 768 | { |
769 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 769 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
770 | 770 | ||
771 | if (params != NULL && | 771 | if (params != NULL && |
772 | params->vertical_total_max > 0 && | 772 | params->vertical_total_max > 0 && |
@@ -799,15 +799,15 @@ static void tgn10_set_drr( | |||
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||
802 | static void tgn10_set_test_pattern( | 802 | static void optc1_set_test_pattern( |
803 | struct timing_generator *tg, | 803 | struct timing_generator *optc, |
804 | /* TODO: replace 'controller_dp_test_pattern' by 'test_pattern_mode' | 804 | /* TODO: replace 'controller_dp_test_pattern' by 'test_pattern_mode' |
805 | * because this is not DP-specific (which is probably somewhere in DP | 805 | * because this is not DP-specific (which is probably somewhere in DP |
806 | * encoder) */ | 806 | * encoder) */ |
807 | enum controller_dp_test_pattern test_pattern, | 807 | enum controller_dp_test_pattern test_pattern, |
808 | enum dc_color_depth color_depth) | 808 | enum dc_color_depth color_depth) |
809 | { | 809 | { |
810 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 810 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
811 | enum test_pattern_color_format bit_depth; | 811 | enum test_pattern_color_format bit_depth; |
812 | enum test_pattern_dyn_range dyn_range; | 812 | enum test_pattern_dyn_range dyn_range; |
813 | enum test_pattern_mode mode; | 813 | enum test_pattern_mode mode; |
@@ -1058,21 +1058,21 @@ static void tgn10_set_test_pattern( | |||
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | static void tgn10_get_crtc_scanoutpos( | 1061 | void optc1_get_crtc_scanoutpos( |
1062 | struct timing_generator *tg, | 1062 | struct timing_generator *optc, |
1063 | uint32_t *v_blank_start, | 1063 | uint32_t *v_blank_start, |
1064 | uint32_t *v_blank_end, | 1064 | uint32_t *v_blank_end, |
1065 | uint32_t *h_position, | 1065 | uint32_t *h_position, |
1066 | uint32_t *v_position) | 1066 | uint32_t *v_position) |
1067 | { | 1067 | { |
1068 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1068 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1069 | struct crtc_position position; | 1069 | struct crtc_position position; |
1070 | 1070 | ||
1071 | REG_GET_2(OTG_V_BLANK_START_END, | 1071 | REG_GET_2(OTG_V_BLANK_START_END, |
1072 | OTG_V_BLANK_START, v_blank_start, | 1072 | OTG_V_BLANK_START, v_blank_start, |
1073 | OTG_V_BLANK_END, v_blank_end); | 1073 | OTG_V_BLANK_END, v_blank_end); |
1074 | 1074 | ||
1075 | tgn10_get_position(tg, &position); | 1075 | optc1_get_position(optc, &position); |
1076 | 1076 | ||
1077 | *h_position = position.horizontal_count; | 1077 | *h_position = position.horizontal_count; |
1078 | *v_position = position.vertical_count; | 1078 | *v_position = position.vertical_count; |
@@ -1080,10 +1080,10 @@ static void tgn10_get_crtc_scanoutpos( | |||
1080 | 1080 | ||
1081 | 1081 | ||
1082 | 1082 | ||
1083 | static void tgn10_enable_stereo(struct timing_generator *tg, | 1083 | static void optc1_enable_stereo(struct timing_generator *optc, |
1084 | const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags) | 1084 | const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags) |
1085 | { | 1085 | { |
1086 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1086 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1087 | 1087 | ||
1088 | uint32_t active_width = timing->h_addressable; | 1088 | uint32_t active_width = timing->h_addressable; |
1089 | uint32_t space1_size = timing->v_total - timing->v_addressable; | 1089 | uint32_t space1_size = timing->v_total - timing->v_addressable; |
@@ -1122,21 +1122,21 @@ static void tgn10_enable_stereo(struct timing_generator *tg, | |||
1122 | OPPBUF_3D_VACT_SPACE1_SIZE, space1_size); | 1122 | OPPBUF_3D_VACT_SPACE1_SIZE, space1_size); |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | static void tgn10_program_stereo(struct timing_generator *tg, | 1125 | void optc1_program_stereo(struct timing_generator *optc, |
1126 | const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags) | 1126 | const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags) |
1127 | { | 1127 | { |
1128 | if (flags->PROGRAM_STEREO) | 1128 | if (flags->PROGRAM_STEREO) |
1129 | tgn10_enable_stereo(tg, timing, flags); | 1129 | optc1_enable_stereo(optc, timing, flags); |
1130 | else | 1130 | else |
1131 | tgn10_disable_stereo(tg); | 1131 | optc1_disable_stereo(optc); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | static bool tgn10_is_stereo_left_eye(struct timing_generator *tg) | 1135 | bool optc1_is_stereo_left_eye(struct timing_generator *optc) |
1136 | { | 1136 | { |
1137 | bool ret = false; | 1137 | bool ret = false; |
1138 | uint32_t left_eye = 0; | 1138 | uint32_t left_eye = 0; |
1139 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1139 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1140 | 1140 | ||
1141 | REG_GET(OTG_STEREO_STATUS, | 1141 | REG_GET(OTG_STEREO_STATUS, |
1142 | OTG_STEREO_CURRENT_EYE, &left_eye); | 1142 | OTG_STEREO_CURRENT_EYE, &left_eye); |
@@ -1148,7 +1148,7 @@ static bool tgn10_is_stereo_left_eye(struct timing_generator *tg) | |||
1148 | return ret; | 1148 | return ret; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | void tgn10_read_otg_state(struct dcn10_timing_generator *tgn10, | 1151 | void optc1_read_otg_state(struct optc *optc1, |
1152 | struct dcn_otg_state *s) | 1152 | struct dcn_otg_state *s) |
1153 | { | 1153 | { |
1154 | REG_GET(OTG_CONTROL, | 1154 | REG_GET(OTG_CONTROL, |
@@ -1192,22 +1192,22 @@ void tgn10_read_otg_state(struct dcn10_timing_generator *tgn10, | |||
1192 | OPTC_UNDERFLOW_OCCURRED_STATUS, &s->underflow_occurred_status); | 1192 | OPTC_UNDERFLOW_OCCURRED_STATUS, &s->underflow_occurred_status); |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | static void tgn10_clear_optc_underflow(struct timing_generator *tg) | 1195 | static void optc1_clear_optc_underflow(struct timing_generator *optc) |
1196 | { | 1196 | { |
1197 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1197 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1198 | 1198 | ||
1199 | REG_UPDATE(OPTC_INPUT_GLOBAL_CONTROL, OPTC_UNDERFLOW_CLEAR, 1); | 1199 | REG_UPDATE(OPTC_INPUT_GLOBAL_CONTROL, OPTC_UNDERFLOW_CLEAR, 1); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | static void tgn10_tg_init(struct timing_generator *tg) | 1202 | static void optc1_tg_init(struct timing_generator *optc) |
1203 | { | 1203 | { |
1204 | tgn10_set_blank_data_double_buffer(tg, true); | 1204 | optc1_set_blank_data_double_buffer(optc, true); |
1205 | tgn10_clear_optc_underflow(tg); | 1205 | optc1_clear_optc_underflow(optc); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | static bool tgn10_is_tg_enabled(struct timing_generator *tg) | 1208 | static bool optc1_is_tg_enabled(struct timing_generator *optc) |
1209 | { | 1209 | { |
1210 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1210 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1211 | uint32_t otg_enabled = 0; | 1211 | uint32_t otg_enabled = 0; |
1212 | 1212 | ||
1213 | REG_GET(OTG_CONTROL, OTG_MASTER_EN, &otg_enabled); | 1213 | REG_GET(OTG_CONTROL, OTG_MASTER_EN, &otg_enabled); |
@@ -1216,9 +1216,9 @@ static bool tgn10_is_tg_enabled(struct timing_generator *tg) | |||
1216 | 1216 | ||
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static bool tgn10_is_optc_underflow_occurred(struct timing_generator *tg) | 1219 | static bool optc1_is_optc_underflow_occurred(struct timing_generator *optc) |
1220 | { | 1220 | { |
1221 | struct dcn10_timing_generator *tgn10 = DCN10TG_FROM_TG(tg); | 1221 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
1222 | uint32_t underflow_occurred = 0; | 1222 | uint32_t underflow_occurred = 0; |
1223 | 1223 | ||
1224 | REG_GET(OPTC_INPUT_GLOBAL_CONTROL, | 1224 | REG_GET(OPTC_INPUT_GLOBAL_CONTROL, |
@@ -1229,51 +1229,51 @@ static bool tgn10_is_optc_underflow_occurred(struct timing_generator *tg) | |||
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | static const struct timing_generator_funcs dcn10_tg_funcs = { | 1231 | static const struct timing_generator_funcs dcn10_tg_funcs = { |
1232 | .validate_timing = tgn10_validate_timing, | 1232 | .validate_timing = optc1_validate_timing, |
1233 | .program_timing = tgn10_program_timing, | 1233 | .program_timing = optc1_program_timing, |
1234 | .program_global_sync = tgn10_program_global_sync, | 1234 | .program_global_sync = optc1_program_global_sync, |
1235 | .enable_crtc = tgn10_enable_crtc, | 1235 | .enable_crtc = optc1_enable_crtc, |
1236 | .disable_crtc = tgn10_disable_crtc, | 1236 | .disable_crtc = optc1_disable_crtc, |
1237 | /* used by enable_timing_synchronization. Not need for FPGA */ | 1237 | /* used by enable_timing_synchronization. Not need for FPGA */ |
1238 | .is_counter_moving = tgn10_is_counter_moving, | 1238 | .is_counter_moving = optc1_is_counter_moving, |
1239 | .get_position = tgn10_get_position, | 1239 | .get_position = optc1_get_position, |
1240 | .get_frame_count = tgn10_get_vblank_counter, | 1240 | .get_frame_count = optc1_get_vblank_counter, |
1241 | .get_scanoutpos = tgn10_get_crtc_scanoutpos, | 1241 | .get_scanoutpos = optc1_get_crtc_scanoutpos, |
1242 | .set_early_control = tgn10_set_early_control, | 1242 | .set_early_control = optc1_set_early_control, |
1243 | /* used by enable_timing_synchronization. Not need for FPGA */ | 1243 | /* used by enable_timing_synchronization. Not need for FPGA */ |
1244 | .wait_for_state = tgn10_wait_for_state, | 1244 | .wait_for_state = optc1_wait_for_state, |
1245 | .set_blank = tgn10_set_blank, | 1245 | .set_blank = optc1_set_blank, |
1246 | .is_blanked = tgn10_is_blanked, | 1246 | .is_blanked = optc1_is_blanked, |
1247 | .set_blank_color = tgn10_program_blank_color, | 1247 | .set_blank_color = optc1_program_blank_color, |
1248 | .did_triggered_reset_occur = tgn10_did_triggered_reset_occur, | 1248 | .did_triggered_reset_occur = optc1_did_triggered_reset_occur, |
1249 | .enable_reset_trigger = tgn10_enable_reset_trigger, | 1249 | .enable_reset_trigger = optc1_enable_reset_trigger, |
1250 | .enable_crtc_reset = tgn10_enable_crtc_reset, | 1250 | .enable_crtc_reset = optc1_enable_crtc_reset, |
1251 | .disable_reset_trigger = tgn10_disable_reset_trigger, | 1251 | .disable_reset_trigger = optc1_disable_reset_trigger, |
1252 | .lock = tgn10_lock, | 1252 | .lock = optc1_lock, |
1253 | .unlock = tgn10_unlock, | 1253 | .unlock = optc1_unlock, |
1254 | .enable_optc_clock = tgn10_enable_optc_clock, | 1254 | .enable_optc_clock = optc1_enable_optc_clock, |
1255 | .set_drr = tgn10_set_drr, | 1255 | .set_drr = optc1_set_drr, |
1256 | .set_static_screen_control = tgn10_set_static_screen_control, | 1256 | .set_static_screen_control = optc1_set_static_screen_control, |
1257 | .set_test_pattern = tgn10_set_test_pattern, | 1257 | .set_test_pattern = optc1_set_test_pattern, |
1258 | .program_stereo = tgn10_program_stereo, | 1258 | .program_stereo = optc1_program_stereo, |
1259 | .is_stereo_left_eye = tgn10_is_stereo_left_eye, | 1259 | .is_stereo_left_eye = optc1_is_stereo_left_eye, |
1260 | .set_blank_data_double_buffer = tgn10_set_blank_data_double_buffer, | 1260 | .set_blank_data_double_buffer = optc1_set_blank_data_double_buffer, |
1261 | .tg_init = tgn10_tg_init, | 1261 | .tg_init = optc1_tg_init, |
1262 | .is_tg_enabled = tgn10_is_tg_enabled, | 1262 | .is_tg_enabled = optc1_is_tg_enabled, |
1263 | .is_optc_underflow_occurred = tgn10_is_optc_underflow_occurred, | 1263 | .is_optc_underflow_occurred = optc1_is_optc_underflow_occurred, |
1264 | .clear_optc_underflow = tgn10_clear_optc_underflow, | 1264 | .clear_optc_underflow = optc1_clear_optc_underflow, |
1265 | }; | 1265 | }; |
1266 | 1266 | ||
1267 | void dcn10_timing_generator_init(struct dcn10_timing_generator *tgn10) | 1267 | void dcn10_timing_generator_init(struct optc *optc1) |
1268 | { | 1268 | { |
1269 | tgn10->base.funcs = &dcn10_tg_funcs; | 1269 | optc1->base.funcs = &dcn10_tg_funcs; |
1270 | 1270 | ||
1271 | tgn10->max_h_total = tgn10->tg_mask->OTG_H_TOTAL + 1; | 1271 | optc1->max_h_total = optc1->tg_mask->OTG_H_TOTAL + 1; |
1272 | tgn10->max_v_total = tgn10->tg_mask->OTG_V_TOTAL + 1; | 1272 | optc1->max_v_total = optc1->tg_mask->OTG_V_TOTAL + 1; |
1273 | 1273 | ||
1274 | tgn10->min_h_blank = 32; | 1274 | optc1->min_h_blank = 32; |
1275 | tgn10->min_v_blank = 3; | 1275 | optc1->min_v_blank = 3; |
1276 | tgn10->min_v_blank_interlace = 5; | 1276 | optc1->min_v_blank_interlace = 5; |
1277 | tgn10->min_h_sync_width = 8; | 1277 | optc1->min_h_sync_width = 8; |
1278 | tgn10->min_v_sync_width = 1; | 1278 | optc1->min_v_sync_width = 1; |
1279 | } | 1279 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h index bb1cbfdc3554..a9ce97fd7f09 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "timing_generator.h" | 29 | #include "timing_generator.h" |
30 | 30 | ||
31 | #define DCN10TG_FROM_TG(tg)\ | 31 | #define DCN10TG_FROM_TG(tg)\ |
32 | container_of(tg, struct dcn10_timing_generator, base) | 32 | container_of(tg, struct optc, base) |
33 | 33 | ||
34 | #define TG_COMMON_REG_LIST_DCN(inst) \ | 34 | #define TG_COMMON_REG_LIST_DCN(inst) \ |
35 | SRI(OTG_VSTARTUP_PARAM, OTG, inst),\ | 35 | SRI(OTG_VSTARTUP_PARAM, OTG, inst),\ |
@@ -84,7 +84,7 @@ | |||
84 | SRI(OTG_TEST_PATTERN_COLOR, OTG, inst) | 84 | SRI(OTG_TEST_PATTERN_COLOR, OTG, inst) |
85 | 85 | ||
86 | 86 | ||
87 | struct dcn_tg_registers { | 87 | struct dcn_optc_registers { |
88 | uint32_t OTG_VERT_SYNC_CONTROL; | 88 | uint32_t OTG_VERT_SYNC_CONTROL; |
89 | uint32_t OTG_MASTER_UPDATE_MODE; | 89 | uint32_t OTG_MASTER_UPDATE_MODE; |
90 | uint32_t OTG_GSL_CONTROL; | 90 | uint32_t OTG_GSL_CONTROL; |
@@ -348,20 +348,20 @@ struct dcn_tg_registers { | |||
348 | type OTG_GSL_FORCE_DELAY;\ | 348 | type OTG_GSL_FORCE_DELAY;\ |
349 | type OTG_GSL_CHECK_ALL_FIELDS; | 349 | type OTG_GSL_CHECK_ALL_FIELDS; |
350 | 350 | ||
351 | struct dcn_tg_shift { | 351 | struct dcn_optc_shift { |
352 | TG_REG_FIELD_LIST(uint8_t) | 352 | TG_REG_FIELD_LIST(uint8_t) |
353 | }; | 353 | }; |
354 | 354 | ||
355 | struct dcn_tg_mask { | 355 | struct dcn_optc_mask { |
356 | TG_REG_FIELD_LIST(uint32_t) | 356 | TG_REG_FIELD_LIST(uint32_t) |
357 | }; | 357 | }; |
358 | 358 | ||
359 | struct dcn10_timing_generator { | 359 | struct optc { |
360 | struct timing_generator base; | 360 | struct timing_generator base; |
361 | 361 | ||
362 | const struct dcn_tg_registers *tg_regs; | 362 | const struct dcn_optc_registers *tg_regs; |
363 | const struct dcn_tg_shift *tg_shift; | 363 | const struct dcn_optc_shift *tg_shift; |
364 | const struct dcn_tg_mask *tg_mask; | 364 | const struct dcn_optc_mask *tg_mask; |
365 | 365 | ||
366 | enum controller_id controller_id; | 366 | enum controller_id controller_id; |
367 | 367 | ||
@@ -376,7 +376,7 @@ struct dcn10_timing_generator { | |||
376 | uint32_t min_v_blank_interlace; | 376 | uint32_t min_v_blank_interlace; |
377 | }; | 377 | }; |
378 | 378 | ||
379 | void dcn10_timing_generator_init(struct dcn10_timing_generator *tg); | 379 | void dcn10_timing_generator_init(struct optc *optc); |
380 | 380 | ||
381 | struct dcn_otg_state { | 381 | struct dcn_otg_state { |
382 | uint32_t v_blank_start; | 382 | uint32_t v_blank_start; |
@@ -397,7 +397,77 @@ struct dcn_otg_state { | |||
397 | uint32_t otg_enabled; | 397 | uint32_t otg_enabled; |
398 | }; | 398 | }; |
399 | 399 | ||
400 | void tgn10_read_otg_state(struct dcn10_timing_generator *tgn10, | 400 | void optc1_read_otg_state(struct optc *optc1, |
401 | struct dcn_otg_state *s); | 401 | struct dcn_otg_state *s); |
402 | 402 | ||
403 | bool optc1_validate_timing( | ||
404 | struct timing_generator *optc, | ||
405 | const struct dc_crtc_timing *timing); | ||
406 | |||
407 | void optc1_program_timing( | ||
408 | struct timing_generator *optc, | ||
409 | const struct dc_crtc_timing *dc_crtc_timing, | ||
410 | bool use_vbios); | ||
411 | |||
412 | void optc1_program_global_sync( | ||
413 | struct timing_generator *optc); | ||
414 | |||
415 | bool optc1_disable_crtc(struct timing_generator *optc); | ||
416 | |||
417 | bool optc1_is_counter_moving(struct timing_generator *optc); | ||
418 | |||
419 | void optc1_get_position(struct timing_generator *optc, | ||
420 | struct crtc_position *position); | ||
421 | |||
422 | uint32_t optc1_get_vblank_counter(struct timing_generator *optc); | ||
423 | |||
424 | void optc1_get_crtc_scanoutpos( | ||
425 | struct timing_generator *optc, | ||
426 | uint32_t *v_blank_start, | ||
427 | uint32_t *v_blank_end, | ||
428 | uint32_t *h_position, | ||
429 | uint32_t *v_position); | ||
430 | |||
431 | void optc1_set_early_control( | ||
432 | struct timing_generator *optc, | ||
433 | uint32_t early_cntl); | ||
434 | |||
435 | void optc1_wait_for_state(struct timing_generator *optc, | ||
436 | enum crtc_state state); | ||
437 | |||
438 | void optc1_set_blank(struct timing_generator *optc, | ||
439 | bool enable_blanking); | ||
440 | |||
441 | bool optc1_is_blanked(struct timing_generator *optc); | ||
442 | |||
443 | void optc1_program_blank_color( | ||
444 | struct timing_generator *optc, | ||
445 | const struct tg_color *black_color); | ||
446 | |||
447 | bool optc1_did_triggered_reset_occur( | ||
448 | struct timing_generator *optc); | ||
449 | |||
450 | void optc1_enable_reset_trigger(struct timing_generator *optc, int source_tg_inst); | ||
451 | |||
452 | void optc1_disable_reset_trigger(struct timing_generator *optc); | ||
453 | |||
454 | void optc1_lock(struct timing_generator *optc); | ||
455 | |||
456 | void optc1_unlock(struct timing_generator *optc); | ||
457 | |||
458 | void optc1_enable_optc_clock(struct timing_generator *optc, bool enable); | ||
459 | |||
460 | void optc1_set_drr( | ||
461 | struct timing_generator *optc, | ||
462 | const struct drr_params *params); | ||
463 | |||
464 | void optc1_set_static_screen_control( | ||
465 | struct timing_generator *optc, | ||
466 | uint32_t value); | ||
467 | |||
468 | void optc1_program_stereo(struct timing_generator *optc, | ||
469 | const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags); | ||
470 | |||
471 | bool optc1_is_stereo_left_eye(struct timing_generator *optc); | ||
472 | |||
403 | #endif /* __DC_TIMING_GENERATOR_DCN10_H__ */ | 473 | #endif /* __DC_TIMING_GENERATOR_DCN10_H__ */ |