aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/ux500
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-12-19 10:55:05 -0500
committerMark Brown <broonie@linaro.org>2014-01-07 10:37:20 -0500
commitf382acbe163a6faebd7cafe57800306970e241d4 (patch)
tree1a13e7b4404c94800799ce101ca25c5d7fbe9ae5 /sound/soc/ux500
parent05c56c24137273de3460872b6121a2bd762d11e8 (diff)
ASoC: ux500: Store DMA data in the DAI differently in the pdata and DT case
In this patch we do two things. Firstly, instead of open coding the store of DMA data in to the DAI for later use, we use the API provided. Secondly we create and store similar DMA data for the DT case, only this time we use 'struct snd_dmaengine_dai_dma_data' which is provided by the core for this very reason. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index bc042cce115f..f4d607a72668 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -17,12 +17,14 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/of.h>
20#include <linux/regulator/consumer.h> 21#include <linux/regulator/consumer.h>
21#include <linux/mfd/dbx500-prcmu.h> 22#include <linux/mfd/dbx500-prcmu.h>
22#include <linux/platform_data/asoc-ux500-msp.h> 23#include <linux/platform_data/asoc-ux500-msp.h>
23 24
24#include <sound/soc.h> 25#include <sound/soc.h>
25#include <sound/soc-dai.h> 26#include <sound/soc-dai.h>
27#include <sound/dmaengine_pcm.h>
26 28
27#include "ux500_msp_i2s.h" 29#include "ux500_msp_i2s.h"
28#include "ux500_msp_dai.h" 30#include "ux500_msp_dai.h"
@@ -654,16 +656,52 @@ static int ux500_msp_dai_trigger(struct snd_pcm_substream *substream,
654 return ret; 656 return ret;
655} 657}
656 658
659static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai)
660{
661 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev);
662 struct snd_dmaengine_dai_dma_data *playback_dma_data;
663 struct snd_dmaengine_dai_dma_data *capture_dma_data;
664
665 playback_dma_data = devm_kzalloc(dai->dev,
666 sizeof(*playback_dma_data),
667 GFP_KERNEL);
668 if (!playback_dma_data)
669 return -ENOMEM;
670
671 capture_dma_data = devm_kzalloc(dai->dev,
672 sizeof(*capture_dma_data),
673 GFP_KERNEL);
674 if (!capture_dma_data)
675 return -ENOMEM;
676
677 playback_dma_data->addr = drvdata->msp->playback_dma_data.tx_rx_addr;
678 capture_dma_data->addr = drvdata->msp->capture_dma_data.tx_rx_addr;
679
680 playback_dma_data->maxburst = 4;
681 capture_dma_data->maxburst = 4;
682
683 snd_soc_dai_init_dma_data(dai, playback_dma_data, capture_dma_data);
684
685 return 0;
686}
687
657static int ux500_msp_dai_probe(struct snd_soc_dai *dai) 688static int ux500_msp_dai_probe(struct snd_soc_dai *dai)
658{ 689{
659 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); 690 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev);
691 struct msp_i2s_platform_data *pdata = dai->dev->platform_data;
692 int ret;
660 693
661 dai->playback_dma_data = &drvdata->msp->playback_dma_data; 694 if (!pdata) {
662 dai->capture_dma_data = &drvdata->msp->capture_dma_data; 695 ret = ux500_msp_dai_of_probe(dai);
696 return ret;
697 }
663 698
664 drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; 699 drvdata->msp->playback_dma_data.data_size = drvdata->slot_width;
665 drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; 700 drvdata->msp->capture_dma_data.data_size = drvdata->slot_width;
666 701
702 snd_soc_dai_init_dma_data(dai,
703 &drvdata->msp->playback_dma_data,
704 &drvdata->msp->capture_dma_data);
667 return 0; 705 return 0;
668} 706}
669 707