Skip to contentSkip to conversation

drm/i915: Implement Displayport automated testing

PATCH Superseded Todd Previte 5 participants 13 messages Oct 4, 2013 – Nov 5, 2013

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

PATCH 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 | 108 +++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_dp_helper.h     |   3 +-
 2 files changed, 108 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +106 -2
index 9770160..a042d59 100644
@@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = {
 		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
 };
 
+/******************************************************************************
+********            Displayport automated testing                      ********
+******************************************************************************/
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp);
+/* Automated testing function - video test pattern */
+static bool
+intel_dp_autotest_video_pattern(struct intel_dp *intel_dp);
+/* Automated testing function - EDID read */
+static bool
+intel_dp_autotest_edid(struct intel_dp *intel_dp);
+/* Automated testing function - PHY pattern */
+static bool
+intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp);
+/* Automated testing function - faux pattern */
+static bool
+intel_dp_autotest_faux_pattern(struct intel_dp *intel_dp);
+/*****************************************************************************/
+
 /**
  * is_edp - is the given port attached to an eDP panel (either CPU or PCH)
  * @intel_dp: DP struct
@@ -2732,9 +2752,93 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 
 static void
 intel_dp_handle_test_request(struct intel_dp *intel_dp)
+{	
+	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) {
+		/* Supported tests handled below */
+		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_VIDEO_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;
+		case DP_TEST_LINK_FAUX_TEST_PATTERN:
+			printk(KERN_DEBUG "Displayport: Executing FAUX_PATTERN request \n");
+			result = intel_dp_autotest_faux_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);
+}
+
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp)
+{
+	/* Automated test function hook */
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated testing function - video test pattern */
+static bool
+intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
+{
+	/* Automated test function hook */
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated testing function - EDID read */
+static bool
+intel_dp_autotest_edid(struct intel_dp *intel_dp)
+{
+	/* Automated test function hook */
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated testing function - PHY pattern */
+static bool
+intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
+{
+	/* Automated test function hook */
+	bool test_result = false;
+	return test_result;
+}
+
+/* Automated testing function - faux pattern */
+static bool
+intel_dp_autotest_faux_pattern(struct intel_dp *intel_dp)
 {
-	/* NAK by default */
-	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, DP_TEST_NAK);
+	/* Automated test function hook */
+	bool test_result = false;
+	return test_result;
 }
 
 /*
include/drm/drm_dp_helper.h +2 -1
index ae8dbfb..9fa544b 100644
@@ -266,9 +266,10 @@
 
 #define DP_TEST_REQUEST			    0x218
 # define DP_TEST_LINK_TRAINING		    (1 << 0)
-# define DP_TEST_LINK_PATTERN		    (1 << 1)
+# define DP_TEST_LINK_VIDEO_PATTERN	    (1 << 1)
 # define DP_TEST_LINK_EDID_READ		    (1 << 2)
 # define DP_TEST_LINK_PHY_TEST_PATTERN	    (1 << 3) /* DPCD >= 1.1 */
+# define DP_TEST_LINK_FAUX_TEST_PATTERN	    (1 << 4) /* DPCD >= 1.2 */
 
 #define DP_TEST_LINK_RATE		    0x219
 # define DP_LINK_RATE_162		    (0x6)
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 17 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 | 108 +++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_dp_helper.h     |   3 +-
 2 files changed, 108 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 9770160..a042d59 100644

drivers/gpu/drm/i915/intel_dp.c static const struct dp_link_dpll vlv_dpll[] = { · line 72

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = {
 		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
 };
 
+/******************************************************************************
+********            Displayport automated testing                      ********
+******************************************************************************/
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp);

The function comment does little more than spell out the function name. What I would prefer to see is a theory-of-operation in the block comment. And all these forward declarations can disappear with clear ordering in the source code.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 21 lines · Chris Wilson
Quoted 20 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 | 108 +++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_dp_helper.h     |   3 +-
  2 files changed, 108 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 9770160..a042d59 100644
@@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = {
  		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
  };
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_dp.c static const struct dp_link_dpll vlv_dpll[] = { · line 72

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+/******************************************************************************
+********            Displayport automated testing                      ********
+******************************************************************************/
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp);

The function comment does little more than spell out the function name. What I would prefer to see is a theory-of-operation in the block comment. And all these forward declarations can disappear with clear ordering in the source code.
-Chris

I wasn't sure which way to go with this and opted for the declarations, but it's just as easy to reorder the definitions to be prior to their use in the handler. I'll get that fixed up and add more useful comments above the functions for V2. Thanks Chris.

-T

#3 lore raw
Quoted 34 lines · Todd Previte
Quoted 21 lines · Chris Wilson
Quoted 20 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 | 108 +++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_dp_helper.h     |   3 +-
 2 files changed, 108 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 9770160..a042d59 100644
@@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = {
 		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
 };
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_dp.c static const struct dp_link_dpll vlv_dpll[] = { · line 72

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+/******************************************************************************
+********            Displayport automated testing                      ********
+******************************************************************************/
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp);

The function comment does little more than spell out the function name. What I would prefer to see is a theory-of-operation in the block comment. And all these forward declarations can disappear with clear ordering in the source code.
-Chris

Quoted 7 lines

I wasn't sure which way to go with this and opted for the declarations, but it's just as easy to reorder the definitions to be prior to their use in the handler. I'll get that fixed up and add more useful comments above the functions for V2. Thanks Chris.

-T

Since it sounds like you have a v2 in the works anyway, can you please change printk to DRM_DEBUG_KMS.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#4 lore raw
Quoted 41 lines · Ben Widawsky
Quoted 40 lines · Todd Previte
Quoted 21 lines · Chris Wilson
Quoted 20 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 | 108 +++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_dp_helper.h     |   3 +-
  2 files changed, 108 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 9770160..a042d59 100644
@@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = {
  		{ .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } }
  };
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_dp.c static const struct dp_link_dpll vlv_dpll[] = { · line 72

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+/******************************************************************************
+********            Displayport automated testing                      ********
+******************************************************************************/
+/* Automated testing function - link training */
+static bool
+intel_dp_autotest_link_training(struct intel_dp *intel_dp);

The function comment does little more than spell out the function name. What I would prefer to see is a theory-of-operation in the block comment. And all these forward declarations can disappear with clear ordering in the source code.
-Chris

I wasn't sure which way to go with this and opted for the declarations, but it's just as easy to reorder the definitions to be prior to their use in the handler. I'll get that fixed up and add more useful comments above the functions for V2. Thanks Chris.

Quoted 4 lines
Quoted 1 line

-T

Since it sounds like you have a v2 in the works anyway, can you please change printk to DRM_DEBUG_KMS.

I have another patch that's following onto this one once the drm header changes get through, so I can either put this in that patch or change them in a separate patch if that's preferred.

-T

maintainer
#5 lore raw
In reply to Todd Previte
Quoted 6 lines · Todd Previte
include/drm/drm_dp_helper.h +0 -0
index ae8dbfb..9fa544b 100644
@@ -266,9 +266,10 @@
 

include/drm/drm_dp_helper.h line 275

Quoted 10 lines
include/drm/drm_dp_helper.h +2 -1
 #define DP_TEST_REQUEST			    0x218
 # define DP_TEST_LINK_TRAINING		    (1 << 0)
-# define DP_TEST_LINK_PATTERN		    (1 << 1)
+# define DP_TEST_LINK_VIDEO_PATTERN	    (1 << 1)
 # define DP_TEST_LINK_EDID_READ		    (1 << 2)
 # define DP_TEST_LINK_PHY_TEST_PATTERN	    (1 << 3) /* DPCD >= 1.1 */
+# define DP_TEST_LINK_FAUX_TEST_PATTERN	    (1 << 4) /* DPCD >= 1.2 */
 
 #define DP_TEST_LINK_RATE		    0x219
 # define DP_LINK_RATE_162		    (0x6)

This hunk needs to be a separate patch, and sent to dri-devel.

Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#6 lore raw
Quoted 15 lines · Jani Nikula
Quoted 14 lines · Todd Previte
include/drm/drm_dp_helper.h +2 -1
index ae8dbfb..9fa544b 100644
@@ -266,9 +266,10 @@
 
  #define DP_TEST_REQUEST			    0x218
  # define DP_TEST_LINK_TRAINING		    (1 << 0)
-# define DP_TEST_LINK_PATTERN		    (1 << 1)
+# define DP_TEST_LINK_VIDEO_PATTERN	    (1 << 1)
  # define DP_TEST_LINK_EDID_READ		    (1 << 2)
  # define DP_TEST_LINK_PHY_TEST_PATTERN	    (1 << 3) /* DPCD >= 1.1 */
+# define DP_TEST_LINK_FAUX_TEST_PATTERN	    (1 << 4) /* DPCD >= 1.2 */
 
Quoted 8 lines

include/drm/drm_dp_helper.h line 275

Quoted 2 lines
include/drm/drm_dp_helper.h +0 -0
  #define DP_TEST_LINK_RATE		    0x219
  # define DP_LINK_RATE_162		    (0x6)

This hunk needs to be a separate patch, and sent to dri-devel.

Jani.

Oh right. Originally I was using local definitions until I found those in the header and used them instead. I'll break those out into a separate patch for V2 as well. Thanks Jani.

-T

#7 lore raw

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

In reply to 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);
 }
 
 /*
Signature · 1 line
1.8.1.2
#8 lore raw

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

In reply to Todd Previte

Revised patch incorporating feedback from the various reviews.
- Changed printk() to DRM_DEBUG_KMS()
- Removed extraneous comments
- Added test hook for Fast AUX automated testing

Note this patch relies on the constants defined in drm/drm_dp_helper.h that were updated in a separate patch.

#9 lore raw

PATCH 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 | 87 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 84 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +84 -3
index c8515bb..5f2a720 100644
@@ -2813,11 +2813,92 @@ 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;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_faux_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;
+
+	DRM_DEBUG_KMS("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:
+			DRM_DEBUG_KMS("Displayport: Executing LINK_TRAINING request\n");
+			result = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_VIDEO_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing TEST_PATTERN request\n");
+			result = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			DRM_DEBUG_KMS("Displayport: Executing EDID request\n");
+			result = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing PHY_PATTERN request\n");
+			result = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+                case DP_TEST_LINK_FAUX_PATTERN:
+                        printk(KERN_DEBUG "Displayport: Executing FAUX_PATTERN request \n");
+                        result = 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 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
maintainer
#10 lore raw
Quoted 62 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 | 87 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 84 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +40 -1
index c8515bb..5f2a720 100644
@@ -2813,11 +2813,92 @@ 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;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_faux_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)
-{

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2865

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +8 -2
-	/* 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;
+
+	DRM_DEBUG_KMS("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);

I don't think you need _retry here. It's only needed for the case when this might wake up the sink, but the call is cargo culted all over the place...

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2866

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+	/* Determine which test has been requested */

I think we get that without the comment. ;)

Is it possible multiple test request bits are set at the same time, or will there always be just one? The spec is a bit unclear on this.

Quoted 14 lines
drivers/gpu/drm/i915/intel_dp.c +14 -0
+	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:
+			DRM_DEBUG_KMS("Displayport: Executing LINK_TRAINING request\n");
+			result = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_VIDEO_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing TEST_PATTERN request\n");
+			result = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			DRM_DEBUG_KMS("Displayport: Executing EDID request\n");

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2890

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+			result = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing PHY_PATTERN request\n");
+			result = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+                case DP_TEST_LINK_FAUX_PATTERN:
+                        printk(KERN_DEBUG "Displayport: Executing FAUX_PATTERN request \n");
+                        result = intel_dp_autotest_faux_pattern(intel_dp);
+                        break;

Use tabs to indent.

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2898

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8 -0
+		/* Unsupported test case or something went wrong */
+		default:
+			/* Log error here for unhandled test request */
+			DRM_DEBUG_KMS("Displayport: Error - unhandled automated test type\n");
+			break;
+	}
+	/* Check for a valid test execution */
+	if (result == true)

if (result) is customary.

An alternative would be to have the test calls return the response to be written to DP_TEST_RESPONSE, but I'm fine either way.

BR,
Jani.

Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+		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 · 6 lines
1.8.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#11 lore raw
Quoted 68 lines · Jani Nikula
Quoted 67 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 | 87 +++++++++++++++++++++++++++++++++++++++--
  1 file changed, 84 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +43 -3
index c8515bb..5f2a720 100644
@@ -2813,11 +2813,92 @@ 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;
+}
+
+/* Automated test function hook - description forthcoming */
+static bool
+intel_dp_autotest_faux_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;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2865

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+	uint8_t rxdata = 0;
+
+	DRM_DEBUG_KMS("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);

I don't think you need _retry here. It's only needed for the case when this might wake up the sink, but the call is cargo culted all over the place...

Sounds good. Paulo and I just discussed this at length and looked over the code. There's no reason for the extra retries here since the sink device is has to be awake to request the test in the first place. I'll get this changed for V4.

Quoted 2 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2866

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+	/* Determine which test has been requested */

I think we get that without the comment. ;)

Perhaps I'm a bit overzealous with comments these days... ;)

I'll pull the extraneous comments from the patch when I'm revising it for V4.

Quoted 3 lines

Is it possible multiple test request bits are set at the same time, or will there always be just one? The spec is a bit unclear on this.

Unfortunately, this is definitely one area where the spec is woefully lacking. The only indicator is this sentence in the CTS spec:

"...the Source DUT shall read the DPCD TEST_REQUEST field to see which test mode is being requested."

I went with a single test per request because it says "which test mode" instead of "which test modes". Not the best basis for making a decision, but there's no other indication in the text. I'm certainly open to arguments for the multiple tests scenario though.

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/i915/intel_dp.c +17 -0
+	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:
+			DRM_DEBUG_KMS("Displayport: Executing LINK_TRAINING request\n");
+			result = intel_dp_autotest_link_training(intel_dp);
+			break;
+		case DP_TEST_LINK_VIDEO_PATTERN:
+			DRM_DEBUG_KMS("Displayport: Executing TEST_PATTERN request\n");
+			result = intel_dp_autotest_video_pattern(intel_dp);
+			break;
+		case DP_TEST_LINK_EDID_READ:
+			DRM_DEBUG_KMS("Displayport: Executing EDID request\n");
+			result = intel_dp_autotest_edid(intel_dp);
+			break;
+		case DP_TEST_LINK_PHY_TEST_PATTERN:
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2890

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+			DRM_DEBUG_KMS("Displayport: Executing PHY_PATTERN request\n");
+			result = intel_dp_autotest_phy_pattern(intel_dp);
+			break;
+                case DP_TEST_LINK_FAUX_PATTERN:
+                        printk(KERN_DEBUG "Displayport: Executing FAUX_PATTERN request \n");
+                        result = intel_dp_autotest_faux_pattern(intel_dp);
+                        break;

Use tabs to indent.

Stupid editor preferences. ;) I'll fix these in V4.

Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) · line 2898

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8 -0
+		/* Unsupported test case or something went wrong */
+		default:
+			/* Log error here for unhandled test request */
+			DRM_DEBUG_KMS("Displayport: Error - unhandled automated test type\n");
+			break;
+	}
+	/* Check for a valid test execution */
+	if (result == true)

if (result) is customary.

Sounds good. I'll change it in V4. Consistency is good.

Quoted 6 lines

An alternative would be to have the test calls return the response to be written to DP_TEST_RESPONSE, but I'm fine either way.

BR,
Jani.

I like that better than just a generic success/fail return. I'll change that for V4 as well.

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_dp.c +3 -1
+		response = DP_TEST_ACK;
+	/* Send ACK/NAK based on action taken above */
+	intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, response);
  }
 
  /*
--

1.8.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw
Quoted 4 lines · Todd Previte

I went with a single test per request because it says "which test mode" instead of "which test modes". Not the best basis for making a decision, but there's no other indication in the text. I'm certainly open to arguments for the multiple tests scenario though.

I'd say until we fail compliance somewhere we should opt to not care. And once this becomes an issue maybe we should file a spec bug - if that's possible for DP.
-Daniel

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