From patchwork Thu Aug 2 06:41:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10553271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7A2013BF for ; Thu, 2 Aug 2018 06:43:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8D742A19B for ; Thu, 2 Aug 2018 06:43:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC97B2A2EB; Thu, 2 Aug 2018 06:43:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8DBD2A19B for ; Thu, 2 Aug 2018 06:43:38 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 21F0E2677C9; Thu, 2 Aug 2018 08:43:35 +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 A97D62677CD; Thu, 2 Aug 2018 08:43:32 +0200 (CEST) Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680050.outbound.protection.outlook.com [40.107.68.50]) by alsa0.perex.cz (Postfix) with ESMTP id 5E02C2676E2 for ; Thu, 2 Aug 2018 08:43:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qPs7Lja3sgj6XDliEo/n7gBVB+Rxkzzc2r2BWyvwKEU=; b=gGV1MUQbEslwdB+KzqnjtEYaOGei6DZV9QIeMlVegIaUPY5JQt05/UIaYsw+8hXXN1x/AEvTjUFVddOPbD3jn8qsw9nFjKnBbgprj9NeQKXaDnGpqL0ZNQFaLKz15Pr6BVo8URjkgwwm5PSs16zRekD+7JqLOLv841xi+/lBh54= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (125.21.194.1) by DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Thu, 2 Aug 2018 06:43:16 +0000 From: Akshu Agrawal To: Date: Thu, 2 Aug 2018 12:11:54 +0530 Message-Id: <1533192134-11626-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [125.21.194.1] X-ClientProxiedBy: MA1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::26) To DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64bc2d22-424d-4874-aecc-08d5f8433f35 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM5PR12MB2359; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 3:DmldJ/UPpd5jHnuk0hjDwC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N+qQS9EuuFQzanZuB5fATc3sVKVd+pZ3wezz2/w596/0YwlqqkiiE3y+8J51lGQ5z23nb3RXIfzir2EvEcLe6tuDTCi0rNYHsn+7hGmbPhLARb+DdZNSp6jYGbw3InGim/g3cT4yy5y8EzrrjNC+7z9dzsVWPlFps0WrCGVESN8CodgwKkPy3GopkGgO2ap2Djb12oXMFkRhVBaHuGYIdCbSc1RWwrpgzA3fsalIzkv0gK1Zmj00eQpw5K5wqG0/MLeLq5nKM2m9nKjqQbrBspkDR3ZC3gw319HPev4eqWQ1EcjrVifDqiahXNveyWNpXnJ; 4:EqUOz3qbAJB3awpBiExq2TidaYRg0yfM/ioNuymXUn1ze1QvJ32qHueTHEUxyYlQXnh/46If/T2dw72Huu5+w5bdWj+S4nM03zvuLwPz9Zkupe/FtrFvhgAdGKvNmTcG3MWdaGs73czL9Qy4DuMgTUS45u9726OMDV5RJRVMKpibOf/aLQbwkeTBaN8Y8ykVcFszB4wD+/D4TENCp81uHbbBs/JrTzHJ1iIDwFiQjAklinI3ULUGR3umDwCR+wuLNwIBsSiLQhK7D/mK2ameBM02sSpTWsMQinC3k3JnMR/XdV8ORNXuuOHNRy4hD8Zb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2359; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2359; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(376002)(396003)(39860400002)(366004)(199004)(189003)(51416003)(50466002)(2906002)(6486002)(8936002)(8676002)(39060400002)(3846002)(81156014)(81166006)(109986005)(4326008)(36756003)(48376002)(44832011)(486006)(1671002)(25786009)(86362001)(476003)(50226002)(217873002)(6116002)(68736007)(66066001)(6666003)(7696005)(26005)(105586002)(106356001)(16526019)(53936002)(47776003)(54906003)(16586007)(2616005)(5660300001)(956004)(53416004)(7736002)(478600001)(72206003)(305945005)(52116002)(97736004)(186003)(316002)(386003)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2359; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB2359; 23:qGFqCZeCbW9/qQwzdqRsZcQARf91ergS2ZhSkK28J?= Z4K7oA7+1JO6mYRyC5CUTNTo22gfahzATYYDwVIzxNIjs1iDyDHEmE5lziSgLBs297t9a5T1jJVwTktKlpvlmwPbbHXnlLbw7xOwHC4VkT12HePnBGQswgp1vhi6lkzjGYizGsS+1PsSVjKPuM4enzOlRDwOSb6JBEQciR80BP4gabVmdj57kAlwQ6kJ9MaQVxZ3MBplqxplIdDu4qu+zLmLS7ZMxkQMoTDqc+3QrmBR3WQFWQsjnKWwFFWg9JlgH1iKxXA6xyEG66G1BhK1yB056A39VH605st2XBpBZHTtjjKJgeS+9VKQlMGHJpS891SGFB4gRjsWan4T7bDl6kAx3tONvMEs5WEamFpvfJj7b6jhN/XoKXFbWlww6YTu+2JuhTbwgFSbws4ELwuhKlmPhBY3ZtO7qK216izpEv54aE0HeuzbZTWK/3Z8+VT2Qv04cDelWLL2p+z+RNXFNLMaTxSv+mGAuFlFu/s2t32Sn8G8ZjVY9Jfr1QWIhUf88JF3TxjJTTcxJ5M3in89ctmHef+vOUNz5oIrMGR2QZb8cJNYswayL4+Dc7b2VCC7mB+2q3wJrUE0zg9zbWwhse/Xk7tu0W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APMBUFrpX0JgapMlGVj2f46ZMOFCjxGhWHCIOM7Y3HDx9uRhFyucnxz/Z7nmDz14SLSB91qVy8SyoAzTiJ9aZywckHJPlspDZZHvunj3pI+0auWP49p1dT8MFQu3Op0+AyO0+gsInulr88nx8uYYNsSAF8hrM8jGeoCV9GE+Mx74axG5u43DBOsAq8t5SlFik7msll1bWXuV9oxXlTu3GkkmCsiNNAV3NTd3gmfRW7EfO7XppbLWE+9JBpZeZHgrn4zyXP/1IDlzKq2fpcYQ1COZxnPUEsbCJjeIHH7rPqKcWRI7PkXbhNknmwjH+iud9pzfCwM3GPr/hPBbcO2dj+lM/gRYc7nMQbxbcNSXjln0TtWfUFYeni7K6oS8lAxsfT6zRsQf7n1Q398b1MJ6m2jltM+6ESl8aNbRyG2qpx3FqAXGtO/W0IKFZ6YbdRYvyHID/JvyztLw==; 5:bar/cILOr0QSybcQeqiR3+6lcvppHk6ag3QECuP9ymjWSsL8ifqZzauvZvxZV4ERinbDUUYQGDhWJNbsFzcG9w+JoQTjcP+wnHE1YRnAPdzop+Xybbd9aFQAfep4gA72vVsPLKEjGURlIJBRfVfe1J6ZulXBrrdGZSg/Xvt/qh0=; 7:23hYpjVS9pbbIyRM2YQL1IY+gycqT/7ln65f9e5mwjwyfo3CICJKSaesxsmYXgmnOIr1B/Fvsw3mzFGWJygjEtao5MeBJExHKadRlfkUgHawN1DceTEiiFGz8gNP2Z7W79KUrUA4UiaF3ssQzcmF1epr3GHWXYzAHVNj9iQjXy2B727UQm1x4+NRSQSYV44jEK4NrTeDPi+0QOQ2YkwLFhlCpXHxwoqe6NPllMLzHVcpz+v7CkMZ+St5lapxNsdO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 20:rknOip3mEjVsMlINhlhzv00sbacSzLrjSks9agy98EfxlQOL32U+HCg77fEs+S1n2anVuUOiQEkoKreZKSiDnegcPGpaxcczB8cNa0joxRHwSljLlMVmA6/wAgs2k5/0/Lh2gREn/U3N2soSTe5DTe/IqLTYtyW0v1055OzrLUQUd/tXL1J+AfNnFcvoZDUR7G52fzoSaE5KZAKTVipZMsnOPTwhw8QAjXN4g4Oe/5J5MyPwV6OFA3iUwd7uNm9Z X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 06:43:16.0369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64bc2d22-424d-4874-aecc-08d5f8433f35 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2359 Cc: "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 Subject: [alsa-devel] [PATCH 1/3] ASoC: AMD: Make ACP->SYSMEM DMA non circular 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/soc/amd/acp-pcm-dma.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 94bcf69..816abd6 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: From patchwork Thu Aug 2 06:41:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10553273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 318D513BF for ; Thu, 2 Aug 2018 06:43:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2172C2A19B for ; Thu, 2 Aug 2018 06:43:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 132BF2A2EB; Thu, 2 Aug 2018 06:43:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B2742A19B for ; Thu, 2 Aug 2018 06:43:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DC5452677DD; Thu, 2 Aug 2018 08:43:47 +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 D336A2677E2; Thu, 2 Aug 2018 08:43:45 +0200 (CEST) Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680073.outbound.protection.outlook.com [40.107.68.73]) by alsa0.perex.cz (Postfix) with ESMTP id A690A2677E2 for ; Thu, 2 Aug 2018 08:43:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PEYwv5MisgYqj/po7Du2okKIvCQFnsKAvdHI5z46hxA=; b=vdvEjB7mk8CQxtA8jrDqOmuWqI3mxKpQRLjiTZOZAAGEJ+S4MXiBjDwGf0bmIPTjkOxw55LBv0wiN/oMhLFVfsiw8IUEWSb5yH9JExzA1YyOmMGkUKd2PGtRSQU6mZC276uJ9iiTOINuIpB4Sc4+ZD2nh+Epr3wNzF7kXMN5C8Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (125.21.194.1) by DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Thu, 2 Aug 2018 06:43:32 +0000 From: Akshu Agrawal To: Date: Thu, 2 Aug 2018 12:11:55 +0530 Message-Id: <1533192134-11626-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533192134-11626-1-git-send-email-akshu.agrawal@amd.com> References: <1533192134-11626-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [125.21.194.1] X-ClientProxiedBy: MA1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::26) To DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bdb49dae-18cd-4666-b5ea-08d5f8434903 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM5PR12MB2359; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 3:7Nw12Gr0AmYqBWv1HCLp1BNFIpcyucfHHUuYZA1r/Pi7/e6tw60K8fjbapUixegGMfVyMn1JkoEfgHdpstovGS7Kf5/N8V6mTEw01YY/utUKAGGc7yXryMnU/Q5JuK6cEcacbpJCKRQUgNUhMh6+O1Gd0sCzHaIim2ZmldU8nvYNJ62sQtazDlNC4xOrs+NNpmcl5Hx/9oaCHgMlsOnXViXhC/0IpJP0W5FIh6G2N3QBAB7htxLejdGm3+K/PcCL; 25:F2mOz9eNLmbUOGGM8NNkxwPHz7/gP/vfrocw3W0MeUb8Do1d/2/tDfj2Y4Jc6dYEmjz9n+3FkNhrJHBkBQ1o+XWQXESsqpiU7NqdiHS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UZhQBn1892RpWLkHZwR3p/A8LJep6vqbo4rPT/13EN1ZSzGf4Pqrt1pdf4lNh8uT4fNFCHhyEL9YsYfFbgdLaX54Xpw2e3qLm9SZ0ueKBa0S1fDL3wIMSLXtKTLw9GHTWCUmllL58ZfjgzJp0MZ2kHcbxbRYhfwYPqa/ViepcQKM7uW8xYu+Rv9fitzYldD8nxHQVBxpvVY6dbXdDEdCt9wFKWYM0mRGcPKRb1Bw6F64fK/kpkshGjZIVinbfaTwBIE8QA0MH0zDlVLGtlObyVZyDRL8DXPgmEX2UmIWWShn1FIW2LvYFdBnQ8UX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2359; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2359; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(376002)(396003)(39860400002)(366004)(199004)(189003)(51416003)(50466002)(2906002)(6486002)(8936002)(8676002)(39060400002)(3846002)(81156014)(81166006)(109986005)(4326008)(36756003)(48376002)(44832011)(486006)(575784001)(1671002)(25786009)(86362001)(476003)(50226002)(6116002)(68736007)(66066001)(6666003)(446003)(7696005)(26005)(105586002)(106356001)(16526019)(53936002)(47776003)(54906003)(16586007)(2616005)(5660300001)(956004)(53416004)(7736002)(11346002)(478600001)(72206003)(76176011)(305945005)(52116002)(97736004)(186003)(316002)(386003)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2359; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB2359; 23:8b3KtB1FfT52a3zpb8whgkZvEC76tlFF49vOaRljU?= t5HPxZfDASckp5HLkLfHfXllDiSAMWC6BvtmANXoy2/Rbj6zptmssSsydOXd7YYLiJ3f/IcUFiIVNoysfoG1riYPZTGPTbyT4nNQa54FtjC9H+QUq/zmvRp9IF1gixJLREYVDpXgHSL6kWiA9e0G9mYRaezEKDubRAmvm5eqISa+E5mlsQJsoavU/yqKiEcIpYPvcu06F8qJBCAdguvXbb2jnZtvUVnEXUId5mrD2qI7a6REkRW4SSlBgFzvEavNCZlVvIyuC2dpc1u12sYNg2yubrvXHVdp5zxai8+VkwEBJAQn0OBe0MPv3ZgeC1pi1bDDgKwUX6KyoGWJfuWnYSxp76h6HKmAisAJVRLva4f/VDXlyhJSeIvaAXFK7BhQKl2bT79dxNObc/BEsgf7vidGT0VzH8t8n/03U5PblwL0QRpasaeehEbhQAsUZPtdiGr7uNwjQre2rA9yJQhZDZiX3jd6XQl8oDVDIIMRvrpKFDdAuGCpMNQ7mFZlXcrRSycWME/vfC13RaFUu09xiN+C85vPM07X/V6eLyUkBgnvQpS5GDLXzdiAWKJKVSM3rnrQdWJungessIm7a4HKVqWTMmds+M6uFI/JAI+rgXUat5h6mgq3m+7lCX0rBNM16KjOsN7+6rtlEBlWzxNGZLJlpiveQcTnvl05NB6V5zFImEi2wl6h8FIyfe6M0wMSEDLrD3FKNicpr22L1EH1gKdl3uLYu87e+8ML9FK/eUC42roaU1NU9NdKzmBCPJEjkUqaFKYmQT5lvXW5jJ+NvM8LVzFFQleayvUEfYo7e62ltbPmoEjYmK9e44dXp0fHTuZ8kR528KX6+LwDgfwXYGXGhi1Y1C00MdGbgzxpcOF3Skw4pY6dvNPVasISNDJabAvJ5Znm3CBfrgUTXBPdx0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8OpiEdmKiBnR8THiu+SygqFk/uCpI3jJq48gw0/sGKVgn6IISHpkq53Riv4VW/ePJlY0nxWAet1Dl7w7MxDH6gi0PbK0aQObc144m7Ck8xc+5bfiiIm/UaAaxUyvsG2Z/jVwrVxd5LjAgH0OUlAeZUAXBtLcQURVh5+3SECZNOxFjZ+77Mvog==; 5:I+/FFMmVTOPvO4HYINFGu+QNfPDxr2QSw6Zb6fmPyxSjVDptFR+9oVsxBh2YTgXgpO0lPFuCJFdh+VkkI83L3ozXyIztsi+gcZk9QTjBTBgA1nTUyhBYI6YA9aKF+m/I1HfPkyuLBPRMTSKpmib0IO9zr/EzCsB8s4O2EQ1tK0o=; 7:FpqBHcZJKw1yK+C1tPCHTq1rs9+mNChBpww6MnTOEk6NjIC35OJCs0tWMD4hvsKDL+Vazz6lV3DGZ+721F008n+nKQ2RZxBr0ZQlNnTqy5BWW9F43bCI7i+5/3CyMwYLtjq0fuUkirvWc2v7QcDkWCzYEU9DzEroWgXBm+giWEbc+2rTkd+5FCiIlE73NxadJkGrBKszMfSC3zQ8jGHNbvw/TODQloyZ7kYdXUhgtxWI44lAoyMdN1fqtd0pTGIi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 20:z/evvwropjGtQFtKw+JCAC1uev76tK3HDIcawUTeL5zEyudA4Hy96hQHNmGoumxnraH/EZBSl3EixIFLOKqu+48g9lidCnP/e1iVDlBH/p/h8CAoldrKtpCBdUz7ullShykioGXh1Ofqcpuxrixz861FFBEBLXIt8g/+xaLijjZVLJIFg+d8+P460ZUE0UPGZwQTuwJZgD5r4R0hZOIr1T/4tvMe3ti3pAowcCBl/Id1RWmN+NGZUPoNmGwP1OrV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 06:43:32.2164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdb49dae-18cd-4666-b5ea-08d5f8434903 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2359 Cc: "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 Subject: [alsa-devel] [PATCH 2/3] ASoC: AMD: Modified DMA pointer for capture 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Mukunda, Vijendar" Give position on ACP->SYSMEM DMA channel for the number of bytes that have been transferred on the current descriptor under service. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-pcm-dma.c | 34 ++++++++++++++++++++++------------ sound/soc/amd/acp.h | 3 +++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 816abd6..6240a77 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -922,10 +922,9 @@ 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; + rtd->cur_trans_cnt = mmACP_DMA_CUR_TRANS_CNT_11; + rtd->end_dma_dscr = CAPTURE_END_DMA_DESCR_CH10; adata->capture_i2sbt_stream = substream; break; case I2S_SP_INSTANCE: @@ -945,10 +944,9 @@ 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; + rtd->cur_trans_cnt = mmACP_DMA_CUR_TRANS_CNT_15; + rtd->end_dma_dscr = CAPTURE_END_DMA_DESCR_CH14; adata->capture_i2ssp_stream = substream; } } @@ -1002,6 +1000,9 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) u32 buffersize; u32 pos = 0; u64 bytescount = 0; + u32 dma_count = 0; + u16 dscr; + u32 period_bytes; struct snd_pcm_runtime *runtime = substream->runtime; struct audio_substream_data *rtd = runtime->private_data; @@ -1010,10 +1011,19 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) 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); + dma_count = acp_reg_read(rtd->acp_mmio, rtd->cur_trans_cnt); + if (dscr == rtd->end_dma_dscr) + dma_count += period_bytes; + pos = dma_count % buffersize; + } else { + 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 0a2240b..cf7c0b9 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -134,10 +134,13 @@ struct audio_substream_data { u16 destination; u16 dma_dscr_idx_1; u16 dma_dscr_idx_2; + u16 end_dma_dscr; u32 pte_offset; u32 sram_bank; u32 byte_cnt_high_reg_offset; u32 byte_cnt_low_reg_offset; + u32 dma_curr_dscr; + u32 cur_trans_cnt; uint64_t size; u64 bytescount; void __iomem *acp_mmio; From patchwork Thu Aug 2 06:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10553275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 960E0174A for ; Thu, 2 Aug 2018 06:44:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8781B2A19B for ; Thu, 2 Aug 2018 06:44:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BACD2A2EB; Thu, 2 Aug 2018 06:44:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89D572A19B for ; Thu, 2 Aug 2018 06:44:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D8A12677E2; Thu, 2 Aug 2018 08:44:02 +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 3E82B2677E4; Thu, 2 Aug 2018 08:43:59 +0200 (CEST) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0084.outbound.protection.outlook.com [104.47.40.84]) by alsa0.perex.cz (Postfix) with ESMTP id B39C22677CD for ; Thu, 2 Aug 2018 08:43:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GNuZ5Dp7FYzxgLQ1yTogPeGNpOAmm8QAD31LORhMBqc=; b=4UcgAiC1ZAKgvUl8AkV/IkG7CBEu6OUQb0IgHITXQdlZUIPL4bSNIUReJaFhYgXlTfWI72AWSQCy/JBkc3RLccSV9LM7O5ntNmWjndunl0i8mX7gNBI5bfi6BXm1OWnXECNHbmUU4Z/BJ+KCXxOeA6Fg7r4wbK5DMNXhzyuujt8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (125.21.194.1) by DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Thu, 2 Aug 2018 06:43:45 +0000 From: Akshu Agrawal To: Date: Thu, 2 Aug 2018 12:11:56 +0530 Message-Id: <1533192134-11626-3-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533192134-11626-1-git-send-email-akshu.agrawal@amd.com> References: <1533192134-11626-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [125.21.194.1] X-ClientProxiedBy: MA1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::26) To DM5PR12MB2359.namprd12.prod.outlook.com (2603:10b6:4:b4::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ca2d402-fe1a-4fee-8f67-08d5f84350c1 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM5PR12MB2359; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 3:+HW0DQ+NSITfjy+505Z+JYkKUHhoFh8z+PcbVxNnqYcWaJLWCQRjAChcnwlEgce2ZBs53bWzg2UHKnJDuUUlzkJWDv90rcJ5rzyNmttnqf8fy3734wzo3TBnYw29N1zvvCIb+g/YsED2yrxQWub+OWCnr3Zw+HNdRZK2INIxowKa82AmLkdi90DsnovwOl6H6S4s3oPsiW3fdj7LdtGeJkqyvpPU/Ks9ay0WhmD/UcD1Q1lV+cL60LrVdXwzAX0a; 25:IDZkb0GHWagosEZN74P3GRSyHuedg2045b0K1MeXNvir6eXpOiyA4W6nD/z2/xPOn5nOwzVbD75wYCn3D4mVUGuHQhpbk81pogjosUtiggScXzInH6xWaHDpPyLBoP8bEQgfU/dyF6JZxcgGlZIVyCl97BQ6h4KONWOqPwxGeY2PUMS0zkq4TFuNQblH0gaWWs7WhaIEn/+bu1yLgNSKPa2xEKMkX4QjoLuCNZfIFLQ4UTFzsicWuunLWTwjCGF3OMKFceJgD1fPpKCCiPlKNlWgEkqAXZAFXrzpmljOEbqysseAa4yuFiiPujBBN1O35wv7IK71jv1AR2AApgqGDg==; 31:vrr0zpKwAU8fFGbkCrXKWFxT4Yry1y+fHI+2agbe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tMDmE5fgy/4tR3ntdvw9F19P4LNja X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2359; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2359; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(376002)(396003)(39860400002)(366004)(199004)(189003)(51416003)(50466002)(2906002)(6486002)(8936002)(8676002)(39060400002)(3846002)(81156014)(81166006)(109986005)(4326008)(36756003)(48376002)(44832011)(486006)(1671002)(25786009)(86362001)(476003)(50226002)(6116002)(68736007)(66066001)(6666003)(446003)(7696005)(26005)(105586002)(106356001)(16526019)(53936002)(47776003)(54906003)(16586007)(2616005)(5660300001)(956004)(53416004)(7736002)(11346002)(478600001)(72206003)(76176011)(305945005)(52116002)(97736004)(186003)(316002)(386003)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2359; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB2359; 23:lZChComXOFPxfCqCzntsuKvwj9AVx9qX1+aIR8ZLN?= Hbv/H+CsOpYjqOaboqUMbUz0A/5CfRQ9Q2k9y3+5ddgWOmMCneZhFUko8n8uAOG2NDLeKzTtGitypqO5awrqzFFxwK7ljZ78VHHBMvl6tcmD9+e6Mk+SlSflOXUDx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5NpWZbGOSE0fZ7nI9V1THVFaaPOJYc2ZteAUuZU2M8XjCnWOPdRuU4N/STSeVuEOj0ZbhR6154VYHaA=; 7:KOjKjjgY1bEjpnNXWgwwgtauGglVlIccQqN+km2JYZSXWRvtaFdw9djdnX/VF2ht9NDfVnJ+3OCWNu5i6MzUbV8RAxmHuXUAhhl1vf+v/kDhhadQU0mGmebTpWW6fszPR4e+cHYOF7abAnotmTDUDpuf+fZ4dML5YrKrmx8AmVNmLlemlB2uRugpfKfZ7j5osLXvc+V7p9Y53uZE9Ny2psuFygUBb/Mi9JBJxmzW42wI/WrwgGxEB6Mz34r14v55 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2359; 20:ZvaZHJAuQLDbnO/zL2sFLcZq+kr/VBHVdK0p/eme95hXkBkVZPmQ+o4z5StR4wv9cCHw41xMweM96Lo7Hl2AW3gds5D0q/cmhy9MVZ1L4ca6a/Y7VMBdtfgpgKdQhZqIqxlGN0d97AmOu9joDo5s3hs/voDcxc9eL1mNdT93nuFuvmxiY2Q0SWb7nYSSYMWQuUOaA4Ts+N7TJHVhW/Cfnxrb3JM0JJC/1L7OIJd53HQnLm/lR4K5llI1ZwAfd+wg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 06:43:45.4409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ca2d402-fe1a-4fee-8f67-08d5f84350c1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2359 Cc: "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 Subject: [alsa-devel] [PATCH 3/3] ASoC: AMD: Set delay value for the capture case 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/soc/amd/acp-pcm-dma.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 6240a77..c24611c 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; rtd->cur_trans_cnt = mmACP_DMA_CUR_TRANS_CNT_11; rtd->end_dma_dscr = CAPTURE_END_DMA_DESCR_CH10; @@ -944,6 +948,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; rtd->cur_trans_cnt = mmACP_DMA_CUR_TRANS_CNT_15; rtd->end_dma_dscr = CAPTURE_END_DMA_DESCR_CH14; @@ -1002,7 +1010,7 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) u64 bytescount = 0; u32 dma_count = 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; @@ -1011,6 +1019,10 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) return -EINVAL; buffersize = frames_to_bytes(runtime, runtime->buffer_size); + bytescount = acp_get_byte_count(rtd); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + 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); @@ -1018,10 +1030,9 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) if (dscr == rtd->end_dma_dscr) dma_count += period_bytes; pos = dma_count % buffersize; + delay = do_div(bytescount, period_bytes); + runtime->delay = bytes_to_frames(runtime, delay); } else { - bytescount = acp_get_byte_count(rtd); - if (bytescount > rtd->bytescount) - bytescount -= rtd->bytescount; pos = do_div(bytescount, buffersize); } return bytes_to_frames(runtime, pos);