MLK-11179 ASoC: fsl: implement specify audio DMA buffer size from devicetree
authorZidan Wang <zidan.wang@freescale.com>
Fri, 26 Jun 2015 08:06:45 +0000 (16:06 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:07 +0000 (14:48 -0500)
If the property "fsl,dma-buffer-size" is present, using the specified buffer size.
Otherwise, using the default audio buffer size.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit bba153dd92a4f58b81c4c26fb3a95c45445c65e0)

Documentation/devicetree/bindings/sound/fsl,esai.txt
Documentation/devicetree/bindings/sound/fsl,spdif.txt
Documentation/devicetree/bindings/sound/fsl,ssi.txt
sound/soc/fsl/fsl_esai.c
sound/soc/fsl/fsl_sai.c
sound/soc/fsl/fsl_spdif.c
sound/soc/fsl/fsl_ssi.c

index cd3ee5d..733c0a6 100644 (file)
@@ -46,6 +46,10 @@ Required properties:
                          will be in use as default, or the big endian mode
                          will be in use for all the device registers.
 
+  - fsl,dma-buffer-size: It specify the audio buffer size of playback and
+    capture. If this property is absent, using the default value of audio buffer
+    size.
+
 Example:
 
 esai: esai@02024000 {
index 4ca39dd..58b966b 100644 (file)
@@ -37,6 +37,10 @@ Required properties:
                          will be in use as default, or the big endian mode
                          will be in use for all the device registers.
 
+   - fsl,dma-buffer-size: It specify the audio buffer size of playback and
+   capture. If this property is absent, using the default value of audio buffer
+   size.
+
 Example:
 
 spdif: spdif@02004000 {
index 5b76be4..3ad1096 100644 (file)
@@ -62,6 +62,10 @@ Optional properties:
                     "ac97-slave" - AC97 mode, SSI is clock slave
                     "ac97-master" - AC97 mode, SSI is clock master
 
+- fsl,dma-buffer-size: It specify the audio buffer size of playback and
+  capture. If this property is absent, using the default value of audio buffer
+  size.
+
 Child 'codec' node required properties:
 - compatible:       Compatible list, contains the name of the codec
 
index 38bfd46..acfe15b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Freescale ESAI ALSA SoC Digital Audio Interface (DAI) driver
  *
- * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2. This program is licensed "as is" without any warranty of any
@@ -792,6 +792,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
        const uint32_t *iprop;
        void __iomem *regs;
        int irq, ret;
+       u32 buffer_size;
 
        esai_priv = devm_kzalloc(&pdev->dev, sizeof(*esai_priv), GFP_KERNEL);
        if (!esai_priv)
@@ -903,7 +904,10 @@ static int fsl_esai_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = imx_pcm_dma_init(pdev, IMX_ESAI_DMABUF_SIZE);
+       if (of_property_read_u32(np, "fsl,dma-buffer-size", &buffer_size))
+               buffer_size = IMX_ESAI_DMABUF_SIZE;
+
+       ret = imx_pcm_dma_init(pdev, buffer_size);
        if (ret)
                dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret);
 
index c3d0298..e58029f 100644 (file)
@@ -808,6 +808,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
        char tmp[8];
        int irq, ret, i;
        int index;
+       u32 buffer_size;
 
        sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
        if (!sai)
@@ -924,8 +925,11 @@ static int fsl_sai_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
+       if (of_property_read_u32(np, "fsl,dma-buffer-size", &buffer_size))
+               buffer_size = IMX_SAI_DMABUF_SIZE;
+
        if (sai->sai_on_imx)
-               return imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE);
+               return imx_pcm_dma_init(pdev, buffer_size);
        else
                return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
 }
index 1ff467c..22964a2 100644 (file)
@@ -1222,6 +1222,7 @@ static int fsl_spdif_probe(struct platform_device *pdev)
        struct resource *res;
        void __iomem *regs;
        int irq, ret, i;
+       u32 buffer_size;
 
        if (!np)
                return -ENODEV;
@@ -1323,7 +1324,10 @@ static int fsl_spdif_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = imx_pcm_dma_init(pdev, IMX_SPDIF_DMABUF_SIZE);
+       if (of_property_read_u32(np, "fsl,dma-buffer-size", &buffer_size))
+               buffer_size = IMX_SPDIF_DMABUF_SIZE;
+
+       ret = imx_pcm_dma_init(pdev, buffer_size);
        if (ret)
                dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret);
 
index 1c03490..4b7a006 100644 (file)
@@ -1341,6 +1341,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
        struct device_node *np = pdev->dev.of_node;
        u32 dmas[4];
        int ret;
+       u32 buffer_size;
 
        if (ssi_private->has_ipg_clk_name)
                ssi_private->clk = devm_clk_get(&pdev->dev, "ipg");
@@ -1383,6 +1384,9 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
                ssi_private->dma_params_rx.maxburst &= ~0x1;
        }
 
+       if (of_property_read_u32(np, "fsl,dma-buffer-size", &buffer_size))
+               buffer_size = IMX_SSI_DMABUF_SIZE;
+
        if (!ssi_private->use_dma) {
 
                /*
@@ -1403,7 +1407,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
                if (ret)
                        goto error_pcm;
        } else {
-               ret = imx_pcm_dma_init(pdev, IMX_SSI_DMABUF_SIZE);
+               ret = imx_pcm_dma_init(pdev, buffer_size);
                if (ret)
                        goto error_pcm;
        }