From: Grazvydas Ignotas <notasas@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>,
Jarkko Nikula <jarkko.nikula@bitmer.com>,
Grazvydas Ignotas <notasas@gmail.com>
Subject: [PATCH 2/3] ASoC: omap-mcbsp: place size constrain on period, not buffer
Date: Fri, 9 Mar 2012 01:19:16 +0200 [thread overview]
Message-ID: <1331248757-3408-3-git-send-email-notasas@gmail.com> (raw)
In-Reply-To: <1331248757-3408-1-git-send-email-notasas@gmail.com>
Placing a constraint on buffer size is not enough, programs are
still free to use periods that are smaller than FIFO, which causes
transmit underflows as soon as the stream starts if program operates
in period-sized writes, ending up in endless loop of underruns.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
sound/soc/omap/omap-mcbsp.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 207365c..b9d1272 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -93,11 +93,11 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
omap_mcbsp_set_rx_threshold(mcbsp, words);
}
-static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
- struct snd_pcm_hw_rule *rule)
+static int omap_mcbsp_hwrule_min_period_size(struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
{
- struct snd_interval *buffer_size = hw_param_interval(params,
- SNDRV_PCM_HW_PARAM_BUFFER_SIZE);
+ struct snd_interval *period_size = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
struct omap_mcbsp *mcbsp = rule->private;
@@ -109,7 +109,7 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
frames.min = size / channels->min;
frames.integer = 1;
- return snd_interval_refine(buffer_size, &frames);
+ return snd_interval_refine(period_size, &frames);
}
static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
@@ -138,12 +138,12 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
*/
if (mcbsp->pdata->buffer_size) {
/*
- * Rule for the buffer size. We should not allow
- * smaller buffer than the FIFO size to avoid underruns
+ * Rule for the period size. We should not allow
+ * smaller period than the FIFO size to avoid underruns
*/
snd_pcm_hw_rule_add(substream->runtime, 0,
- SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
- omap_mcbsp_hwrule_min_buffersize,
+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
+ omap_mcbsp_hwrule_min_period_size,
mcbsp,
SNDRV_PCM_HW_PARAM_CHANNELS, -1);
--
1.7.0.4
next prev parent reply other threads:[~2012-03-08 23:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 23:19 [PATCH 0/3] ASoC: omap-mcbsp: fixes for some underflow problems Grazvydas Ignotas
2012-03-08 23:19 ` [PATCH 1/3] ASoC: omap-mcbsp: fix snd_pcm_hw_rule_add arguments Grazvydas Ignotas
2012-03-09 10:08 ` Peter Ujfalusi
2012-03-09 10:45 ` Grazvydas Ignotas
2012-03-09 12:01 ` Peter Ujfalusi
2012-03-09 12:02 ` Peter Ujfalusi
2012-03-09 12:19 ` Mark Brown
2012-03-08 23:19 ` Grazvydas Ignotas [this message]
2012-03-09 12:19 ` [PATCH 2/3] ASoC: omap-mcbsp: place size constrain on period, not buffer Mark Brown
2012-03-08 23:19 ` [PATCH 3/3] ASoC: omap-mcbsp: make minimum period size larger than FIFO Grazvydas Ignotas
2012-03-09 12:20 ` Mark Brown
2012-03-09 12:42 ` Peter Ujfalusi
2012-03-09 13:25 ` Grazvydas Ignotas
2012-03-09 13:42 ` Peter Ujfalusi
2012-03-09 21:07 ` Grazvydas Ignotas
2012-03-11 17:39 ` Jarkko Nikula
2012-03-12 12:05 ` Grazvydas Ignotas
2012-03-12 12:15 ` Mark Brown
2012-03-12 12:41 ` Peter Ujfalusi
2012-03-12 14:06 ` Grazvydas Ignotas
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=1331248757-3408-3-git-send-email-notasas@gmail.com \
--to=notasas@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jarkko.nikula@bitmer.com \
--cc=lrg@ti.com \
--cc=peter.ujfalusi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.