diff mbox

[13/17] drm/dp: Use drm_dp_aux_rd_interval()

Message ID 20180205193827.20374-14-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Feb. 5, 2018, 7:38 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Make use of the newly added drm_dp_aux_rd_interval() helper in existing
DP link training helpers and add comments about minimum required delays
mandated by the DP specification.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 0d9e66ea9667..dabac772dfc3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -120,11 +120,13 @@  EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis);
 
 void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
 {
-	unsigned int min;
+	unsigned int min = drm_dp_aux_rd_interval(dpcd);
 
-	if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] != 0)
-		min = dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4000;
-	else
+	/*
+	 * The DP specification mandates a delay of 100 us during clock
+	 * recovery if the sink doesn't report an AUX read interval.
+	 */
+	if (min == 0)
 		min = 100;
 
 	usleep_range(min, min * 2);
@@ -133,11 +135,13 @@  EXPORT_SYMBOL(drm_dp_link_train_clock_recovery_delay);
 
 void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
 {
-	unsigned int min;
+	unsigned int min = drm_dp_aux_rd_interval(dpcd);
 
-	if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] != 0)
-		min = dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4000;
-	else
+	/*
+	 * The DP specification mandates a delay of 400 us during clock
+	 * recovery if the sink doesn't report an AUX read interval.
+	 */
+	if (min == 0)
 		min = 400;
 
 	usleep_range(min, min * 2);