Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3738240imm; Mon, 6 Aug 2018 09:44:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchCkyj4JaI+dqdfnUTOa3f7rzRU2X9iOm7ZAOJGopqVLW/q+wpx12m+o/2TB0kC3AxKTw4 X-Received: by 2002:a17:902:7d94:: with SMTP id a20-v6mr14467356plm.19.1533573852914; Mon, 06 Aug 2018 09:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533573852; cv=none; d=google.com; s=arc-20160816; b=fTFsgXAqLQGG/62c/uGZLGDQs4Qm7btftHOFLGMcagAxMxdD8PPiRVsFD8oOFVvvF1 IMWNBKuzY59HH9M7+5COxk6WALn4TSbKks3yYkFUQhljHYUGGyT0xpP/X1DhsyNzyWZp IvX5jnDLHiw9L1nQ1oQb4obH8MTBNPXKn0UatAchVeSuVuoJ/cPQFGBYNZ20o9EbvTvg CCK173oB4NeZxS7znPcxm4uoK/cMADhh6jIOcrMucIFJo9KDkv3/lmHJBzDb7e3miGKE Ea4eXWJAYCb6Ny5uefi53MAxBnRhbhDJFVIEqauZsETpOVvbZe3XQ788f6VCsRn49FNH H3yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=5O9avfYGapKdlVqzlrJWZCuMjiFThgqJQ7mILPUApTQ=; b=vZu4H16iRdYp0lveSJQnMOs8Tyt/8X37AXYTNa4xr5OJROAaU0rf5bojqdniZdhSEs yxxTIQzb+yVhTNXb/JnHztRQDsuEvrhfvNKmZ/k2bFRpXmqYjAskf10B+x4eDZM3KZE8 EYwnoKlBfYt5BnMRl2AaHg/GQqLNWZfYfav2WP50ccDzs+eUykNm7i7bVHDuCdpcmvez qEN7wcxOrxfabv0Iaz/+hp+LXhc9q6s895x6F/HFVhJwgQ2vSBBJx7TyHxMqvQYIUfGU RM48lXR5OUJf43tLEo+/3g1wxlTg4HZBFkW4gNwUeXfWCierscTq6Pltze0VGyqG+Vf2 FZcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=QwvGtQmq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si11781726pgf.558.2018.08.06.09.43.58; Mon, 06 Aug 2018 09:44:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=QwvGtQmq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733189AbeHFSQK (ORCPT + 99 others); Mon, 6 Aug 2018 14:16:10 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51284 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728626AbeHFSQK (ORCPT ); Mon, 6 Aug 2018 14:16:10 -0400 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 Cc: Vijendar Mukunda , Akshu Agrawal , Mark Brown , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Greg Kroah-Hartman , Takashi Iwai , Liam Girdwood , djkurtz@chromium.org, akshu.agrawal@amd.com, Mark Brown , "Mukunda,, Vijendar" , Alex Deucher , Guenter Roeck , alsa-devel@alsa-project.org Subject: Applied "ASoC: AMD: Modified DMA pointer for capture" to the asoc tree 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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; -- 2.18.0