diff options
author | Nikesh Oswal <noswal@nvidia.com> | 2011-11-06 10:12:31 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:50:09 -0800 |
commit | 83bb2183fe873f54d401cf88fc7dc1c9308e93a6 (patch) | |
tree | 3e2fc6b35bc17edd0e6462b946353d18c05f3b5b /sound/soc/tegra/tegra_pcm.c | |
parent | 64f161ec92b9715c08ca58a36a3e772ba9e412b5 (diff) |
ASoC: tegra: configure the dma request if dma data is set
configure the dma request if dma data is set by the cpu
dai. In voice call use case we open a pcm device with
alsa driver which has a codec dai for configuring the
codec and a dummy cpu dai, which had no dma data since
we dont want any dma for this device as the flow
of data is directly between the baseband and codec.
Bug: 862023
Change-Id: Ia64dee48ff5e102b334f4a3d64286787e6db415b
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: http://git-master/r/62621
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Rebase-Id: Rb144e52e059eb7240e09ac0d63825a490e3542af
Diffstat (limited to 'sound/soc/tegra/tegra_pcm.c')
-rw-r--r-- | sound/soc/tegra/tegra_pcm.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index b15a90bb9e27..f506d0954acb 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -147,24 +147,27 @@ static int tegra_pcm_open(struct snd_pcm_substream *substream) spin_lock_init(&prtd->lock); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - setup_dma_tx_request(&prtd->dma_req[0], dmap); - setup_dma_tx_request(&prtd->dma_req[1], dmap); - } else { - dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - setup_dma_rx_request(&prtd->dma_req[0], dmap); - setup_dma_rx_request(&prtd->dma_req[1], dmap); - } - - prtd->dma_req[0].dev = prtd; - prtd->dma_req[1].dev = prtd; - - prtd->dma_chan = tegra_dma_allocate_channel( - TEGRA_DMA_MODE_CONTINUOUS_SINGLE, "pcm"); - if (prtd->dma_chan == NULL) { - ret = -ENOMEM; - goto err; + dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + + if (dmap) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + setup_dma_tx_request(&prtd->dma_req[0], dmap); + setup_dma_tx_request(&prtd->dma_req[1], dmap); + } else { + setup_dma_rx_request(&prtd->dma_req[0], dmap); + setup_dma_rx_request(&prtd->dma_req[1], dmap); + } + + prtd->dma_req[0].dev = prtd; + prtd->dma_req[1].dev = prtd; + + prtd->dma_chan = tegra_dma_allocate_channel( + TEGRA_DMA_MODE_CONTINUOUS_SINGLE, + "pcm"); + if (prtd->dma_chan == NULL) { + ret = -ENOMEM; + goto err; + } } /* Set HW params now that initialization is complete */ @@ -199,7 +202,8 @@ static int tegra_pcm_close(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct tegra_runtime_data *prtd = runtime->private_data; - tegra_dma_free_channel(prtd->dma_chan); + if (prtd->dma_chan) + tegra_dma_free_channel(prtd->dma_chan); kfree(prtd); |