From patchwork Mon Aug 6 16:06:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 143522 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3461206ljj; Mon, 6 Aug 2018 09:06:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcuHJxOU0tXknasW2bseFp9R4TntMT80klwiphthWAM2SOMQVHjbgRLWIkWD16gDx6bfmPQ X-Received: by 2002:a1c:415:: with SMTP id 21-v6mr12803754wme.128.1533571578615; Mon, 06 Aug 2018 09:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533571578; cv=none; d=google.com; s=arc-20160816; b=t0/lOQhsYjLnRBsKaMZY1CaeWXGnoiYGiO2BufcWjWw6TjmNKqGdEielDGtTJMBhNd XtVb3O8IHibp3z4tGvDc14JuE2ODBT/cESZkc321YJdsEXcxV2IKN4LaWUHsw4yfUaAm l9URPYzDN5M026bJRVYaCMVQXdOe0EBWDrXNApNHIdByfmUNmrdr7A+x4MHVqNN8Jtmi F7MO8Qh97sZpc74sZWygk4PdzTqrR8yXGKbNqckuAcu9OIF7uQ7loCla0mvOlZ9JtEaK 4DYiexPlvcB0K8aZiBB4GYxRm236UOSGSPk30CXzjjvdYcQqhG40OknNFGEvjEluuh5/ Tp3Q== 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=pG1684z49Xwv8hSI3Ih3ki+T4VfqTSnUN71246iqh8M=; b=kZxUlw0Oxidb1O7kBgZRPKCb7ocEifMeyzv1/EFOFVLFpGEgtqzD3fFtbbuCY+PXRt 2+D7CKtcNo2GuXiNfG6PapSsNCNAMlSdBEZmGVY7LZBiSkid76cY/FHok275H+VYH/Bm KC3/sbBW1Hf3c1UzOPzBM6uAfp0qaRijh9nAVIF/BMCjpvOdh1FClpg/YWKGklcTt5JB KY0LP5NdM75emjzdNZNsn3c6derCxinLanuHHmai2MoZgATpMqhx8yb6hwP5am5vG4ao va6355Zyej+efk9aA1+7e0MmKQjAKT5Z0J8CMY3BgG4ew1xxr50gY8wX+iaTXPty9GVT tQ5w== 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=aw1ac3zy; 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 j2-v6si8522299wrq.362.2018.08.06.09.06.18; Mon, 06 Aug 2018 09:06:18 -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=aw1ac3zy; 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 74741267832; Mon, 6 Aug 2018 18:06:16 +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 4E839267851; Mon, 6 Aug 2018 18:06:13 +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 4E9282677A2 for ; Mon, 6 Aug 2018 18:06:08 +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=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 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) Cc: , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , djkurtz@chromium.org, open list , Mark Brown , "Mukunda, , Vijendar" , Alex Deucher , akshu.agrawal@amd.com, Guenter Roeck Subject: [alsa-devel] Applied "ASoC: AMD: Set delay value for the capture case" 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: 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(-) -- 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 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);