diff mbox

[1/2] drm/i915: Always perform link training when requested

Message ID 1463120623-3585-1-git-send-email-shubhangi.shrivastava@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shubhangi Shrivastava May 13, 2016, 6:23 a.m. UTC
Short pulse can be generated for automated tests requesting
link training again, such scenarios we have to perform the
request irrespective of the current status of link. This
patch adds support for this request in DP encoder.

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 4c564ba..d5ed84f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3846,6 +3846,7 @@  intel_dp_check_link_status(struct intel_dp *intel_dp)
 	struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	u8 link_status[DP_LINK_STATUS_SIZE];
+	bool check_link = false;
 
 	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
@@ -3854,17 +3855,20 @@  intel_dp_check_link_status(struct intel_dp *intel_dp)
 		return;
 	}
 
-	if (!intel_encoder->base.crtc)
-		return;
-
-	if (!to_intel_crtc(intel_encoder->base.crtc)->active)
-		return;
-
 	/* if link training is requested we should perform it always */
-	if ((intel_dp->compliance_test_type == DP_TEST_LINK_TRAINING) ||
-	    (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))) {
-		DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
+	if (intel_dp->compliance_test_type == DP_TEST_LINK_TRAINING) {
+		DRM_DEBUG_KMS("%s: Link training requested, retraining\n",
 			      intel_encoder->base.name);
+		check_link = true;
+	} else if (((to_intel_crtc(intel_encoder->base.crtc)->active) &&
+		  (intel_encoder->base.crtc)) &&
+		  (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))) {
+			DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
+				      intel_encoder->base.name);
+			check_link = true;
+	}
+
+	if (check_link) {
 		intel_dp_start_link_train(intel_dp);
 		intel_dp_stop_link_train(intel_dp);
 	}