From patchwork Mon Aug 6 16:06:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 143523 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3461290ljj; Mon, 6 Aug 2018 09:06:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdCQ9cOLZRAj2O3OOYwU/jTX3IW84npXj0toP8Sj1hgZvdK+ZG4JM3BwFauUQKlYN+ZAxEt X-Received: by 2002:a5d:6250:: with SMTP id m16-v6mr10460672wrv.179.1533571583699; Mon, 06 Aug 2018 09:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533571583; cv=none; d=google.com; s=arc-20160816; b=jKrDTZTb9smOnCKi98F5NnExdQJOnh94/fB9D7bxMgREN4GdQjF1BVJMGDMEdCZHCb rjHh7cLhJamKQpWQBmOIvexmbu88hTdPyJngOpEk+OqlbMF1nO98QH10szWUx+XTfCDT Kl0bmakFUb9sWzbXTQdlFneedSp1oUuoAm4lpY8+6WDTuanH6aNO9fhCk5g6ZP9c2pZe 0jm1Og4gQFffsuMflVAixzoNuEkql9Y2WvWNhigNnTeVP+2zPPsLnFtEtEUFfXZz0MmC +K0vOnx73Ltbk52i2z/O80jdDKf8TTmA1DAO6cJrMXXniS2u6h800Uwu6PYli+Qb9+o0 zYTw== 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=PMvHdmNr6o65/Fc4ec8SwNgDNU+OkzgBkqpbRPCmn+Y=; b=0peqbQO0optHV6oLJ6xCpefNx+bXd20zHi9kodQS/TOto9dIafZGG3NXvtuSqZhObI YE7N7ogFJ7hPAFOi8PDZlWHrGA/dyP07Y6zQZv/JDcGQLWnE87Q/Zfovuqwd8J3Eh7Br TcXRFic4faVHJMSZYIs6rYsAixAyK4JfjIPj6nNdB3EdRf+qgcFa0aCze1Ue0SBLd+2+ NITn1UmSRQBnTWoBlqKTrTXUWu/1BE7hzsuFgn+uSCq2tiGex3ifCMLZ7Ph+Wgke14QL FpY8QSunm04fz6HVTELXdGQGUZgVSeLbvrPp47ytaVlXogKXe2WrCJXPDKDr7sY6Yjyj REvg== 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=QwvGtQmq; 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 d21-v6si9721824wrb.418.2018.08.06.09.06.23; Mon, 06 Aug 2018 09:06:23 -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=QwvGtQmq; 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 C6DE7267858; Mon, 6 Aug 2018 18:06:20 +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 3B6A326785E; Mon, 6 Aug 2018 18:06:19 +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 75446267857 for ; Mon, 6 Aug 2018 18:06:17 +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=5O9avfYGapKdlVqzlrJWZCuMjiFThgqJQ7mILPUApTQ=; b=QwvGtQmqV2hu YuC10Siz8iNlbJuQcAY4CgFpwvaZ0LA9GfKNd10ACt3rSWlDxF63EqYPc2cY2PZ5XHNGTyViqGhIW BHk9g+Zn0CUrSEoRQ3vEBaZK8SeV8OMe9i2Cyl34UtfghObvFvCXE1RtcBmxMze2P4oUdjV5MgJAs oprTs=; 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 1fmi1P-00085g-F5; Mon, 06 Aug 2018 16:06:15 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id EEA7E440078; Mon, 6 Aug 2018 17:06:14 +0100 (BST) From: Mark Brown To: Mukunda@sirena.org.uk, Vijendar In-Reply-To: <1533540439-18735-2-git-send-email-akshu.agrawal@amd.com> Message-Id: <20180806160614.EEA7E440078@finisterre.ee.mobilebroadband> Date: Mon, 6 Aug 2018 17:06:14 +0100 (BST) Cc: , alsa-devel@alsa-project.org, Liam Girdwood , Greg Kroah-Hartman , Takashi Iwai , open list , djkurtz@chromium.org, akshu.agrawal@amd.com, Mark Brown , "Mukunda, , Vijendar" , Alex Deucher , Guenter Roeck Subject: [alsa-devel] Applied "ASoC: AMD: Modified DMA pointer for capture" 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 pointer for capture 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 662fb3efe7ee835f0eeba6bc63b81e82a97fc312 Mon Sep 17 00:00:00 2001 From: "Mukunda, Vijendar" Date: Mon, 6 Aug 2018 12:57:15 +0530 Subject: [PATCH] ASoC: AMD: Modified DMA pointer for capture Give position on ACP->SYSMEM DMA channel for the number of bytes that have been transferred on the basis of current descriptor under service. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal Signed-off-by: Mark Brown --- sound/soc/amd/acp-pcm-dma.c | 31 ++++++++++++++++++------------- sound/soc/amd/acp.h | 1 + 2 files changed, 19 insertions(+), 13 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 816abd65a6ed..32f27c5e4d93 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -922,10 +922,7 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, rtd->destination = FROM_BLUETOOTH; rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH10; rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH11; - rtd->byte_cnt_high_reg_offset = - mmACP_I2S_BT_RECEIVE_BYTE_CNT_HIGH; - rtd->byte_cnt_low_reg_offset = - mmACP_I2S_BT_RECEIVE_BYTE_CNT_LOW; + rtd->dma_curr_dscr = mmACP_DMA_CUR_DSCR_11; adata->capture_i2sbt_stream = substream; break; case I2S_SP_INSTANCE: @@ -945,10 +942,7 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, rtd->destination = FROM_ACP_I2S_1; rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH14; rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH15; - rtd->byte_cnt_high_reg_offset = - mmACP_I2S_RECEIVED_BYTE_CNT_HIGH; - rtd->byte_cnt_low_reg_offset = - mmACP_I2S_RECEIVED_BYTE_CNT_LOW; + rtd->dma_curr_dscr = mmACP_DMA_CUR_DSCR_15; adata->capture_i2ssp_stream = substream; } } @@ -1002,6 +996,8 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) u32 buffersize; u32 pos = 0; u64 bytescount = 0; + u16 dscr; + u32 period_bytes; struct snd_pcm_runtime *runtime = substream->runtime; struct audio_substream_data *rtd = runtime->private_data; @@ -1009,11 +1005,20 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) if (!rtd) return -EINVAL; - buffersize = frames_to_bytes(runtime, runtime->buffer_size); - bytescount = acp_get_byte_count(rtd); - - bytescount -= rtd->bytescount; - pos = do_div(bytescount, buffersize); + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + period_bytes = frames_to_bytes(runtime, runtime->period_size); + dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); + if (dscr == rtd->dma_dscr_idx_1) + pos = period_bytes; + else + pos = 0; + } else { + buffersize = frames_to_bytes(runtime, runtime->buffer_size); + bytescount = acp_get_byte_count(rtd); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + pos = do_div(bytescount, buffersize); + } return bytes_to_frames(runtime, pos); } diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h index 0a2240bff62e..be3963e8f4fa 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -138,6 +138,7 @@ struct audio_substream_data { u32 sram_bank; u32 byte_cnt_high_reg_offset; u32 byte_cnt_low_reg_offset; + u32 dma_curr_dscr; uint64_t size; u64 bytescount; void __iomem *acp_mmio;