diff options
author | Timur Tabi <timur@freescale.com> | 2010-08-19 17:43:42 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-20 07:14:45 -0400 |
commit | c04019d450a885a095a2ca38fcd5db8d57cd2718 (patch) | |
tree | 2c7c8fa132fc6e3b012ff4fcb7cf7ac894980a2a /sound/soc/fsl | |
parent | b67696b40f2e7f890d017db3c6805ff90cb392b6 (diff) |
ASoC: add support for separate codec DAIs to the fsl_dma driver
Some codecs have separate DAIs for playback and capture, so the DMA driver
should allocate a DMA buffer only for the streams that are valid when the
driver is opened.
Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl_dma.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index 57774cb91ae3..5a6f56d63756 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -303,21 +303,29 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
303 | if (!card->dev->coherent_dma_mask) | 303 | if (!card->dev->coherent_dma_mask) |
304 | card->dev->coherent_dma_mask = fsl_dma_dmamask; | 304 | card->dev->coherent_dma_mask = fsl_dma_dmamask; |
305 | 305 | ||
306 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, | 306 | /* Some codecs have separate DAIs for playback and capture, so we |
307 | fsl_dma_hardware.buffer_bytes_max, | 307 | * should allocate a DMA buffer only for the streams that are valid. |
308 | &pcm->streams[0].substream->dma_buffer); | 308 | */ |
309 | if (ret) { | 309 | |
310 | dev_err(card->dev, "can't allocate playback dma buffer\n"); | 310 | if (dai->driver->playback.channels_min) { |
311 | return ret; | 311 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, |
312 | fsl_dma_hardware.buffer_bytes_max, | ||
313 | &pcm->streams[0].substream->dma_buffer); | ||
314 | if (ret) { | ||
315 | dev_err(card->dev, "can't alloc playback dma buffer\n"); | ||
316 | return ret; | ||
317 | } | ||
312 | } | 318 | } |
313 | 319 | ||
314 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, | 320 | if (dai->driver->capture.channels_min) { |
315 | fsl_dma_hardware.buffer_bytes_max, | 321 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, |
316 | &pcm->streams[1].substream->dma_buffer); | 322 | fsl_dma_hardware.buffer_bytes_max, |
317 | if (ret) { | 323 | &pcm->streams[1].substream->dma_buffer); |
318 | snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer); | 324 | if (ret) { |
319 | dev_err(card->dev, "can't allocate capture dma buffer\n"); | 325 | snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer); |
320 | return ret; | 326 | dev_err(card->dev, "can't alloc capture dma buffer\n"); |
327 | return ret; | ||
328 | } | ||
321 | } | 329 | } |
322 | 330 | ||
323 | return 0; | 331 | return 0; |