diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-12-10 13:42:04 +0800 |
---|---|---|
committer | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-12-10 18:35:09 +0800 |
commit | fe88b874f67f1b8d33f019e8fe166b2d4bb63eb1 (patch) | |
tree | c5cbc394d467e75b506bb1ab369b92384afe995a /sound/soc/fsl/imx-pcm-dma-v2.c | |
parent | 0e05c736c00578e967d9c399b36eb4767fecee23 (diff) |
LF-374: ASoC: imx-pcm-dma-v2: Fix compile issue with SND_SOC_IMX_PCM_DMA=m
When build with CONFIG_SND_SOC_IMX_PCM_DMA=m, there is error:
ERROR: "snd_pcm_lib_preallocate_free" [sound/soc/fsl/imx-pcm-dma-v2.ko] undefined!
The reason is that snd_pcm_lib_preallocate_free is not declared
with EXPORT_SYMBOL.
In this patch, we use snd_dma_alloc_pages & snd_dma_free_pages to replace
the snd_pcm_lib_preallocate_pages & snd_pcm_lib_preallocate_free to fix
the build issue.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/imx-pcm-dma-v2.c')
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma-v2.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/sound/soc/fsl/imx-pcm-dma-v2.c b/sound/soc/fsl/imx-pcm-dma-v2.c index 54b08131199b..b5fad925fd0c 100644 --- a/sound/soc/fsl/imx-pcm-dma-v2.c +++ b/sound/soc/fsl/imx-pcm-dma-v2.c @@ -99,21 +99,29 @@ static snd_pcm_uframes_t imx_pcm_pointer(struct snd_pcm_substream *substream) return snd_dmaengine_pcm_pointer(substream); } -static void imx_pcm_preallocate_dma_buffer(struct snd_pcm_substream *substream, - struct device *dev) +static int imx_pcm_preallocate_dma_buffer(struct snd_pcm_substream *substream, + struct device *dev) { size_t size = imx_pcm_hardware.buffer_bytes_max; + int ret; + + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_IRAM, + dev, + size, + &substream->dma_buffer); + if (ret) + return ret; - snd_pcm_lib_preallocate_pages(substream, - SNDRV_DMA_TYPE_DEV_IRAM, - dev, - size, - size); + return 0; } static void imx_pcm_free_dma_buffers(struct snd_pcm_substream *substream) { - snd_pcm_lib_preallocate_free(substream); + if (substream) { + snd_dma_free_pages(&substream->dma_buffer); + substream->dma_buffer.area = NULL; + substream->dma_buffer.addr = 0; + } } static int imx_pcm_open(struct snd_pcm_substream *substream) @@ -202,7 +210,9 @@ static int imx_pcm_open(struct snd_pcm_substream *substream) snd_soc_set_runtime_hwparams(substream, &imx_pcm_hardware); - imx_pcm_preallocate_dma_buffer(substream, chan->device->dev); + ret = imx_pcm_preallocate_dma_buffer(substream, chan->device->dev); + if (ret) + return ret; ret = snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS); |