Commit 302f5988 authored by Dale Zhao's avatar Dale Zhao Committed by Alex Deucher

drm/amd/display: Use absolute time stamp to follow the eDP T7 spec requirement

[Why]:
According to eDP spec, max T7 delay should be 50 ms. Current code uses 300
retry counters may not be accurate enough for different panels.

[How]:
Use absolute time stamp to achive accurate delay.
Signed-off-by: default avatarDale Zhao <dale.zhao@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a7044591
...@@ -173,15 +173,20 @@ bool edp_receiver_ready_T9(struct dc_link *link) ...@@ -173,15 +173,20 @@ bool edp_receiver_ready_T9(struct dc_link *link)
} }
bool edp_receiver_ready_T7(struct dc_link *link) bool edp_receiver_ready_T7(struct dc_link *link)
{ {
unsigned int tries = 0;
unsigned char sinkstatus = 0; unsigned char sinkstatus = 0;
unsigned char edpRev = 0; unsigned char edpRev = 0;
enum dc_status result = DC_OK; enum dc_status result = DC_OK;
/* use absolute time stamp to constrain max T7*/
unsigned long long enter_timestamp = 0;
unsigned long long finish_timestamp = 0;
unsigned long long time_taken_in_ns = 0;
result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, &edpRev, sizeof(edpRev)); result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, &edpRev, sizeof(edpRev));
if (result == DC_OK && edpRev < DP_EDP_12) if (result == DC_OK && edpRev < DP_EDP_12)
return true; return true;
/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/ /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
enter_timestamp = dm_get_timestamp(link->ctx);
do { do {
sinkstatus = 0; sinkstatus = 0;
result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus)); result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus));
...@@ -189,8 +194,10 @@ bool edp_receiver_ready_T7(struct dc_link *link) ...@@ -189,8 +194,10 @@ bool edp_receiver_ready_T7(struct dc_link *link)
break; break;
if (result != DC_OK) if (result != DC_OK)
break; break;
udelay(25); //MAx T7 is 50ms udelay(25);
} while (++tries < 300); finish_timestamp = dm_get_timestamp(link->ctx);
time_taken_in_ns = dm_get_elapse_time_in_ns(link->ctx, finish_timestamp, enter_timestamp);
} while (time_taken_in_ns < 50 * 1000000); //MAx T7 is 50ms
if (link->local_sink->edid_caps.panel_patch.extra_t7_ms > 0) if (link->local_sink->edid_caps.panel_patch.extra_t7_ms > 0)
udelay(link->local_sink->edid_caps.panel_patch.extra_t7_ms * 1000); udelay(link->local_sink->edid_caps.panel_patch.extra_t7_ms * 1000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment