aboutsummaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-07-29 09:51:28 +0300
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-08-02 10:38:16 +0100
commit998a8a69f3a40f9c82e83730bfdaceb63954d753 (patch)
tree07b02d547ef8e70e93ae25f4d7b9ae1eb03a1405 /sound/soc
parentcf80e15860852be5ce38714979db94ec36c5e288 (diff)
ASoC: omap-mcbsp: Remove period size constraint in THRESHOLD mode
The use of sDMA packet mode in THRESHOLD mode removes the restriction on the period size. With the extended THRESHOLD mode user space can ask for any period size it wishes, and the driver will configure the sDMA and McBSP FIFO accordingly. Replace the hw_rule for the period size with static constraint, which will make sure that the period size will be always even (to avoid prime period size, which could be possible in mono stream) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/omap/omap-mcbsp.c43
1 files changed, 4 insertions, 39 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 9fd00b09181..86f213905e2 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -202,31 +202,6 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params,
return snd_interval_refine(buffer_size, &frames);
}
-static int omap_mcbsp_hwrule_max_periodsize(struct snd_pcm_hw_params *params,
- struct snd_pcm_hw_rule *rule)
-{
- 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 snd_pcm_substream *substream = rule->private;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
- struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
- struct snd_interval frames;
- int size;
-
- snd_interval_any(&frames);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- size = omap_mcbsp_get_max_tx_threshold(mcbsp_data->bus_id);
- else
- size = omap_mcbsp_get_max_rx_threshold(mcbsp_data->bus_id);
-
- frames.max = size / channels->min;
- frames.integer = 1;
- return snd_interval_refine(period_size, &frames);
-}
-
static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -255,10 +230,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
* 4 channels: size is 128 / 4 = 32 frames (4 * 32 words)
*/
if (cpu_is_omap343x()) {
- int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id);
-
/*
- * The first rule is for the buffer size, we should not allow
+ * Rule for the buffer size. We should not allow
* smaller buffer than the FIFO size to avoid underruns
*/
snd_pcm_hw_rule_add(substream->runtime, 0,
@@ -267,17 +240,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
mcbsp_data,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
- /*
- * In case of threshold mode, the rule will ensure, that the
- * period size is not bigger than the maximum allowed threshold
- * value.
- */
- if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
- snd_pcm_hw_rule_add(substream->runtime, 0,
- SNDRV_PCM_HW_PARAM_CHANNELS,
- omap_mcbsp_hwrule_max_periodsize,
- substream,
- SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
+ /* Make sure, that the period size is always even */
+ snd_pcm_hw_constraint_step(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
}
return err;