[Intel-gfx] [PATCH] drm/i915: ELD info update during HDMI hot plug

Wang Xingchao xingchao.wang at intel.com
Wed Sep 5 07:06:16 CEST 2012


ELD infomation should update immediately when detected HDMI hot plug event.
The related ELD_VALID bit should be set/clear to generate unsolicited event
to notify Alsa driver this change.

Signed-off-by: Wang Xingchao <xingchao.wang at intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e4c37bb..1d9aaa9 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -719,6 +719,10 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	struct edid *edid;
 	enum drm_connector_status status = connector_status_disconnected;
+	enum drm_connector_status old_status = connector->status;
+	int aud_cntrl_st2;
+	uint32_t eldv;
+	int i;
 
 	if (IS_G4X(connector->dev) && !g4x_hdmi_connected(intel_hdmi))
 		return status;
@@ -747,6 +751,30 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 				(intel_hdmi->force_audio == HDMI_AUDIO_ON);
 	}
 
+	if (status != old_status) {
+		if (HAS_PCH_IBX(connector->dev))
+			aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
+		else if (IS_HASWELL(connector->dev))
+			aud_cntrl_st2 = HSW_AUD_PIN_ELD_CP_VLD;
+		else
+			aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
+
+		eldv = (AUDIO_ELD_VALID_A |
+			AUDIO_ELD_VALID_B |
+			AUDIO_ELD_VALID_C) ;
+		if (status == connector_status_connected) {
+			DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Pluged In\n", connector->base.id,
+					drm_get_connector_name(connector));
+			I915_WRITE(aud_cntrl_st2, eldv);
+		} else {
+			i = I915_READ(aud_cntrl_st2);
+			i &= ~eldv;
+			I915_WRITE(aud_cntrl_st2, i);
+			DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Pluged Out\n", connector->base.id,
+					drm_get_connector_name(connector));
+		}
+	}
+
 	return status;
 }
 
-- 
1.7.9.5




More information about the Intel-gfx mailing list