Commit 0cd114ff authored by Timur Tabi's avatar Timur Tabi Committed by Mark Brown

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: default avatarTimur Tabi <timur@freescale.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3115ae17
...@@ -310,7 +310,7 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai, ...@@ -310,7 +310,7 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
* should allocate a DMA buffer only for the streams that are valid. * should allocate a DMA buffer only for the streams that are valid.
*/ */
if (dai->driver->playback.channels_min) { if (pcm->streams[0].substream) {
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
fsl_dma_hardware.buffer_bytes_max, fsl_dma_hardware.buffer_bytes_max,
&pcm->streams[0].substream->dma_buffer); &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,13 +320,13 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
} }
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[1].substream) {
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
fsl_dma_hardware.buffer_bytes_max, fsl_dma_hardware.buffer_bytes_max,
&pcm->streams[1].substream->dma_buffer); &pcm->streams[1].substream->dma_buffer);
if (ret) { if (ret) {
snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
dev_err(card->dev, "can't alloc capture dma buffer\n"); dev_err(card->dev, "can't alloc capture dma buffer\n");
snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
return ret; return ret;
} }
} }
...@@ -449,7 +449,8 @@ static int fsl_dma_open(struct snd_pcm_substream *substream) ...@@ -449,7 +449,8 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
dma_private->ld_buf_phys = ld_buf_phys; dma_private->ld_buf_phys = ld_buf_phys;
dma_private->dma_buf_phys = substream->dma_buffer.addr; dma_private->dma_buf_phys = substream->dma_buffer.addr;
ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "DMA", dma_private); ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "fsldma-audio",
dma_private);
if (ret) { if (ret) {
dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n", dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n",
dma_private->irq, ret); dma_private->irq, ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment