From patchwork Thu Apr 5 20:37:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Abhay" X-Patchwork-Id: 10325457 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 00B2860541 for ; Thu, 5 Apr 2018 20:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3FF1281B7 for ; Thu, 5 Apr 2018 20:41:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E29B1293D1; Thu, 5 Apr 2018 20:41:07 +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 86516281B7 for ; Thu, 5 Apr 2018 20:41:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC4206E892; Thu, 5 Apr 2018 20:39:00 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 535946E093 for ; Thu, 5 Apr 2018 20:38:59 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2018 13:38:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,412,1517904000"; d="scan'208";a="31909728" Received: from abhaykum-lin.sc.intel.com ([10.3.62.173]) by orsmga006.jf.intel.com with ESMTP; 05 Apr 2018 13:38:58 -0700 From: Abhay Kumar To: intel-gfx@lists.freedesktop.org Date: Thu, 5 Apr 2018 13:37:50 -0700 Message-Id: <1522960670-29948-1-git-send-email-abhay.kumar@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508968932-32208-1-git-send-email-abhay.kumar@intel.com> References: <1508968932-32208-1-git-send-email-abhay.kumar@intel.com> Subject: [Intel-gfx] [PATCH v2] drm/i915: set minimum CD clock to twice the BCLK. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP In glk when device boots with 1366x768 panel, HDA codec doesn't comeup. This result in no audio forever as cdclk is < 96Mhz. This chagne will ensure CD clock to be twice of BCLK. v2: - Address comment (Jani) - New design approach Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102937 Signed-off-by: Abhay Kumar --- drivers/gpu/drm/i915/intel_audio.c | 33 ++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_cdclk.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 709d6ca68074..f7dd3d532e93 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -723,15 +723,37 @@ static void i915_audio_component_put_power(struct device *kdev) intel_display_power_put(kdev_to_i915(kdev), POWER_DOMAIN_AUDIO); } +/* Get CDCLK in kHz */ +static int i915_audio_component_get_cdclk_freq(struct device *kdev) +{ + struct drm_i915_private *dev_priv = kdev_to_i915(kdev); + + if (WARN_ON_ONCE(!HAS_DDI(dev_priv))) + return -ENODEV; + + return dev_priv->cdclk.hw.cdclk; +} + static void i915_audio_component_codec_wake_override(struct device *kdev, bool enable) { struct drm_i915_private *dev_priv = kdev_to_i915(kdev); u32 tmp; + int current_cdclk; if (!IS_GEN9_BC(dev_priv)) return; + current_cdclk = i915_audio_component_get_cdclk_freq(kdev); + + /* + * Before probing for HDA Codec we need to make sure + * "The CD clock frequency must be at least twice + * the frequency of the Azalia BCLK." + */ + if (INTEL_GEN(dev_priv) >= 9 && current_cdclk <= 192000) + intel_cdclk_bump(dev_priv); + i915_audio_component_get_power(kdev); /* @@ -753,17 +775,6 @@ static void i915_audio_component_codec_wake_override(struct device *kdev, i915_audio_component_put_power(kdev); } -/* Get CDCLK in kHz */ -static int i915_audio_component_get_cdclk_freq(struct device *kdev) -{ - struct drm_i915_private *dev_priv = kdev_to_i915(kdev); - - if (WARN_ON_ONCE(!HAS_DDI(dev_priv))) - return -ENODEV; - - return dev_priv->cdclk.hw.cdclk; -} - /* * get the intel_encoder according to the parameter port and pipe * intel_encoder is saved by the index of pipe diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c index dc7db8a2caf8..9426e1b7badc 100644 --- a/drivers/gpu/drm/i915/intel_cdclk.c +++ b/drivers/gpu/drm/i915/intel_cdclk.c @@ -1516,6 +1516,27 @@ void bxt_init_cdclk(struct drm_i915_private *dev_priv) } /** + * intel_cdclk_bump - Increase cdclk to 2* BCLK + * @dev_priv: i915 device + * + * Increase CDCLK for GKL and CNL. This is done only + * during HDA codec probe. + */ +void intel_cdclk_bump(struct drm_i915_private *dev_priv) +{ + struct intel_cdclk_state cdclk_state; + + cdclk_state = dev_priv->cdclk.hw; + + if (IS_GEMINILAKE(dev_priv)) { + cdclk_state.cdclk = glk_calc_cdclk((2*96000)); + cdclk_state.vco = glk_de_pll_vco(dev_priv, cdclk_state.cdclk); + cdclk_state.voltage_level = bxt_calc_voltage_level(cdclk_state.cdclk); + bxt_set_cdclk(dev_priv, &cdclk_state); + } +} + +/** * bxt_uninit_cdclk - Uninitialize CDCLK on BXT * @dev_priv: i915 device * diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d1452fd2a58d..5192753df3dc 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1417,6 +1417,7 @@ void skl_uninit_cdclk(struct drm_i915_private *dev_priv); void cnl_init_cdclk(struct drm_i915_private *dev_priv); void cnl_uninit_cdclk(struct drm_i915_private *dev_priv); void bxt_init_cdclk(struct drm_i915_private *dev_priv); +void intel_cdclk_bump(struct drm_i915_private *dev_priv); void bxt_uninit_cdclk(struct drm_i915_private *dev_priv); void icl_init_cdclk(struct drm_i915_private *dev_priv); void icl_uninit_cdclk(struct drm_i915_private *dev_priv);