Skip to contentSkip to conversation

drm/i915: Implement Displayport automated testing

PATCH Superseded Todd Previte 1 participant 2 messages Oct 4, 2013 1 message not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): e28f07e502513abe8db6e421386680fef0631eeb

#1 lore raw

PATCH v2 1/1 drm/i915: Implement Displayport automated testing

This initial patch adds support for automated testing of the source device to the i915 driver. Most of this patch is infrastructure for the tests; follow up patches will add support for the individual tests with updates to ACK the tests that are supported (or NAK if the test fails/is unsupported).

---
 drivers/gpu/drm/i915/intel_dp.c | 75 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 72 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +72 -3
index 9770160..1f97a1c 100644
@@ -2730,11 +2730,80 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 	return true;
 }
 
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_edid(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
 static void
 intel_dp_handle_test_request(struct intel_dp *intel_dp)
-{
-	/* NAK by default */
-	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, DP_TEST_NAK);
+{	
+	uint8_t response = DP_TEST_NAK;
+	bool result = false;
+	uint8_t rxdata = 0;
+
+	printk(KERN_DEBUG "Displayport: Recvd automated test request\n");
+	/* Read DP_TEST_REQUEST register to identify the requested test */
+	intel_dp_aux_native_read_retry(intel_dp, DP_TEST_REQUEST, &rxdata, 1);
+	/* Determine which test has been requested */
+	switch (rxdata) {
+		/* ACK/NAK response based on the success or failure of the specified
+		   automated test function. Unimplemented tests will NAK as will those
+		   that are unsupported. */
+		case DP_TEST_LINK_TRAINING:
+			printk(KERN_DEBUG "Displayport: Executing LINK_TRAINING request\n");
+			result = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_PATTERN:
+			printk(KERN_DEBUG "Displayport: Executing TEST_PATTERN request\n");
+			result = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			printk(KERN_DEBUG "Displayport: Executing EDID request\n");
+			result = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
+			printk(KERN_DEBUG "Displayport: Executing PHY_PATTERN request\n");
+			result = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+		/* Unsupported test case or something went wrong */
+		default:
+			/* Log error here for unhandled test request */
+			printk(KERN_DEBUG "Displayport: Error - unhandled automated test type\n");
+			break;
+	}
+	/* Check for a valid test execution */
+	if (result == true)
+		response = DP_TEST_ACK;
+	/* Send ACK/NAK based on action taken above */
+	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, response);
 }
 
 /*
Signature · 1 line
1.8.1.2
#2 lore raw

Ignore this message. Will resend to appropriate thread.

-T

Quoted 99 lines · Todd Previte

This initial patch adds support for automated testing of the source device to the i915 driver. Most of this patch is infrastructure for the tests; follow up patches will add support for the individual tests with updates to ACK the tests that are supported (or NAK if the test fails/is unsupported).

---
  drivers/gpu/drm/i915/intel_dp.c | 75 +++++++++++++++++++++++++++++++++++++++--
  1 file changed, 72 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +72 -3
index 9770160..1f97a1c 100644
@@ -2730,11 +2730,80 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
  	return true;
  }
 
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_edid(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
+{
+	bool test_result = false;
+	return test_result;
+}
+
  static void
  intel_dp_handle_test_request(struct intel_dp *intel_dp)
-{
-	/* NAK by default */
-	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, DP_TEST_NAK);
+{	
+	uint8_t response = DP_TEST_NAK;
+	bool result = false;
+	uint8_t rxdata = 0;
+
+	printk(KERN_DEBUG "Displayport: Recvd automated test request\n");
+	/* Read DP_TEST_REQUEST register to identify the requested test */
+	intel_dp_aux_native_read_retry(intel_dp, DP_TEST_REQUEST, &rxdata, 1);
+	/* Determine which test has been requested */
+	switch (rxdata) {
+		/* ACK/NAK response based on the success or failure of the specified
+		   automated test function. Unimplemented tests will NAK as will those
+		   that are unsupported. */
+		case DP_TEST_LINK_TRAINING:
+			printk(KERN_DEBUG "Displayport: Executing LINK_TRAINING request\n");
+			result = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_PATTERN:
+			printk(KERN_DEBUG "Displayport: Executing TEST_PATTERN request\n");
+			result = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			printk(KERN_DEBUG "Displayport: Executing EDID request\n");
+			result = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
+			printk(KERN_DEBUG "Displayport: Executing PHY_PATTERN request\n");
+			result = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+		/* Unsupported test case or something went wrong */
+		default:
+			/* Log error here for unhandled test request */
+			printk(KERN_DEBUG "Displayport: Error - unhandled automated test type\n");
+			break;
+	}
+	/* Check for a valid test execution */
+	if (result == true)
+		response = DP_TEST_ACK;
+	/* Send ACK/NAK based on action taken above */
+	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, response);
  }
 
  /*