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>
This commit is contained in:
Timur Tabi 2011-06-08 15:02:56 -05:00 committed by Mark Brown
parent 3115ae1746
commit 0cd114fff9

View file

@ -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.
*/
if (dai->driver->playback.channels_min) {
if (pcm->streams[0].substream) {
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
fsl_dma_hardware.buffer_bytes_max,
&pcm->streams[0].substream->dma_buffer);
@ -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,
fsl_dma_hardware.buffer_bytes_max,
&pcm->streams[1].substream->dma_buffer);
if (ret) {
snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
dev_err(card->dev, "can't alloc capture dma buffer\n");
snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
return ret;
}
}
@ -449,7 +449,8 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
dma_private->ld_buf_phys = ld_buf_phys;
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) {
dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n",
dma_private->irq, ret);