From patchwork Mon Aug 6 16:07:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 143524 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3462180ljj; Mon, 6 Aug 2018 09:07:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYq78IgbidYv1RBVDQhBJNPo0hmiKJLThTm3qlpQLA9k/BOiXNxNXftTuR6S57lrzkBFtz X-Received: by 2002:a1c:68f:: with SMTP id 137-v6mr12790834wmg.82.1533571640578; Mon, 06 Aug 2018 09:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533571640; cv=none; d=google.com; s=arc-20160816; b=dclugBQ5Rx6qtKcH0TzK4IFZKPtWb6wRxmyCFGKMdSzHWgQCzCNBesZv0L292zEX8s bJToUPj/bwvQVBtvl0kSTRqcGVv1KPFsG3zzX/XuCEvaFQwGfFDIYc7s5HHHCmf5nqDw AhSfT+hC5wwRLtTmc1TjD6AEy6Xxsfg/uoc12s1AKDXmR7KOIPz+tTX8XtG5/tdht1nv /3wKRtGDR98xQYk2zS6TBk1Il3DGm0w3K/8IXieD+GyYDenBFZHpURcxxIGsu9LSRMv1 HciG4m8XK06KEmdC0GW3IWQj7UX351hnx/ZJAW9KtfWzWJyHXIErp7uVwpRICqjiqR64 5VYQ== 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=cP96NGVuZIblVyeDSmNA2PS8uwZ5CxD840JXh9SSVM0=; b=WHcpREBu53rGvlqJ8ZiHNpvfWtK6M9a6asAs19ypFcZFJ1Nkd4YLaGE/nec6z4bYRh zlidjBszRimnzeNZugSK+riuAndjW84KmiboCVXABN+KFUAWKQlCa0NOFiT6XEYVOuXi oJEJg4b1hstMdBLiyj1y+tz2ZB3RFP999zJtLZm5FXWy4+Y6Ax2WArZjZJEgpNTYdVZT uA17wT7hG5FKZuX7ZO5V4Uqg48OP4a3Dem3nkOMCvzlac90GMmroSuBefuCjgCVDG2Gx NvsVTE1qRuEHgDZYiOymSll6EFmLpsOwtx6oV3G6MzSNde8WdkgCPU81Zfh0EG/zqRHJ xjfw== 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=J9sEQQBn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id a64-v6si5874439wmf.119.2018.08.06.09.07.20; Mon, 06 Aug 2018 09:07:20 -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=J9sEQQBn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 49E58267851; Mon, 6 Aug 2018 18:07:19 +0200 (CEST) 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 A19FC267857; Mon, 6 Aug 2018 18:07:16 +0200 (CEST) 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, RCVD_IN_DNSWL_NONE, 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 17534267832 for ; Mon, 6 Aug 2018 18:07:14 +0200 (CEST) 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=5+mFpdc53GydZHS0HHLvL0+eNQMF3VRQjpBWpzn5vqc=; b=J9sEQQBnEQOA AciAKTbXWlQTasSc6ieulcvZkcnezl1ZGKDU7PnEezJCfZPQbNFe/fwW5O6FoaODkybsSeZ6fcpY7 L9REmE/292gg9knf79lhCvsbWOthKei7lgzN9A0sJZqmGsIq4VMaSFk5l2Eavrt6OGpATxOmwohem EeL4s=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] 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 1fmi2M-00085z-EH; Mon, 06 Aug 2018 16:07:14 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id E48F7440078; Mon, 6 Aug 2018 17:07:13 +0100 (BST) From: Mark Brown To: Akshu Agrawal In-Reply-To: Message-Id: <20180806160713.E48F7440078@finisterre.ee.mobilebroadband> Date: Mon, 6 Aug 2018 17:07:13 +0100 (BST) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: AMD: Make ACP->SYSMEM DMA non circular" 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: Make ACP->SYSMEM DMA non circular 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 bbdb7012b0736cda0b9b00a2949e9207cf2f892f Mon Sep 17 00:00:00 2001 From: Akshu Agrawal Date: Mon, 6 Aug 2018 12:57:14 +0530 Subject: [PATCH] ASoC: AMD: Make ACP->SYSMEM DMA non circular In capture case we don't want ACP to SYSMEM dma to be circular. This is because if an in place DSP filter is applied to captured output then circular DMA can overwrite the filter value with stale data. Signed-off-by: Akshu Agrawal Signed-off-by: Mark Brown --- sound/soc/amd/acp-pcm-dma.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) -- 2.18.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 94bcf69008df..816abd65a6ed 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -400,7 +400,7 @@ static void acp_dma_cap_channel_disable(void __iomem *acp_mmio, } /* Start a given DMA channel transfer */ -static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) +static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num, bool is_circular) { u32 dma_ctrl; @@ -429,8 +429,11 @@ static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) break; } - /* circular for both DMA channel */ - dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; + /* enable for ACP to SRAM DMA channel */ + if (is_circular == true) + dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; + else + dma_ctrl &= ~ACP_DMA_CNTL_0__Circular_DMA_En_MASK; acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); } @@ -674,6 +677,7 @@ static int acp_deinit(void __iomem *acp_mmio) /* ACP DMA irq handler routine for playback, capture usecases */ static irqreturn_t dma_irq_handler(int irq, void *arg) { + u16 dscr_idx; u32 intr_flag, ext_intr_status; struct audio_drv_data *irq_data; void __iomem *acp_mmio; @@ -705,6 +709,15 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) != 0) { valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_14) == + CAPTURE_START_DMA_DESCR_CH15) + dscr_idx = CAPTURE_END_DMA_DESCR_CH14; + else + dscr_idx = CAPTURE_START_DMA_DESCR_CH14; + config_acp_dma_channel(acp_mmio, ACP_TO_SYSRAM_CH_NUM, dscr_idx, + 1, 0); + acp_dma_start(acp_mmio, ACP_TO_SYSRAM_CH_NUM, false); + snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); @@ -712,6 +725,17 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_10) == + CAPTURE_START_DMA_DESCR_CH11) + dscr_idx = CAPTURE_END_DMA_DESCR_CH10; + else + dscr_idx = CAPTURE_START_DMA_DESCR_CH10; + config_acp_dma_channel(acp_mmio, + ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + dscr_idx, 1, 0); + acp_dma_start(acp_mmio, ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + false); + snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) << 16, @@ -1053,9 +1077,11 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) acp_dma_cap_channel_enable(rtd->acp_mmio, CAP_CHANNEL1); } + acp_dma_start(rtd->acp_mmio, rtd->ch1, true); + } else { + acp_dma_start(rtd->acp_mmio, rtd->ch1, true); + acp_dma_start(rtd->acp_mmio, rtd->ch2, true); } - acp_dma_start(rtd->acp_mmio, rtd->ch1); - acp_dma_start(rtd->acp_mmio, rtd->ch2); ret = 0; break; case SNDRV_PCM_TRIGGER_STOP: