From patchwork Wed Sep 5 05:06:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xingchao X-Patchwork-Id: 1405161 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E4D12DF28C for ; Wed, 5 Sep 2012 05:20:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98336A0297 for ; Tue, 4 Sep 2012 22:20:02 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 785D0A0291 for ; Tue, 4 Sep 2012 22:19:29 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 04 Sep 2012 22:19:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,372,1344236400"; d="scan'208";a="188917583" Received: from wxc-intel.bj.intel.com ([10.238.145.58]) by azsmga001.ch.intel.com with ESMTP; 04 Sep 2012 22:19:26 -0700 From: Wang Xingchao To: intel-gfx@lists.freedesktop.org Date: Wed, 5 Sep 2012 13:06:16 +0800 Message-Id: <1346821576-18024-1-git-send-email-xingchao.wang@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: daniel.vetter@ffwll.ch, fengguang.wu@intel.com Subject: [Intel-gfx] [PATCH] drm/i915: ELD info update during HDMI hot plug X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- 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; }