Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: mxs: move to use generic DMA helper

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>

authored by

Shawn Guo and committed by
Mark Brown
62477adf e76af6d1

+12 -60
+11 -6
Documentation/devicetree/bindings/sound/mxs-saif.txt
··· 3 3 Required properties: 4 4 - compatible: Should be "fsl,<chip>-saif" 5 5 - reg: Should contain registers location and length 6 - - interrupts: Should contain ERROR and DMA interrupts 7 - - fsl,saif-dma-channel: APBX DMA channel for the SAIF 6 + - interrupts: Should contain ERROR interrupt number 7 + - dmas: DMA specifier, consisting of a phandle to DMA controller node 8 + and SAIF DMA channel ID. 9 + Refer to dma.txt and fsl-mxs-dma.txt for details. 10 + - dma-names: Must be "rx-tx". 8 11 9 12 Optional properties: 10 13 - fsl,saif-master: phandle to the master SAIF. It's only required for ··· 26 23 saif0: saif@80042000 { 27 24 compatible = "fsl,imx28-saif"; 28 25 reg = <0x80042000 2000>; 29 - interrupts = <59 80>; 30 - fsl,saif-dma-channel = <4>; 26 + interrupts = <59>; 27 + dmas = <&dma_apbx 4>; 28 + dma-names = "rx-tx"; 31 29 }; 32 30 33 31 saif1: saif@80046000 { 34 32 compatible = "fsl,imx28-saif"; 35 33 reg = <0x80046000 2000>; 36 - interrupts = <58 81>; 37 - fsl,saif-dma-channel = <5>; 34 + interrupts = <58>; 35 + dmas = <&dma_apbx 5>; 36 + dma-names = "rx-tx"; 38 37 fsl,saif-master = <&saif0>; 39 38 };
-18
sound/soc/mxs/mxs-pcm.c
··· 49 49 .fifo_size = 32, 50 50 }; 51 51 52 - static bool filter(struct dma_chan *chan, void *param) 53 - { 54 - struct mxs_pcm_dma_params *dma_params = param; 55 - 56 - if (!mxs_dma_is_apbx(chan)) 57 - return false; 58 - 59 - if (chan->chan_id != dma_params->chan_num) 60 - return false; 61 - 62 - chan->private = &dma_params->dma_data; 63 - 64 - return true; 65 - } 66 - 67 52 static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = { 68 53 .pcm_hardware = &snd_mxs_hardware, 69 - .compat_filter_fn = filter, 70 54 .prealloc_buffer_size = 64 * 1024, 71 55 }; 72 56 ··· 58 74 { 59 75 return snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config, 60 76 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | 61 - SND_DMAENGINE_PCM_FLAG_NO_DT | 62 - SND_DMAENGINE_PCM_FLAG_COMPAT | 63 77 SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX); 64 78 } 65 79 EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
-7
sound/soc/mxs/mxs-pcm.h
··· 19 19 #ifndef _MXS_PCM_H 20 20 #define _MXS_PCM_H 21 21 22 - #include <linux/fsl/mxs-dma.h> 23 - 24 - struct mxs_pcm_dma_params { 25 - struct mxs_dma_data dma_data; 26 - int chan_num; 27 - }; 28 - 29 22 int mxs_pcm_platform_register(struct device *dev); 30 23 void mxs_pcm_platform_unregister(struct device *dev); 31 24
+1 -28
sound/soc/mxs/mxs-saif.c
··· 26 26 #include <linux/clk.h> 27 27 #include <linux/delay.h> 28 28 #include <linux/time.h> 29 - #include <linux/fsl/mxs-dma.h> 30 29 #include <sound/core.h> 31 30 #include <sound/pcm.h> 32 31 #include <sound/pcm_params.h> ··· 603 604 struct mxs_saif *saif = dev_get_drvdata(dai->dev); 604 605 605 606 snd_soc_dai_set_drvdata(dai, saif); 606 - dai->playback_dma_data = &saif->dma_param; 607 - dai->capture_dma_data = &saif->dma_param; 608 607 609 608 return 0; 610 609 } ··· 661 664 static int mxs_saif_probe(struct platform_device *pdev) 662 665 { 663 666 struct device_node *np = pdev->dev.of_node; 664 - struct resource *iores, *dmares; 667 + struct resource *iores; 665 668 struct mxs_saif *saif; 666 669 int ret = 0; 667 670 struct device_node *master; ··· 716 719 if (IS_ERR(saif->base)) 717 720 return PTR_ERR(saif->base); 718 721 719 - dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 720 - if (!dmares) { 721 - /* 722 - * TODO: This is a temporary solution and should be changed 723 - * to use generic DMA binding later when the helplers get in. 724 - */ 725 - ret = of_property_read_u32(np, "fsl,saif-dma-channel", 726 - &saif->dma_param.chan_num); 727 - if (ret) { 728 - dev_err(&pdev->dev, "failed to get dma channel\n"); 729 - return ret; 730 - } 731 - } else { 732 - saif->dma_param.chan_num = dmares->start; 733 - } 734 - 735 722 saif->irq = platform_get_irq(pdev, 0); 736 723 if (saif->irq < 0) { 737 724 ret = saif->irq; ··· 729 748 "mxs-saif", saif); 730 749 if (ret) { 731 750 dev_err(&pdev->dev, "failed to request irq\n"); 732 - return ret; 733 - } 734 - 735 - saif->dma_param.dma_data.chan_irq = platform_get_irq(pdev, 1); 736 - if (saif->dma_param.dma_data.chan_irq < 0) { 737 - ret = saif->dma_param.dma_data.chan_irq; 738 - dev_err(&pdev->dev, "failed to get dma irq resource: %d\n", 739 - ret); 740 751 return ret; 741 752 } 742 753
-1
sound/soc/mxs/mxs-saif.h
··· 117 117 unsigned int mclk_in_use; 118 118 void __iomem *base; 119 119 int irq; 120 - struct mxs_pcm_dma_params dma_param; 121 120 unsigned int id; 122 121 unsigned int master_id; 123 122 unsigned int cur_rate;