|
63 | 63 | #define AUX_REG_WRITE(reg_name, val) \
|
64 | 64 | dm_write_reg(CTX, AUX_REG(reg_name), val)
|
65 | 65 |
|
| 66 | +#ifndef MIN |
| 67 | +#define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) |
| 68 | +#endif |
| 69 | + |
66 | 70 | void dcn31_link_encoder_set_dio_phy_mux(
|
67 | 71 | struct link_encoder *enc,
|
68 | 72 | enum encoder_type_select sel,
|
@@ -217,7 +221,7 @@ static const struct link_encoder_funcs dcn31_link_enc_funcs = {
|
217 | 221 | .get_dig_frontend = dcn10_get_dig_frontend,
|
218 | 222 | .get_dig_mode = dcn10_get_dig_mode,
|
219 | 223 | .is_in_alt_mode = dcn31_link_encoder_is_in_alt_mode,
|
220 |
| - .get_max_link_cap = dcn20_link_encoder_get_max_link_cap, |
| 224 | + .get_max_link_cap = dcn31_link_encoder_get_max_link_cap, |
221 | 225 | .set_dio_phy_mux = dcn31_link_encoder_set_dio_phy_mux,
|
222 | 226 | };
|
223 | 227 |
|
@@ -435,3 +439,30 @@ bool dcn31_link_encoder_is_in_alt_mode(struct link_encoder *enc)
|
435 | 439 |
|
436 | 440 | return is_usb_c_alt_mode;
|
437 | 441 | }
|
| 442 | + |
| 443 | +void dcn31_link_encoder_get_max_link_cap(struct link_encoder *enc, |
| 444 | + struct dc_link_settings *link_settings) |
| 445 | +{ |
| 446 | + struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc); |
| 447 | + uint32_t is_in_usb_c_dp4_mode = 0; |
| 448 | + |
| 449 | + dcn10_link_encoder_get_max_link_cap(enc, link_settings); |
| 450 | + |
| 451 | + /* in usb c dp2 mode, max lane count is 2 */ |
| 452 | + if (enc->funcs->is_in_alt_mode && enc->funcs->is_in_alt_mode(enc)) { |
| 453 | + if (enc->ctx->asic_id.hw_internal_rev != YELLOW_CARP_B0) { |
| 454 | + // [Note] no need to check hw_internal_rev once phy mux selection is ready |
| 455 | + REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, &is_in_usb_c_dp4_mode); |
| 456 | + } else { |
| 457 | + if ((enc10->base.transmitter == TRANSMITTER_UNIPHY_A) |
| 458 | + || (enc10->base.transmitter == TRANSMITTER_UNIPHY_B) |
| 459 | + || (enc10->base.transmitter == TRANSMITTER_UNIPHY_E)) { |
| 460 | + REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, &is_in_usb_c_dp4_mode); |
| 461 | + } else { |
| 462 | + REG_GET(RDPCSPIPE_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, &is_in_usb_c_dp4_mode); |
| 463 | + } |
| 464 | + } |
| 465 | + if (!is_in_usb_c_dp4_mode) |
| 466 | + link_settings->lane_count = MIN(LANE_COUNT_TWO, link_settings->lane_count); |
| 467 | + } |
| 468 | +} |
0 commit comments