diff options
author | Zidan Wang <zidan.wang@freescale.com> | 2015-06-26 16:06:45 +0800 |
---|---|---|
committer | Zidan Wang <zidan.wang@freescale.com> | 2015-06-30 09:55:09 +0800 |
commit | bba153dd92a4f58b81c4c26fb3a95c45445c65e0 (patch) | |
tree | 9ca145ef796b8acf89332831e16cae949a5e0aee | |
parent | 57e83e13bf3e11d78447f3b524bdff99cd72364f (diff) |
MLK-11179 ASoC: fsl: implement specify audio DMA buffer size from devicetree
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>
-rw-r--r-- | Documentation/devicetree/bindings/sound/fsl,esai.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/sound/fsl,spdif.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/sound/fsl,ssi.txt | 4 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_esai.c | 8 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 6 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_spdif.c | 6 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 6 |
7 files changed, 33 insertions, 5 deletions
diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt b/Documentation/devicetree/bindings/sound/fsl,esai.txt index aeb8c4a0b88d..e156a049c90b 100644 --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt @@ -38,6 +38,10 @@ Required properties: 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 { diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt index 3e9e82c8eab3..f03014cca972 100644 --- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt +++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt @@ -33,6 +33,10 @@ Required properties: 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 { diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt b/Documentation/devicetree/bindings/sound/fsl,ssi.txt index b93e9a91e30e..5c47860419ba 100644 --- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt +++ b/Documentation/devicetree/bindings/sound/fsl,ssi.txt @@ -65,6 +65,10 @@ Optional properties: - dma-names: Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq is not defined. +- 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 diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index bffec8bd6e4a..57341bd92e74 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -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 @@ -875,6 +875,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) @@ -999,7 +1000,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); diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 78c8fbfd65ea..50c2b3c1695d 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -727,6 +727,7 @@ static int fsl_sai_probe(struct platform_device *pdev) void __iomem *base; char tmp[8]; int irq, ret, i; + u32 buffer_size; sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); if (!sai) @@ -833,8 +834,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, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE); diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 3b31f4a5c9a2..eaff4cc082aa 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1191,6 +1191,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; @@ -1304,7 +1305,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); diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 08feebff20d1..39aff7ec6f63 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1259,6 +1259,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"); @@ -1305,6 +1306,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) { /* @@ -1325,7 +1329,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; } |