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#include "reg_helper.h"
28
29#include "core_types.h"
30#include "link_encoder.h"
31#include "dcn31_dio_link_encoder.h"
32#include "stream_encoder.h"
33#include "i2caux_interface.h"
34#include "dc_bios_types.h"
35
36#include "gpio_service_interface.h"
37
38#include "link_enc_cfg.h"
39#include "dc_dmub_srv.h"
40#include "dal_asic_id.h"
41
42#define CTX \
43 enc10->base.ctx
44#define DC_LOGGER \
45 enc10->base.ctx->logger
46
47#define REG(reg)\
48 (enc10->link_regs->reg)
49
50#undef FN
51#define FN(reg_name, field_name) \
52 enc10->link_shift->field_name, enc10->link_mask->field_name
53
54#define IND_REG(index) \
55 (enc10->link_regs->index)
56
57#define AUX_REG(reg)\
58 (enc10->aux_regs->reg)
59
60#define AUX_REG_READ(reg_name) \
61 dm_read_reg(CTX, AUX_REG(reg_name))
62
63#define AUX_REG_WRITE(reg_name, val) \
64 dm_write_reg(CTX, AUX_REG(reg_name), val)
65
66#ifndef MIN
67#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
68#endif
69
70static uint8_t phy_id_from_transmitter(enum transmitter t)
71{
72 uint8_t phy_id;
73
74 switch (t) {
75 case TRANSMITTER_UNIPHY_A:
76 phy_id = 0;
77 break;
78 case TRANSMITTER_UNIPHY_B:
79 phy_id = 1;
80 break;
81 case TRANSMITTER_UNIPHY_C:
82 phy_id = 2;
83 break;
84 case TRANSMITTER_UNIPHY_D:
85 phy_id = 3;
86 break;
87 case TRANSMITTER_UNIPHY_E:
88 phy_id = 4;
89 break;
90 case TRANSMITTER_UNIPHY_F:
91 phy_id = 5;
92 break;
93 case TRANSMITTER_UNIPHY_G:
94 phy_id = 6;
95 break;
96 default:
97 phy_id = 0;
98 break;
99 }
100 return phy_id;
101}
102
103static bool has_query_dp_alt(struct link_encoder *enc)
104{
105 struct dc_dmub_srv *dc_dmub_srv = enc->ctx->dmub_srv;
106
107
108 return dc_dmub_srv &&
109 !(dc_dmub_srv->dmub->fw_version >= DMUB_FW_VERSION(4, 0, 0) &&
110 dc_dmub_srv->dmub->fw_version <= DMUB_FW_VERSION(4, 0, 10));
111}
112
113static bool query_dp_alt_from_dmub(struct link_encoder *enc,
114 union dmub_rb_cmd *cmd)
115{
116 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
117 struct dc_dmub_srv *dc_dmub_srv = enc->ctx->dmub_srv;
118
119 memset(cmd, 0, sizeof(*cmd));
120 cmd->query_dp_alt.header.type = DMUB_CMD__VBIOS;
121 cmd->query_dp_alt.header.sub_type =
122 DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT;
123 cmd->query_dp_alt.header.payload_bytes = sizeof(cmd->query_dp_alt.data);
124 cmd->query_dp_alt.data.phy_id = phy_id_from_transmitter(enc10->base.transmitter);
125
126 if (!dc_dmub_srv_cmd_with_reply_data(dc_dmub_srv, cmd))
127 return false;
128
129 return true;
130}
131
132void dcn31_link_encoder_set_dio_phy_mux(
133 struct link_encoder *enc,
134 enum encoder_type_select sel,
135 uint32_t hpo_inst)
136{
137 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
138
139 switch (enc->transmitter) {
140 case TRANSMITTER_UNIPHY_A:
141 if (sel == ENCODER_TYPE_HDMI_FRL)
142 REG_UPDATE(DIO_LINKA_CNTL,
143 HPO_HDMI_ENC_SEL, hpo_inst);
144 else if (sel == ENCODER_TYPE_DP_128B132B)
145 REG_UPDATE(DIO_LINKA_CNTL,
146 HPO_DP_ENC_SEL, hpo_inst);
147 REG_UPDATE(DIO_LINKA_CNTL,
148 ENC_TYPE_SEL, sel);
149 break;
150 case TRANSMITTER_UNIPHY_B:
151 if (sel == ENCODER_TYPE_HDMI_FRL)
152 REG_UPDATE(DIO_LINKB_CNTL,
153 HPO_HDMI_ENC_SEL, hpo_inst);
154 else if (sel == ENCODER_TYPE_DP_128B132B)
155 REG_UPDATE(DIO_LINKB_CNTL,
156 HPO_DP_ENC_SEL, hpo_inst);
157 REG_UPDATE(DIO_LINKB_CNTL,
158 ENC_TYPE_SEL, sel);
159 break;
160 case TRANSMITTER_UNIPHY_C:
161 if (sel == ENCODER_TYPE_HDMI_FRL)
162 REG_UPDATE(DIO_LINKC_CNTL,
163 HPO_HDMI_ENC_SEL, hpo_inst);
164 else if (sel == ENCODER_TYPE_DP_128B132B)
165 REG_UPDATE(DIO_LINKC_CNTL,
166 HPO_DP_ENC_SEL, hpo_inst);
167 REG_UPDATE(DIO_LINKC_CNTL,
168 ENC_TYPE_SEL, sel);
169 break;
170 case TRANSMITTER_UNIPHY_D:
171 if (sel == ENCODER_TYPE_HDMI_FRL)
172 REG_UPDATE(DIO_LINKD_CNTL,
173 HPO_HDMI_ENC_SEL, hpo_inst);
174 else if (sel == ENCODER_TYPE_DP_128B132B)
175 REG_UPDATE(DIO_LINKD_CNTL,
176 HPO_DP_ENC_SEL, hpo_inst);
177 REG_UPDATE(DIO_LINKD_CNTL,
178 ENC_TYPE_SEL, sel);
179 break;
180 case TRANSMITTER_UNIPHY_E:
181 if (sel == ENCODER_TYPE_HDMI_FRL)
182 REG_UPDATE(DIO_LINKE_CNTL,
183 HPO_HDMI_ENC_SEL, hpo_inst);
184 else if (sel == ENCODER_TYPE_DP_128B132B)
185 REG_UPDATE(DIO_LINKE_CNTL,
186 HPO_DP_ENC_SEL, hpo_inst);
187 REG_UPDATE(DIO_LINKE_CNTL,
188 ENC_TYPE_SEL, sel);
189 break;
190 case TRANSMITTER_UNIPHY_F:
191 if (sel == ENCODER_TYPE_HDMI_FRL)
192 REG_UPDATE(DIO_LINKF_CNTL,
193 HPO_HDMI_ENC_SEL, hpo_inst);
194 else if (sel == ENCODER_TYPE_DP_128B132B)
195 REG_UPDATE(DIO_LINKF_CNTL,
196 HPO_DP_ENC_SEL, hpo_inst);
197 REG_UPDATE(DIO_LINKF_CNTL,
198 ENC_TYPE_SEL, sel);
199 break;
200 default:
201
202 break;
203 }
204}
205
206static void enc31_hw_init(struct link_encoder *enc)
207{
208 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
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 AUX_REG_WRITE(AUX_DPHY_RX_CONTROL0, 0x103d1110);
234
235 AUX_REG_WRITE(AUX_DPHY_TX_CONTROL, 0x21c7a);
236
237
238
239
240
241
242
243#ifdef CLEANUP_FIXME
244
245 REG_WRITE(RDPCSTX_DEBUG_CONFIG, 0);
246#endif
247
248
249 REG_UPDATE(TMDS_CTL_BITS, TMDS_CTL0, 1);
250
251
252 REG_UPDATE(RDPCSTX_CNTL,
253 RDPCS_TX_FIFO_RD_START_DELAY, 4);
254
255 dcn10_aux_initialize(enc10);
256}
257
258static const struct link_encoder_funcs dcn31_link_enc_funcs = {
259 .read_state = link_enc2_read_state,
260 .validate_output_with_stream =
261 dcn30_link_encoder_validate_output_with_stream,
262 .hw_init = enc31_hw_init,
263 .setup = dcn10_link_encoder_setup,
264 .enable_tmds_output = dcn10_link_encoder_enable_tmds_output,
265 .enable_dp_output = dcn31_link_encoder_enable_dp_output,
266 .enable_dp_mst_output = dcn31_link_encoder_enable_dp_mst_output,
267 .disable_output = dcn31_link_encoder_disable_output,
268 .dp_set_lane_settings = dcn10_link_encoder_dp_set_lane_settings,
269 .dp_set_phy_pattern = dcn10_link_encoder_dp_set_phy_pattern,
270 .update_mst_stream_allocation_table =
271 dcn10_link_encoder_update_mst_stream_allocation_table,
272 .psr_program_dp_dphy_fast_training =
273 dcn10_psr_program_dp_dphy_fast_training,
274 .psr_program_secondary_packet = dcn10_psr_program_secondary_packet,
275 .connect_dig_be_to_fe = dcn10_link_encoder_connect_dig_be_to_fe,
276 .enable_hpd = dcn10_link_encoder_enable_hpd,
277 .disable_hpd = dcn10_link_encoder_disable_hpd,
278 .is_dig_enabled = dcn10_is_dig_enabled,
279 .destroy = dcn10_link_encoder_destroy,
280 .fec_set_enable = enc2_fec_set_enable,
281 .fec_set_ready = enc2_fec_set_ready,
282 .fec_is_active = enc2_fec_is_active,
283 .get_dig_frontend = dcn10_get_dig_frontend,
284 .get_dig_mode = dcn10_get_dig_mode,
285 .is_in_alt_mode = dcn31_link_encoder_is_in_alt_mode,
286 .get_max_link_cap = dcn31_link_encoder_get_max_link_cap,
287 .set_dio_phy_mux = dcn31_link_encoder_set_dio_phy_mux,
288};
289
290void dcn31_link_encoder_construct(
291 struct dcn20_link_encoder *enc20,
292 const struct encoder_init_data *init_data,
293 const struct encoder_feature_support *enc_features,
294 const struct dcn10_link_enc_registers *link_regs,
295 const struct dcn10_link_enc_aux_registers *aux_regs,
296 const struct dcn10_link_enc_hpd_registers *hpd_regs,
297 const struct dcn10_link_enc_shift *link_shift,
298 const struct dcn10_link_enc_mask *link_mask)
299{
300 struct bp_encoder_cap_info bp_cap_info = {0};
301 const struct dc_vbios_funcs *bp_funcs = init_data->ctx->dc_bios->funcs;
302 enum bp_result result = BP_RESULT_OK;
303 struct dcn10_link_encoder *enc10 = &enc20->enc10;
304
305 enc10->base.funcs = &dcn31_link_enc_funcs;
306 enc10->base.ctx = init_data->ctx;
307 enc10->base.id = init_data->encoder;
308
309 enc10->base.hpd_source = init_data->hpd_source;
310 enc10->base.connector = init_data->connector;
311
312 enc10->base.preferred_engine = ENGINE_ID_UNKNOWN;
313
314 enc10->base.features = *enc_features;
315
316 enc10->base.transmitter = init_data->transmitter;
317
318
319
320
321
322
323
324
325
326
327 enc10->base.output_signals =
328 SIGNAL_TYPE_DVI_SINGLE_LINK |
329 SIGNAL_TYPE_DVI_DUAL_LINK |
330 SIGNAL_TYPE_LVDS |
331 SIGNAL_TYPE_DISPLAY_PORT |
332 SIGNAL_TYPE_DISPLAY_PORT_MST |
333 SIGNAL_TYPE_EDP |
334 SIGNAL_TYPE_HDMI_TYPE_A;
335
336
337
338
339
340
341
342
343
344
345
346
347 enc10->link_regs = link_regs;
348 enc10->aux_regs = aux_regs;
349 enc10->hpd_regs = hpd_regs;
350 enc10->link_shift = link_shift;
351 enc10->link_mask = link_mask;
352
353 switch (enc10->base.transmitter) {
354 case TRANSMITTER_UNIPHY_A:
355 enc10->base.preferred_engine = ENGINE_ID_DIGA;
356 break;
357 case TRANSMITTER_UNIPHY_B:
358 enc10->base.preferred_engine = ENGINE_ID_DIGB;
359 break;
360 case TRANSMITTER_UNIPHY_C:
361 enc10->base.preferred_engine = ENGINE_ID_DIGC;
362 break;
363 case TRANSMITTER_UNIPHY_D:
364 enc10->base.preferred_engine = ENGINE_ID_DIGD;
365 break;
366 case TRANSMITTER_UNIPHY_E:
367 enc10->base.preferred_engine = ENGINE_ID_DIGE;
368 break;
369 case TRANSMITTER_UNIPHY_F:
370 enc10->base.preferred_engine = ENGINE_ID_DIGF;
371 break;
372 default:
373 ASSERT_CRITICAL(false);
374 enc10->base.preferred_engine = ENGINE_ID_UNKNOWN;
375 }
376
377
378 enc10->base.features.flags.bits.HDMI_6GB_EN = 1;
379
380 result = bp_funcs->get_encoder_cap_info(enc10->base.ctx->dc_bios,
381 enc10->base.id, &bp_cap_info);
382
383
384 if (result == BP_RESULT_OK) {
385 enc10->base.features.flags.bits.IS_HBR2_CAPABLE =
386 bp_cap_info.DP_HBR2_EN;
387 enc10->base.features.flags.bits.IS_HBR3_CAPABLE =
388 bp_cap_info.DP_HBR3_EN;
389 enc10->base.features.flags.bits.HDMI_6GB_EN = bp_cap_info.HDMI_6GB_EN;
390 enc10->base.features.flags.bits.IS_DP2_CAPABLE = bp_cap_info.IS_DP2_CAPABLE;
391 enc10->base.features.flags.bits.IS_UHBR10_CAPABLE = bp_cap_info.DP_UHBR10_EN;
392 enc10->base.features.flags.bits.IS_UHBR13_5_CAPABLE = bp_cap_info.DP_UHBR13_5_EN;
393 enc10->base.features.flags.bits.IS_UHBR20_CAPABLE = bp_cap_info.DP_UHBR20_EN;
394 enc10->base.features.flags.bits.DP_IS_USB_C =
395 bp_cap_info.DP_IS_USB_C;
396 } else {
397 DC_LOG_WARNING("%s: Failed to get encoder_cap_info from VBIOS with error code %d!\n",
398 __func__,
399 result);
400 }
401 if (enc10->base.ctx->dc->debug.hdmi20_disable) {
402 enc10->base.features.flags.bits.HDMI_6GB_EN = 0;
403 }
404}
405
406void dcn31_link_encoder_construct_minimal(
407 struct dcn20_link_encoder *enc20,
408 struct dc_context *ctx,
409 const struct encoder_feature_support *enc_features,
410 const struct dcn10_link_enc_registers *link_regs,
411 enum engine_id eng_id)
412{
413 struct dcn10_link_encoder *enc10 = &enc20->enc10;
414
415 enc10->base.funcs = &dcn31_link_enc_funcs;
416 enc10->base.ctx = ctx;
417 enc10->base.id.type = OBJECT_TYPE_ENCODER;
418 enc10->base.hpd_source = HPD_SOURCEID_UNKNOWN;
419 enc10->base.connector.type = OBJECT_TYPE_CONNECTOR;
420 enc10->base.preferred_engine = eng_id;
421 enc10->base.features = *enc_features;
422 enc10->base.transmitter = TRANSMITTER_UNKNOWN;
423 enc10->link_regs = link_regs;
424
425 enc10->base.output_signals =
426 SIGNAL_TYPE_DISPLAY_PORT |
427 SIGNAL_TYPE_DISPLAY_PORT_MST |
428 SIGNAL_TYPE_EDP;
429}
430
431
432static bool link_dpia_control(struct dc_context *dc_ctx,
433 struct dmub_cmd_dig_dpia_control_data *dpia_control)
434{
435 union dmub_rb_cmd cmd;
436 struct dc_dmub_srv *dmub = dc_ctx->dmub_srv;
437
438 memset(&cmd, 0, sizeof(cmd));
439
440 cmd.dig1_dpia_control.header.type = DMUB_CMD__DPIA;
441 cmd.dig1_dpia_control.header.sub_type =
442 DMUB_CMD__DPIA_DIG1_DPIA_CONTROL;
443 cmd.dig1_dpia_control.header.payload_bytes =
444 sizeof(cmd.dig1_dpia_control) -
445 sizeof(cmd.dig1_dpia_control.header);
446
447 cmd.dig1_dpia_control.dpia_control = *dpia_control;
448
449 dc_dmub_srv_cmd_queue(dmub, &cmd);
450 dc_dmub_srv_cmd_execute(dmub);
451 dc_dmub_srv_wait_idle(dmub);
452
453 return true;
454}
455
456static void link_encoder_disable(struct dcn10_link_encoder *enc10)
457{
458
459 REG_UPDATE(DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, 0);
460}
461
462void dcn31_link_encoder_enable_dp_output(
463 struct link_encoder *enc,
464 const struct dc_link_settings *link_settings,
465 enum clock_source_id clock_source)
466{
467 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
468
469
470 if (!link_enc_cfg_is_transmitter_mappable(enc->ctx->dc, enc)) {
471
472 dcn20_link_encoder_enable_dp_output(enc, link_settings, clock_source);
473
474 } else {
475
476 struct dmub_cmd_dig_dpia_control_data dpia_control = { 0 };
477 struct dc_link *link;
478
479 link = link_enc_cfg_get_link_using_link_enc(enc->ctx->dc, enc->preferred_engine);
480
481 enc1_configure_encoder(enc10, link_settings);
482
483 dpia_control.action = (uint8_t)TRANSMITTER_CONTROL_ENABLE;
484 dpia_control.enc_id = enc->preferred_engine;
485 dpia_control.mode_laneset.digmode = 0;
486 dpia_control.lanenum = (uint8_t)link_settings->lane_count;
487 dpia_control.symclk_10khz = link_settings->link_rate *
488 LINK_RATE_REF_FREQ_IN_KHZ / 10;
489
490
491
492 dpia_control.hpdsel = 6;
493
494 if (link) {
495 dpia_control.dpia_id = link->ddc_hw_inst;
496 dpia_control.fec_rdy = dc_link_should_enable_fec(link);
497 } else {
498 DC_LOG_ERROR("%s: Failed to execute DPIA enable DMUB command.\n", __func__);
499 BREAK_TO_DEBUGGER();
500 return;
501 }
502
503 link_dpia_control(enc->ctx, &dpia_control);
504 }
505}
506
507void dcn31_link_encoder_enable_dp_mst_output(
508 struct link_encoder *enc,
509 const struct dc_link_settings *link_settings,
510 enum clock_source_id clock_source)
511{
512 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
513
514
515 if (!link_enc_cfg_is_transmitter_mappable(enc->ctx->dc, enc)) {
516
517 dcn10_link_encoder_enable_dp_mst_output(enc, link_settings, clock_source);
518
519 } else {
520
521 struct dmub_cmd_dig_dpia_control_data dpia_control = { 0 };
522 struct dc_link *link;
523
524 link = link_enc_cfg_get_link_using_link_enc(enc->ctx->dc, enc->preferred_engine);
525
526 enc1_configure_encoder(enc10, link_settings);
527
528 dpia_control.action = (uint8_t)TRANSMITTER_CONTROL_ENABLE;
529 dpia_control.enc_id = enc->preferred_engine;
530 dpia_control.mode_laneset.digmode = 5;
531 dpia_control.lanenum = (uint8_t)link_settings->lane_count;
532 dpia_control.symclk_10khz = link_settings->link_rate *
533 LINK_RATE_REF_FREQ_IN_KHZ / 10;
534
535
536
537 dpia_control.hpdsel = 6;
538
539 if (link) {
540 dpia_control.dpia_id = link->ddc_hw_inst;
541 dpia_control.fec_rdy = dc_link_should_enable_fec(link);
542 } else {
543 DC_LOG_ERROR("%s: Failed to execute DPIA enable DMUB command.\n", __func__);
544 BREAK_TO_DEBUGGER();
545 return;
546 }
547
548 link_dpia_control(enc->ctx, &dpia_control);
549 }
550}
551
552void dcn31_link_encoder_disable_output(
553 struct link_encoder *enc,
554 enum signal_type signal)
555{
556 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
557
558
559 if (!link_enc_cfg_is_transmitter_mappable(enc->ctx->dc, enc)) {
560
561 dcn10_link_encoder_disable_output(enc, signal);
562
563 } else {
564
565 struct dmub_cmd_dig_dpia_control_data dpia_control = { 0 };
566 struct dc_link *link;
567
568 if (!dcn10_is_dig_enabled(enc))
569 return;
570
571 link = link_enc_cfg_get_link_using_link_enc(enc->ctx->dc, enc->preferred_engine);
572
573 dpia_control.action = (uint8_t)TRANSMITTER_CONTROL_DISABLE;
574 dpia_control.enc_id = enc->preferred_engine;
575 if (signal == SIGNAL_TYPE_DISPLAY_PORT) {
576 dpia_control.mode_laneset.digmode = 0;
577 } else if (signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
578 dpia_control.mode_laneset.digmode = 5;
579 } else {
580 DC_LOG_ERROR("%s: USB4 DPIA only supports DisplayPort.\n", __func__);
581 BREAK_TO_DEBUGGER();
582 }
583
584 if (link) {
585 dpia_control.dpia_id = link->ddc_hw_inst;
586 } else {
587 DC_LOG_ERROR("%s: Failed to execute DPIA enable DMUB command.\n", __func__);
588 BREAK_TO_DEBUGGER();
589 return;
590 }
591
592 link_dpia_control(enc->ctx, &dpia_control);
593
594 link_encoder_disable(enc10);
595 }
596}
597
598bool dcn31_link_encoder_is_in_alt_mode(struct link_encoder *enc)
599{
600 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
601 union dmub_rb_cmd cmd;
602 uint32_t dp_alt_mode_disable;
603
604
605 if (!enc->features.flags.bits.DP_IS_USB_C)
606 return false;
607
608
609
610
611
612 if (has_query_dp_alt(enc)) {
613 if (!query_dp_alt_from_dmub(enc, &cmd))
614 return false;
615
616 return (cmd.query_dp_alt.data.is_dp_alt_disable == 0);
617 }
618
619
620 if (enc->ctx->asic_id.hw_internal_rev != YELLOW_CARP_B0) {
621 REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE,
622 &dp_alt_mode_disable);
623 } else {
624
625
626
627
628 if ((enc10->base.transmitter == TRANSMITTER_UNIPHY_A) ||
629 (enc10->base.transmitter == TRANSMITTER_UNIPHY_B) ||
630 (enc10->base.transmitter == TRANSMITTER_UNIPHY_E)) {
631 REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE,
632 &dp_alt_mode_disable);
633 } else {
634 REG_GET(RDPCSPIPE_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE,
635 &dp_alt_mode_disable);
636 }
637 }
638
639 return (dp_alt_mode_disable == 0);
640}
641
642void dcn31_link_encoder_get_max_link_cap(struct link_encoder *enc, struct dc_link_settings *link_settings)
643{
644 struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
645 union dmub_rb_cmd cmd;
646 uint32_t is_in_usb_c_dp4_mode = 0;
647
648 dcn10_link_encoder_get_max_link_cap(enc, link_settings);
649
650
651 if (!enc->features.flags.bits.DP_IS_USB_C)
652 return;
653
654
655
656
657
658 if (has_query_dp_alt(enc)) {
659 if (!query_dp_alt_from_dmub(enc, &cmd))
660 return;
661
662 if (cmd.query_dp_alt.data.is_usb &&
663 cmd.query_dp_alt.data.is_dp4 == 0)
664 link_settings->lane_count = MIN(LANE_COUNT_TWO, link_settings->lane_count);
665
666 return;
667 }
668
669
670 if (enc->ctx->asic_id.hw_internal_rev != YELLOW_CARP_B0) {
671 REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4,
672 &is_in_usb_c_dp4_mode);
673 } else {
674 if ((enc10->base.transmitter == TRANSMITTER_UNIPHY_A) ||
675 (enc10->base.transmitter == TRANSMITTER_UNIPHY_B) ||
676 (enc10->base.transmitter == TRANSMITTER_UNIPHY_E)) {
677 REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4,
678 &is_in_usb_c_dp4_mode);
679 } else {
680 REG_GET(RDPCSPIPE_PHY_CNTL6, RDPCS_PHY_DPALT_DP4,
681 &is_in_usb_c_dp4_mode);
682 }
683 }
684
685 if (!is_in_usb_c_dp4_mode)
686 link_settings->lane_count = MIN(LANE_COUNT_TWO, link_settings->lane_count);
687}
688