diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2011-08-25 09:54:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-08-31 04:42:24 -0400 |
commit | 35dcf58634cf696966cdec69f62b14a7f49a8c42 (patch) | |
tree | 641e6b41e21e8a341bbd92f7c170e7dc9533ad3d /sound/soc/imx | |
parent | d4ba7854c9ea388e83731ee4b3c6546076f70f9d (diff) |
ASoC: imx: use more robust checking of available streams
Replace the channels_min check with a check for the relevant substream
being present. Suggested here [1] when mxs implemented the
audio-support.
[1] http://www.spinics.net/lists/arm-kernel/msg133010.html
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/imx')
-rw-r--r-- | sound/soc/imx/imx-pcm-fiq.c | 11 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index 309c59e6fb6c..ac790e87e231 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c | |||
@@ -243,23 +243,22 @@ static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | |||
243 | struct snd_card *card = rtd->card->snd_card; | 243 | struct snd_card *card = rtd->card->snd_card; |
244 | struct snd_soc_dai *dai = rtd->cpu_dai; | 244 | struct snd_soc_dai *dai = rtd->cpu_dai; |
245 | struct snd_pcm *pcm = rtd->pcm; | 245 | struct snd_pcm *pcm = rtd->pcm; |
246 | struct snd_pcm_substream *substream; | ||
246 | int ret; | 247 | int ret; |
247 | 248 | ||
248 | ret = imx_pcm_new(rtd); | 249 | ret = imx_pcm_new(rtd); |
249 | if (ret) | 250 | if (ret) |
250 | return ret; | 251 | return ret; |
251 | 252 | ||
252 | if (dai->driver->playback.channels_min) { | 253 | substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
253 | struct snd_pcm_substream *substream = | 254 | if (substream) { |
254 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | ||
255 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 255 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
256 | 256 | ||
257 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; | 257 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; |
258 | } | 258 | } |
259 | 259 | ||
260 | if (dai->driver->capture.channels_min) { | 260 | substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
261 | struct snd_pcm_substream *substream = | 261 | if (substream) { |
262 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | ||
263 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 262 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
264 | 263 | ||
265 | imx_ssi_fiq_rx_buffer = (unsigned long)buf->area; | 264 | imx_ssi_fiq_rx_buffer = (unsigned long)buf->area; |
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 3b8d5cd2516a..4297cb6af42e 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -399,14 +399,14 @@ int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
399 | card->dev->dma_mask = &imx_pcm_dmamask; | 399 | card->dev->dma_mask = &imx_pcm_dmamask; |
400 | if (!card->dev->coherent_dma_mask) | 400 | if (!card->dev->coherent_dma_mask) |
401 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 401 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
402 | if (dai->driver->playback.channels_min) { | 402 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { |
403 | ret = imx_pcm_preallocate_dma_buffer(pcm, | 403 | ret = imx_pcm_preallocate_dma_buffer(pcm, |
404 | SNDRV_PCM_STREAM_PLAYBACK); | 404 | SNDRV_PCM_STREAM_PLAYBACK); |
405 | if (ret) | 405 | if (ret) |
406 | goto out; | 406 | goto out; |
407 | } | 407 | } |
408 | 408 | ||
409 | if (dai->driver->capture.channels_min) { | 409 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { |
410 | ret = imx_pcm_preallocate_dma_buffer(pcm, | 410 | ret = imx_pcm_preallocate_dma_buffer(pcm, |
411 | SNDRV_PCM_STREAM_CAPTURE); | 411 | SNDRV_PCM_STREAM_CAPTURE); |
412 | if (ret) | 412 | if (ret) |