Skip to content

Commit 5a1fef0

Browse files
Hansenalexdeucher
authored andcommitted
drm/amd/display: Fix detection of 4 lane for DPALT
[Why] DPALT detection for B0 PHY has its own set of RDPCSPIPE registers [How] Use RDPCSPIPE registers to detect if DPALT lane is 4 lane Reviewed-by: Charlene Liu <[email protected]> Acked-by: Solomon Chiu <[email protected]> Signed-off-by: Hansen <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent a7e397b commit 5a1fef0

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
#define AUX_REG_WRITE(reg_name, val) \
6464
dm_write_reg(CTX, AUX_REG(reg_name), val)
6565

66+
#ifndef MIN
67+
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
68+
#endif
69+
6670
void dcn31_link_encoder_set_dio_phy_mux(
6771
struct link_encoder *enc,
6872
enum encoder_type_select sel,
@@ -217,7 +221,7 @@ static const struct link_encoder_funcs dcn31_link_enc_funcs = {
217221
.get_dig_frontend = dcn10_get_dig_frontend,
218222
.get_dig_mode = dcn10_get_dig_mode,
219223
.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,
221225
.set_dio_phy_mux = dcn31_link_encoder_set_dio_phy_mux,
222226
};
223227

@@ -435,3 +439,30 @@ bool dcn31_link_encoder_is_in_alt_mode(struct link_encoder *enc)
435439

436440
return is_usb_c_alt_mode;
437441
}
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+
}

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,7 @@ void dcn31_link_encoder_disable_output(
252252
bool dcn31_link_encoder_is_in_alt_mode(
253253
struct link_encoder *enc);
254254

255+
void dcn31_link_encoder_get_max_link_cap(struct link_encoder *enc,
256+
struct dc_link_settings *link_settings);
257+
255258
#endif /* __DC_LINK_ENCODER__DCN31_H__ */

0 commit comments

Comments
 (0)