diff mbox

[2/4] drm/i915: Enable DisplayPort audio

Message ID 1284879129-19720-3-git-send-email-zhenyuw@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhenyu Wang Sept. 19, 2010, 6:52 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 208a4ec..81fca1e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1444,39 +1444,50 @@  intel_dp_detect(struct drm_connector *connector)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t temp, bit;
 	enum drm_connector_status status;
+	struct edid *edid = NULL;
 
 	intel_dp->has_audio = false;
 
-	if (HAS_PCH_SPLIT(dev))
-		return ironlake_dp_detect(connector);
+	if (HAS_PCH_SPLIT(dev)) {
+		status = ironlake_dp_detect(connector);
+	} else {
+		switch (intel_dp->output_reg) {
+		case DP_B:
+			bit = DPB_HOTPLUG_INT_STATUS;
+			break;
+		case DP_C:
+			bit = DPC_HOTPLUG_INT_STATUS;
+			break;
+		case DP_D:
+			bit = DPD_HOTPLUG_INT_STATUS;
+			break;
+		default:
+			return connector_status_unknown;
+		}
 
-	switch (intel_dp->output_reg) {
-	case DP_B:
-		bit = DPB_HOTPLUG_INT_STATUS;
-		break;
-	case DP_C:
-		bit = DPC_HOTPLUG_INT_STATUS;
-		break;
-	case DP_D:
-		bit = DPD_HOTPLUG_INT_STATUS;
-		break;
-	default:
-		return connector_status_unknown;
-	}
+		temp = I915_READ(PORT_HOTPLUG_STAT);
 
-	temp = I915_READ(PORT_HOTPLUG_STAT);
+		if ((temp & bit) == 0)
+			return connector_status_disconnected;
 
-	if ((temp & bit) == 0)
-		return connector_status_disconnected;
+		status = connector_status_disconnected;
+		if (intel_dp_aux_native_read(intel_dp, 0x000, intel_dp->dpcd,
+					     sizeof (intel_dp->dpcd)) == sizeof (intel_dp->dpcd))
+		{
+			if (intel_dp->dpcd[0] != 0)
+				status = connector_status_connected;
+		}
+	}
 
-	status = connector_status_disconnected;
-	if (intel_dp_aux_native_read(intel_dp,
-				     0x000, intel_dp->dpcd,
-				     sizeof (intel_dp->dpcd)) == sizeof (intel_dp->dpcd))
-	{
-		if (intel_dp->dpcd[0] != 0)
-			status = connector_status_connected;
+	if (status == connector_status_connected) {
+		edid = drm_get_edid(connector, intel_dp->base.ddc_bus);
+		if (edid) {
+			intel_dp->has_audio = drm_detect_monitor_audio(edid);
+			connector->display_info.raw_edid = NULL;
+			kfree(edid);
+		}
 	}
+
 	return status;
 }