aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2011-06-08 16:02:56 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-09 06:53:11 -0400
commit0cd114fff9ace7014c0d3ef8ab385fc5d3cf2d2f (patch)
tree60cb1a86cad6a267a1bbf3139776c6771ec1cd50 /sound
parent3115ae174620eeab4b16f52c8d0a9a35d2717e3c (diff)
ASoC: fsl: fix initialization of DMA buffers
The DMA (PCM) driver used by some Freescale PowerPC supports separate DAIs for playback and capture, so DMA buffers should be allocated only for the initialized streams. Instead of checking for the number of active channels, which apparently is not reliable, check to see if the actual stream object exists. Also provide a better name for the DMA interrupt. Signed-off-by: Timur Tabi <timur@freescale.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_dma.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 15dac0f20cd8..6680c0b4d203 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -310,7 +310,7 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
310 * should allocate a DMA buffer only for the streams that are valid. 310 * should allocate a DMA buffer only for the streams that are valid.
311 */ 311 */
312 312
313 if (dai->driver->playback.channels_min) { 313 if (pcm->streams[0].substream) {
314 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, 314 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
315 fsl_dma_hardware.buffer_bytes_max, 315 fsl_dma_hardware.buffer_bytes_max,
316 &pcm->streams[0].substream->dma_buffer); 316 &pcm->streams[0].substream->dma_buffer);
@@ -320,13 +320,13 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
320 } 320 }
321 } 321 }
322 322
323 if (dai->driver->capture.channels_min) { 323 if (pcm->streams[1].substream) {
324 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, 324 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
325 fsl_dma_hardware.buffer_bytes_max, 325 fsl_dma_hardware.buffer_bytes_max,
326 &pcm->streams[1].substream->dma_buffer); 326 &pcm->streams[1].substream->dma_buffer);
327 if (ret) { 327 if (ret) {
328 snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
329 dev_err(card->dev, "can't alloc capture dma buffer\n"); 328 dev_err(card->dev, "can't alloc capture dma buffer\n");
329 snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
330 return ret; 330 return ret;
331 } 331 }
332 } 332 }
@@ -449,7 +449,8 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
449 dma_private->ld_buf_phys = ld_buf_phys; 449 dma_private->ld_buf_phys = ld_buf_phys;
450 dma_private->dma_buf_phys = substream->dma_buffer.addr; 450 dma_private->dma_buf_phys = substream->dma_buffer.addr;
451 451
452 ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "DMA", dma_private); 452 ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "fsldma-audio",
453 dma_private);
453 if (ret) { 454 if (ret) {
454 dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n", 455 dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n",
455 dma_private->irq, ret); 456 dma_private->irq, ret);