Skip to contentSkip to conversation

i915 Displayport Compliance Testing

PATCH In review Todd Previte 4 participants 10 messages Jun 24, 2014 – Jul 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch set adds the foundational support for Displayport compliance testing in the i915 driver. It implements the framework for automated test support that preclude the need (most) for operator input during testing. Tests for AUX transactions, EDID reads and basic link training have also been included, along with any support and utility functions required. Some changes have also been made to existing code to accommodate compliance testing.

#1 lore raw

PATCH 1/6 drm/i915: Add automated testing support for Displayport compliance testing

Add the skeleton framework for supporting automation for Displayport compliance testing. This patch adds the necessary framework for the source device to appropriately responded to test automation requests from a sink device.

---
 drivers/gpu/drm/i915/intel_dp.c | 84 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +82 -2
index b5ec489..3bd1780 100644
@@ -3328,11 +3328,91 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 				       sink_irq_vector, 1) == 1;
 }
 
+/* Displayport compliance testing - Link training */
+static uint8_t
+intel_dp_autotest_link_training(struct intel_dp *intel_dp)
+{
+	uint8_t test_result = DP_TEST_NAK;
+	return test_result;
+}
+
+/* Displayport compliance testing - Video pattern testing */
+static uint8_t
+intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
+{
+	uint8_t test_result = DP_TEST_NAK;
+	return test_result;
+}
+
+/* Displayport compliance testing - EDID operations */
+static uint8_t
+intel_dp_autotest_edid(struct intel_dp *intel_dp)
+{
+	uint8_t test_result = DP_TEST_NAK;
+	return test_result;
+}
+
+/* Displayport compliance testing - PHY pattern testing */
+static uint8_t
+intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
+{
+	uint8_t test_result = DP_TEST_NAK;
+	return test_result;
+}
+
+/* Displayport compliance testing - Fast AUX transactions (optional) */
+static uint8_t
+intel_dp_autotest_faux_pattern(struct intel_dp *intel_dp)
+{
+        uint8_t test_result = DP_TEST_NAK;
+		printk("Displayport: Fast AUX (FAUX) not supported.\n");
+        return test_result;
+}
+
 static void
 intel_dp_handle_test_request(struct intel_dp *intel_dp)
 {
-	/* NAK by default */
-	drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_RESPONSE, DP_TEST_NAK);
+	uint8_t response = DP_TEST_NAK;
+	uint8_t rxdata = 0;
+	int ret = 0;
+
+	DRM_DEBUG_KMS("Displayport: Received automated test request\n");
+	/* Read DP_TEST_REQUEST register to identify the requested test */
+	ret = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_REQUEST, &rxdata, 1);
+
+	/* Determine which test has been requested */
+	switch (rxdata) {
+		/* ACK/NAK response based on test function response
+		   Unimplemented/unsupported tests will NAK */
+		case DP_TEST_LINK_TRAINING:
+			DRM_DEBUG_KMS("Displayport: Executing LINK_TRAINING request\n");
+			response = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_VIDEO_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing TEST_PATTERN request\n");
+			response = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			DRM_DEBUG_KMS("Displayport: Executing EDID request\n");
+			response = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing PHY_PATTERN request\n");
+			response = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+			/* FAUX is optional in DP 1.2*/
+		case DP_TEST_LINK_FAUX_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing FAUX_PATTERN request \n");
+			response = intel_dp_autotest_faux_pattern(intel_dp);
+			break;
+		/* Unsupported test case or something went wrong */
+		default:
+			/* Log error here for unhandled test request */
+			DRM_DEBUG_KMS("Displayport: Error - unhandled automated test request\n");
+			break;
+	}
+	/* Send the response from the test result */
+	ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_RESPONSE, &response, 1);
 }
 
 /*
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/6 drm/i915: Add a delay in Displayport AUX transactions for compliance testing

In reply to Todd Previte

Several compliance tests require that follow-up AUX transactions (after a failure or no response) are not resent sooner than 400us later. Add a 400us delay to the response time of any failed transaction to account for this.

---
 drivers/gpu/drm/i915/intel_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +5 -1
index 3bd1780..43fcabe 100644
@@ -561,8 +561,12 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 				   DP_AUX_CH_CTL_RECEIVE_ERROR);
 
 			if (status & (DP_AUX_CH_CTL_TIME_OUT_ERROR |
-				      DP_AUX_CH_CTL_RECEIVE_ERROR))
+				      DP_AUX_CH_CTL_RECEIVE_ERROR)) {
+				/* 400us delay between transactions for errors/timeouts
+				   required for DP compliance testing */
+				udelay(400);
 				continue;
+			}
 			if (status & DP_AUX_CH_CTL_DONE)
 				break;
 		}
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for compliance testing

Quoted 14 lines · Todd Previte

Several compliance tests require that follow-up AUX transactions (after a failure or no response) are not resent sooner than 400us later. Add a 400us delay to the response time of any failed transaction to account for this.

---
 drivers/gpu/drm/i915/intel_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 3bd1780..43fcabe 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_aux_ch(struct intel_dp *intel_dp, · line 564

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -561,8 +561,12 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 				   DP_AUX_CH_CTL_RECEIVE_ERROR);
 
 			if (status & (DP_AUX_CH_CTL_TIME_OUT_ERROR |
-				      DP_AUX_CH_CTL_RECEIVE_ERROR))
+				      DP_AUX_CH_CTL_RECEIVE_ERROR)) {

I think "required for DP compliance testing" is a little verbose and can be shortened to "DP requires". If you have a spec reference handy, that would be useful.

/* 10.2.1: DP requires 400us delay after an error. */

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +4 -0
+				/* 400us delay between transactions for errors/timeouts
+				   required for DP compliance testing */
+				udelay(400);
 				continue;
+			}
 			if (status & DP_AUX_CH_CTL_DONE)
 				break;
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw

PATCH 3/6 drm/i915: Implement basic Displayport automated testing function for EDID operations

In reply to Todd Previte

Implements some of the basic EDID tests for Displayport compliance. These tests include reading the EDID, verifying the checksum and writing the test responses back to the sink device.

---
 drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +35 -1
index 43fcabe..d060853 100644
@@ -3352,8 +3352,42 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
 static uint8_t
 intel_dp_autotest_edid(struct intel_dp *intel_dp)
 {
+	struct drm_connector *connector = &intel_dp->attached_connector->base;
+	struct i2c_adapter *adapter = &intel_dp->aux.ddc;
+	struct edid *edid_read = NULL;
+	uint8_t *edid_data = NULL;
 	uint8_t test_result = DP_TEST_NAK;
-	return test_result;
+	uint32_t i = 0, ret = 0, checksum = 0;
+	struct drm_display_mode *use_mode = NULL;
+	dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED;
+	int mode_count = 0;
+
+	edid_read = drm_get_edid(connector, adapter);
+
+	DRM_DEBUG_KMS("Displayport: EDID automated test\n");
+
+	if (edid_read) {
+		test_result = true;
+		edid_data = (uint8_t*) edid_read;
+		// Compute checksum
+		for (i = 0; i < 128; i++)
+				checksum += edid_data[i];
+
+		DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum);
+		// Verify EDID checksum
+		if (checksum % 256 == 0) {
+			/* Write the checksum to EDID checksum register */
+			ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1);
+			// Reponse is ACK and and checksum written
+			test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
+			DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum);
+		}
+		else {
+			// Invalid checksum, set for failsafe mode
+			comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE;
+		}
+	}
+        return test_result;
 }
 
 /* Displayport compliance testing - PHY pattern testing */
Signature · 1 line
1.9.1
maintainer
#5 lore raw

Re: [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations

Quoted 23 lines · Todd Previte

Implements some of the basic EDID tests for Displayport compliance. These tests include reading the EDID, verifying the checksum and writing the test responses back to the sink device.

---
 drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +4 -1
index 43fcabe..d060853 100644
@@ -3352,8 +3352,42 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
 static uint8_t
 intel_dp_autotest_edid(struct intel_dp *intel_dp)
 {
+	struct drm_connector *connector = &intel_dp->attached_connector->base;
+	struct i2c_adapter *adapter = &intel_dp->aux.ddc;
+	struct edid *edid_read = NULL;
+	uint8_t *edid_data = NULL;
 	uint8_t test_result = DP_TEST_NAK;
-	return test_result;

drivers/gpu/drm/i915/intel_dp.c intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) · line 3369

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	uint32_t i = 0, ret = 0, checksum = 0;
+	struct drm_display_mode *use_mode = NULL;
+	dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED;
+	int mode_count = 0;
+
+	edid_read = drm_get_edid(connector, adapter);
+
+	DRM_DEBUG_KMS("Displayport: EDID automated test\n");
+
+	if (edid_read) {

It is customary to have if (!edid_read) and bail out early. Then the rest will be a happy day scenario with minimal indentation.

BR,
Jani.

Quoted 31 lines
drivers/gpu/drm/i915/intel_dp.c +21 -0
+		test_result = true;
+		edid_data = (uint8_t*) edid_read;
+		// Compute checksum
+		for (i = 0; i < 128; i++)
+				checksum += edid_data[i];
+
+		DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum);
+		// Verify EDID checksum
+		if (checksum % 256 == 0) {
+			/* Write the checksum to EDID checksum register */
+			ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1);
+			// Reponse is ACK and and checksum written
+			test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
+			DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum);
+		}
+		else {
+			// Invalid checksum, set for failsafe mode
+			comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE;
+		}
+	}
+        return test_result;
 }
 
 /* Displayport compliance testing - PHY pattern testing */
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#6 lore raw

Re: [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations

In reply to Todd Previte
Quoted 26 lines · Todd Previte

Implements some of the basic EDID tests for Displayport compliance. These tests include reading the EDID, verifying the checksum and writing the test responses back to the sink device.

---
 drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +7 -1
index 43fcabe..d060853 100644
@@ -3352,8 +3352,42 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
 static uint8_t
 intel_dp_autotest_edid(struct intel_dp *intel_dp)
 {
+	struct drm_connector *connector = &intel_dp->attached_connector->base;
+	struct i2c_adapter *adapter = &intel_dp->aux.ddc;
+	struct edid *edid_read = NULL;
+	uint8_t *edid_data = NULL;
 	uint8_t test_result = DP_TEST_NAK;
-	return test_result;
+	uint32_t i = 0, ret = 0, checksum = 0;
+	struct drm_display_mode *use_mode = NULL;
+	dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED;

drivers/gpu/drm/i915/intel_dp.c intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) · line 3372

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	int mode_count = 0;
+
+	edid_read = drm_get_edid(connector, adapter);
+
+	DRM_DEBUG_KMS("Displayport: EDID automated test\n");
+
+	if (edid_read) {
+		test_result = true;
+		edid_data = (uint8_t*) edid_read;
+		// Compute checksum

Checkpatch isn't approving of // style comments, and there's other issues. -Daniel

Quoted 28 lines
drivers/gpu/drm/i915/intel_dp.c +18 -0
+		for (i = 0; i < 128; i++)
+				checksum += edid_data[i];
+
+		DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum);
+		// Verify EDID checksum
+		if (checksum % 256 == 0) {
+			/* Write the checksum to EDID checksum register */
+			ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1);
+			// Reponse is ACK and and checksum written
+			test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
+			DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum);
+		}
+		else {
+			// Invalid checksum, set for failsafe mode
+			comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE;
+		}
+	}
+        return test_result;
 }
 
 /* Displayport compliance testing - PHY pattern testing */
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

PATCH 4/6 drm/i915: Update Displayport compliance test for EDID operations

In reply to Todd Previte

Adds additional functionality to the EDID compliance testing operations to further enhance Displayport compliance. Specifically this patch adds the ability to search through the probed EDID modes and select an appropriate mode based on the test requirements. A stub function for actually setting the mode is included as well.

---
 drivers/gpu/drm/i915/intel_dp.c | 100 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 93 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +93 -7
index d060853..4c5d229 100644
@@ -82,6 +82,15 @@ static const struct dp_link_dpll chv_dpll[] = {
 		{ .p1 = 2, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c00000 } }
 };
 
+/* Enum for selecting EDID preferred or failsafe display mode
+   during DP compliance testing */
+typedef enum
+{
+	DP_COMPLIANCE_MODE_FAILSAFE = 0,
+	DP_COMPLIANCE_MODE_PREFERRED = 1
+} dp_compliance_mode;
+
+
 /**
  * is_edp - is the given port attached to an eDP panel (either CPU or PCH)
  * @intel_dp: DP struct
@@ -3332,6 +3341,65 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 				       sink_irq_vector, 1) == 1;
 }
 
+/* Displayport compliance - internal modeset function */
+static int
+intel_dp_set_mode_for_compliance(struct intel_dp* intel_dp,
+								 struct drm_display_mode *comp_mode)
+{
+	int status = 0;
+	/* FIXME: Implementation TBD - necessary for DP compliance */
+	return status;
+}
+
+/* Displayport compliance - find the correct display mode */
+static struct drm_display_mode*
+intel_dp_get_compliance_mode(struct intel_dp *intel_dp, dp_compliance_mode compliance_mode)
+{
+	struct drm_display_mode *found_mode = NULL;
+	struct drm_connector *connector = &intel_dp->attached_connector->base;
+	int mode_count = 0;
+	char *comp_mode_string = NULL;
+
+	switch (compliance_mode) {
+		case DP_COMPLIANCE_MODE_FAILSAFE:
+			/* Failsafe is 640x480 @ 60Hz, 6bpc */
+			list_for_each_entry(found_mode, &connector->probed_modes, head) {
+				if (found_mode->hdisplay == 640 &&
+					   found_mode->vdisplay == 480 &&
+					   found_mode->vrefresh == 60) {
+					   // Found the failsafe mode, return it
+					   DRM_DEBUG_KMS("Displayport: Found failsafe mode '%s'\n",
+									 found_mode->name);
+					   goto exit_with_mode;
+				}
+				mode_count++;
+			}
+			comp_mode_string = "Failsafe";
+			break;
+		case DP_COMPLIANCE_MODE_PREFERRED:
+			list_for_each_entry(found_mode, &connector->probed_modes, head) {
+				// Check for a preferred mode
+				if (found_mode->type & DRM_MODE_TYPE_PREFERRED) {
+					   // Found the preferred mode, return it
+					   DRM_DEBUG_KMS("Displayport: Found preferred mode '%s'\n",
+									 found_mode->name);
+					   goto exit_with_mode;
+				}
+				mode_count++;
+			}
+			comp_mode_string = "Preferred";
+			break;
+		default:
+			DRM_DEBUG_KMS("Displayport: Invalid compliance mode type specified\n");
+			break;
+	}
+	/* No mode found, report the error */
+	DRM_DEBUG_KMS("Displayport: Could not find %s mode in %d modes\n", comp_mode_string, mode_count);
+
+exit_with_mode:
+	return found_mode;
+}
+
 /* Displayport compliance testing - Link training */
 static uint8_t
 intel_dp_autotest_link_training(struct intel_dp *intel_dp)
@@ -3362,30 +3430,48 @@ intel_dp_autotest_edid(struct intel_dp *intel_dp)
 	dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED;
 	int mode_count = 0;
 
+	DRM_DEBUG_KMS("Displayport: EDID automated test\n");
+
+	/* FIXME: Need a complete DPCD read here
+	          Need to read out branch device information */
+
+	/* Now read out the EDID */
 	edid_read = drm_get_edid(connector, adapter);
 
-	DRM_DEBUG_KMS("Displayport: EDID automated test\n");
+	/* FIXME: Need to determine how to detect E-DDC here */
+
 
 	if (edid_read) {
 		test_result = true;
 		edid_data = (uint8_t*) edid_read;
-		// Compute checksum
+		/* Compute checksum */
 		for (i = 0; i < 128; i++)
 				checksum += edid_data[i];
-
-		DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum);
-		// Verify EDID checksum
+		/* Verify EDID checksum */
 		if (checksum % 256 == 0) {
 			/* Write the checksum to EDID checksum register */
 			ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1);
-			// Reponse is ACK and and checksum written
+			/* Reponse is ACK and and checksum written */
 			test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
 			DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum);
 		}
 		else {
-			// Invalid checksum, set for failsafe mode
+			/* Invalid checksum - EDID corruption detection test */
+			DRM_DEBUG_KMS("Displayport: EDID test - checksum %02x invalid \n", edid_read->checksum);
 			comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE;
 		}
+
+		mode_count = intel_connector_update_modes(connector, edid_read);
+
+		if (!mode_count)
+			DRM_DEBUG_KMS("Displayport: Mode update failed\n");
+		else
+			DRM_DEBUG_KMS("Displayport: Added %d modes\n", mode_count);
+
+		/* Get the correct mode for this compliance test*/
+		use_mode = intel_dp_get_compliance_mode(intel_dp, comp_mode_type);
+		/* Set the mode */
+		intel_dp_set_mode_for_compliance(intel_dp, use_mode);
 	}
         return test_result;
 }
Signature · 1 line
1.9.1
#8 lore raw

PATCH 5/6 drm/i915: Update Displayport compliance testing for link training

In reply to Todd Previte

Adds basic link training test functionality for Displayport compliance.

---
 drivers/gpu/drm/i915/intel_dp.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +24 -0
index 4c5d229..95bd27a 100644
@@ -3405,6 +3405,30 @@ static uint8_t
 intel_dp_autotest_link_training(struct intel_dp *intel_dp)
 {
 	uint8_t test_result = DP_TEST_NAK;
+	uint8_t rxdata[2];
+	uint8_t link_status[DP_LINK_STATUS_SIZE];
+	int bytes_ret = 0;
+
+	/* Read test parameters */
+	bytes_ret = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_LINK_RATE, rxdata, 2);
+
+	/* Set link rate directly */
+	intel_dp->link_bw = rxdata[0];
+	/* Preserve 7:5 when setting lane count */
+	intel_dp->lane_count &= 0xE0;
+	intel_dp->lane_count |= rxdata[1];
+
+	DRM_DEBUG_KMS("Displayport: Link training testing - %d lanes @ %02x link rate\n", intel_dp->lane_count, intel_dp->link_bw);
+
+	/* Train the link */
+	intel_dp_start_link_train(intel_dp);
+	intel_dp_complete_link_train(intel_dp);
+	intel_dp_stop_link_train(intel_dp);
+
+	// Check link status for successful completion
+	if (drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))
+		test_result = true;
+
 	return test_result;
 }
 
Signature · 1 line
1.9.1
#9 lore raw

PATCH 6/6 drm/i915: Update intel_dp_check_link_status() for Displayport compliance testing

In reply to Todd Previte

Move the DPCD read to the top and check for an interrupt from the sink to catch Displayport automated testing requests necessary to support Displayport compliance testing. The checks for active connectors and link status are moved below the check for the interrupt.

---
 drivers/gpu/drm/i915/intel_dp.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +16 -16
index 95bd27a..b58fc25 100644
@@ -3579,22 +3579,9 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 	u8 sink_irq_vector;
 	u8 link_status[DP_LINK_STATUS_SIZE];
 
-	/* FIXME: This access isn't protected by any locks. */
-	if (!intel_encoder->connectors_active)
-		return;
-
-	if (WARN_ON(!intel_encoder->base.crtc))
-		return;
-
-	/* Try to read receiver status if the link appears to be up */
-	if (!intel_dp_get_link_status(intel_dp, link_status)) {
-		return;
-	}
-
-	/* Now read the DPCD to see if it's actually running */
-	if (!intel_dp_get_dpcd(intel_dp)) {
+	/* Attempt to read the DPCD */
+	if (!intel_dp_get_dpcd(intel_dp))
 		return;
-	}
 
 	/* Try to read the source of the interrupt */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
@@ -3604,12 +3591,25 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
 				   DP_DEVICE_SERVICE_IRQ_VECTOR,
 				   sink_irq_vector);
 
-		if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
+		if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST) {
+			DRM_DEBUG_KMS("Displayport: Received automated test request\n");
 			intel_dp_handle_test_request(intel_dp);
+		}
 		if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
 			DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
 	}
 
+	/* FIXME: This access isn't protected by any locks. */
+	if (!intel_encoder->connectors_active)
+		return;
+
+	if (WARN_ON(!intel_encoder->base.crtc))
+		return;
+
+	/* Try to read receiver status if the link appears to be up */
+	if (!intel_dp_get_link_status(intel_dp, link_status))
+		return;
+
 	if (!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);
Signature · 1 line
1.9.1