From patchwork Mon Aug 6 07:27:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10556579 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 056F613BB for ; Mon, 6 Aug 2018 07:28:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCC3829210 for ; Mon, 6 Aug 2018 07:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C697D29217; Mon, 6 Aug 2018 07:28:51 +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 CF22029216 for ; Mon, 6 Aug 2018 07:28:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A85A92677C1; Mon, 6 Aug 2018 09:28:49 +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 C43DC2677C4; Mon, 6 Aug 2018 09:28:46 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0078.outbound.protection.outlook.com [104.47.33.78]) by alsa0.perex.cz (Postfix) with ESMTP id 11DA42677BC for ; Mon, 6 Aug 2018 09:28: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=qPs7Lja3sgj6XDliEo/n7gBVB+Rxkzzc2r2BWyvwKEU=; b=gdK3LXVlPwl6aNRup9RthLJu/ZsJOXlIYmoPaJBe+unDO4eKX5Spzz/jHSVKeCfIz4KiAIoxtVI9QqxOabxjv4mkstQkY/JWkjjVAHe6KRejsdiTgC6ZpI95cZt3x7fGwNeI/zBl7JL1Eb7iAoQzxlMQh1ysmw/wF9uHXjSLnS8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) by MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 6 Aug 2018 07:28:33 +0000 From: Akshu Agrawal To: Date: Mon, 6 Aug 2018 12:57:14 +0530 Message-Id: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::27) To MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cdc4a1bb-6702-471d-5e58-08d5fb6e3bd7 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:MW2PR12MB2364; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 3:gldq6v12FZiDnWa7aY9Gt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+e2/gynsLRbAPHlT6Gcb0OXbsVNJ3mBuba36cRMNni1CywYc7YIO8vx/+Spc1i0kmTc0b/aox6z9OKwIAXfy5VgHBvqbc6f4mrCAQFJ2rO0to4om5simNNR+0CPBHODKJ6lQp9atgnnd/fKvTPWC4RNFnMvTHE4R+rYrstiZ9sK26RbxZZxytWDFGXq4gkMwadiWdOFRjmnSGL5XSSUu4jRPpv89d2J/pGMtonFAM8SZUq4JRzb632D3AFoNQHEwSNxsjG8sQ9cUy5O3EFkUBe1eAfQrSCoRU9Lv7Sq925JnfE/oh6qc0QW4d/NdTiXbtFWZxWTrg3D7pUc4lj+Wl0kLbk7Ou; 4:0YvybLesKGrJeVm209ifplvtsWPQed/BV+qYRSMWLn9gIg8nKeW2FGww+CYmJy/UegrlZZyNlKTH3Kl/XZsxv257KGb6HaL/NLKH0f+ybejFCIIq0X+TH5tdBP1HOMJgPB9Al0WG2fD3N4+e1o33igJ48bzIerrseoFswlhGiMN+0r4c2xIgIOOh/GmGqAiwjd0/Qm5aIz+RngTObGPxtWGk1sAUnOndmPFh66Nr+TYcIvHkTwGwPC6HeJ2c6UsZR/sChMNP4XIgKzeHBmdYFwOPjxmfTyiosE1cg5G+CReFEIIBK94T+LAJrXx0uwsb 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)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2364; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2364; X-Forefront-PRVS: 07562C22DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(6486002)(386003)(86362001)(2906002)(486006)(476003)(186003)(16526019)(105586002)(48376002)(54906003)(217873002)(1671002)(36756003)(52116002)(51416003)(305945005)(7736002)(7696005)(47776003)(26005)(2616005)(956004)(44832011)(66066001)(478600001)(8676002)(316002)(25786009)(4326008)(53416004)(72206003)(97736004)(16586007)(3846002)(6116002)(109986005)(8936002)(53936002)(50466002)(39060400002)(68736007)(5660300001)(50226002)(106356001)(81166006)(6666003)(81156014)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2364; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR12MB2364; 23:tIrvHCn5aFwhbg5IFb0G8UrGr3Bx/In5nIfofJzoL?= YVkM0Qt1IJFyuQNdlgG1u2hj1a3wDtEjk9ROANxYcMONyOamW9DBl/+RaiYi+EiQCNLOAQQ6pTHcwFsy6OvsiDmx8+OER+/kIifcGFH9LpxGtmwvbwr7zEIMqI57xkU9d+7SXimkJXa0mWU8sNjStAvz6H9y4OQeukD6z/X35lbHD5oVZxZJxOqwx0bkHDRBTEQqnf7+R2U4AHXo7YLNXI5Qc/P8S2fUOSJ2OP4pPdkmdZq+0Nu4shq5e2onFV32eqEx3+MSZyYVU+O2DQJusLZ6ACfVnkhQqM3dUkjK9DIx4juvcJpzjg+WuY0Y3B6hW55Rf/Vf4ub7czDc85SHAoD5CEhEuuTN3jQ8KuBgaY3QGgieryUY8+309Q8fx+mTScl4xhXxvzlULuqaI5lYdZSJgjhFE9Jvt71VRjd8uk/AZyALh0lSJo4j4wVC+lS/ezEy3jNFerzpPJZtReqnxtDeKCF/RpXbFhdb/WLwj8sAxiFRbDQrBAapPvUcQgRlbShC5os+ogAW7Ae+AdR6rCuakUU1uUYW0LDkxNsRObipqdHm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soft-Exchange-Diagnostics: 1; MW2PR12MB2364; 6:rBNIKEX6c56MX5txXkgpw8rkcjSzyX7TBCbTM83dQxd+FvmNm8JJ1DFgiTN9bzgmwsMWLMEsNAupkm9zArZ520fbN6jy7wnbH8yTCFxeIMnfLN4ALn4CDW/xph9iwIwNIzem3Y9N4AOsUeDO26GuIHFswl619qccd1UUqG1GbRxeZybPSSj7VmhsOfav/ECFrLJEdqXJq14WAVNh3NR7YtPO/wCW0EATodFf9brwOs+39qM0ZiCYTEsL3NOpB983dmL7hQXRnfaIYPN5IJpCGk7G5RQis9Kw7nWurk8iDtO53mlusnMPwaSx/ZwnoJCB4BWHZgPg+eSrcrw2ofrxdcw683SfFX9RlDjH/SZAe4T8c2/Tmqw6GSlDzwQHYfGi2GOauaVwe4aTLlA5jI/my2uWJgE8A0nzKDXQik/0R49102xir+V5XOwhKLFvu3CADtji0snKontiBvK1Y+18Ww==; 5:Ul6mfK2/ahL9uUTEtkqaDMcYduQt/2tNqMybNP0dZTWdxbLrEp0PoFKZ/Lk3BLtPpHIg59sJsIwTXilO/cS/JGJp/NYeBRrm+RzYvQ3VONzMqJLjRFMVfFyosQdCmWiHFdq47yEuYy0VCmEUTA/zP5trtWZ36KdxEF1siXHRw58=; 7:pE0k4PBf1VZMLQuTR4r8qrl8j5AnfEXB3SMglOPYueJh6iI2yHRTXiy7Aajv3LfMOXMR+DCzPMbHY0/gZfFWZA8OZ5C3xWvUhbtzJRgqJtieTKgJMXVarGtA7bK1DOK20msbpejWPb3NbZWYbfqkGAjrmSqPJwLOTWv2y0V9qBCg9NYI6vFSvaUuS4NaaGulR2Awq57BNJ0iz/T253WTDXQpWHZ3GBVTsn5g3PhWoonMXX0TS0bS5Y2249DONndq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 20:+GRGRV5fSvY4xjYczO39hUdHKtG0q+nX8I4ysNWwKgxz67sQWQprWUSzrb57+p5x2HdaYX+JZnp0JbpRdF6p5wqmHgOcgZIZruQ2KMgzILKxCnDVq30O2UjdIAaPeiWFj1FokGd3L4YhT8HE83s8UvSBfB2rmBEsudl1q5r20ialiXLofJkYEg4zLamps0ROSeNOIb/FNFbN0GklVyTFwrWYyu7tox3dxdgLPBRbEuqu/cgD5bvo1/knKad/fOm7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2018 07:28:33.2324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cdc4a1bb-6702-471d-5e58-08d5fb6e3bd7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2364 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 Mon Aug 6 07:27:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10556581 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 84B7C13BB for ; Mon, 6 Aug 2018 07:29:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66D6329210 for ; Mon, 6 Aug 2018 07:29:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B24029217; Mon, 6 Aug 2018 07:29: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 9CEBD29210 for ; Mon, 6 Aug 2018 07:29:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 844F7267814; Mon, 6 Aug 2018 09:29: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 65EF126781F; Mon, 6 Aug 2018 09:29:00 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0076.outbound.protection.outlook.com [104.47.33.76]) by alsa0.perex.cz (Postfix) with ESMTP id 437242677BC for ; Mon, 6 Aug 2018 09:28:58 +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=1sCxUg9BZWW+eCb2cPtyo4pLsw8oYbrfQiJ07wzKkQE=; b=irl+KeGYQhJDI7mtw7Uue9K4G7v8xWacHS4tUqXwDlZeQYrQqbfpMmPiZK81HTbF0XNoczy7vJem4iivhUTQxPkHg3UaeLVpNtIxz0geDGfBb+MeJPUI0OdYUcvmJ3JwFasANhrFU9Zwv09V7u6HVKQynrdzk25nQrFpuoZAvOo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) by MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 6 Aug 2018 07:28:48 +0000 From: Akshu Agrawal To: Date: Mon, 6 Aug 2018 12:57:15 +0530 Message-Id: <1533540439-18735-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> References: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::27) To MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5245cf7-9396-4fcf-ee66-08d5fb6e44d7 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:MW2PR12MB2364; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 3:QsvszDWVowSjDtK4ZIK2LKkjDKlT1FZBCGx0/hMdhhNv3C4nCnFbMeGMSDsMcG/WnqtM0/jM1K3fVBphAQhS7fMaonn2vReW+UpIMyY/pjWaN/vIPYqTI0hogjzynX0svHixW0fJ8D2dd0A6BPZzT9sO7rEsUx5lF5sOiCeFvwyhJqINCfW1NCwhBKUXr1MainIzMkni3u3h/P5Hqkk6cCcG6xFNmjTpWI+1RygmyBsX69r58RnpcJy8dfUIMtRZ; 25:BLdQKFr5rlKEWBbQPaLA3zdXR37QyNP7B9Cd7MGQSvwYaWeXD19C6QCfOHekrVbRSz8J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sS6PAvkZwrxVf51MdE; 4:1qznqv0xE3vM5s9S4D3k5aEaK6gsCU+jHTAnfXqEp8kvjVj0OEq3r7+9SNItYHJh6GXmbLgxISx7vzI809N7sDqTOSepktveQwDg2gVNNsHHLU+jB2+1ubd0INVRTrZumDokgwE5ytxym//jw59LjK6JMe6iexb2ckO+xo6SW7sajmGHQGA2aoji4i1ul5ElJWd5zbTQ8+iOQre5Mso8dhuzBtEzXc0SpxOJ2IBKYGzHUpWzIJaeAnp2J/GySnXXDgslsGps/Zcro1MSuKkMIk64WVBPgi3Tyi/5uydYUYTIylF0dOwcmSz+xC81Wrx/ 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)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2364; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2364; X-Forefront-PRVS: 07562C22DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(6486002)(386003)(86362001)(2906002)(486006)(476003)(186003)(16526019)(105586002)(48376002)(54906003)(1671002)(36756003)(52116002)(51416003)(305945005)(7736002)(7696005)(76176011)(47776003)(26005)(2616005)(956004)(44832011)(66066001)(478600001)(8676002)(316002)(25786009)(11346002)(4326008)(53416004)(72206003)(97736004)(16586007)(3846002)(6116002)(109986005)(8936002)(53936002)(50466002)(39060400002)(68736007)(446003)(5660300001)(50226002)(106356001)(81166006)(6666003)(81156014)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2364; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR12MB2364; 23:XR1W7oye+dbklkFsGiUqaK6vDcEAIOo1Jyf09TeCm?= WamYjTWNrNTG3Vs6fUmIf+MUTuADSckcl67Y9fygEU3zqFmly3cKcJTx1xGBUrt0tqxIYTlSHQcwZLol31a9D7KtV4cKCj7uiZZF288qJzS1IDMs9D1JopqkkWynlFiq8Io7jO1dAuTNYwHLsSp35PWQrAKh3BUn16Ai6B6CJY6YGMHXzjlfHTVttKw/P8VUZQrtp9V4KgL87pMEBRSY1iVVeos8RYcCTGNixp9Y2KMg7eNrg8rpRzZdar9D1FtTZUXRPVenwEw4Wk5tTR67IDfhtBEEsd7WMB4Mi/h6rJpJuzdhfF8uIAj/wp/J7X+m+48l0BPcylRPfAX65D0g7pNXV+w2s2Os/dzy/3lzAw92Se6d+Y9fyRCxHhq/CL7i7cq4A8M3P0MsjVvfwbZQtGDhIo71ijosM8vKgKtHt4LUxFoiNSDMDALlHLRx3j71JaFcKcEsdFFUbSmA6FH3MlBRJ4QqH871rjy4Xzkc0sgjPdKMlIL8+XexXEE4dI3hnhfgTJ62Bx5OKIYhvC1wkNYV8fEBCPS3AWSCwjbU7+HQ8+mEm/OEMID5U43EATkhpQimROUCCOHIZwrOIBiAJ4lCOcAiW8zKHG5e4B+q0dCGDFeT3ACBbHCC4l1q550sdByyR+Q7VTMY5KAPOLBOjnYardkgfGo/aBKSsTdut/YmsEz8zHj3G+Jbqpk0nbSOhVi15gnHrENyLsKOTG0dQqO1pm7VogcRfpaIG1bOHS9vMd4n5I9TwRHDfOjJpB/you4mbindOKEubDlHmwQy8ZWQ3L4s4P21pO5YsC+DNEpclkckQZOoYNJy+z4kQ/MYB4GptVb1gMdzEmg4ECHVgRkv+QeyyavWbxbPckZ7tZN9syCii2EncaLIZ9d4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72VYQniGwXag3xWv5V3MAd9TDsX86ELVLljvdcRh6FHGXA5Z3aqS+wo7NmvXw9IlDitfNlsqj7RvQdHxawROLLoy+qBONJ5PFah1MTYZ3hWiuuJrjMlAb2OGMRBNvBhS41EXPv5dZKW8yZ051ho5Ql+dkZCi5q8XNBR3Yi1Pq7G5UgQ4hl25w==; 5:oADFmh6WRDO2UnNTyGIc3e/PEVl92xy89H4ybJu8wXzm+ulcOlwKVEV56O/GwypWjRqkpsUPqMEzkJi4XAw5wvjxhuUFayNs5lbyiLZUIhw5KhBS8w7DmvbDhQM31w8nLWHtQ937mOhDYsvQ1Ce8QI2Kg90YzPm7bg4dvzLsdvE=; 7:XTyE84aGLV+i+dOt2XSz/BDMJW0fbPLSTw7uXaeNiL0SmQ5Q7KRo8R9+/nLjIT1NSypkOvG2UeVy7MFBIYtOrxbZDgeluPkk6h5COyXJBlbAAkHCy9RyTzbdHOCfjPyVjN1qiUxux7JLm5qrdSaKlPolw5/yws/26xVvu6yCYnrk9DS4amhLhEdAeijod0Z5JwtrpLNUQ9em/TwmZ4eTfLYxD2W+rhxiQxsyDNa6F6eu/vsXYJezAAzh9SDFCTUh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 20:f37Y4pnGiUL6ziCglBIESxNe83hQTuRvIUTj4U96wF2KjKWGShQFjapo2U6BBqpeKneo+yu1CX+QataNkSDw20XKmESv011jduD5bUA8rq8RpjPq14IELO9t9ISNFlHth/m8ME/LKTduVSnI/RIoiErIlJmx6aIZOGYf8XEfHplqYbvwIt1JFvjbYXDo8+VUcxefk9oYsERbwMjzHQeiLV2JFsqGyzhesH4T3XzNpRQmbMshakEw1uwaXc3kqn/B X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2018 07:28:48.1144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5245cf7-9396-4fcf-ee66-08d5fb6e44d7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2364 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 v2 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 basis of current descriptor under service. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal --- v2: Fixed position, now position = 0 if on 1st descriptor and pos = period_bytes if on second descriptor. 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 816abd6..32f27c5 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 0a2240b..be3963e 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; From patchwork Mon Aug 6 07:27:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10556583 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 F09A413AC for ; Mon, 6 Aug 2018 07:29:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3C0E29210 for ; Mon, 6 Aug 2018 07:29:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4D8229217; Mon, 6 Aug 2018 07:29:16 +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 E39BE29210 for ; Mon, 6 Aug 2018 07:29:15 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D8A172677BC; Mon, 6 Aug 2018 09:29:14 +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 B91F7267812; Mon, 6 Aug 2018 09:29:12 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0075.outbound.protection.outlook.com [104.47.33.75]) by alsa0.perex.cz (Postfix) with ESMTP id 59114267818 for ; Mon, 6 Aug 2018 09:29:10 +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=3ZRrrNLvOJvb0lhoN4eU2afev8R1r2Tp80pl4kbkhJY=; b=svnaNHzbmbbdAF7xDn36Ewfb99nr87AKWE3TpQaIGls/VN47mwLBB1NUQEM8cK1F363QiPGkE563472w/wQf3Ft2fKUYcdvmPUIKuB9Cja0L5Umvy0ZGgKWyQX/HA8/o8udWCk9/n/3RRGRFJHdeAq+kJC454OBytRw+Ct7a9T4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) by MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 6 Aug 2018 07:29:00 +0000 From: Akshu Agrawal To: Date: Mon, 6 Aug 2018 12:57:16 +0530 Message-Id: <1533540439-18735-3-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> References: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::27) To MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba44b046-3dd4-456c-bd52-08d5fb6e4bf8 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:MW2PR12MB2364; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 3:eYKi5lBPnkWqaMts8GkIukV5RSWCXAA5O07L5nin7JRCYlaugAi7i0Ynuo3V7b1tcvr89WRMtYTq34RnB9eVFh//XI5vZ/gww2+rePf3TPSCVXN3yKFGGLz8wFXiotQmmWvhXE3+PIq6dBj5vmdrMpGvM8yKUmZ6lDQcTfSjIHJ9V/Knj6hk+AnO8MYNaOwIPMIXegWG9HsRE/m8SRAN4SK48Ll5NPZdByFmX1s5sMMHnj2bz1LcPgLFyYoBq818; 25:9aihwuaTGfcC3/a6DIhwn3f7Lqql7AiEaxUfsLJ9oKl+ZxXdIGgQrdqqtMUM2IS/OWQjIaF2V5K5c3s3gsfPb1lyx8lUuVlr1qeId2rW4mbeZIPcIT0KauW6FctBs134JliYKTbI6uQresRXB7zjAUzJy+IeMhmUEt46H+VGJiDYG0KSS9Idk7fkl7eBhc+FeXqJNY80OOgdPjDXyPhoEMzXEZlU+ut8p/VyI05LcNaYARm0MbabNDkNC3Bg8SnTbyMuSK3+q+Boq73KjcEoGzeVvmJlaY/csSReNLIppxkYTcLZcs+nVBtoy7uODpjIfTwisUQwX+nLRhyoRt3fPA==; 31:CLsheNo2TEgLMPateUN8cvlJwRV/LkR1x1xZOOfqODMcTGFH8yZRrvd9bfO0N31j7dEu0ND1kFw82OE2BBmhQmbZNQlo0UUolx3o231QkOpuV35fiG4NFWGxGKGNaNjQ1SCNmchKa9vGDyvz5VfDYeroQYXbsawgRevA69wcP+SI0A5g2ckXQyFlNk7pRITqBOWanScd5ser2lkGoMFaJpLcHVeEDsE2xD5j3TfJGqs= X-MS-TrafficTypeDiagnostic: MW2PR12MB2364: X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 20:ZANdEFkc0oM117I1NoyzvyPRDT8KiVoiClS4Jar6n1rrBE9Racd0Fiu5pk2cgVIQol3Q5hU02aqtscX9ZRXR9rjAhtZ3Mlm4GKu8xAEOClkm+fcgWCAZO7nRjpPJEYxxhPtI4hb2I4IDvYMJ12f/LMNtswUmGvXU647yfqjuruBSQLuqjgc5I2rnPt/2krBeYdAcKXoHzbr10LsDt5pw7Q7RH+HXrfC5C0nLLYYk/1Mn2q5zTB/FOLSTn4eDYLF6sZogW8p/JSxRiYGo4/0D53pXIY0ac3DpdktSppo9qtSxUYqjzeTtjt3KO4msxrlLBc8zrdB7jsXLOKcCpSyt9eAxWwjxIVd1lH2ZPJxdTvlwlUNzlBTwDuFQK9ECMLIoPW1LvZoR/iQtbsNLgsy32PiW2RzJZM3Qktf6C7tjwj+QDNvKNQmxcFDrPiEKqi+hnn5ukOmgZmt5u7unzZdjh3IORIS12E1+0+jSNuBSfhaJrE6HWlZr4L7LmCEF2+te; 4:NepBpGiU2BhBaT/b9eSZmKgFnWk8tUoS9T5OfuDKH3zzkCCcS4SuhwDp5AWof+RiNpAT744GyO+wa2hFDDggdgAOiSeftNAtZWh0jEsLdCz+1NQzSJ6z85i+0upVoMIN7+eQfb3T1C5SczT8FSaLKGLsFw9elLpQe2ZkkOkQh95Srx4M/19qQ3ZASCWoMOdoa2w2dXzoW52xVH7S1j1W3NkEZ56eAu/clmi9OHsHzyQ58JkGjq1HyVKn8ny6i0Jcn1SEBhbCdp/MWLj1khgov27rOacWIW2sN08cjB+lmIbhHe7UbMYv3nHDfuTDOY+s 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)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2364; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2364; X-Forefront-PRVS: 07562C22DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(6486002)(386003)(86362001)(2906002)(486006)(476003)(186003)(16526019)(105586002)(48376002)(54906003)(1671002)(36756003)(52116002)(51416003)(305945005)(7736002)(7696005)(76176011)(47776003)(26005)(2616005)(956004)(44832011)(66066001)(478600001)(8676002)(316002)(25786009)(11346002)(4326008)(53416004)(72206003)(97736004)(16586007)(3846002)(6116002)(109986005)(8936002)(53936002)(50466002)(39060400002)(68736007)(446003)(5660300001)(14444005)(50226002)(106356001)(81166006)(6666003)(81156014)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2364; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR12MB2364; 23:TFdfZ0woEffU8w7Goq+Nkf+pRo/LIfoY2yisVD9sN?= tiiZCMGjyUVyvvlSAM6IZVpdRwUr6qSwqesvG396h36NAcqVtkc4fcj2tlpaGKf2Hj0XzqpS8KEIBCLUQ/UutwvddSbsX6I/886m1bigyHQBVvdRoFePpMKUXmmby2gXWat3XH7x1urEbbscAkGj6Izv3I+ouNZ+dZW7CHe++4iIttI53q9gJXXqwD+fCPlSs0Uo/Yh0py4mVxq+m/xUd6oQ6cDgT0aLQJc7HQVfl6g8mruHSIO6ZyeDjsCzMF+IF/e7DyNjaa/kF+FtgQHo/VvVHt1M4iebvRSoiLYla8jtyGlsGSWuXyAKN/K1l7ur4qjzOOIwAte7cvZV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ZmUIDcrt7ZzhUiV9v7LReKlHTYh9uNbSiG+kldvPJu4kxIMgW23kHfe3vKzenZebhhwSY05FUiTM+sCwW4An7shIXD5W5MwG7iZq0h1xT/qlnYOsYvcQrAlLAli5qA2rXILwbtT84Y59flCz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 20:wM1zjHRZqVMevbb2qdh+0tQvkKmn9B435uEgzG5EzuAg7R5xkA9rpKML0nhIgdSciaxpuFzB43H5NsjXpDJVHXl+KfVPm2Bz2pHALOKLK2kOBu983OaeWEdjWvduWgSBzMoWujsvs5kQJ/jwxkK5D4cAm+UELEZijM5UzJmBi8atJTnXKAZo8c47jKYdmD/pd8X33+i0esX8np+KqvHXbP5NMU9jG0UfUrvrgQUT1pfM4mMBxHWSndVGz9i4ETTa X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2018 07:29:00.2306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba44b046-3dd4-456c-bd52-08d5fb6e4bf8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2364 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 v2 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 --- v2: moved reading of bytes transfered from I2S->ACP to get more accurate delay information. 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 32f27c5..e359938 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);