mirror of https://gitee.com/openkylin/linux.git
drm/amd/display: Enable type C hotplug
[Why and How] We want to change where timing is done for alt mode. Some of the commented out #ifs are needed for DCN20 so we enable them for that case. Signed-off-by: Eric Yang <Eric.Yang2@amd.com> Reviewed-by: Eric Yang <eric.yang2@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
2c58cc6dc0
commit
b5b1f45549
|
@ -684,6 +684,56 @@ static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid)
|
|||
return (memcmp(old_edid->raw_edid, new_edid->raw_edid, new_edid->length) == 0);
|
||||
}
|
||||
|
||||
bool wait_for_alt_mode(struct dc_link *link)
|
||||
{
|
||||
|
||||
/**
|
||||
* something is terribly wrong if time out is > 200ms. (5Hz)
|
||||
* 500 microseconds * 400 tries us 200 ms
|
||||
**/
|
||||
unsigned int sleep_time_in_microseconds = 500;
|
||||
unsigned int tries_allowed = 400;
|
||||
bool is_in_alt_mode;
|
||||
unsigned long long enter_timestamp;
|
||||
unsigned long long finish_timestamp;
|
||||
unsigned long long time_taken_in_ns;
|
||||
int tries_taken;
|
||||
|
||||
DC_LOGGER_INIT(link->ctx->logger);
|
||||
|
||||
if (link->link_enc->funcs->is_in_alt_mode == NULL)
|
||||
return true;
|
||||
|
||||
is_in_alt_mode = link->link_enc->funcs->is_in_alt_mode(link->link_enc);
|
||||
DC_LOG_WARNING("DP Alt mode state on HPD: %d\n", is_in_alt_mode);
|
||||
|
||||
if (is_in_alt_mode)
|
||||
return true;
|
||||
|
||||
enter_timestamp = dm_get_timestamp(link->ctx);
|
||||
|
||||
for (tries_taken = 0; tries_taken < tries_allowed; tries_taken++) {
|
||||
udelay(sleep_time_in_microseconds);
|
||||
/* ask the link if alt mode is enabled, if so return ok */
|
||||
if (link->link_enc->funcs->is_in_alt_mode(link->link_enc)) {
|
||||
|
||||
finish_timestamp = dm_get_timestamp(link->ctx);
|
||||
time_taken_in_ns = dm_get_elapse_time_in_ns(
|
||||
link->ctx, finish_timestamp, enter_timestamp);
|
||||
DC_LOG_WARNING("Alt mode entered finished after %llu ms\n",
|
||||
time_taken_in_ns / 1000000);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
finish_timestamp = dm_get_timestamp(link->ctx);
|
||||
time_taken_in_ns = dm_get_elapse_time_in_ns(link->ctx, finish_timestamp,
|
||||
enter_timestamp);
|
||||
DC_LOG_WARNING("Alt mode has timed out after %llu ms\n",
|
||||
time_taken_in_ns / 1000000);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* dc_link_detect() - Detect if a sink is attached to a given link
|
||||
*
|
||||
|
@ -772,6 +822,15 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
|
|||
}
|
||||
|
||||
case SIGNAL_TYPE_DISPLAY_PORT: {
|
||||
/* wa HPD high coming too early*/
|
||||
if (link->link_enc->features.flags.bits.DP_IS_USB_C == 1) {
|
||||
|
||||
/* if alt mode times out, return false */
|
||||
if (wait_for_alt_mode(link) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!detect_dp(
|
||||
link,
|
||||
&sink_caps,
|
||||
|
|
|
@ -337,6 +337,7 @@ struct dcn10_link_enc_registers {
|
|||
type RDPCS_TX_FIFO_ERROR_MASK;\
|
||||
type RDPCS_DPALT_DISABLE_TOGGLE_MASK;\
|
||||
type RDPCS_DPALT_4LANE_TOGGLE_MASK;\
|
||||
type RDPCS_PHY_DPALT_DISABLE;\
|
||||
type RDPCS_PHY_DPALT_DISABLE_ACK;\
|
||||
type RDPCS_PHY_DP_MPLLB_V2I;\
|
||||
type RDPCS_PHY_DP_MPLLB_FREQ_VCO;\
|
||||
|
|
|
@ -183,6 +183,7 @@ struct link_encoder_funcs {
|
|||
|
||||
bool (*fec_is_active)(struct link_encoder *enc);
|
||||
#endif
|
||||
bool (*is_in_alt_mode) (struct link_encoder *enc);
|
||||
};
|
||||
|
||||
#endif /* LINK_ENCODER_H_ */
|
||||
|
|
Loading…
Reference in New Issue