Browse Source

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>
(cherry picked from commit d2589c6bcd)
isee-imx_3.14.28.y
Nicolin Chen 7 years ago
committed by Nitin Garg
parent
commit
1f865021bb
7 changed files with 28 additions and 10 deletions
  1. +1
    -1
      sound/soc/fsl/fsl_esai.c
  2. +2
    -2
      sound/soc/fsl/fsl_sai.c
  3. +1
    -1
      sound/soc/fsl/fsl_spdif.c
  4. +1
    -1
      sound/soc/fsl/fsl_ssi.c
  5. +19
    -2
      sound/soc/fsl/imx-pcm-dma.c
  6. +3
    -2
      sound/soc/fsl/imx-pcm.h
  7. +1
    -1
      sound/soc/fsl/imx-ssi.c

+ 1
- 1
sound/soc/fsl/fsl_esai.c View File

@ -853,7 +853,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
return ret;
}
ret = imx_pcm_dma_init(pdev);
ret = imx_pcm_dma_init(pdev, IMX_ESAI_DMABUF_SIZE);
if (ret)
dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret);


+ 2
- 2
sound/soc/fsl/fsl_sai.c View File

@ -1,7 +1,7 @@
/*
* Freescale ALSA SoC Digital Audio Interface (SAI) driver.
*
* Copyright 2012-2013 Freescale Semiconductor, Inc.
* Copyright 2012-2014 Freescale Semiconductor, Inc.
*
* This program is free software, you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -634,7 +634,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
return ret;
if (sai->sai_on_imx)
return imx_pcm_dma_init(pdev);
return imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE);
else
return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);


+ 1
- 1
sound/soc/fsl/fsl_spdif.c View File

@ -1273,7 +1273,7 @@ static int fsl_spdif_probe(struct platform_device *pdev)
return ret;
}
ret = imx_pcm_dma_init(pdev);
ret = imx_pcm_dma_init(pdev, IMX_SPDIF_DMABUF_SIZE);
if (ret)
dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret);


+ 1
- 1
sound/soc/fsl/fsl_ssi.c View File

@ -1238,7 +1238,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
if (ret)
goto error_pcm;
} else {
ret = imx_pcm_dma_init(pdev);
ret = imx_pcm_dma_init(pdev, IMX_SSI_DMABUF_SIZE);
if (ret)
goto error_pcm;
}


+ 19
- 2
sound/soc/fsl/imx-pcm-dma.c View File

@ -55,10 +55,27 @@ 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)
int imx_pcm_dma_init(struct platform_device *pdev, size_t size)
{
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 devm_snd_dmaengine_pcm_register(&pdev->dev,
&imx_dmaengine_pcm_config,
config,
SND_DMAENGINE_PCM_FLAG_COMPAT);
}
EXPORT_SYMBOL_GPL(imx_pcm_dma_init);


+ 3
- 2
sound/soc/fsl/imx-pcm.h View File

@ -20,6 +20,7 @@
*/
#define IMX_DEFAULT_DMABUF_SIZE (256 * 1024)
#define IMX_SSI_DMABUF_SIZE (64 * 1024)
#define IMX_SAI_DMABUF_SIZE (64 * 1024)
#define IMX_SPDIF_DMABUF_SIZE (64 * 1024)
#define IMX_ESAI_DMABUF_SIZE (256 * 1024)
#define IMX_ASRC_DMABUF_SIZE (256 * 1024)
@ -43,9 +44,9 @@ struct imx_pcm_fiq_params {
};
#if IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA)
int imx_pcm_dma_init(struct platform_device *pdev);
int imx_pcm_dma_init(struct platform_device *pdev, size_t size);
#else
static inline int imx_pcm_dma_init(struct platform_device *pdev)
static inline int imx_pcm_dma_init(struct platform_device *pdev, size_t size)
{
return -ENODEV;
}


+ 1
- 1
sound/soc/fsl/imx-ssi.c View File

@ -602,7 +602,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
ssi->fiq_init = imx_pcm_fiq_init(pdev, &ssi->fiq_params);
ssi->dma_init = imx_pcm_dma_init(pdev);
ssi->dma_init = imx_pcm_dma_init(pdev, IMX_SSI_DMABUF_SIZE);
if (ssi->fiq_init && ssi->dma_init) {
ret = ssi->fiq_init;


Loading…
Cancel
Save