From: Jai Luthra <j-luthra@ti.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: <linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<alsa-devel@alsa-project.org>, Devarsh Thakkar <devarsht@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
Jayesh Choudhary <j-choudhary@ti.com>,
Jai Luthra <j-luthra@ti.com>
Subject: [PATCH v2 2/2] ASoC: ti: davinci-mcasp: Set min period size using FIFO config
Date: Mon, 10 Jun 2024 16:26:01 +0530 [thread overview]
Message-ID: <20240610-asoc_next-v2-2-b52aaf5d67c4@ti.com> (raw)
In-Reply-To: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com>
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 <j-luthra@ti.com>
---
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;
--
2.43.0
next prev parent reply other threads:[~2024-06-10 10:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 10:55 [PATCH v2 0/2] Fixes for McASP and dmaengine_pcm Jai Luthra
2024-06-10 10:56 ` [PATCH v2 1/2] ALSA: dmaengine: Synchronize dma channel in prepare() Jai Luthra
2024-06-11 0:45 ` Lars-Peter Clausen
2024-06-11 10:39 ` Mark Brown
2024-06-11 12:35 ` Jai Luthra
2024-06-10 10:56 ` Jai Luthra [this message]
2024-06-10 14:47 ` [PATCH v2 2/2] ASoC: ti: davinci-mcasp: Set min period size using FIFO config Péter Ujfalusi
2024-06-12 20:21 ` [PATCH v2 0/2] Fixes for McASP and dmaengine_pcm Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240610-asoc_next-v2-2-b52aaf5d67c4@ti.com \
--to=j-luthra@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devarsht@ti.com \
--cc=j-choudhary@ti.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@gmail.com \
--cc=tiwai@suse.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox