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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will turn on DP audio output by checking monitor's audio
capability.

Tested-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
Signed-off-by: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_dp.c |   61 +++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 25 deletions(-)

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;
 }
 
-- 
1.7.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux