summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-10-17 18:24:29 +0800
committerJason Liu <r64343@freescale.com>2013-10-30 09:56:14 +0800
commit07157b22e7995163eb97040bd709899660668543 (patch)
tree507d9935b80701e15b8177ae5aa015ff73755cc3 /sound
parentf809e132f7cb3cff0e0b72d3b98d57914bbfe068 (diff)
ENGR00283079-1 ASoC: fsl: Implement different DMA buffer sizes
Each CPU DAI driver has its own defined DMA buffer size, so this patch just drops the original one that uses a fixed size for all drivers and implements a different DMA buffer size to each driver. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <b42378@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_asrc.c3
-rw-r--r--sound/soc/fsl/fsl_esai.c3
-rw-r--r--sound/soc/fsl/fsl_spdif.c3
-rw-r--r--sound/soc/fsl/fsl_ssi.c3
-rw-r--r--sound/soc/fsl/imx-pcm-dma.c22
-rw-r--r--sound/soc/fsl/imx-pcm.h4
-rw-r--r--sound/soc/fsl/imx-ssi.c3
7 files changed, 31 insertions, 10 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index d91484f236c9..1e9b9c35442e 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -449,7 +449,8 @@ static int fsl_asrc_p2p_probe(struct platform_device *pdev)
ret = imx_pcm_dma_init(asrc_p2p->soc_platform_pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
SND_DMAENGINE_PCM_FLAG_NO_DT |
- SND_DMAENGINE_PCM_FLAG_COMPAT);
+ SND_DMAENGINE_PCM_FLAG_COMPAT,
+ IMX_ASRC_DMABUF_SIZE);
if (ret) {
dev_err(&pdev->dev, "init pcm dma failed\n");
goto failed_pcm_init;
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index f2687ef1ffb5..221b4e49ed60 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -642,7 +642,8 @@ static int fsl_esai_probe(struct platform_device *pdev)
ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
SND_DMAENGINE_PCM_FLAG_NO_DT |
- SND_DMAENGINE_PCM_FLAG_COMPAT);
+ SND_DMAENGINE_PCM_FLAG_COMPAT,
+ IMX_ESAI_DMABUF_SIZE);
if (ret) {
dev_err(&pdev->dev, "init pcm dma failed\n");
goto failed_pcm_init;
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 44ae85a46876..bce6d0e18c5e 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1189,7 +1189,8 @@ static int fsl_spdif_probe(struct platform_device *pdev)
return ret;
}
- ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
+ ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE,
+ IMX_SPDIF_DMABUF_SIZE);
if (ret) {
dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret);
goto error_component;
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index aa0be19a05a2..928bbcbe598f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1010,7 +1010,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
}
if (ssi_private->ssi_on_imx) {
- ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
+ ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE,
+ IMX_SSI_DMABUF_SIZE);
if (ret)
goto error_dev;
}
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 3d083a41e767..33752da05482 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -120,10 +120,26 @@ static const struct snd_dmaengine_pcm_config imx_dmaengine_pcm_config = {
.prealloc_buffer_size = IMX_DEFAULT_DMABUF_SIZE,
};
-int imx_pcm_dma_init(struct platform_device *pdev, unsigned int flags)
+int imx_pcm_dma_init(struct platform_device *pdev, unsigned int flags, size_t size)
{
- return snd_dmaengine_pcm_register(&pdev->dev,
- &imx_dmaengine_pcm_config, flags);
+ struct snd_dmaengine_pcm_config *config;
+ struct snd_pcm_hardware *pcm_hardware;
+
+ config = devm_kzalloc(&pdev->dev,
+ sizeof(struct snd_dmaengine_pcm_config), GFP_KERNEL);
+ *config = imx_dmaengine_pcm_config;
+ if (size)
+ config->prealloc_buffer_size = size;
+
+ pcm_hardware = devm_kzalloc(&pdev->dev,
+ sizeof(struct snd_pcm_hardware), GFP_KERNEL);
+ *pcm_hardware = imx_pcm_hardware;
+ if (size)
+ pcm_hardware->buffer_bytes_max = size;
+
+ config->pcm_hardware = pcm_hardware;
+
+ return snd_dmaengine_pcm_register(&pdev->dev, config, flags);
}
EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index e8ff5afa8685..ee01836ad696 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -37,11 +37,11 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
}
#ifdef CONFIG_SND_SOC_IMX_PCM_DMA
-int imx_pcm_dma_init(struct platform_device *pdev, unsigned int flags);
+int imx_pcm_dma_init(struct platform_device *pdev, unsigned int flags, size_t size);
void imx_pcm_dma_exit(struct platform_device *pdev);
#else
static inline int imx_pcm_dma_init(struct platform_device *pdev,
- unsigned int flags)
+ unsigned int flags, size_t size)
{
return -ENODEV;
}
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 7b48ac264e8f..ab74902d381d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -596,7 +596,8 @@ static int imx_ssi_probe(struct platform_device *pdev)
ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
SND_DMAENGINE_PCM_FLAG_NO_DT |
- SND_DMAENGINE_PCM_FLAG_COMPAT);
+ SND_DMAENGINE_PCM_FLAG_COMPAT,
+ IMX_SSI_DMABUF_SIZE);
if (ret)
goto failed_pcm_dma;