]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: mxs: move to use generic DMA helper
authorShawn Guo <shawn.guo@linaro.org>
Mon, 13 May 2013 05:30:56 +0000 (13:30 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 13 May 2013 05:55:28 +0000 (09:55 +0400)
With mxs-dma converted to generic DMA bindings, let's move mxs-pcm to
use it by removing flages SND_DMAENGINE_PCM_FLAG_NO_DT and
SND_DMAENGINE_PCM_FLAG_COMPAT.  As the result, those mxs custom dma
params code can be removed now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Documentation/devicetree/bindings/sound/mxs-saif.txt
sound/soc/mxs/mxs-pcm.c
sound/soc/mxs/mxs-pcm.h
sound/soc/mxs/mxs-saif.c
sound/soc/mxs/mxs-saif.h

index c37ba6143d9b338cc9b80b66f1253f1939af9d2b..7ba07a118e370deb7ac43e72fb18b307aa4a33c5 100644 (file)
@@ -3,8 +3,11 @@
 Required properties:
 - compatible: Should be "fsl,<chip>-saif"
 - reg: Should contain registers location and length
-- interrupts: Should contain ERROR and DMA interrupts
-- fsl,saif-dma-channel: APBX DMA channel for the SAIF
+- interrupts: Should contain ERROR interrupt number
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SAIF DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "rx-tx".
 
 Optional properties:
 - fsl,saif-master: phandle to the master SAIF.  It's only required for
@@ -23,14 +26,16 @@ aliases {
 saif0: saif@80042000 {
        compatible = "fsl,imx28-saif";
        reg = <0x80042000 2000>;
-       interrupts = <59 80>;
-       fsl,saif-dma-channel = <4>;
+       interrupts = <59>;
+       dmas = <&dma_apbx 4>;
+       dma-names = "rx-tx";
 };
 
 saif1: saif@80046000 {
        compatible = "fsl,imx28-saif";
        reg = <0x80046000 2000>;
-       interrupts = <58 81>;
-       fsl,saif-dma-channel = <5>;
+       interrupts = <58>;
+       dmas = <&dma_apbx 5>;
+       dma-names = "rx-tx";
        fsl,saif-master = <&saif0>;
 };
index b41fffc056fbec0ec583256d3b336a9d3520b73f..b16abbbf7764beddd61d42514f70bd33338a7781 100644 (file)
@@ -49,24 +49,8 @@ static const struct snd_pcm_hardware snd_mxs_hardware = {
        .fifo_size              = 32,
 };
 
-static bool filter(struct dma_chan *chan, void *param)
-{
-       struct mxs_pcm_dma_params *dma_params = param;
-
-       if (!mxs_dma_is_apbx(chan))
-               return false;
-
-       if (chan->chan_id != dma_params->chan_num)
-               return false;
-
-       chan->private = &dma_params->dma_data;
-
-       return true;
-}
-
 static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = {
        .pcm_hardware = &snd_mxs_hardware,
-       .compat_filter_fn = filter,
        .prealloc_buffer_size = 64 * 1024,
 };
 
@@ -74,8 +58,6 @@ int mxs_pcm_platform_register(struct device *dev)
 {
        return snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config,
                SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-               SND_DMAENGINE_PCM_FLAG_NO_DT |
-               SND_DMAENGINE_PCM_FLAG_COMPAT |
                SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX);
 }
 EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
index 3aa918f9ed3eeff4d5c554ce8fe261eb4576aa33..bc685b67cac71e80c17657357c9eb388eac0ac2e 100644 (file)
 #ifndef _MXS_PCM_H
 #define _MXS_PCM_H
 
-#include <linux/fsl/mxs-dma.h>
-
-struct mxs_pcm_dma_params {
-       struct mxs_dma_data dma_data;
-       int chan_num;
-};
-
 int mxs_pcm_platform_register(struct device *dev);
 void mxs_pcm_platform_unregister(struct device *dev);
 
index 71a972f5af97cbad72a35b8cde35db993d3c65e1..49d870034bc34fa7061dd255d9c0f997614c0691 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/time.h>
-#include <linux/fsl/mxs-dma.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -604,8 +603,6 @@ static int mxs_saif_dai_probe(struct snd_soc_dai *dai)
        struct mxs_saif *saif = dev_get_drvdata(dai->dev);
 
        snd_soc_dai_set_drvdata(dai, saif);
-       dai->playback_dma_data = &saif->dma_param;
-       dai->capture_dma_data = &saif->dma_param;
 
        return 0;
 }
@@ -664,7 +661,7 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
 static int mxs_saif_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct resource *iores, *dmares;
+       struct resource *iores;
        struct mxs_saif *saif;
        int ret = 0;
        struct device_node *master;
@@ -719,22 +716,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
        if (IS_ERR(saif->base))
                return PTR_ERR(saif->base);
 
-       dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-       if (!dmares) {
-               /*
-                * TODO: This is a temporary solution and should be changed
-                * to use generic DMA binding later when the helplers get in.
-                */
-               ret = of_property_read_u32(np, "fsl,saif-dma-channel",
-                                          &saif->dma_param.chan_num);
-               if (ret) {
-                       dev_err(&pdev->dev, "failed to get dma channel\n");
-                       return ret;
-               }
-       } else {
-               saif->dma_param.chan_num = dmares->start;
-       }
-
        saif->irq = platform_get_irq(pdev, 0);
        if (saif->irq < 0) {
                ret = saif->irq;
@@ -751,14 +732,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
                return ret;
        }
 
-       saif->dma_param.dma_data.chan_irq = platform_get_irq(pdev, 1);
-       if (saif->dma_param.dma_data.chan_irq < 0) {
-               ret = saif->dma_param.dma_data.chan_irq;
-               dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
-                       ret);
-               return ret;
-       }
-
        platform_set_drvdata(pdev, saif);
 
        ret = snd_soc_register_component(&pdev->dev, &mxs_saif_component,
index 3cb342e5bc902b2c9b39eff62023015a43c7fe70..53eaa4bf0e2726b04c593d9c083895aece2becd6 100644 (file)
@@ -117,7 +117,6 @@ struct mxs_saif {
        unsigned int mclk_in_use;
        void __iomem *base;
        int irq;
-       struct mxs_pcm_dma_params dma_param;
        unsigned int id;
        unsigned int master_id;
        unsigned int cur_rate;