From patchwork Thu Jun 13 19:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 10993567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23BEB1398 for ; Thu, 13 Jun 2019 19:24:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 111D726256 for ; Thu, 13 Jun 2019 19:24:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 053B326538; Thu, 13 Jun 2019 19:24: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 D4EED262AE for ; Thu, 13 Jun 2019 19:24:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EAAD71847; Thu, 13 Jun 2019 21:06:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EAAD71847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1560452827; bh=XXttEgxU+Ksv2daDpZ100nWz0rieGs9y1/jBr4bGU6I=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SIPzJ8Jf1DCGuFvumasAlNr8fYRZRkfoBWeaqYMI8UvluUm6WWag2fw9BCZaQDm/i csmplvvOU+kxPvOtvvLPLjum52fvTdprBh2BQIQNy4BwQDCudSQ3vdnZyMgFsYd7Bt 4B4q4Fa2A9fQWLmixQvDk4usRyiqdQARaa8rlPUw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4F8DDF89730; Thu, 13 Jun 2019 21:05:34 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id DDDFDF80791; Thu, 13 Jun 2019 21:05:30 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 56B16F80791 for ; Thu, 13 Jun 2019 21:05:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 56B16F80791 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2019 12:05:25 -0700 X-ExtLoop1: 1 Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga007.fm.intel.com with ESMTP; 13 Jun 2019 12:05:23 -0700 From: cezary.rojewski@intel.com To: alsa-devel@alsa-project.org Date: Thu, 13 Jun 2019 21:04:30 +0200 Message-Id: <20190613190436.20156-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190613190436.20156-1-cezary.rojewski@intel.com> References: <20190613190436.20156-1-cezary.rojewski@intel.com> Cc: Leoni Prodduvaka , Cezary Rojewski , lgirdwood@gmail.com, tiwai@suse.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com Subject: [alsa-devel] [PATCH 1/7] ASoC: Intel: Skylake: Fix incorrect capture position reporting X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cezary Rojewski HW recommends to set DUM bit on device power up, so that DPIB write request occurs every frame regardless of whether DPIB has changed or not. This addresses incorrect position reporting for capture streams. Signed-off-by: Leoni Prodduvaka Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl.c | 21 +++++++++++++++++++++ sound/soc/intel/skylake/skl.h | 1 + 2 files changed, 22 insertions(+) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index f864f7b3df3a..7174b5da4099 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -192,6 +192,25 @@ void skl_update_d0i3c(struct device *dev, bool enable) snd_hdac_chip_readb(bus, VS_D0I3C)); } +/** + * skl_dum_set - set DUM bit in EM2 register + * @bus: HD-audio core bus + * + * Addresses incorrect position reporting for capture streams. + * Used on device power up. + */ +static void skl_dum_set(struct hdac_bus *bus) +{ + /* For the DUM bit to be set, CRST needs to be out of reset state */ + if (!(snd_hdac_chip_readb(bus, GCTL) & AZX_GCTL_RESET)) { + skl_enable_miscbdcge(bus->dev, false); + snd_hdac_bus_exit_link_reset(bus); + skl_enable_miscbdcge(bus->dev, true); + } + + snd_hdac_chip_updatel(bus, VS_EM2, AZX_VS_EM2_DUM, AZX_VS_EM2_DUM); +} + /* called from IRQ */ static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr) { @@ -299,6 +318,7 @@ static int _skl_resume(struct hdac_bus *bus) struct skl *skl = bus_to_skl(bus); skl_init_pci(skl); + skl_dum_set(bus); skl_init_chip(bus, true); return skl_resume_dsp(skl); @@ -956,6 +976,7 @@ static int skl_first_init(struct hdac_bus *bus) /* initialize chip */ skl_init_pci(skl); + skl_dum_set(bus); return skl_init_chip(bus, true); } diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h index 85f8bb6687dc..b92a7f8fe675 100644 --- a/sound/soc/intel/skylake/skl.h +++ b/sound/soc/intel/skylake/skl.h @@ -46,6 +46,7 @@ #define DMA_TRANSMITION_START 2 #define DMA_TRANSMITION_STOP 3 +#define AZX_VS_EM2_DUM BIT(23) #define AZX_REG_VS_EM2_L1SEN BIT(13) struct skl_dsp_resource {