From patchwork Mon Mar 26 13:13:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10307787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8622960386 for ; Mon, 26 Mar 2018 13:13:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 653922949C for ; Mon, 26 Mar 2018 13:13:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59DD6294EA; Mon, 26 Mar 2018 13:13:01 +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=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no 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 D85D7294E9 for ; Mon, 26 Mar 2018 13:12:59 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7296E267253; Mon, 26 Mar 2018 15:12:51 +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 2C70A26718D; Mon, 26 Mar 2018 15:12:47 +0200 (CEST) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0054.outbound.protection.outlook.com [104.47.41.54]) by alsa0.perex.cz (Postfix) with ESMTP id B4AC426722D for ; Mon, 26 Mar 2018 15:12:44 +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; bh=5H8GEm27bw/Y2+8PTSGTcVeRvr1bxTZNgqHy/+fywq8=; b=pDpdYiOqJlAXPwu0FROB4qp6xk5T8iglCyaZwjya5qCXBrUCo8/SWu63/Jcn6VusSfrJ/OE6uDVLkq1IK75DPw4NrghhOPa2A3H27rojzWgh1PWpIIqsv21OnGxp4w/RDr1/zKL3YsnEVy0geD4ZcJIZDFZk83omZGa2OKUperc= Received: from CY1PR12CA0077.namprd12.prod.outlook.com (2a01:111:e400:c42b::45) by DM3PR12MB0762.namprd12.prod.outlook.com (2a01:111:e400:5984::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Mon, 26 Mar 2018 13:12:40 +0000 Received: from DM3NAM03FT036.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::209) by CY1PR12CA0077.outlook.office365.com (2a01:111:e400:c42b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10 via Frontend Transport; Mon, 26 Mar 2018 13:12:40 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT036.mail.protection.outlook.com (10.152.82.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.631.7 via Frontend Transport; Mon, 26 Mar 2018 13:12:39 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.382.0; Mon, 26 Mar 2018 08:12:38 -0500 From: Vijendar Mukunda To: , , Date: Mon, 26 Mar 2018 18:43:01 +0530 Message-ID: <1522069983-11381-7-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522069983-11381-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1522069983-11381-1-git-send-email-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(39860400002)(39380400002)(396003)(376002)(346002)(2980300002)(428003)(199004)(189003)(26005)(6666003)(16586007)(478600001)(36756003)(110136005)(54906003)(50466002)(2906002)(97736004)(316002)(81156014)(2616005)(105586002)(8676002)(81166006)(446003)(47776003)(11346002)(48376002)(39060400002)(356003)(336012)(426003)(106466001)(53416004)(76176011)(51416003)(7696005)(59450400001)(53936002)(72206003)(8936002)(50226002)(2201001)(104016004)(186003)(77096007)(68736007)(5660300001)(4326008)(86362001)(305945005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0762; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT036; 1:p1CCK5Bphr7bRIAkDSbSUFerOhBlpoH8jWzazoVPBwVxmLWyeXOSnTBMS4WNglwVXdZ1FcAlWwocpb42Z7SQwfz4Om+fT5nBrG4gHC4rgPZncTLxg60yO5j1TPZREnl/ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fe40a73-8092-4c46-4f5a-08d5931b4097 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:DM3PR12MB0762; X-Microsoft-Exchange-Di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F5bpEhiNHjc27PdIDQtvsakw/HlEtgrGk3XTk8jo8tjZ118hyi7tFN1yKeChO/7s+MgrxJz4QsJ4ejZa6AEboG4BBTodFDg8KF33rvuqpZpaDKCBp1wmQ4DczSS5IDh9ag3WSdiAmyEnLTl3kJ2gjMVeivns23S58RLgH500ullG4VHlG5/uggqr/uCm52JdUSX5jfS2LQj5K4uXqtWo9cQngmw0+0Pa7rsOPZPe+4ouCZfnZwrK2/peJ7LOBiVB9zXWEEqL24Trb7qmAdh1L6pRAL5acOWSmITqD5FRTtNkcAMpM7ndx2k04p5P5rDETpFCw++JwmhL6JEnQ7scB5cfGvCok+kNYrX226r46xvXAQ1dsMJTScs+NzhuJnmN+VBMLcd/zJ/kQkCRkxP8LP/UPWYM9sJGVKi/Zlm2cIL9OWkpMYZWaBsvhMJVT8/U/ayYs1yquttMiHerFhbdfPFqSvADxhqERj7z X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93003095)(3002001)(10201501046)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM3PR12MB0762; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0762; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0762; 4:H6kiZJVi/TyxKAeTUsixRDsK+eqG5iyF69nmyz62E5D9d2tXBg+fVTxqabj5PajMoIB9n4SwINbimspRmvrrxDeiG7J1caDQHW9yE+2jxalOcrFocKS7aeCcxxbF25xIi1r1ubA2s1K2cgX23JSkVfejR1uPRlx+lfR5YF1S3wczEzaiju6kBzDLgW5Hur1aL5+T6/uKVHKQRPuP7f+EJuMhOFUmDfsOxSavTmOuG2fLyseKlRdaolaFK+BBkbQlFuEu8ub+8yMW5uBncxD499310J8fwPr7bwJL1so+MsSeSpXhEu/8u2cALdyRhgbK X-Forefront-PRVS: 06237E4555 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0762; 23:HZuk3pCt2EcGGDiZq/qVsQSwWPEHud54fDEvbIX/j?= =?us-ascii?Q?jnRti76bQxbtpvUZ4bOMFKvd3CNwxTCKMJibHLkOz+U7az/OTNXa9ueIiI1p?= =?us-ascii?Q?etpej+KBhX6PfDiGj3xCEHhMXGzQd+BV++nJrpFn1mU5YHJl5ojFY9jUNOqG?= =?us-ascii?Q?BTdoNEYfFTl+UvquK7viMtFa8WAC1mLdYgsqhy8zKGw0GsZTeMAbFKJ4Mkq2?= =?us-ascii?Q?HmcSecglULBFdDEEts90VDXpFlP2QVUn+40MTlz/XZP5ngmXVvis2C7lZ98F?= =?us-ascii?Q?GxHViJfQbaaF5qJ9D82kAKlGCgWcypuEK8Juy3RvuaE36Du9aIXPIwFe5ITm?= =?us-ascii?Q?XkK63Mk3XVe14yimvW7mF3+rxrs2bWJgKevvhLwOgkxhrNxktoQV7OKZph11?= =?us-ascii?Q?Yw1tKKdsxysjUj4Jg69aVNX952M+sAomFIITF/qoTSm2L6M6jAnV5jpwTL3S?= =?us-ascii?Q?0KOkqQ1tu/sIStDSd/cH/hB27aKOgCVJvqgFs2MdSt9GgfETBGIqXLzJRiER?= =?us-ascii?Q?oRaUDlUTdhYNSP0W24TxpVS37Wivt64V98Q9/JRbAAmUAw2fISaJrLzxFpR/?= =?us-ascii?Q?RgvQQLwc/ojYgkEXdKOo/EVkB8/+inNy62F6d5QVNghMzI/g8dl4T5bTrWYj?= =?us-ascii?Q?UWSuIwaPN1HVfEHisjguW9o3Lf1aU/l4meCY+jvU5GBsEO5ZhQ/ZrWAJT6b8?= =?us-ascii?Q?AQB4Cew0G6Luxb/b20ZrEyzXucEITMWYJGiAxYdgu2I4heCR2EUGWc1/YVWP?= =?us-ascii?Q?sIj74xi+AICmRueUKWRT86etJnjeNY/wIaW1jE7OlRCUQdKaMtZ9tT880lDd?= =?us-ascii?Q?gKWlvwTB7hsLOiPKldAwViTHbEDqw/82akojQe9HggSA3njUxVSXwnfjMYs4?= =?us-ascii?Q?cKoYZhRTENs7hhD8fy7IAMt9S7jI7J0M4FTJQG4ZQx8lNx74TiTHjK2SM1YE?= =?us-ascii?Q?XmdzUym6NgL1176zWkf8xjg6gqQtQvvpyb1QdAmXJQZjcRDObtvoOvLML3m3?= =?us-ascii?Q?vliWDufdo2P4aGig9UOit7xu1TLss8aRcby/RksLZzODBP98QE1j9QSr6NdO?= =?us-ascii?Q?tfGwE1meaq+1t+Asupj1qoKllf9EtQkTyYwypWImgiVWiwpXRRsdqHoWK7be?= =?us-ascii?Q?hrv+g15q7TujHY1WYjVXmc3XAQpyiX82FXsbG/QwZFDdtyUTugFNkUlDIHA7?= =?us-ascii?Q?s18ZEuV/oMRTS7GDgsuLQvz8FQFpg88A5FG7F3Q5Q6aj+fVy6N92lHt4wuW7?= =?us-ascii?Q?jlDGFSl3De985mgzkWEIpCHpMxPI8UXNxiAA4ZPif6nzlprHq6ybPkwZIgPS?= =?us-ascii?B?QT09?= X-Microsoft-Antispam-Message-Info: 0JwIMZI1Kpk4V9CWW63+PGZLNXY6Qcw9WadAV3DXsOod2zBMRC7/Fzaa42tdeyGeL9MelBDYqZKLp1/8JcFbeNz27+1pndp2WCXqcp9hpMHAnY1/gwd/y3t2PiuW+T4CCq+Uofj5A7PE1gXcSAi1lzrXZCrxYBrQXhhnIkRKGLaa4m7ovvs/AmtoUCVGdBk6 X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0762; 6:JU2WWyZ4ZAoCPK3j83bN5ee7iiadHcg13pIG9BoYvKbcVe2Cq2nWswIAi0JwAUu1M+6bXbFONnvbm93VOjxJpayKaUpQWyszBnjOoZnmS1M4SVhzrCumJ7Q0F82xba9LXh4b8hJV6HDtw6FD/lHSyV4hyQWKiPuLrXADpbnXIwFwkSkSBKZkOtwgc5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CvVeQLXcePqWr3ha3Xpb/G32Kpb2qsU1T+R2HqDaUyQfmafpIyHQYTYeISWSRD1Qk/qoJI4gJyKvjRC9zai+BI5YFHOj5YCKPo X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 13:12:39.6413 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fe40a73-8092-4c46-4f5a-08d5931b4097 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0762 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, Vijendar Mukunda , lgirdwood@gmail.com, Akshu.Agrawal@amd.com Subject: [alsa-devel] [PATCH 6/8] ASoC: amd: pointer and trigger callback modifications for bt i2s 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 modified trigger and pointer callbacks for bt i2s instance. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp-pcm-dma.c | 189 +++++++++++++++++++++++++++++++++----------- 1 file changed, 144 insertions(+), 45 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 86d2287..c695e42 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -956,23 +956,43 @@ static int acp_dma_hw_free(struct snd_pcm_substream *substream) return snd_pcm_lib_free_pages(substream); } -static u64 acp_get_byte_count(void __iomem *acp_mmio, int stream) +static u64 acp_get_byte_count(void __iomem *acp_mmio, u16 instance, int stream) { union acp_dma_count playback_dma_count; union acp_dma_count capture_dma_count; u64 bytescount = 0; if (stream == SNDRV_PCM_STREAM_PLAYBACK) { - playback_dma_count.bcount.high = acp_reg_read(acp_mmio, + switch (instance) { + case I2S_BT_INSTANCE: + playback_dma_count.bcount.high = acp_reg_read(acp_mmio, + mmACP_I2S_BT_TRANSMIT_BYTE_CNT_HIGH); + playback_dma_count.bcount.low = acp_reg_read(acp_mmio, + mmACP_I2S_BT_TRANSMIT_BYTE_CNT_LOW); + break; + case I2S_SP_INSTANCE: + default: + playback_dma_count.bcount.high = acp_reg_read(acp_mmio, mmACP_I2S_TRANSMIT_BYTE_CNT_HIGH); - playback_dma_count.bcount.low = acp_reg_read(acp_mmio, + playback_dma_count.bcount.low = acp_reg_read(acp_mmio, mmACP_I2S_TRANSMIT_BYTE_CNT_LOW); + } bytescount = playback_dma_count.bytescount; } else { - capture_dma_count.bcount.high = acp_reg_read(acp_mmio, + switch (instance) { + case I2S_BT_INSTANCE: + capture_dma_count.bcount.high = acp_reg_read(acp_mmio, + mmACP_I2S_BT_RECEIVE_BYTE_CNT_HIGH); + capture_dma_count.bcount.low = acp_reg_read(acp_mmio, + mmACP_I2S_BT_RECEIVE_BYTE_CNT_LOW); + break; + case I2S_SP_INSTANCE: + default: + capture_dma_count.bcount.high = acp_reg_read(acp_mmio, mmACP_I2S_RECEIVED_BYTE_CNT_HIGH); - capture_dma_count.bcount.low = acp_reg_read(acp_mmio, + capture_dma_count.bcount.low = acp_reg_read(acp_mmio, mmACP_I2S_RECEIVED_BYTE_CNT_LOW); + } bytescount = capture_dma_count.bytescount; } return bytescount; @@ -991,14 +1011,38 @@ 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->acp_mmio, substream->stream); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (bytescount > rtd->i2ssp_renderbytescount) - bytescount = bytescount - rtd->i2ssp_renderbytescount; + bytescount = acp_get_byte_count(rtd->acp_mmio, + rtd->i2s_play_instance, + substream->stream); + switch (rtd->i2s_play_instance) { + case I2S_BT_INSTANCE: + if (bytescount > rtd->i2sbt_renderbytescount) + bytescount = bytescount - + rtd->i2sbt_renderbytescount; + break; + case I2S_SP_INSTANCE: + default: + if (bytescount > rtd->i2ssp_renderbytescount) + bytescount = bytescount - + rtd->i2ssp_renderbytescount; + } } else { - if (bytescount > rtd->i2ssp_capturebytescount) - bytescount = bytescount - rtd->i2ssp_capturebytescount; + bytescount = acp_get_byte_count(rtd->acp_mmio, + rtd->i2s_capture_instance, + substream->stream); + switch (rtd->i2s_capture_instance) { + case I2S_BT_INSTANCE: + if (bytescount > rtd->i2sbt_capturebytescount) + bytescount = bytescount - + rtd->i2sbt_capturebytescount; + break; + case I2S_SP_INSTANCE: + default: + if (bytescount > rtd->i2ssp_capturebytescount) + bytescount = bytescount - + rtd->i2ssp_capturebytescount; + } } pos = do_div(bytescount, buffersize); return bytes_to_frames(runtime, pos); @@ -1089,54 +1133,109 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_RESUME: - bytescount = acp_get_byte_count(rtd->acp_mmio, - substream->stream); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (rtd->i2ssp_renderbytescount == 0) - rtd->i2ssp_renderbytescount = bytescount; - acp_dma_start(rtd->acp_mmio, - SYSRAM_TO_ACP_CH_NUM, false); - while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & - BIT(SYSRAM_TO_ACP_CH_NUM)) { - if (!loops--) { - dev_err(component->dev, - "acp dma start timeout\n"); - return -ETIMEDOUT; + bytescount = acp_get_byte_count(rtd->acp_mmio, + rtd->i2s_play_instance, + substream->stream); + switch (rtd->i2s_play_instance) { + case I2S_BT_INSTANCE: + if (rtd->i2sbt_renderbytescount == 0) + rtd->i2sbt_renderbytescount = bytescount; + acp_dma_start(rtd->acp_mmio, + SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, + false); + while (acp_reg_read(rtd->acp_mmio, + mmACP_DMA_CH_STS) & + BIT(SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM)) { + if (!loops--) { + dev_err(component->dev, + "acp dma start timeout\n"); + return -ETIMEDOUT; + } + cpu_relax(); } - cpu_relax(); - } - - acp_dma_start(rtd->acp_mmio, + acp_dma_start(rtd->acp_mmio, + ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM, + true); + break; + case I2S_SP_INSTANCE: + default: + if (rtd->i2ssp_renderbytescount == 0) + rtd->i2ssp_renderbytescount = bytescount; + acp_dma_start(rtd->acp_mmio, + SYSRAM_TO_ACP_CH_NUM, false); + while (acp_reg_read(rtd->acp_mmio, + mmACP_DMA_CH_STS) & + BIT(SYSRAM_TO_ACP_CH_NUM)) { + if (!loops--) { + dev_err(component->dev, + "acp dma start timeout\n"); + return -ETIMEDOUT; + } + cpu_relax(); + } + acp_dma_start(rtd->acp_mmio, ACP_TO_I2S_DMA_CH_NUM, true); - + } } else { - if (rtd->i2ssp_capturebytescount == 0) - rtd->i2ssp_capturebytescount = bytescount; - acp_dma_start(rtd->acp_mmio, - I2S_TO_ACP_DMA_CH_NUM, true); + bytescount = acp_get_byte_count(rtd->acp_mmio, + rtd->i2s_capture_instance, + substream->stream); + switch (rtd->i2s_capture_instance) { + case I2S_BT_INSTANCE: + if (rtd->i2sbt_capturebytescount == 0) + rtd->i2sbt_capturebytescount = 0; + acp_dma_start(rtd->acp_mmio, + I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM, + true); + break; + case I2S_SP_INSTANCE: + default: + if (rtd->i2ssp_capturebytescount == 0) + rtd->i2ssp_capturebytescount = bytescount; + acp_dma_start(rtd->acp_mmio, + I2S_TO_ACP_DMA_CH_NUM, true); + } } ret = 0; break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_SUSPEND: - /* Need to stop only circular DMA channels : - * ACP_TO_I2S_DMA_CH_NUM / I2S_TO_ACP_DMA_CH_NUM. Non-circular - * channels will stopped automatically after its transfer - * completes : SYSRAM_TO_ACP_CH_NUM / ACP_TO_SYSRAM_CH_NUM - */ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - ret = acp_dma_stop(rtd->acp_mmio, + switch (rtd->i2s_play_instance) { + case I2S_BT_INSTANCE: + ret = acp_dma_stop(rtd->acp_mmio, + SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM); + ret = acp_dma_stop(rtd->acp_mmio, + ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM); + rtd->i2sbt_renderbytescount = 0; + break; + case I2S_SP_INSTANCE: + default: + ret = acp_dma_stop(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM); - ret = acp_dma_stop(rtd->acp_mmio, - ACP_TO_I2S_DMA_CH_NUM); - rtd->i2ssp_renderbytescount = 0; + ret = acp_dma_stop(rtd->acp_mmio, + ACP_TO_I2S_DMA_CH_NUM); + rtd->i2ssp_renderbytescount = 0; + } } else { - ret = acp_dma_stop(rtd->acp_mmio, - I2S_TO_ACP_DMA_CH_NUM); - ret = acp_dma_stop(rtd->acp_mmio, + switch (rtd->i2s_capture_instance) { + case I2S_BT_INSTANCE: + ret = acp_dma_stop(rtd->acp_mmio, + I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM); + ret = acp_dma_stop(rtd->acp_mmio, + ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM); + rtd->i2sbt_capturebytescount = 0; + break; + case I2S_SP_INSTANCE: + default: + ret = acp_dma_stop(rtd->acp_mmio, + I2S_TO_ACP_DMA_CH_NUM); + ret = acp_dma_stop(rtd->acp_mmio, ACP_TO_SYSRAM_CH_NUM); - rtd->i2ssp_capturebytescount = 0; + rtd->i2ssp_capturebytescount = 0; + } } break; default: