Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3702754imm; Mon, 6 Aug 2018 09:08:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcUL1vw4+TTLud48UWesFGBbv0Szv3TZZWGQ51XFU8YuBmfyApGX91D4QiGEB294F0xhtKt X-Received: by 2002:a63:d5b:: with SMTP id 27-v6mr14879176pgn.107.1533571697555; Mon, 06 Aug 2018 09:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533571697; cv=none; d=google.com; s=arc-20160816; b=yVtmnO3XdcKYsTyY5Ry28b8C6FO1qI8Zy94ng0gj1XMdyXMbSb/6+7enC7C5blqQSt 775fCMMC8uOBBnv0crFDP2shGtNysLhHfKMn9wR9UrbeGoEJ1MjsURuA73E552AVQHiO XDZj/RteAQzbj6VcrjDVX9eUIbAQ8I84cU5NLC1Rbbrd21zqO5UQ4Do41VHKIe7IeGsI RIQ8QdyeiyhSLgukZACjlYZScDOf+oq7Si2E/lZPu3zFOXFZA5ytxjSqlG7xx/OA0g8s jT0ljEMTIjuzW3djm8T0/ZOMckiRX5MuHQYuOJQZn3RN/hUyKjoAFasaoM7BRJFKvShU 7YwA== 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=Hlp0BRXdu38s8UdeZ/s4cVIN2IbTcfdJfbxhA5COqHI=; b=OHvBc+B0HO52Wh6xNco1LJJ7jxTr8x9A5le3oEHq3mDpp5UMG4MlUMwTb4DyPQxpSD J+Y7IG29OkyVVIkngFUKZjq0tmWyBVBGq3sInvKVMPfxP1cLnEAtzs7mKNqgSyrMzJW1 Ii55OZKjXkp70RQER9d9mlvG+wwOSEqK+xKOeCMMGGJNlUDYFfXk2aoNFTzccNXqNs8t 0oOtMWGTWoCj/1sV0epYDGwpxn0BJXS7D8RIUiLWJllP2ixlcOI16ss3CYRvnIVY7jRe gmWxe1xJj82xB0o/rXZAJuifLE8FPlXwRgu4HVu4mPyIk4toC2/3CCmt/EVpwMma41lp IUsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=aw1ac3zy; 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 f8-v6si13156172pgf.166.2018.08.06.09.08.02; Mon, 06 Aug 2018 09:08:17 -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=aw1ac3zy; 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 S1733176AbeHFSQD (ORCPT + 99 others); Mon, 6 Aug 2018 14:16:03 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51040 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728626AbeHFSQD (ORCPT ); Mon, 6 Aug 2018 14:16:03 -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=Hlp0BRXdu38s8UdeZ/s4cVIN2IbTcfdJfbxhA5COqHI=; b=aw1ac3zyf0Du YfFJ3r0dNP/7h0SdG8sLYnpwor9L8KaxqAmAonsbJ48PX+aado0yfDfRw3TaFattZMI/RnjpHCmpP lq1eaFnann9qQgm1rPQrtYkqtHtVcJ/6oTYvDCK3gx8NDbqONIG81YoubmUEMvVZv5hpkdkaS0Now nKTFQ=; 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 1fmi1H-00085W-39; Mon, 06 Aug 2018 16:06:07 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 8E541440078; Mon, 6 Aug 2018 17:06:06 +0100 (BST) From: Mark Brown To: Akshu Agrawal Cc: Mark Brown , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Takashi Iwai , Liam Girdwood , djkurtz@chromium.org, Mark Brown , "Mukunda,, Vijendar" , Alex Deucher , akshu.agrawal@amd.com, Guenter Roeck , alsa-devel@alsa-project.org Subject: Applied "ASoC: AMD: Set delay value for the capture case" to the asoc tree In-Reply-To: <1533540439-18735-3-git-send-email-akshu.agrawal@amd.com> Message-Id: <20180806160606.8E541440078@finisterre.ee.mobilebroadband> Date: Mon, 6 Aug 2018 17:06:06 +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: Set delay value for the capture case 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 c21c834adb5bc81e7081aa93ac50619c6d060506 Mon Sep 17 00:00:00 2001 From: Akshu Agrawal Date: Mon, 6 Aug 2018 12:57:16 +0530 Subject: [PATCH] ASoC: AMD: Set delay value for the capture case ACP->SYSMEM DMA happens at every I2S->SYSMEM period completion. Thus, there is delay of x frames till I2S->SYSMEM reaches a period length. This delay is communicated to user space. Signed-off-by: Akshu Agrawal Signed-off-by: Mark Brown --- sound/soc/amd/acp-pcm-dma.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 32f27c5e4d93..e359938e3d7e 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -922,6 +922,10 @@ 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; @@ -942,6 +946,10 @@ 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; } @@ -997,7 +1005,7 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) u32 pos = 0; u64 bytescount = 0; u16 dscr; - u32 period_bytes; + u32 period_bytes, delay; struct snd_pcm_runtime *runtime = substream->runtime; struct audio_substream_data *rtd = runtime->private_data; @@ -1012,6 +1020,11 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) pos = period_bytes; else pos = 0; + bytescount = acp_get_byte_count(rtd); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + delay = do_div(bytescount, period_bytes); + runtime->delay = bytes_to_frames(runtime, delay); } else { buffersize = frames_to_bytes(runtime, runtime->buffer_size); bytescount = acp_get_byte_count(rtd); -- 2.18.0