diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-04-03 05:06:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-05 06:25:47 -0400 |
commit | a8909c9bc5803fd68363c8b349bd76c99fc0569b (patch) | |
tree | 8744cc20bbb9456c9f0507af4571fb27cc0dd956 /sound/soc/fsl | |
parent | 3489d5067a2cd8c51a2649b2f39bfb5b11852b8d (diff) |
ASoC: fsl: Use common DAI DMA data struct
Use the common DAI DMA data struct for fsl/imx, this allows us to use the common
helper function to configure the DMA slave config based on the DAI DMA data.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 23 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma.c | 23 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-fiq.c | 4 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm.h | 16 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.c | 21 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.h | 7 |
6 files changed, 47 insertions, 47 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 2cce1ce1b7dd..8a7eac4bf651 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sound/pcm_params.h> | 27 | #include <sound/pcm_params.h> |
28 | #include <sound/initval.h> | 28 | #include <sound/initval.h> |
29 | #include <sound/soc.h> | 29 | #include <sound/soc.h> |
30 | #include <sound/dmaengine_pcm.h> | ||
30 | 31 | ||
31 | #include "fsl_ssi.h" | 32 | #include "fsl_ssi.h" |
32 | #include "imx-pcm.h" | 33 | #include "imx-pcm.h" |
@@ -122,8 +123,10 @@ struct fsl_ssi_private { | |||
122 | bool ssi_on_imx; | 123 | bool ssi_on_imx; |
123 | struct clk *clk; | 124 | struct clk *clk; |
124 | struct platform_device *imx_pcm_pdev; | 125 | struct platform_device *imx_pcm_pdev; |
125 | struct imx_pcm_dma_params dma_params_tx; | 126 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
126 | struct imx_pcm_dma_params dma_params_rx; | 127 | struct snd_dmaengine_dai_dma_data dma_params_rx; |
128 | struct imx_dma_data filter_data_tx; | ||
129 | struct imx_dma_data filter_data_rx; | ||
127 | 130 | ||
128 | struct { | 131 | struct { |
129 | unsigned int rfrc; | 132 | unsigned int rfrc; |
@@ -738,14 +741,18 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
738 | * We have burstsize be "fifo_depth - 2" to match the SSI | 741 | * We have burstsize be "fifo_depth - 2" to match the SSI |
739 | * watermark setting in fsl_ssi_startup(). | 742 | * watermark setting in fsl_ssi_startup(). |
740 | */ | 743 | */ |
741 | ssi_private->dma_params_tx.burstsize = | 744 | ssi_private->dma_params_tx.maxburst = |
742 | ssi_private->fifo_depth - 2; | 745 | ssi_private->fifo_depth - 2; |
743 | ssi_private->dma_params_rx.burstsize = | 746 | ssi_private->dma_params_rx.maxburst = |
744 | ssi_private->fifo_depth - 2; | 747 | ssi_private->fifo_depth - 2; |
745 | ssi_private->dma_params_tx.dma_addr = | 748 | ssi_private->dma_params_tx.addr = |
746 | ssi_private->ssi_phys + offsetof(struct ccsr_ssi, stx0); | 749 | ssi_private->ssi_phys + offsetof(struct ccsr_ssi, stx0); |
747 | ssi_private->dma_params_rx.dma_addr = | 750 | ssi_private->dma_params_rx.addr = |
748 | ssi_private->ssi_phys + offsetof(struct ccsr_ssi, srx0); | 751 | ssi_private->ssi_phys + offsetof(struct ccsr_ssi, srx0); |
752 | ssi_private->dma_params_tx.filter_data = | ||
753 | &ssi_private->filter_data_tx; | ||
754 | ssi_private->dma_params_rx.filter_data = | ||
755 | &ssi_private->filter_data_rx; | ||
749 | /* | 756 | /* |
750 | * TODO: This is a temporary solution and should be changed | 757 | * TODO: This is a temporary solution and should be changed |
751 | * to use generic DMA binding later when the helplers get in. | 758 | * to use generic DMA binding later when the helplers get in. |
@@ -760,9 +767,9 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
760 | shared = of_device_is_compatible(of_get_parent(np), | 767 | shared = of_device_is_compatible(of_get_parent(np), |
761 | "fsl,spba-bus"); | 768 | "fsl,spba-bus"); |
762 | 769 | ||
763 | imx_pcm_dma_params_init_data(&ssi_private->dma_params_tx, | 770 | imx_pcm_dma_params_init_data(&ssi_private->filter_data_tx, |
764 | dma_events[0], shared); | 771 | dma_events[0], shared); |
765 | imx_pcm_dma_params_init_data(&ssi_private->dma_params_rx, | 772 | imx_pcm_dma_params_init_data(&ssi_private->filter_data_rx, |
766 | dma_events[1], shared); | 773 | dma_events[1], shared); |
767 | } | 774 | } |
768 | 775 | ||
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 64af57336dbb..ee838c8a3b11 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c | |||
@@ -34,10 +34,12 @@ | |||
34 | 34 | ||
35 | static bool filter(struct dma_chan *chan, void *param) | 35 | static bool filter(struct dma_chan *chan, void *param) |
36 | { | 36 | { |
37 | struct snd_dmaengine_dai_dma_data *dma_data = param; | ||
38 | |||
37 | if (!imx_dma_is_general_purpose(chan)) | 39 | if (!imx_dma_is_general_purpose(chan)) |
38 | return false; | 40 | return false; |
39 | 41 | ||
40 | chan->private = param; | 42 | chan->private = dma_data->filter_data; |
41 | 43 | ||
42 | return true; | 44 | return true; |
43 | } | 45 | } |
@@ -47,23 +49,16 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
47 | { | 49 | { |
48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 50 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
49 | struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); | 51 | struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); |
50 | struct imx_pcm_dma_params *dma_params; | ||
51 | struct dma_slave_config slave_config; | 52 | struct dma_slave_config slave_config; |
52 | int ret; | 53 | int ret; |
53 | 54 | ||
54 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
55 | |||
56 | ret = snd_hwparams_to_dma_slave_config(substream, params, &slave_config); | 55 | ret = snd_hwparams_to_dma_slave_config(substream, params, &slave_config); |
57 | if (ret) | 56 | if (ret) |
58 | return ret; | 57 | return ret; |
59 | 58 | ||
60 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 59 | snd_dmaengine_pcm_set_config_from_dai_data(substream, |
61 | slave_config.dst_addr = dma_params->dma_addr; | 60 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream), |
62 | slave_config.dst_maxburst = dma_params->burstsize; | 61 | &slave_config); |
63 | } else { | ||
64 | slave_config.src_addr = dma_params->dma_addr; | ||
65 | slave_config.src_maxburst = dma_params->burstsize; | ||
66 | } | ||
67 | 62 | ||
68 | ret = dmaengine_slave_config(chan, &slave_config); | 63 | ret = dmaengine_slave_config(chan, &slave_config); |
69 | if (ret) | 64 | if (ret) |
@@ -96,13 +91,11 @@ static struct snd_pcm_hardware snd_imx_hardware = { | |||
96 | static int snd_imx_open(struct snd_pcm_substream *substream) | 91 | static int snd_imx_open(struct snd_pcm_substream *substream) |
97 | { | 92 | { |
98 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 93 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
99 | struct imx_pcm_dma_params *dma_params; | ||
100 | 94 | ||
101 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); | 95 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); |
102 | 96 | ||
103 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 97 | return snd_dmaengine_pcm_open(substream, filter, |
104 | 98 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream)); | |
105 | return snd_dmaengine_pcm_open(substream, filter, &dma_params->dma_data); | ||
106 | } | 99 | } |
107 | 100 | ||
108 | static struct snd_pcm_ops imx_pcm_ops = { | 101 | static struct snd_pcm_ops imx_pcm_ops = { |
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c index 920f945cb2f4..025d0d9494f4 100644 --- a/sound/soc/fsl/imx-pcm-fiq.c +++ b/sound/soc/fsl/imx-pcm-fiq.c | |||
@@ -299,8 +299,8 @@ int imx_pcm_fiq_init(struct platform_device *pdev) | |||
299 | 299 | ||
300 | imx_ssi_fiq_base = (unsigned long)ssi->base; | 300 | imx_ssi_fiq_base = (unsigned long)ssi->base; |
301 | 301 | ||
302 | ssi->dma_params_tx.burstsize = 4; | 302 | ssi->dma_params_tx.maxburst = 4; |
303 | ssi->dma_params_rx.burstsize = 6; | 303 | ssi->dma_params_rx.maxburst = 6; |
304 | 304 | ||
305 | ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); | 305 | ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); |
306 | if (ret) | 306 | if (ret) |
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h index 16eaf5a09f53..be9cc64a208b 100644 --- a/sound/soc/fsl/imx-pcm.h +++ b/sound/soc/fsl/imx-pcm.h | |||
@@ -20,22 +20,16 @@ | |||
20 | */ | 20 | */ |
21 | #define IMX_SSI_DMABUF_SIZE (64 * 1024) | 21 | #define IMX_SSI_DMABUF_SIZE (64 * 1024) |
22 | 22 | ||
23 | struct imx_pcm_dma_params { | ||
24 | unsigned long dma_addr; | ||
25 | int burstsize; | ||
26 | struct imx_dma_data dma_data; | ||
27 | }; | ||
28 | |||
29 | static inline void | 23 | static inline void |
30 | imx_pcm_dma_params_init_data(struct imx_pcm_dma_params *params, | 24 | imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data, |
31 | int dma, bool shared) | 25 | int dma, bool shared) |
32 | { | 26 | { |
33 | params->dma_data.dma_request = dma; | 27 | dma_data->dma_request = dma; |
34 | params->dma_data.priority = DMA_PRIO_HIGH; | 28 | dma_data->priority = DMA_PRIO_HIGH; |
35 | if (shared) | 29 | if (shared) |
36 | params->dma_data.peripheral_type = IMX_DMATYPE_SSI_SP; | 30 | dma_data->peripheral_type = IMX_DMATYPE_SSI_SP; |
37 | else | 31 | else |
38 | params->dma_data.peripheral_type = IMX_DMATYPE_SSI; | 32 | dma_data->peripheral_type = IMX_DMATYPE_SSI; |
39 | } | 33 | } |
40 | 34 | ||
41 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | 35 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index 14018c4628ec..dce05b613bd3 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -236,7 +236,7 @@ static int imx_ssi_startup(struct snd_pcm_substream *substream, | |||
236 | struct snd_soc_dai *cpu_dai) | 236 | struct snd_soc_dai *cpu_dai) |
237 | { | 237 | { |
238 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); | 238 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
239 | struct imx_pcm_dma_params *dma_data; | 239 | struct snd_dmaengine_dai_dma_data *dma_data; |
240 | 240 | ||
241 | /* Tx/Rx config */ | 241 | /* Tx/Rx config */ |
242 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 242 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -369,8 +369,8 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | |||
369 | 369 | ||
370 | snd_soc_dai_set_drvdata(dai, ssi); | 370 | snd_soc_dai_set_drvdata(dai, ssi); |
371 | 371 | ||
372 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | 372 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.maxburst) | |
373 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | 373 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.maxburst); |
374 | writel(val, ssi->base + SSI_SFCSR); | 374 | writel(val, ssi->base + SSI_SFCSR); |
375 | 375 | ||
376 | return 0; | 376 | return 0; |
@@ -570,21 +570,24 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
570 | 570 | ||
571 | writel(0x0, ssi->base + SSI_SIER); | 571 | writel(0x0, ssi->base + SSI_SIER); |
572 | 572 | ||
573 | ssi->dma_params_rx.dma_addr = res->start + SSI_SRX0; | 573 | ssi->dma_params_rx.addr = res->start + SSI_SRX0; |
574 | ssi->dma_params_tx.dma_addr = res->start + SSI_STX0; | 574 | ssi->dma_params_tx.addr = res->start + SSI_STX0; |
575 | 575 | ||
576 | ssi->dma_params_tx.burstsize = 6; | 576 | ssi->dma_params_tx.maxburst = 6; |
577 | ssi->dma_params_rx.burstsize = 4; | 577 | ssi->dma_params_rx.maxburst = 4; |
578 | |||
579 | ssi->dma_params_tx.filter_data = &ssi->filter_data_tx; | ||
580 | ssi->dma_params_rx.filter_data = &ssi->filter_data_rx; | ||
578 | 581 | ||
579 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0"); | 582 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0"); |
580 | if (res) { | 583 | if (res) { |
581 | imx_pcm_dma_params_init_data(&ssi->dma_params_tx, res->start, | 584 | imx_pcm_dma_params_init_data(&ssi->filter_data_tx, res->start, |
582 | false); | 585 | false); |
583 | } | 586 | } |
584 | 587 | ||
585 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0"); | 588 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0"); |
586 | if (res) { | 589 | if (res) { |
587 | imx_pcm_dma_params_init_data(&ssi->dma_params_rx, res->start, | 590 | imx_pcm_dma_params_init_data(&ssi->filter_data_rx, res->start, |
588 | false); | 591 | false); |
589 | } | 592 | } |
590 | 593 | ||
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h index dc114bdedce5..bb6b3dbb13fd 100644 --- a/sound/soc/fsl/imx-ssi.h +++ b/sound/soc/fsl/imx-ssi.h | |||
@@ -187,6 +187,7 @@ | |||
187 | 187 | ||
188 | #include <linux/dmaengine.h> | 188 | #include <linux/dmaengine.h> |
189 | #include <linux/platform_data/dma-imx.h> | 189 | #include <linux/platform_data/dma-imx.h> |
190 | #include <sound/dmaengine_pcm.h> | ||
190 | #include "imx-pcm.h" | 191 | #include "imx-pcm.h" |
191 | 192 | ||
192 | struct imx_ssi { | 193 | struct imx_ssi { |
@@ -204,8 +205,10 @@ struct imx_ssi { | |||
204 | void (*ac97_reset) (struct snd_ac97 *ac97); | 205 | void (*ac97_reset) (struct snd_ac97 *ac97); |
205 | void (*ac97_warm_reset)(struct snd_ac97 *ac97); | 206 | void (*ac97_warm_reset)(struct snd_ac97 *ac97); |
206 | 207 | ||
207 | struct imx_pcm_dma_params dma_params_rx; | 208 | struct snd_dmaengine_dai_dma_data dma_params_rx; |
208 | struct imx_pcm_dma_params dma_params_tx; | 209 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
210 | struct imx_dma_data filter_data_tx; | ||
211 | struct imx_dma_data filter_data_rx; | ||
209 | 212 | ||
210 | int enabled; | 213 | int enabled; |
211 | 214 | ||