ASoC: DaVinci: pcm, constrain buffer size to multiple of period
authorTroy Kisky <troy.kisky@boundarydevices.com>
Thu, 6 Aug 2009 23:55:32 +0000 (16:55 -0700)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 7 Aug 2009 10:38:29 +0000 (11:38 +0100)
The dma setup code assumes that the buffer size is a multiple
of the period size.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/davinci/davinci-pcm.c

index 8fd0c3cdc710c8d70199686cfbd8bfb13f3e86ab..ab43a539c11de04b458e4baf837a66439e3a87bc 100644 (file)
@@ -244,6 +244,11 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
        int ret = 0;
 
        snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware);
+       /* ensure that buffer size is a multiple of period size */
+       ret = snd_pcm_hw_constraint_integer(runtime,
+                                               SNDRV_PCM_HW_PARAM_PERIODS);
+       if (ret < 0)
+               return ret;
 
        prtd = kzalloc(sizeof(struct davinci_runtime_data), GFP_KERNEL);
        if (prtd == NULL)