All of lore.kernel.org
 help / color / mirror / Atom feed
* i915 Displayport Compliance Testing
@ 2014-06-24 22:12 Todd Previte
  2014-06-24 22:12 ` [PATCH 1/6] drm/i915: Add automated testing support for Displayport compliance testing Todd Previte
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/6] drm/i915: Add automated testing support for Displayport compliance testing
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  2014-06-24 22:12 ` [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for " Todd Previte
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 84 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b5ec489..3bd1780 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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);
 }
 
 /*
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for compliance testing
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
  2014-06-24 22:12 ` [PATCH 1/6] drm/i915: Add automated testing support for Displayport compliance testing Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  2014-06-25  6:45   ` Chris Wilson
  2014-06-24 22:12 ` [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Todd Previte
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3bd1780..43fcabe 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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;
 		}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
  2014-06-24 22:12 ` [PATCH 1/6] drm/i915: Add automated testing support for Displayport compliance testing Todd Previte
  2014-06-24 22:12 ` [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for " Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  2014-06-25  7:57   ` Jani Nikula
  2014-07-07 15:37   ` Daniel Vetter
  2014-06-24 22:12 ` [PATCH 4/6] drm/i915: Update Displayport compliance test " Todd Previte
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 43fcabe..d060853 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] drm/i915: Update Displayport compliance test for EDID operations
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
                   ` (2 preceding siblings ...)
  2014-06-24 22:12 ` [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  2014-06-24 22:12 ` [PATCH 5/6] drm/i915: Update Displayport compliance testing for link training Todd Previte
  2014-06-24 22:12 ` [PATCH 6/6] drm/i915: Update intel_dp_check_link_status() for Displayport compliance testing Todd Previte
  5 siblings, 0 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 100 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 93 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d060853..4c5d229 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] drm/i915: Update Displayport compliance testing for link training
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
                   ` (3 preceding siblings ...)
  2014-06-24 22:12 ` [PATCH 4/6] drm/i915: Update Displayport compliance test " Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  2014-06-24 22:12 ` [PATCH 6/6] drm/i915: Update intel_dp_check_link_status() for Displayport compliance testing Todd Previte
  5 siblings, 0 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

Adds basic link training test functionality for Displayport compliance.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 4c5d229..95bd27a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/6] drm/i915: Update intel_dp_check_link_status() for Displayport compliance testing
  2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
                   ` (4 preceding siblings ...)
  2014-06-24 22:12 ` [PATCH 5/6] drm/i915: Update Displayport compliance testing for link training Todd Previte
@ 2014-06-24 22:12 ` Todd Previte
  5 siblings, 0 replies; 10+ messages in thread
From: Todd Previte @ 2014-06-24 22:12 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 95bd27a..b58fc25 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for compliance testing
  2014-06-24 22:12 ` [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for " Todd Previte
@ 2014-06-25  6:45   ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2014-06-25  6:45 UTC (permalink / raw)
  To: Todd Previte; +Cc: intel-gfx

On Tue, Jun 24, 2014 at 03:12:50PM -0700, Todd Previte wrote:
> 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.
> 
> Signed-off-by: Todd Previte <tprevite@gmail.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 3bd1780..43fcabe 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -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. */
> +				/* 400us delay between transactions for errors/timeouts
> +				   required for DP compliance testing */
> +				udelay(400);
>  				continue;
> +			}
>  			if (status & DP_AUX_CH_CTL_DONE)
>  				break;

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations
  2014-06-24 22:12 ` [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Todd Previte
@ 2014-06-25  7:57   ` Jani Nikula
  2014-07-07 15:37   ` Daniel Vetter
  1 sibling, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2014-06-25  7:57 UTC (permalink / raw)
  To: Todd Previte, intel-gfx

On Wed, 25 Jun 2014, Todd Previte <tprevite@gmail.com> wrote:
> 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.
>
> Signed-off-by: Todd Previte <tprevite@gmail.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 43fcabe..d060853 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -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) {

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.


> +		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 */
> -- 
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations
  2014-06-24 22:12 ` [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Todd Previte
  2014-06-25  7:57   ` Jani Nikula
@ 2014-07-07 15:37   ` Daniel Vetter
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2014-07-07 15:37 UTC (permalink / raw)
  To: Todd Previte; +Cc: intel-gfx

On Tue, Jun 24, 2014 at 03:12:51PM -0700, Todd Previte wrote:
> 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.
> 
> Signed-off-by: Todd Previte <tprevite@gmail.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 43fcabe..d060853 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -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

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

> +		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 */
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-07-07 15:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 22:12 i915 Displayport Compliance Testing Todd Previte
2014-06-24 22:12 ` [PATCH 1/6] drm/i915: Add automated testing support for Displayport compliance testing Todd Previte
2014-06-24 22:12 ` [PATCH 2/6] drm/i915: Add a delay in Displayport AUX transactions for " Todd Previte
2014-06-25  6:45   ` Chris Wilson
2014-06-24 22:12 ` [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Todd Previte
2014-06-25  7:57   ` Jani Nikula
2014-07-07 15:37   ` Daniel Vetter
2014-06-24 22:12 ` [PATCH 4/6] drm/i915: Update Displayport compliance test " Todd Previte
2014-06-24 22:12 ` [PATCH 5/6] drm/i915: Update Displayport compliance testing for link training Todd Previte
2014-06-24 22:12 ` [PATCH 6/6] drm/i915: Update intel_dp_check_link_status() for Displayport compliance testing Todd Previte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.