From patchwork Tue Oct 25 04:18:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9393947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 365FD6077A for ; Tue, 25 Oct 2016 04:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 281D929177 for ; Tue, 25 Oct 2016 04:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CAB5292D1; Tue, 25 Oct 2016 04:19:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24B2529177 for ; Tue, 25 Oct 2016 04:19:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 96CA16E03D; Tue, 25 Oct 2016 04:19:02 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04F6A6E03D for ; Tue, 25 Oct 2016 04:19:01 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 24 Oct 2016 21:19:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,544,1473145200"; d="scan'208";a="23627513" Received: from nuc-skylake.jf.intel.com ([10.54.75.23]) by orsmga004.jf.intel.com with ESMTP; 24 Oct 2016 21:19:01 -0700 From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Mon, 24 Oct 2016 21:18:36 -0700 Message-Id: <1477369117-24627-2-git-send-email-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477369117-24627-1-git-send-email-dhinakaran.pandiyan@intel.com> References: <1477369117-24627-1-git-send-email-dhinakaran.pandiyan@intel.com> Cc: Paulo Zanoni , Jani Nikula , Jeeja KP , Libin Yang , Dhinakaran Pandiyan Subject: [Intel-gfx] [PATCH v2 1/2] drm/i915/dp: Enable DP audio stall fix for gen9 platforms X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Enabling DP audio stall fix is necessary to play audio over DP HBR2. So, let's set this bit right before enabling the audio codec. Playing audio without setting this bit results in pipe FIFO underruns. Signed-off-by: Dhinakaran Pandiyan --- drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ 3 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 00efaa1..76dac48 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -6236,6 +6236,11 @@ enum { #define SLICE_ECO_CHICKEN0 _MMIO(0x7308) #define PIXEL_MASK_CAMMING_DISABLE (1 << 14) +#define _CHICKEN_TRANS_A 0x420C0 +#define _CHICKEN_TRANS_B 0x420C4 +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B) +#define SPARE_13 (1<<13) + /* WaCatErrorRejectionIssue */ #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG _MMIO(0x9030) #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index fb18d69..84c91c1 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder, I915_WRITE(FDI_RX_CTL(PIPE_A), val); } +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config) +{ + struct drm_i915_private *dev_priv = + to_i915(pipe_config->base.crtc->dev); + enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; + uint32_t temp; + + if (intel_crtc_has_dp_encoder(pipe_config) && + pipe_config->port_clock >= 54000) { + + temp = I915_READ(CHICKEN_TRANS(cpu_transcoder)); + temp |= SPARE_13; + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp); + } +} + +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config) +{ + struct drm_i915_private *dev_priv = + to_i915(pipe_config->base.crtc->dev); + enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; + uint32_t temp; + + if (intel_crtc_has_dp_encoder(pipe_config) && + pipe_config->port_clock >= 54000) { + + temp = I915_READ(CHICKEN_TRANS(cpu_transcoder)); + temp &= ~SPARE_13; + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp); + } +} + static void intel_enable_ddi(struct intel_encoder *intel_encoder, struct intel_crtc_state *pipe_config, struct drm_connector_state *conn_state) @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder, } if (intel_crtc->config->has_audio) { + if (IS_GEN9(dev_priv)) + gen9_enable_dp_audio_stall_fix(pipe_config); + intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); intel_audio_codec_enable(intel_encoder); } @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder, if (intel_crtc->config->has_audio) { intel_audio_codec_disable(intel_encoder); intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); + + if (IS_GEN9(dev_priv)) + gen9_disable_dp_audio_stall_fix(old_crtc_state); } if (type == INTEL_OUTPUT_EDP) { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 4e90b07..ef02c62 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev, uint64_t fb_format_modifier); u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv, uint64_t fb_modifier, uint32_t pixel_format); +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config); +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config); /* intel_audio.c */ void intel_init_audio_hooks(struct drm_i915_private *dev_priv);