From patchwork Tue Sep 24 05:01:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Mengdong" X-Patchwork-Id: 2933411 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8244B9F289 for ; Tue, 24 Sep 2013 12:01:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAA3920494 for ; Tue, 24 Sep 2013 12:01:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5FDF52044C for ; Tue, 24 Sep 2013 12:01:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FEFCE6816 for ; Tue, 24 Sep 2013 05:01:32 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id DD34DE6210 for ; Tue, 24 Sep 2013 05:01:21 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 24 Sep 2013 05:01:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,970,1371106800"; d="scan'208";a="382776261" Received: from amanda-hsw-pc.sh.intel.com ([10.239.37.28]) by orsmga001.jf.intel.com with ESMTP; 24 Sep 2013 04:59:37 -0700 From: mengdong.lin@intel.com To: intel-gfx@lists.freedesktop.org Date: Tue, 24 Sep 2013 01:01:25 -0400 Message-Id: <1379998885-9955-1-git-send-email-mengdong.lin@intel.com> X-Mailer: git-send-email 1.8.1.2 Cc: Mukesh Subject: [Intel-gfx] [PATCH v3 1/2] drm/i915/hsw: Add display Audio codec disable sequence for Haswell 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 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mukesh The code defines a new function intel_disable_audio() to implement the entire audio codec disable sequence, called by intel_disable_ddi() in DDI port disablement. This audio codec disbale sequence is implemented as per the recommendation of the Bspec. [Patch modified by Mendong to apply to both HDMI and DP port.] Signed-off-by: Mukesh Arora Signed-off-by: Mengdong Lin Reviewed-by: Ben Widawsky diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index b042ee5..bda9181 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1088,6 +1088,50 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE); } +/* audio codec disable sequence, as per Bspec */ +void intel_disable_audio(struct intel_encoder *intel_encoder) +{ + int type = intel_encoder->type; + struct drm_encoder *encoder = &intel_encoder->base; + struct drm_device *dev = encoder->dev; + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); + int pipe = intel_crtc->pipe; + int aud_config = HSW_AUD_CFG(pipe); + u32 temp; + + /* need not disable sample fabrication because never enabled */ + + /* disable timestamps */ + temp = I915_READ(aud_config); + if (type == INTEL_OUTPUT_HDMI) + temp &= ~AUD_CONFIG_N_VALUE_INDEX; + else if (type == INTEL_OUTPUT_DISPLAYPORT) + temp |= AUD_CONFIG_N_VALUE_INDEX; + else + return; + temp |= AUD_CONFIG_N_PROG_ENABLE; + temp &= ~(AUD_CONFIG_UPPER_N_VALUE|AUD_CONFIG_LOWER_N_VALUE); + I915_WRITE(aud_config, temp); + POSTING_READ(aud_config); + + /* Disable ELDV and ELD buffer */ + temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); + temp &= ~(AUDIO_ELD_VALID_A << (pipe * 4)); + I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, temp); + POSTING_READ(HSW_AUD_PIN_ELD_CP_VLD); + + /* Wait for 2 vertical blanks */ + intel_wait_for_vblank(dev, pipe); + intel_wait_for_vblank(dev, pipe); + + /* Disable audio PD. This is optional as per Bspec. */ + temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); + temp &= ~(AUDIO_OUTPUT_ENABLE_A << (pipe * 4)); + I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, temp); + POSTING_READ(HSW_AUD_PIN_ELD_CP_VLD); +} + static void intel_enable_ddi(struct intel_encoder *intel_encoder) { struct drm_encoder *encoder = &intel_encoder->base; @@ -1132,18 +1176,10 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) struct drm_encoder *encoder = &intel_encoder->base; struct drm_crtc *crtc = encoder->crtc; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - int pipe = intel_crtc->pipe; int type = intel_encoder->type; - struct drm_device *dev = encoder->dev; - struct drm_i915_private *dev_priv = dev->dev_private; - uint32_t tmp; - if (intel_crtc->eld_vld && type != INTEL_OUTPUT_EDP) { - tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); - tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << - (pipe * 4)); - I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); - } + if (intel_crtc->eld_vld && type != INTEL_OUTPUT_EDP) + intel_disable_audio(intel_encoder); if (type == INTEL_OUTPUT_EDP) { struct intel_dp *intel_dp = enc_to_intel_dp(encoder);