Commit 35dcf586 authored by Wolfram Sang's avatar Wolfram Sang Committed by Mark Brown

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.htmlSigned-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d4ba7854
...@@ -243,23 +243,22 @@ static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) ...@@ -243,23 +243,22 @@ static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd)
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
struct snd_pcm_substream *substream;
int ret; int ret;
ret = imx_pcm_new(rtd); ret = imx_pcm_new(rtd);
if (ret) if (ret)
return ret; return ret;
if (dai->driver->playback.channels_min) { substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
struct snd_pcm_substream *substream = if (substream) {
pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer; struct snd_dma_buffer *buf = &substream->dma_buffer;
imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; imx_ssi_fiq_tx_buffer = (unsigned long)buf->area;
} }
if (dai->driver->capture.channels_min) { substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
struct snd_pcm_substream *substream = if (substream) {
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer; struct snd_dma_buffer *buf = &substream->dma_buffer;
imx_ssi_fiq_rx_buffer = (unsigned long)buf->area; imx_ssi_fiq_rx_buffer = (unsigned long)buf->area;
......
...@@ -399,14 +399,14 @@ int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -399,14 +399,14 @@ int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
card->dev->dma_mask = &imx_pcm_dmamask; card->dev->dma_mask = &imx_pcm_dmamask;
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = imx_pcm_preallocate_dma_buffer(pcm, ret = imx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = imx_pcm_preallocate_dma_buffer(pcm, ret = imx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (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