[Intel-gfx] [PATCH] drm/i915/dp: Add branch/sink OUI debugging

Adam Jackson ajax at redhat.com
Fri Jan 13 19:26:08 CET 2012


DisplayPort lets you discover the manufacturer OUI of the other end.
This is good, because it means you might be able to have per-phy quirks
to work around other people's bugs, but it's bad because it removes some
incentive to not make buggy hardware.

At any rate DisplayPort is proving fickle enough that I'm getting
desperate.  Dump the OUI in the log when KMS debug is on.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   33 +++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |    8 ++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index db3b461..96b3fe2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2097,6 +2097,37 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada
 	return ret;
 }
 
+static void
+intel_dp_debug_oui(struct intel_dp *dp, uint8_t dpcd[DP_RECEIVER_CAP_SIZE])
+{
+	uint8_t count;
+	int offset;
+	uint8_t oui[3];
+
+	/* not valid in 1.0 */
+	if (dpcd[0] == < 0x11)
+		return;
+
+	/* check oui support bit */
+	count = dpcd[DP_DOWN_STREAM_PORT_COUNT];
+	if (!(count & DP_DOWN_STREAM_OUI_SUPPORTED))
+		return;
+
+	count &= (~DP_DOWN_STREAM_OUI_SUPPORTED);
+	if ((count & DP_DOWN_STREAM_PORT_COUNT_MASK) == 0)
+		offset = DP_SINK_IEEE_OUI;
+	else
+		offset = DP_BRANCH_IEEE_OUI_OUT;
+
+	if (!intel_dp_aux_native_read_retry(dp, offset, oui, 3))
+		return;
+
+	DRM_DEBUG_KMS("%s OUI: %02hx%2hx%02hx\n",
+		      offset == DP_SINK_IEEE_OUI ? "sink" : "branch",
+		      oui[2], oui[1], oui[0]);
+
+	/* in a just world, we will never add a quirks table here */
+}
 
 /**
  * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection.
@@ -2127,6 +2158,8 @@ intel_dp_detect(struct drm_connector *connector, bool force)
 	if (status != connector_status_connected)
 		return status;
 
+	intel_dp_debug_oui(intel_dp, intel_dp->dpcd);
+
 	if (intel_dp->force_audio) {
 		intel_dp->has_audio = intel_dp->force_audio > 0;
 	} else {
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 93df2d7..44be1cd 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -72,6 +72,10 @@
 
 #define DP_MAIN_LINK_CHANNEL_CODING         0x006
 
+#define DP_DOWN_STREAM_PORT_COUNT	    0x007
+# define DP_DOWN_STREAM_PORT_COUNT_MASK	    0x0f
+# define DP_DOWN_STREAM_OUI_SUPPORTED	    (1 << 7)
+
 #define DP_EDP_CONFIGURATION_CAP            0x00d
 #define DP_TRAINING_AUX_RD_INTERVAL         0x00e
 
@@ -213,6 +217,10 @@
 # define DP_TEST_NAK			    (1 << 1)
 # define DP_TEST_EDID_CHECKSUM_WRITE	    (1 << 2)
 
+#define DP_SOURCE_IEEE_OUI		    0x300
+#define DP_SINK_IEEE_OUI		    0x400
+#define DP_BRANCH_IEEE_OUI		    0x500
+
 #define DP_SET_POWER                        0x600
 # define DP_SET_POWER_D0                    0x1
 # define DP_SET_POWER_D3                    0x2
-- 
1.7.7.5




More information about the Intel-gfx mailing list