[PATCH 14/21] drm/dp: Use drm_dp_aux_rd_interval()

Thierry Reding thierry.reding at gmail.com
Mon Aug 5 12:23:43 UTC 2019


From: Thierry Reding <treding at 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 at nvidia.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 344f887fef2c..1fb3c27cd012 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -122,17 +122,7 @@ 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 rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] &
-					DP_TRAINING_AUX_RD_MASK;
-
-	if (rd_interval > 4)
-		DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n",
-			      rd_interval);
-
-	if (rd_interval == 0 || dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14)
-		rd_interval = 100;
-	else
-		rd_interval *= 4;
+	unsigned int rd_interval = drm_dp_aux_rd_interval(dpcd);
 
 	usleep_range(rd_interval, rd_interval * 2);
 }
@@ -140,19 +130,9 @@ 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 rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] &
-					DP_TRAINING_AUX_RD_MASK;
-
-	if (rd_interval > 4)
-		DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n",
-			      rd_interval);
+	unsigned int min = drm_dp_aux_rd_interval(dpcd);
 
-	if (rd_interval == 0)
-		rd_interval = 400;
-	else
-		rd_interval *= 4;
-
-	usleep_range(rd_interval, rd_interval * 2);
+	usleep_range(min, min * 2);
 }
 EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay);
 
-- 
2.22.0



More information about the dri-devel mailing list