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>5.4-rM2-2.2.x-imx-squashed
parent
0e05c736c0
commit
fe88b874f6
|
@ -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;
|
||||
|
||||
snd_pcm_lib_preallocate_pages(substream,
|
||||
SNDRV_DMA_TYPE_DEV_IRAM,
|
||||
dev,
|
||||
size,
|
||||
size);
|
||||
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_IRAM,
|
||||
dev,
|
||||
size,
|
||||
&substream->dma_buffer);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue