From patchwork Mon Jun 10 10:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 804163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2D11C27C6E for ; Thu, 13 Jun 2024 16:13:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2A6C2E9F; Thu, 13 Jun 2024 18:13:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2A6C2E9F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718295205; bh=O+lWqMRXwSy8zBJ1mc67aSXihmGU78/BDKwHYJeNvQw=; h=From:Date:Subject:References:In-Reply-To:To:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GGx3dr4wqyAVfHIpPSYsSfd5TYd6jnMI/9hO/VGO9GdyGoN2fKmkwtEZcsBKHfawG mNOMM/YDL04e/M/kaF7BG5xYrJffkRWPW4LEhsEp9xaz7dwhoucWX7QwGY+/Sy3npo O1gJAJRfINIpl2mMHtX1MAb03HraslBXWvuYAJs0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D6F95F8064F; Thu, 13 Jun 2024 18:04:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 208CEF8085B; Thu, 13 Jun 2024 18:04:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3494F80448; Mon, 10 Jun 2024 12:56:41 +0200 (CEST) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ABFC4F80130 for ; Mon, 10 Jun 2024 12:56:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ABFC4F80130 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=jno0hY7l Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuS2t009004; Mon, 10 Jun 2024 05:56:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1718016988; bh=/WPuP+3MqrfuEjdImm1fPrjNvw+T0MBh7NTiOXP2HsM=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=jno0hY7lIhYQBmxspZnUlszmMjEftMmiz0wE6cMssYG7tdUznQxty5JlaGzhWQ1lc KQ9IyUKCPpQSse4UVKOd6EClxyiSa74tKPViRZphiK7bdUfzykIKfAFLEW1ghBLGwd XRh4+LPwmfIbkg5gntDznAzKOCd3H3O9UTrgsvNc= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 45AAuS1d061861 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2024 05:56:28 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 10 Jun 2024 05:56:27 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 10 Jun 2024 05:56:27 -0500 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.116]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuQnD079439; Mon, 10 Jun 2024 05:56:27 -0500 From: Jai Luthra Date: Mon, 10 Jun 2024 16:26:00 +0530 Subject: [PATCH v2 1/2] ALSA: dmaengine: Synchronize dma channel in prepare() MIME-Version: 1.0 Message-ID: <20240610-asoc_next-v2-1-b52aaf5d67c4@ti.com> References: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> In-Reply-To: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> To: Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Peter Ujfalusi CC: , , , Devarsh Thakkar , Vignesh Raghavendra , Jayesh Choudhary , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3364; i=j-luthra@ti.com; h=from:subject:message-id; bh=O+lWqMRXwSy8zBJ1mc67aSXihmGU78/BDKwHYJeNvQw=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBmZtvXvyGKfK9Fw7nQW8ivV8GWNEMKrun8JD93m 24/mt6wReOJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZmbb1wAKCRBD3pH5JJpx RRZVEACYO/2PEQhnin0tBClnmN5daonwZs/efSNQ0rQ/6aq0El9FRVHGeDUN6vYFdPMloxR5ny0 vpTFccQKV2DQa6uyiw5jIWjiNr1su8HEXlizOINmu/F8bsUaL/A/7hb2182YWKikBNWzbW4XkyF pETB13RztXAD3d15rjIAuPIjxbf2GonuBwuqVM37ypWcrimCxNk11Qugxh3Shuw/HPEhwBdVXkb cvDE2IE2m2J+uwHCiS0YSSQ7Z4hGlPa85ZF4OL47nkt2yW3b4Q8LGcrNEWZ4Vyt2ilURdL9bVS8 v4jakrlH8Ce0xmvvtiL2ytSl9IlRXvUzTMUNU8R+QSoNI8DgiueK4wwVbf93jta4B2WNoQcftm4 FL4qTkjo8l2ip6R2O68DaTTtCoGU6QAY1nEDpTXdZr3MrP3a0cPuTJXGYmwTs3vo3zLgfKum0sP TsLlT3ORUdDnqNDUK8+e+7S1hLiAwGdRkv4aBv47j8bMkZQjT8sboXGnImAq2Wfef18UiyBOaxD vvMHQdU3z34qfM6IvCFnLPgWqYdR+O2HK0ioMptZ4sRGTd57Zhi0ncccO0CtrDi4ZfPDW8cNEk4 yBz83QnS2VZAtJwogbGoO0f6rtpdxZedN0Sok+Kdm+F9IK7pyxkUMIvLxiSrX///Da0wDyv+3kl Z2++lP+bEbDZepQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-MailFrom: j-luthra@ti.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 3KXX3GKCQSPTS3H3PR6LBTDAC5VBDS4F X-Message-ID-Hash: 3KXX3GKCQSPTS3H3PR6LBTDAC5VBDS4F X-Mailman-Approved-At: Thu, 13 Jun 2024 16:04:29 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Sometimes the stream may be stopped due to XRUN events, in which case the userspace can call snd_pcm_drop() and snd_pcm_prepare() to stop and start the stream again. In these cases, we must wait for the DMA channel to synchronize before marking the stream as prepared for playback, as the DMA channel gets stopped by snd_pcm_drop() without any synchronization. Reviewed-by: Peter Ujfalusi Signed-off-by: Jai Luthra --- include/sound/dmaengine_pcm.h | 1 + sound/core/pcm_dmaengine.c | 10 ++++++++++ sound/soc/soc-generic-dmaengine-pcm.c | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index c11aaf8079fb..9c5800e5659f 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -36,6 +36,7 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream, struct dma_chan *chan); int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream); +int snd_dmaengine_pcm_prepare(struct snd_pcm_substream *substream); int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream, dma_filter_fn filter_fn, void *filter_data); diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 12aa1cef11a1..dbf5c6136d68 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -349,6 +349,16 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream, } EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan); +int snd_dmaengine_pcm_prepare(struct snd_pcm_substream *substream) +{ + struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); + + dmaengine_synchronize(prtd->dma_chan); + + return 0; +} +EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_prepare); + /** * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream * @substream: PCM substream diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index ea3bc9318412..078fcb0ba8a2 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -318,6 +318,12 @@ static int dmaengine_copy(struct snd_soc_component *component, return 0; } +static int dmaengine_pcm_prepare(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + return snd_dmaengine_pcm_prepare(substream); +} + static const struct snd_soc_component_driver dmaengine_pcm_component = { .name = SND_DMAENGINE_PCM_DRV_NAME, .probe_order = SND_SOC_COMP_ORDER_LATE, @@ -327,6 +333,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = { .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, .pcm_construct = dmaengine_pcm_new, + .prepare = dmaengine_pcm_prepare, }; static const struct snd_soc_component_driver dmaengine_pcm_component_process = { @@ -339,6 +346,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = { .pointer = dmaengine_pcm_pointer, .copy = dmaengine_copy, .pcm_construct = dmaengine_pcm_new, + .prepare = dmaengine_pcm_prepare, }; static const char * const dmaengine_pcm_dma_channel_names[] = { From patchwork Mon Jun 10 10:56:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 804162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14C72C27C4F for ; Thu, 13 Jun 2024 16:13:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 42A7A218F; Thu, 13 Jun 2024 18:13:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 42A7A218F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718295230; bh=WPF2iC1SV8AsqNd6SPxTttV/JMzPbLAHKzCU/mAhLq0=; h=From:Date:Subject:References:In-Reply-To:To:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=N2f3iNUeQT+H0cCBnHoEWQOC6NAOcQCEnMD0bsSOgTGk40deVCZe0zkA/LCUpjv4d MbYoQ9oOmwgxb/PglEz3hWsd23h7HG/m7Zxo+oRoDy2ueEGWzoy87AjOeHBoDfzrxE mOq510nWrteGvQiP7wkkCZFHB/CDCGCp687npFQ4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 828CAF898D7; Thu, 13 Jun 2024 18:04:48 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CE50CF898E8; Thu, 13 Jun 2024 18:04:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB419F80448; Mon, 10 Jun 2024 12:56:46 +0200 (CEST) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 99C9DF800D0 for ; Mon, 10 Jun 2024 12:56:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 99C9DF800D0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=glvYyz/W Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuTbW009009; Mon, 10 Jun 2024 05:56:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1718016989; bh=m28Tjms8EG/D+LF08iHzhc9HsItx6aYa/0oUcN3SEgw=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=glvYyz/WsEiU2YwVpFf87uAP78t6GUf9L2Se+jmkDNr4kQo/ZCFeOrJxsKFI89JUV DxtbIKX0l8c5qpbDycH5aBWq/mjFRGNQjewNkvy7hagW8zzHZvcc7Gj418jJREIRT7 rteukvMIe6O5cRAT6kKlTBAtSamQwF6C2J/LFlqc= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 45AAuTil004949 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2024 05:56:29 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 10 Jun 2024 05:56:29 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 10 Jun 2024 05:56:29 -0500 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.116]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuSlc110545; Mon, 10 Jun 2024 05:56:28 -0500 From: Jai Luthra Date: Mon, 10 Jun 2024 16:26:01 +0530 Subject: [PATCH v2 2/2] ASoC: ti: davinci-mcasp: Set min period size using FIFO config MIME-Version: 1.0 Message-ID: <20240610-asoc_next-v2-2-b52aaf5d67c4@ti.com> References: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> In-Reply-To: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> To: Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Peter Ujfalusi CC: , , , Devarsh Thakkar , Vignesh Raghavendra , Jayesh Choudhary , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1960; i=j-luthra@ti.com; h=from:subject:message-id; bh=WPF2iC1SV8AsqNd6SPxTttV/JMzPbLAHKzCU/mAhLq0=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBmZtvYRZUS1YnZ7wXULBNwFYahVxcCh5M0cRfMj OW3gz+xT/mJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZmbb2AAKCRBD3pH5JJpx RSYnD/9/UHlozo/st4AN88B7W06HOUrbfDOElMmFCyGwQhRUERSoD1E2xe2iv2HlZERyxH6qOZx qc0y3ynQllWf22HxB/v0xGVUk0IVEcDKpx+jHP8/cjeOHdB3gCd/Qbpu3LCFZxGb7P4AFE1qgWW y/7RDNYKXnSTb6fhMNLPEeweIGu7T9kxY5Awp6bXAyzoV3KxAtZ4dp4YzfZUOxnUbHgaIxjmb6I Sc7sIayOVVg32WbWPElFNlN3ZWPK0dhfXWWVem1Vs+iy9plJ5CW9R9VW/3+lfFS0L7Tvv+Rdegx 0VQYg05UCkEt38uAgJpSiJV7+x758nQmnI21Th6eGaWS8QN5aiK5fNdpjCbtuc0Opuy+QBQyfqE BpoUsTCZK6uK9heI4BU+rrHHa7+TXYeoz9b4EUGJs4sX882Z3ViB4gx+VFIdBkX5WFpY8owP/L/ Vu8nSk8vnp2BN8djvj5Gwp6AHqIf3b3Ninue++dyi06rNK9xp/oSHnEFYztNU7OVFBF+nbuDhut f+vcCRT2nTB9eQowOLFAMUPMoMKNOjx2ePNGyZpixgTuQdgaswm1KPaPzA7K+eV+Jnro3fNb6Z6 KP6hz9b2I8UXOsAMfRstRUSkxt44is9Vv/DeydzFataw14QLjiXCoxWfn1FHuUnR+91Tw81Vgn+ CNDOd3qHWIqvCSA== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-MailFrom: j-luthra@ti.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: PLQCOEAY2ZFK5BQHDIOH4H2DA5CODWN7 X-Message-ID-Hash: PLQCOEAY2ZFK5BQHDIOH4H2DA5CODWN7 X-Mailman-Approved-At: Thu, 13 Jun 2024 16:04:29 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The minimum period size was enforced to 64 as older devices integrating McASP with EDMA used an internal FIFO of 64 samples. With UDMA based platforms this internal McASP FIFO is optional, as the DMA engine internally does some buffering which is already accounted for when registering the platform. So we should read the actual FIFO configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to 64. Signed-off-by: Jai Luthra --- sound/soc/ti/davinci-mcasp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c index 1e760c315521..2b1ed91a736c 100644 --- a/sound/soc/ti/davinci-mcasp.c +++ b/sound/soc/ti/davinci-mcasp.c @@ -1472,10 +1472,11 @@ static int davinci_mcasp_hw_rule_min_periodsize( { struct snd_interval *period_size = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); + u8 numevt = *((u8 *)rule->private); struct snd_interval frames; snd_interval_any(&frames); - frames.min = 64; + frames.min = numevt; frames.integer = 1; return snd_interval_refine(period_size, &frames); @@ -1490,6 +1491,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, u32 max_channels = 0; int i, dir, ret; int tdm_slots = mcasp->tdm_slots; + u8 *numevt; /* Do not allow more then one stream per direction */ if (mcasp->substreams[substream->stream]) @@ -1589,9 +1591,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, return ret; } + numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? + &mcasp->txnumevt : + &mcasp->rxnumevt; snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - davinci_mcasp_hw_rule_min_periodsize, NULL, + davinci_mcasp_hw_rule_min_periodsize, numevt, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); return 0;