* [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver
@ 2010-08-19 21:43 Timur Tabi
2010-08-20 9:39 ` Liam Girdwood
2010-08-20 9:45 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Timur Tabi @ 2010-08-19 21:43 UTC (permalink / raw)
To: alsa-devel, lrg, broonie
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>
---
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 cb78698..4cf98c0 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -306,21 +306,29 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = fsl_dma_dmamask;
- ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
- fsl_dma_hardware.buffer_bytes_max,
- &pcm->streams[0].substream->dma_buffer);
- if (ret) {
- dev_err(card->dev, "can't allocate playback dma buffer\n");
- return ret;
+ /* Some codecs have separate DAIs for playback and capture, so we
+ * should allocate a DMA buffer only for the streams that are valid.
+ */
+
+ if (dai->driver->playback.channels_min) {
+ ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
+ fsl_dma_hardware.buffer_bytes_max,
+ &pcm->streams[0].substream->dma_buffer);
+ if (ret) {
+ dev_err(card->dev, "can't alloc playback dma buffer\n");
+ return ret;
+ }
}
- 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 allocate capture dma buffer\n");
- return ret;
+ if (dai->driver->capture.channels_min) {
+ 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");
+ return ret;
+ }
}
return 0;
--
1.7.0.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver
2010-08-19 21:43 [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver Timur Tabi
@ 2010-08-20 9:39 ` Liam Girdwood
2010-08-20 9:45 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-08-20 9:39 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel, broonie
On Thu, 2010-08-19 at 16:43 -0500, Timur Tabi wrote:
> 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>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver
2010-08-19 21:43 [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver Timur Tabi
2010-08-20 9:39 ` Liam Girdwood
@ 2010-08-20 9:45 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-08-20 9:45 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel, lrg
On Thu, Aug 19, 2010 at 04:43:42PM -0500, Timur Tabi wrote:
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-20 9:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 21:43 [PATCH 3/3] asoc/multi-component: add support for separate codec DAIs to the fsl_dma driver Timur Tabi
2010-08-20 9:39 ` Liam Girdwood
2010-08-20 9:45 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).