From patchwork Tue Mar 13 16:31:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 131503 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp1043736edg; Tue, 13 Mar 2018 09:31:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELsrJ6PvrsmZfb4uiixsQXobB4G2EKKBX6EiirXIetzmyt4dS5y0BPcpIj8hk7uOk/6TN3Qi X-Received: by 10.28.48.11 with SMTP id w11mr1370945wmw.88.1520958715246; Tue, 13 Mar 2018 09:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520958715; cv=none; d=google.com; s=arc-20160816; b=JPjVcxpxLoc5P2o0Z8i7H+GRaMVXmkbfPJ6RdYLvam8RdJkkZHXDC2eQXLOceor6ky AZtAcr/ZFStxQ7SSerZVm/ypBqiaYp0lPQUUcKp8j0fffdDeHHLhC22I5keKJx6i4ajd 6BoATlvceG5iTAJ+hGTXeCxmXuBn0VulB/ZOVmxUe5HP5ex0mXfngvv1IDhuzc0EyFFL TtLwuPFQ0NX9o5uARe7DdC6Tsxc3PEgaqFKw3eq5LLzEVUwWJ+VfSLAOLL8hozfd52cd qNs3hpYOeUvbPzA6xNunlq0ht3LwSKvpTX0jS1W1gduMmCjmGKRwEGuiq8Lox2xXh47v /6Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=nKJ7znwojYLLh3IwGsGKvgwphqHX2NvSUWIObywaHIk=; b=sN6NACpSid5rEYgMCI1fGUfn2lqs79wpZ3mCMPrhU45p60axAMXbw87ZJ9F42qHN7X 7pQ6lUwMXlFwC0+DS6XwMb4gdQNdR8Ai9KuRK647o0708GGlXQzUlYG9ES3k1vHUD71p 0ycHGngHXs2eRvWdqrHqSndIGp1HgwbMOCtuTAcY9atd92Ktyg24kwAiPS73MRLHEMIS X21wTqybyZb9FQqbzlz3wBIDXbe5CePdCcT0fUhQEzIfbJq4ZNLsGIHyL9+nS254PZes 6km18uZz4dYeY6VHPdEVNwWXiJ1UoqjcpXzSvaLTo2lbV/HB/xptRfC6XLnqLgspdSkI 2Gig== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=on/6N9mL; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id r74si395780wrb.249.2018.03.13.09.31.55; Tue, 13 Mar 2018 09:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=on/6N9mL; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 41EE6267371; Tue, 13 Mar 2018 17:31:38 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E7CA6267371; Tue, 13 Mar 2018 17:31:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 52E26267320 for ; Tue, 13 Mar 2018 17:31:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=VecdYOlhumxfjcpCIC6YoLjKcZnBst3aCNLdqM7T5LY=; b=on/6N9mLgA60 tLKG1o8KjUjpvv9/v8qegDDHYP29xk5RGGdQjM498GzClPVDZp67mjyfAaAULlYH2lFegzDptkvSe fIUhQpQAL8m/4q+9P4mcsjlkK3wEkgWvRftyKQyFISU0aUk6j+kq/zizCM9H3v1w37A1mZbiM4koh xFCkk=; Received: from [65.153.83.185] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1evmpZ-0007m2-4S; Tue, 13 Mar 2018 16:31:17 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 2829A440079; Tue, 13 Mar 2018 16:31:15 +0000 (GMT) From: Mark Brown To: Sanyog Kale In-Reply-To: <20180313033225.9714-1-guneshwor.o.singh@intel.com> Message-Id: <20180313163115.2829A440079@finisterre.ee.mobilebroadband> Date: Tue, 13 Mar 2018 16:31:15 +0000 (GMT) Cc: alsa-devel@alsa-project.org, Takashi Iwai , Guneshwor Singh , Liam Girdwood , Patches Audio , Mark Brown , Rakesh Ughreja , Vinod Koul Subject: [alsa-devel] Applied "ASoC: Intel: Skylake: Disable clock and power gating during FW/LIB download" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org The patch ASoC: Intel: Skylake: Disable clock and power gating during FW/LIB download has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From fc9fdd61c4809b14faa9b84fe3d8f4167a836326 Mon Sep 17 00:00:00 2001 From: Sanyog Kale Date: Tue, 13 Mar 2018 09:02:25 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Disable clock and power gating during FW/LIB download In order to achieve better DMA performance and reduce download time for firmware and library, it is recommended to disable dynamic clock and power gating. In some scenarios, DMA may wait to accumulate more data and last chunk of data never gets completed if dynamic clock and power gating is kept enabled. This patch adds support to disable/enable dynamic clock and power gating and use it during firmware and library download. Signed-off-by: Rakesh Ughreja Signed-off-by: Sanyog Kale Signed-off-by: Guneshwor Singh Signed-off-by: Mark Brown --- sound/soc/intel/skylake/skl-messages.c | 7 ++++++- sound/soc/intel/skylake/skl-pcm.c | 7 ++++++- sound/soc/intel/skylake/skl-sst-ipc.h | 3 +++ sound/soc/intel/skylake/skl.c | 27 +++++++++++++++++++++++++++ sound/soc/intel/skylake/skl.h | 4 ++++ 5 files changed, 46 insertions(+), 2 deletions(-) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index f161907859f3..57d4a58522a6 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -417,11 +417,16 @@ int skl_resume_dsp(struct skl *skl) if (skl->skl_sst->is_first_boot == true) return 0; - /* disable dynamic clock gating during fw and lib download */ + /* + * Disable dynamic clock and power gating during firmware + * and library download + */ ctx->enable_miscbdcge(ctx->dev, false); + ctx->clock_power_gating(ctx->dev, false); ret = skl_dsp_wake(ctx->dsp); ctx->enable_miscbdcge(ctx->dev, true); + ctx->clock_power_gating(ctx->dev, true); if (ret < 0) return ret; diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 84e40faeb869..15cb8ac3e374 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -1356,11 +1356,16 @@ static int skl_platform_soc_probe(struct snd_soc_component *component) return -EIO; } - /* disable dynamic clock gating during fw and lib download */ + /* + * Disable dynamic clock and power gating during firmware + * and library download + */ skl->skl_sst->enable_miscbdcge(component->dev, false); + skl->skl_sst->clock_power_gating(component->dev, false); ret = ops->init_fw(component->dev, skl->skl_sst); skl->skl_sst->enable_miscbdcge(component->dev, true); + skl->skl_sst->clock_power_gating(component->dev, true); if (ret < 0) { dev_err(component->dev, "Failed to boot first fw: %d\n", ret); return ret; diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h index 55f2d2ce09df..f74f040dfd83 100644 --- a/sound/soc/intel/skylake/skl-sst-ipc.h +++ b/sound/soc/intel/skylake/skl-sst-ipc.h @@ -118,6 +118,9 @@ struct skl_sst { struct skl_d0i3_data d0i3; const struct skl_dsp_ops *dsp_ops; + + /* Callback to update dynamic clock and power gating registers */ + void (*clock_power_gating)(struct device *dev, bool enable); }; struct skl_ipc_init_instance_msg { diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index aa9edc84eefb..abf324747b29 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -94,6 +94,32 @@ static void skl_enable_miscbdcge(struct device *dev, bool enable) update_pci_dword(pci, AZX_PCIREG_CGCTL, AZX_CGCTL_MISCBDCGE_MASK, val); } +/** + * skl_clock_power_gating: Enable/Disable clock and power gating + * + * @dev: Device pointer + * @enable: Enable/Disable flag + */ +static void skl_clock_power_gating(struct device *dev, bool enable) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct hdac_ext_bus *ebus = pci_get_drvdata(pci); + struct hdac_bus *bus = ebus_to_hbus(ebus); + u32 val; + + /* Update PDCGE bit of CGCTL register */ + val = enable ? AZX_CGCTL_ADSPDCGE : 0; + update_pci_dword(pci, AZX_PCIREG_CGCTL, AZX_CGCTL_ADSPDCGE, val); + + /* Update L1SEN bit of EM2 register */ + val = enable ? AZX_REG_VS_EM2_L1SEN : 0; + snd_hdac_chip_updatel(bus, VS_EM2, AZX_REG_VS_EM2_L1SEN, val); + + /* Update ADSPPGD bit of PGCTL register */ + val = enable ? 0 : AZX_PGCTL_ADSPPGD; + update_pci_dword(pci, AZX_PCIREG_PGCTL, AZX_PGCTL_ADSPPGD, val); +} + /* * While performing reset, controller may not come back properly causing * issues, so recommendation is to set CGCTL.MISCBDCGE to 0 then do reset @@ -916,6 +942,7 @@ static int skl_probe(struct pci_dev *pci, goto out_nhlt_free; } skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge; + skl->skl_sst->clock_power_gating = skl_clock_power_gating; } if (bus->mlcap) snd_hdac_ext_bus_get_ml_capabilities(ebus); diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h index ca46ad1d0a08..0d5375cbcf6e 100644 --- a/sound/soc/intel/skylake/skl.h +++ b/sound/soc/intel/skylake/skl.h @@ -33,8 +33,10 @@ #define AZX_PCIREG_PGCTL 0x44 #define AZX_PGCTL_LSRMD_MASK (1 << 4) +#define AZX_PGCTL_ADSPPGD BIT(2) #define AZX_PCIREG_CGCTL 0x48 #define AZX_CGCTL_MISCBDCGE_MASK (1 << 6) +#define AZX_CGCTL_ADSPDCGE BIT(1) /* D0I3C Register fields */ #define AZX_REG_VS_D0I3C_CIP 0x1 /* Command in progress */ #define AZX_REG_VS_D0I3C_I3 0x4 /* D0i3 enable */ @@ -43,6 +45,8 @@ #define DMA_TRANSMITION_START 2 #define DMA_TRANSMITION_STOP 3 +#define AZX_REG_VS_EM2_L1SEN BIT(13) + struct skl_dsp_resource { u32 max_mcps; u32 max_mem;