From: Nicolin Chen Date: Thu, 15 Nov 2012 03:28:19 +0000 (+0800) Subject: ENGR00233731 ALSA: add DMABUF allocating for different driver X-Git-Tag: v3.0.35-fsl~254 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d010757ec4025b6e51fd52bc34c93dacf58c9a9e;p=karo-tx-linux.git ENGR00233731 ALSA: add DMABUF allocating for different driver Patch ENGR00233056 added DMABUF size setting for hw_param and changed SSI's buffer allocating size. But didn't add allocation for ESAI and SPDIF, which might cause some dma transmitting issue. This Patch add new allocation code that detects the driver before allocating its DMABUF. Signed-off-by: Nicolin Chen --- diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index b4c3aea56278..060d093a0aa9 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -439,8 +439,18 @@ EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap); static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) { struct snd_pcm_substream *substream = pcm->streams[stream].substream; + struct snd_soc_pcm_runtime *rtd = pcm->private_data; struct snd_dma_buffer *buf = &substream->dma_buffer; - size_t size = IMX_SSI_DMABUF_SIZE; + size_t size; + + if (!strncmp(rtd->cpu_dai->name, "imx-ssi", strlen("imx-ssi"))) + size = IMX_SSI_DMABUF_SIZE; + else if (!strncmp(rtd->cpu_dai->name, "imx-esai", strlen("imx-esai"))) + size = IMX_ESAI_DMABUF_SIZE; + else if (!strncmp(rtd->cpu_dai->name, "imx-spdif", strlen("imx-spdif"))) + size = IMX_SPDIF_DMABUF_SIZE; + else + size = IMX_DEFAULT_DMABUF_SIZE; buf->dev.type = SNDRV_DMA_TYPE_DEV; buf->dev.dev = pcm->card->dev;