From patchwork Thu Nov 9 17:42:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 118470 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6882984qgn; Thu, 9 Nov 2017 09:42:43 -0800 (PST) X-Google-Smtp-Source: ABhQp+RSLzNLjmhhZeVrAgCbhhA/FSWO4JkfAMHIA4tH0wjhASMJ2IR1ASUj1pepsp1Vc/JzemIj X-Received: by 10.223.184.42 with SMTP id h39mr1194868wrf.38.1510249363265; Thu, 09 Nov 2017 09:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510249363; cv=none; d=google.com; s=arc-20160816; b=pyoezffcd/3cjVvxSST3UFiSWsc3MjeLjb3GHVu+hUUvzlO3TEPrVIN0AUtB3RHRCE 0HUCd1gKy6NkFpt2Pgfb8wme95LAl6Kwc9vktycp32kVvrL26czp4xcCxUgh4YxfY3vE 4ZrkaQ4gxGjHVDO+AIniJcMWCRWfbvKp9FtzJfmAdmd+X6IhVH+IC8yLJ4DXbG2zlynk bRFE4N2YiHW588oSHJQ5gk0NLm/hWI0nA5InDH/+2F17Sa2FpsZcGv5w8IU02v8yuPXm e9QylZC7f5SpSJefDl0NQyIkXG6hzMHVg1XgBlDpcK7CChwJbkfqdzSUV7GJxyWnfmYg Yy0Q== 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=kk8dogOMEYgT0fiDHIKuePbJJODegJbcOwGLkq+nqoE=; b=ckffcfbsGNj5yRWfRvUYFuGheWaaVvuyd+bLkuS8c3WXFmGF/l0oKRYJWV05o6w1rO uJ8C/kZY6k4uuDNQAYoUxbVHRk9OJF5D9sOpe3tRCr2V9Sb9qJfYRsgyF5pVqn4xUoDC mvzeawBZJkfKlb5brjXoF+/igHlvBsKnVtVZlvjR8WLYzfIpY3ykOR/1o+mb7lUIyVfx IIGVr6YTKx8LDAZILytq7+5iqrYenQP34ILYJtyfy3Zlpp1o6rK8+eM9rb0vtWWUS6/G FiWyit7Zpud5c/Lq6qrT+yAsC2BD9ualRnx1D8hLRR92iFHqrqv21qtsBpRQNJHbUVGH Thuw== 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=HjhwvG2z; 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 p197si5701746wme.259.2017.11.09.09.42.42; Thu, 09 Nov 2017 09:42:43 -0800 (PST) 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=HjhwvG2z; 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 086F1267845; Thu, 9 Nov 2017 18:42:42 +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 5E0A826784B; Thu, 9 Nov 2017 18:42:41 +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.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS 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 366F8267826 for ; Thu, 9 Nov 2017 18:42:32 +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=vPhNCUKtCmwaGqTBhoFTq68oONA3Cq755V5E1NRODQ4=; b=HjhwvG2zMIzi 1NF+4dvwB97zto3E0B4OOMrXPWd+zFOGgprQI1xnYV4Y0g0qVEn6LX8FVz3KOT3YNsBNKUH2JeZVl QB265YbDZ1VJ/IbO51ITlllUVPBW9tkxTqWGr5kWbf9Dyda6Frh5zTt/casfvN0WUEQ2egC7SJMDU I5jfo=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eCqqQ-0005Md-NS; Thu, 09 Nov 2017 17:42:26 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1eCqqQ-0006as-1m; Thu, 09 Nov 2017 17:42:26 +0000 From: Mark Brown To: Vijendar Mukunda In-Reply-To: <20171109173552.21438-2-alexander.deucher@amd.com> Message-Id: Date: Thu, 09 Nov 2017 17:42:26 +0000 Cc: alsa-devel@alsa-project.org, tiwai@suse.de, lgirdwood@gmail.com, Akshu Agrawal , broonie@kernel.org, Vijendar.Mukunda@amd.com, Alex Deucher Subject: [alsa-devel] Applied "ASoC: amd: Modified DMA transfer Mechanism for Playback" 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: amd: Modified DMA transfer Mechanism for Playback 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 31c45b3e8d0ecc3a5cbfbf3dfe18adeab2f17a48 Mon Sep 17 00:00:00 2001 From: Vijendar Mukunda Date: Thu, 9 Nov 2017 12:35:52 -0500 Subject: [PATCH] ASoC: amd: Modified DMA transfer Mechanism for Playback Before rendering starts, DMA driver copies full buffer valid data to ACP SRAM for the first time, after that ACP SRAM to I2S FIFO DMA will be initiated. After rendering first half of ACP SRAM, IOC will be raised then Audio data will be copied from first half of System Memory to first half of ACP SRAM. Similarly after rendering second half of ACP SRAM, IOC will be raised then Audio Data will be copied from second half of the System Memory to second half of the ACP SRAM in ping-pong way till rendering stops. Old design introducing latency issues resulting stutter sound observed during playback. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal Signed-off-by: Alex Deucher Signed-off-by: Mark Brown --- sound/soc/amd/acp-pcm-dma.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) -- 2.15.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index ef7e98ad960c..9f521a55d610 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -193,8 +193,8 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio, dmadscr[i].xfer_val = 0; if (direction == SNDRV_PCM_STREAM_PLAYBACK) { dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH12 + i; - dmadscr[i].dest = ACP_SHARED_RAM_BANK_1_ADDRESS + - (size / 2) - (i * (size/2)); + dmadscr[i].dest = ACP_SHARED_RAM_BANK_1_ADDRESS + + (i * (size/2)); dmadscr[i].src = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS + (pte_offset * SZ_4K) + (i * (size/2)); switch (asic_type) { @@ -655,9 +655,9 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) valid_irq = true; if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_13) == PLAYBACK_START_DMA_DESCR_CH13) - dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; - else dscr_idx = PLAYBACK_END_DMA_DESCR_CH12; + else + dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; config_acp_dma_channel(acp_mmio, SYSRAM_TO_ACP_CH_NUM, dscr_idx, 1, 0); acp_dma_start(acp_mmio, SYSRAM_TO_ACP_CH_NUM, false); @@ -882,23 +882,6 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) config_acp_dma_channel(rtd->acp_mmio, ACP_TO_I2S_DMA_CH_NUM, PLAYBACK_START_DMA_DESCR_CH13, NUM_DSCRS_PER_CHANNEL, 0); - /* Fill ACP SRAM (2 periods) with zeros from System RAM - * which is zero-ed in hw_params - */ - acp_dma_start(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM, false); - - /* ACP SRAM (2 periods of buffer size) is intially filled with - * zeros. Before rendering starts, 2nd half of SRAM will be - * filled with valid audio data DMA'ed from first half of system - * RAM and 1st half of SRAM will be filled with Zeros. This is - * the initial scenario when redering starts from SRAM. Later - * on, 2nd half of system memory will be DMA'ed to 1st half of - * SRAM, 1st half of system memory will be DMA'ed to 2nd half of - * SRAM in ping-pong way till rendering stops. - */ - config_acp_dma_channel(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM, - PLAYBACK_START_DMA_DESCR_CH12, - 1, 0); } else { config_acp_dma_channel(rtd->acp_mmio, ACP_TO_SYSRAM_CH_NUM, CAPTURE_START_DMA_DESCR_CH14, @@ -913,7 +896,7 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) { int ret; - u32 loops = 1000; + u32 loops = 4000; u64 bytescount = 0; struct snd_pcm_runtime *runtime = substream->runtime;