Skip to contentSkip to conversation

drm/i915/dp: Add branch/sink OUI debugging

PATCH In review Adam Jackson 3 participants 3 messages Jan 13, 2012 – Jan 14, 2012

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

PATCH 1/1 drm/i915/dp: Add branch/sink OUI debugging

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.

---
 drivers/gpu/drm/i915/intel_dp.c |   33 +++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |    8 ++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +33 -0
index db3b461..96b3fe2 100644
@@ -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 {
include/drm/drm_dp_helper.h +8 -0
index 93df2d7..44be1cd 100644
@@ -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
Signature · 1 line
1.7.7.5
Reviewed-by on v1 1/1
#1 lore raw

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada · line 2120

Quoted 5 lines · Adam Jackson
drivers/gpu/drm/i915/intel_dp.c +5 -0
+	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;

I suspect the SINK_IEEE_OUI will be more relevant than the BRANCH_IEEE_OUI, but if you're going to the trouble to tell that there is a downstream device, perhaps you should just report both?

include/drm/drm_dp_helper.h

Quoted 9 lines
include/drm/drm_dp_helper.h +8 -0
+#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_SOURCE_IEEE_OUI		    0x300
+#define DP_SINK_IEEE_OUI		    0x400
+#define DP_BRANCH_IEEE_OUI		    0x500
+

These definitions match the DP spec, and the code uses them correctly.

So, the code looks like it will work, the only question I have is whether the BRANCH or SINK would be more useful for debugging problems...

Signature · 1 line
[email protected]

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

#2 lore raw
In reply to Adam Jackson
Quoted 21 lines · Adam Jackson

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.

---
 drivers/gpu/drm/i915/intel_dp.c |   33 +++++++++++++++++++++++++++++++++
 include/drm/drm_dp_helper.h     |    8 ++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index db3b461..96b3fe2 100644
@@ -2097,6 +2097,37 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada
 	return ret;
 }

drivers/gpu/drm/i915/intel_dp.c intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada · line 2108

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
 
+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)
                    ^^^^

That looks broken.

Cheers,
Julien