aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-08-12 04:42:39 -0400
committerMark Brown <broonie@linaro.org>2013-08-15 06:29:07 -0400
commitd65a14587a9be853a887a1407db133df1fb68e29 (patch)
tree97e31a61fe5c8d567ccb4c6f97c5eaf95fe700ce
parent2023c90c3a2c4c1aeb7f47649367d551c676da07 (diff)
ASoC: pxa: use snd_dmaengine_dai_dma_data
Use snd_dmaengine_dai_dma_data for passing the dma parameters from clients to the pxa pcm lib. This does no functional change, it's just an intermedia step to migrate the pxa bits over to dmaengine. The calculation of dcmd is a transition hack which will be removed again in a later patch. It's just there to make the transition more readable. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/pxa2xx-lib.h7
-rw-r--r--sound/arm/pxa2xx-ac97.c26
-rw-r--r--sound/arm/pxa2xx-pcm-lib.c52
-rw-r--r--sound/arm/pxa2xx-pcm.c5
-rw-r--r--sound/arm/pxa2xx-pcm.h6
-rw-r--r--sound/soc/pxa/mmp-pcm.c8
-rw-r--r--sound/soc/pxa/mmp-sspa.c12
-rw-r--r--sound/soc/pxa/pxa-ssp.c36
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c67
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c28
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c8
11 files changed, 142 insertions, 113 deletions
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
index 2fd3d251d9a5..56e818e4a1cb 100644
--- a/include/sound/pxa2xx-lib.h
+++ b/include/sound/pxa2xx-lib.h
@@ -6,13 +6,6 @@
6 6
7/* PCM */ 7/* PCM */
8 8
9struct pxa2xx_pcm_dma_params {
10 char *name; /* stream identifier */
11 u32 dcmd; /* DMA descriptor dcmd field */
12 volatile u32 *drcmr; /* the DMA request channel to use */
13 u32 dev_addr; /* device physical address for DMA */
14};
15
16extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, 9extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
17 struct snd_pcm_hw_params *params); 10 struct snd_pcm_hw_params *params);
18extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); 11extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index ce431e6e07cf..5066a3768b28 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -14,12 +14,14 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/dmaengine.h>
17 18
18#include <sound/core.h> 19#include <sound/core.h>
19#include <sound/pcm.h> 20#include <sound/pcm.h>
20#include <sound/ac97_codec.h> 21#include <sound/ac97_codec.h>
21#include <sound/initval.h> 22#include <sound/initval.h>
22#include <sound/pxa2xx-lib.h> 23#include <sound/pxa2xx-lib.h>
24#include <sound/dmaengine_pcm.h>
23 25
24#include <mach/regs-ac97.h> 26#include <mach/regs-ac97.h>
25#include <mach/audio.h> 27#include <mach/audio.h>
@@ -41,20 +43,20 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
41 .reset = pxa2xx_ac97_reset, 43 .reset = pxa2xx_ac97_reset,
42}; 44};
43 45
44static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { 46static unsigned long pxa2xx_ac97_pcm_out_req = 12;
45 .name = "AC97 PCM out", 47static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = {
46 .dev_addr = __PREG(PCDR), 48 .addr = __PREG(PCDR),
47 .drcmr = &DRCMR(12), 49 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
48 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 50 .maxburst = 32,
49 DCMD_BURST32 | DCMD_WIDTH4, 51 .filter_data = &pxa2xx_ac97_pcm_out_req,
50}; 52};
51 53
52static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { 54static unsigned long pxa2xx_ac97_pcm_in_req = 11;
53 .name = "AC97 PCM in", 55static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = {
54 .dev_addr = __PREG(PCDR), 56 .addr = __PREG(PCDR),
55 .drcmr = &DRCMR(11), 57 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
56 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 58 .maxburst = 32,
57 DCMD_BURST32 | DCMD_WIDTH4, 59 .filter_data = &pxa2xx_ac97_pcm_in_req,
58}; 60};
59 61
60static struct snd_pcm *pxa2xx_ac97_pcm; 62static struct snd_pcm *pxa2xx_ac97_pcm;
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c
index 823359ed95e1..a61d7a9a995e 100644
--- a/sound/arm/pxa2xx-pcm-lib.c
+++ b/sound/arm/pxa2xx-pcm-lib.c
@@ -7,11 +7,13 @@
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <linux/dmaengine.h>
10 11
11#include <sound/core.h> 12#include <sound/core.h>
12#include <sound/pcm.h> 13#include <sound/pcm.h>
13#include <sound/pcm_params.h> 14#include <sound/pcm_params.h>
14#include <sound/pxa2xx-lib.h> 15#include <sound/pxa2xx-lib.h>
16#include <sound/dmaengine_pcm.h>
15 17
16#include <mach/dma.h> 18#include <mach/dma.h>
17 19
@@ -43,6 +45,35 @@ int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
43 size_t period = params_period_bytes(params); 45 size_t period = params_period_bytes(params);
44 pxa_dma_desc *dma_desc; 46 pxa_dma_desc *dma_desc;
45 dma_addr_t dma_buff_phys, next_desc_phys; 47 dma_addr_t dma_buff_phys, next_desc_phys;
48 u32 dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG;
49
50 /* temporary transition hack */
51 switch (rtd->params->addr_width) {
52 case DMA_SLAVE_BUSWIDTH_1_BYTE:
53 dcmd |= DCMD_WIDTH1;
54 break;
55 case DMA_SLAVE_BUSWIDTH_2_BYTES:
56 dcmd |= DCMD_WIDTH2;
57 break;
58 case DMA_SLAVE_BUSWIDTH_4_BYTES:
59 dcmd |= DCMD_WIDTH4;
60 break;
61 default:
62 /* can't happen */
63 break;
64 }
65
66 switch (rtd->params->maxburst) {
67 case 8:
68 dcmd |= DCMD_BURST8;
69 break;
70 case 16:
71 dcmd |= DCMD_BURST16;
72 break;
73 case 32:
74 dcmd |= DCMD_BURST32;
75 break;
76 }
46 77
47 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 78 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
48 runtime->dma_bytes = totsize; 79 runtime->dma_bytes = totsize;
@@ -55,14 +86,14 @@ int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
55 dma_desc->ddadr = next_desc_phys; 86 dma_desc->ddadr = next_desc_phys;
56 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 87 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
57 dma_desc->dsadr = dma_buff_phys; 88 dma_desc->dsadr = dma_buff_phys;
58 dma_desc->dtadr = rtd->params->dev_addr; 89 dma_desc->dtadr = rtd->params->addr;
59 } else { 90 } else {
60 dma_desc->dsadr = rtd->params->dev_addr; 91 dma_desc->dsadr = rtd->params->addr;
61 dma_desc->dtadr = dma_buff_phys; 92 dma_desc->dtadr = dma_buff_phys;
62 } 93 }
63 if (period > totsize) 94 if (period > totsize)
64 period = totsize; 95 period = totsize;
65 dma_desc->dcmd = rtd->params->dcmd | period | DCMD_ENDIRQEN; 96 dma_desc->dcmd = dcmd | period | DCMD_ENDIRQEN;
66 dma_desc++; 97 dma_desc++;
67 dma_buff_phys += period; 98 dma_buff_phys += period;
68 } while (totsize -= period); 99 } while (totsize -= period);
@@ -76,8 +107,10 @@ int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream)
76{ 107{
77 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; 108 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
78 109
79 if (rtd && rtd->params && rtd->params->drcmr) 110 if (rtd && rtd->params && rtd->params->filter_data) {
80 *rtd->params->drcmr = 0; 111 unsigned long req = *(unsigned long *) rtd->params->filter_data;
112 DRCMR(req) = 0;
113 }
81 114
82 snd_pcm_set_runtime_buffer(substream, NULL); 115 snd_pcm_set_runtime_buffer(substream, NULL);
83 return 0; 116 return 0;
@@ -136,6 +169,7 @@ EXPORT_SYMBOL(pxa2xx_pcm_pointer);
136int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) 169int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream)
137{ 170{
138 struct pxa2xx_runtime_data *prtd = substream->runtime->private_data; 171 struct pxa2xx_runtime_data *prtd = substream->runtime->private_data;
172 unsigned long req;
139 173
140 if (!prtd || !prtd->params) 174 if (!prtd || !prtd->params)
141 return 0; 175 return 0;
@@ -146,7 +180,8 @@ int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream)
146 DCSR(prtd->dma_ch) &= ~DCSR_RUN; 180 DCSR(prtd->dma_ch) &= ~DCSR_RUN;
147 DCSR(prtd->dma_ch) = 0; 181 DCSR(prtd->dma_ch) = 0;
148 DCMD(prtd->dma_ch) = 0; 182 DCMD(prtd->dma_ch) = 0;
149 *prtd->params->drcmr = prtd->dma_ch | DRCMR_MAPVLD; 183 req = *(unsigned long *) prtd->params->filter_data;
184 DRCMR(req) = prtd->dma_ch | DRCMR_MAPVLD;
150 185
151 return 0; 186 return 0;
152} 187}
@@ -155,7 +190,6 @@ EXPORT_SYMBOL(__pxa2xx_pcm_prepare);
155void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id) 190void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id)
156{ 191{
157 struct snd_pcm_substream *substream = dev_id; 192 struct snd_pcm_substream *substream = dev_id;
158 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data;
159 int dcsr; 193 int dcsr;
160 194
161 dcsr = DCSR(dma_ch); 195 dcsr = DCSR(dma_ch);
@@ -164,8 +198,8 @@ void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id)
164 if (dcsr & DCSR_ENDINTR) { 198 if (dcsr & DCSR_ENDINTR) {
165 snd_pcm_period_elapsed(substream); 199 snd_pcm_period_elapsed(substream);
166 } else { 200 } else {
167 printk(KERN_ERR "%s: DMA error on channel %d (DCSR=%#x)\n", 201 printk(KERN_ERR "DMA error on channel %d (DCSR=%#x)\n",
168 rtd->params->name, dma_ch, dcsr); 202 dma_ch, dcsr);
169 snd_pcm_stream_lock(substream); 203 snd_pcm_stream_lock(substream);
170 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 204 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
171 snd_pcm_stream_unlock(substream); 205 snd_pcm_stream_unlock(substream);
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c
index 26422a3584ea..69a2455b4472 100644
--- a/sound/arm/pxa2xx-pcm.c
+++ b/sound/arm/pxa2xx-pcm.c
@@ -11,8 +11,11 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/dmaengine.h>
15
14#include <sound/core.h> 16#include <sound/core.h>
15#include <sound/pxa2xx-lib.h> 17#include <sound/pxa2xx-lib.h>
18#include <sound/dmaengine_pcm.h>
16 19
17#include "pxa2xx-pcm.h" 20#include "pxa2xx-pcm.h"
18 21
@@ -40,7 +43,7 @@ static int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
40 43
41 rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 44 rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
42 client->playback_params : client->capture_params; 45 client->playback_params : client->capture_params;
43 ret = pxa_request_dma(rtd->params->name, DMA_PRIO_LOW, 46 ret = pxa_request_dma("dma", DMA_PRIO_LOW,
44 pxa2xx_pcm_dma_irq, substream); 47 pxa2xx_pcm_dma_irq, substream);
45 if (ret < 0) 48 if (ret < 0)
46 goto err2; 49 goto err2;
diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h
index 65f86b56ba42..2a8fc08d52a1 100644
--- a/sound/arm/pxa2xx-pcm.h
+++ b/sound/arm/pxa2xx-pcm.h
@@ -13,14 +13,14 @@
13 13
14struct pxa2xx_runtime_data { 14struct pxa2xx_runtime_data {
15 int dma_ch; 15 int dma_ch;
16 struct pxa2xx_pcm_dma_params *params; 16 struct snd_dmaengine_dai_dma_data *params;
17 pxa_dma_desc *dma_desc_array; 17 pxa_dma_desc *dma_desc_array;
18 dma_addr_t dma_desc_array_phys; 18 dma_addr_t dma_desc_array_phys;
19}; 19};
20 20
21struct pxa2xx_pcm_client { 21struct pxa2xx_pcm_client {
22 struct pxa2xx_pcm_dma_params *playback_params; 22 struct snd_dmaengine_dai_dma_data *playback_params;
23 struct pxa2xx_pcm_dma_params *capture_params; 23 struct snd_dmaengine_dai_dma_data *capture_params;
24 int (*startup)(struct snd_pcm_substream *); 24 int (*startup)(struct snd_pcm_substream *);
25 void (*shutdown)(struct snd_pcm_substream *); 25 void (*shutdown)(struct snd_pcm_substream *);
26 int (*prepare)(struct snd_pcm_substream *); 26 int (*prepare)(struct snd_pcm_substream *);
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
index 5d57e071cdf5..9a97843ab09f 100644
--- a/sound/soc/pxa/mmp-pcm.c
+++ b/sound/soc/pxa/mmp-pcm.c
@@ -17,6 +17,8 @@
17#include <linux/dmaengine.h> 17#include <linux/dmaengine.h>
18#include <linux/platform_data/dma-mmp_tdma.h> 18#include <linux/platform_data/dma-mmp_tdma.h>
19#include <linux/platform_data/mmp_audio.h> 19#include <linux/platform_data/mmp_audio.h>
20#include <linux/dmaengine.h>
21
20#include <sound/pxa2xx-lib.h> 22#include <sound/pxa2xx-lib.h>
21#include <sound/core.h> 23#include <sound/core.h>
22#include <sound/pcm.h> 24#include <sound/pcm.h>
@@ -67,7 +69,7 @@ static int mmp_pcm_hw_params(struct snd_pcm_substream *substream,
67{ 69{
68 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); 70 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
69 struct snd_soc_pcm_runtime *rtd = substream->private_data; 71 struct snd_soc_pcm_runtime *rtd = substream->private_data;
70 struct pxa2xx_pcm_dma_params *dma_params; 72 struct snd_dmaengine_dai_dma_data *dma_params;
71 struct dma_slave_config slave_config; 73 struct dma_slave_config slave_config;
72 int ret; 74 int ret;
73 75
@@ -80,10 +82,10 @@ static int mmp_pcm_hw_params(struct snd_pcm_substream *substream,
80 return ret; 82 return ret;
81 83
82 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 84 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
83 slave_config.dst_addr = dma_params->dev_addr; 85 slave_config.dst_addr = dma_params->addr;
84 slave_config.dst_maxburst = 4; 86 slave_config.dst_maxburst = 4;
85 } else { 87 } else {
86 slave_config.src_addr = dma_params->dev_addr; 88 slave_config.src_addr = dma_params->addr;
87 slave_config.src_maxburst = 4; 89 slave_config.src_maxburst = 4;
88 } 90 }
89 91
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 1605934d525e..41752a5fe3b0 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -27,12 +27,15 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/pxa2xx_ssp.h> 28#include <linux/pxa2xx_ssp.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/dmaengine.h>
31
30#include <sound/core.h> 32#include <sound/core.h>
31#include <sound/pcm.h> 33#include <sound/pcm.h>
32#include <sound/initval.h> 34#include <sound/initval.h>
33#include <sound/pcm_params.h> 35#include <sound/pcm_params.h>
34#include <sound/soc.h> 36#include <sound/soc.h>
35#include <sound/pxa2xx-lib.h> 37#include <sound/pxa2xx-lib.h>
38#include <sound/dmaengine_pcm.h>
36#include "mmp-sspa.h" 39#include "mmp-sspa.h"
37 40
38/* 41/*
@@ -40,7 +43,7 @@
40 */ 43 */
41struct sspa_priv { 44struct sspa_priv {
42 struct ssp_device *sspa; 45 struct ssp_device *sspa;
43 struct pxa2xx_pcm_dma_params *dma_params; 46 struct snd_dmaengine_dai_dma_data *dma_params;
44 struct clk *audio_clk; 47 struct clk *audio_clk;
45 struct clk *sysclk; 48 struct clk *sysclk;
46 int dai_fmt; 49 int dai_fmt;
@@ -266,7 +269,7 @@ static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
266 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 269 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
267 struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai); 270 struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai);
268 struct ssp_device *sspa = sspa_priv->sspa; 271 struct ssp_device *sspa = sspa_priv->sspa;
269 struct pxa2xx_pcm_dma_params *dma_params; 272 struct snd_dmaengine_dai_dma_data *dma_params;
270 u32 sspa_ctrl; 273 u32 sspa_ctrl;
271 274
272 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 275 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -309,7 +312,7 @@ static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
309 } 312 }
310 313
311 dma_params = &sspa_priv->dma_params[substream->stream]; 314 dma_params = &sspa_priv->dma_params[substream->stream];
312 dma_params->dev_addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 315 dma_params->addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
313 (sspa->phys_base + SSPA_TXD) : 316 (sspa->phys_base + SSPA_TXD) :
314 (sspa->phys_base + SSPA_RXD); 317 (sspa->phys_base + SSPA_RXD);
315 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_params); 318 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_params);
@@ -425,7 +428,8 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
425 return -ENOMEM; 428 return -ENOMEM;
426 429
427 priv->dma_params = devm_kzalloc(&pdev->dev, 430 priv->dma_params = devm_kzalloc(&pdev->dev,
428 2 * sizeof(struct pxa2xx_pcm_dma_params), GFP_KERNEL); 431 2 * sizeof(struct snd_dmaengine_dai_dma_data),
432 GFP_KERNEL);
429 if (priv->dma_params == NULL) 433 if (priv->dma_params == NULL)
430 return -ENOMEM; 434 return -ENOMEM;
431 435
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 19296f22cb28..c0dcc3538e35 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/pxa2xx_ssp.h> 23#include <linux/pxa2xx_ssp.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/dmaengine.h>
25 26
26#include <asm/irq.h> 27#include <asm/irq.h>
27 28
@@ -31,9 +32,9 @@
31#include <sound/pcm_params.h> 32#include <sound/pcm_params.h>
32#include <sound/soc.h> 33#include <sound/soc.h>
33#include <sound/pxa2xx-lib.h> 34#include <sound/pxa2xx-lib.h>
35#include <sound/dmaengine_pcm.h>
34 36
35#include <mach/hardware.h> 37#include <mach/hardware.h>
36#include <mach/dma.h>
37 38
38#include "../../arm/pxa2xx-pcm.h" 39#include "../../arm/pxa2xx-pcm.h"
39#include "pxa-ssp.h" 40#include "pxa-ssp.h"
@@ -80,27 +81,14 @@ static void pxa_ssp_disable(struct ssp_device *ssp)
80 __raw_writel(sscr0, ssp->mmio_base + SSCR0); 81 __raw_writel(sscr0, ssp->mmio_base + SSCR0);
81} 82}
82 83
83struct pxa2xx_pcm_dma_data {
84 struct pxa2xx_pcm_dma_params params;
85 char name[20];
86};
87
88static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4, 84static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4,
89 int out, struct pxa2xx_pcm_dma_params *dma_data) 85 int out, struct snd_dmaengine_dai_dma_data *dma)
90{ 86{
91 struct pxa2xx_pcm_dma_data *dma; 87 dma->filter_data = out ? &ssp->drcmr_tx : &ssp->drcmr_rx;
92 88 dma->addr_width = width4 ? DMA_SLAVE_BUSWIDTH_4_BYTES :
93 dma = container_of(dma_data, struct pxa2xx_pcm_dma_data, params); 89 DMA_SLAVE_BUSWIDTH_2_BYTES;
94 90 dma->maxburst = 16;
95 snprintf(dma->name, 20, "SSP%d PCM %s %s", ssp->port_id, 91 dma->addr = ssp->phys_base + SSDR;
96 width4 ? "32-bit" : "16-bit", out ? "out" : "in");
97
98 dma->params.name = dma->name;
99 dma->params.drcmr = &DRCMR(out ? ssp->drcmr_tx : ssp->drcmr_rx);
100 dma->params.dcmd = (out ? (DCMD_INCSRCADDR | DCMD_FLOWTRG) :
101 (DCMD_INCTRGADDR | DCMD_FLOWSRC)) |
102 (width4 ? DCMD_WIDTH4 : DCMD_WIDTH2) | DCMD_BURST16;
103 dma->params.dev_addr = ssp->phys_base + SSDR;
104} 92}
105 93
106static int pxa_ssp_startup(struct snd_pcm_substream *substream, 94static int pxa_ssp_startup(struct snd_pcm_substream *substream,
@@ -108,7 +96,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
108{ 96{
109 struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); 97 struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai);
110 struct ssp_device *ssp = priv->ssp; 98 struct ssp_device *ssp = priv->ssp;
111 struct pxa2xx_pcm_dma_data *dma; 99 struct snd_dmaengine_dai_dma_data *dma;
112 int ret = 0; 100 int ret = 0;
113 101
114 if (!cpu_dai->active) { 102 if (!cpu_dai->active) {
@@ -116,10 +104,10 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
116 pxa_ssp_disable(ssp); 104 pxa_ssp_disable(ssp);
117 } 105 }
118 106
119 dma = kzalloc(sizeof(struct pxa2xx_pcm_dma_data), GFP_KERNEL); 107 dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
120 if (!dma) 108 if (!dma)
121 return -ENOMEM; 109 return -ENOMEM;
122 snd_soc_dai_set_dma_data(cpu_dai, substream, &dma->params); 110 snd_soc_dai_set_dma_data(cpu_dai, substream, dma);
123 111
124 return ret; 112 return ret;
125} 113}
@@ -560,7 +548,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
560 u32 sspsp; 548 u32 sspsp;
561 int width = snd_pcm_format_physical_width(params_format(params)); 549 int width = snd_pcm_format_physical_width(params_format(params));
562 int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; 550 int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf;
563 struct pxa2xx_pcm_dma_params *dma_data; 551 struct snd_dmaengine_dai_dma_data *dma_data;
564 552
565 dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); 553 dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream);
566 554
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 1475515712e6..f1059d999de6 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -14,15 +14,16 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/dmaengine.h>
17 18
18#include <sound/core.h> 19#include <sound/core.h>
19#include <sound/ac97_codec.h> 20#include <sound/ac97_codec.h>
20#include <sound/soc.h> 21#include <sound/soc.h>
21#include <sound/pxa2xx-lib.h> 22#include <sound/pxa2xx-lib.h>
23#include <sound/dmaengine_pcm.h>
22 24
23#include <mach/hardware.h> 25#include <mach/hardware.h>
24#include <mach/regs-ac97.h> 26#include <mach/regs-ac97.h>
25#include <mach/dma.h>
26#include <mach/audio.h> 27#include <mach/audio.h>
27 28
28#include "pxa2xx-ac97.h" 29#include "pxa2xx-ac97.h"
@@ -48,44 +49,44 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
48 .reset = pxa2xx_ac97_cold_reset, 49 .reset = pxa2xx_ac97_cold_reset,
49}; 50};
50 51
51static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { 52static unsigned long pxa2xx_ac97_pcm_stereo_in_req = 12;
52 .name = "AC97 PCM Stereo out", 53static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = {
53 .dev_addr = __PREG(PCDR), 54 .addr = __PREG(PCDR),
54 .drcmr = &DRCMR(12), 55 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
55 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 56 .maxburst = 32,
56 DCMD_BURST32 | DCMD_WIDTH4, 57 .filter_data = &pxa2xx_ac97_pcm_stereo_in_req,
57}; 58};
58 59
59static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { 60static unsigned long pxa2xx_ac97_pcm_stereo_out_req = 11;
60 .name = "AC97 PCM Stereo in", 61static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = {
61 .dev_addr = __PREG(PCDR), 62 .addr = __PREG(PCDR),
62 .drcmr = &DRCMR(11), 63 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
63 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 64 .maxburst = 32,
64 DCMD_BURST32 | DCMD_WIDTH4, 65 .filter_data = &pxa2xx_ac97_pcm_stereo_out_req,
65}; 66};
66 67
67static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { 68static unsigned long pxa2xx_ac97_pcm_aux_mono_out_req = 10;
68 .name = "AC97 Aux PCM (Slot 5) Mono out", 69static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_out = {
69 .dev_addr = __PREG(MODR), 70 .addr = __PREG(MODR),
70 .drcmr = &DRCMR(10), 71 .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
71 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 72 .maxburst = 16,
72 DCMD_BURST16 | DCMD_WIDTH2, 73 .filter_data = &pxa2xx_ac97_pcm_aux_mono_out_req,
73}; 74};
74 75
75static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { 76static unsigned long pxa2xx_ac97_pcm_aux_mono_in_req = 9;
76 .name = "AC97 Aux PCM (Slot 5) Mono in", 77static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_in = {
77 .dev_addr = __PREG(MODR), 78 .addr = __PREG(MODR),
78 .drcmr = &DRCMR(9), 79 .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
79 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 80 .maxburst = 16,
80 DCMD_BURST16 | DCMD_WIDTH2, 81 .filter_data = &pxa2xx_ac97_pcm_aux_mono_in_req,
81}; 82};
82 83
83static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { 84static unsigned long pxa2xx_ac97_pcm_aux_mic_mono_req = 8;
84 .name = "AC97 Mic PCM (Slot 6) Mono in", 85static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_mic_mono_in = {
85 .dev_addr = __PREG(MCDR), 86 .addr = __PREG(MCDR),
86 .drcmr = &DRCMR(8), 87 .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
87 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 88 .maxburst = 16,
88 DCMD_BURST16 | DCMD_WIDTH2, 89 .filter_data = &pxa2xx_ac97_pcm_aux_mic_mono_req,
89}; 90};
90 91
91#ifdef CONFIG_PM 92#ifdef CONFIG_PM
@@ -119,7 +120,7 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
119 struct snd_pcm_hw_params *params, 120 struct snd_pcm_hw_params *params,
120 struct snd_soc_dai *cpu_dai) 121 struct snd_soc_dai *cpu_dai)
121{ 122{
122 struct pxa2xx_pcm_dma_params *dma_data; 123 struct snd_dmaengine_dai_dma_data *dma_data;
123 124
124 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 125 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
125 dma_data = &pxa2xx_ac97_pcm_stereo_out; 126 dma_data = &pxa2xx_ac97_pcm_stereo_out;
@@ -135,7 +136,7 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream,
135 struct snd_pcm_hw_params *params, 136 struct snd_pcm_hw_params *params,
136 struct snd_soc_dai *cpu_dai) 137 struct snd_soc_dai *cpu_dai)
137{ 138{
138 struct pxa2xx_pcm_dma_params *dma_data; 139 struct snd_dmaengine_dai_dma_data *dma_data;
139 140
140 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 141 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
141 dma_data = &pxa2xx_ac97_pcm_aux_mono_out; 142 dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index f7ca71664112..d5340a088858 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -23,9 +23,9 @@
23#include <sound/initval.h> 23#include <sound/initval.h>
24#include <sound/soc.h> 24#include <sound/soc.h>
25#include <sound/pxa2xx-lib.h> 25#include <sound/pxa2xx-lib.h>
26#include <sound/dmaengine_pcm.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <mach/dma.h>
29#include <mach/audio.h> 29#include <mach/audio.h>
30 30
31#include "pxa2xx-i2s.h" 31#include "pxa2xx-i2s.h"
@@ -82,20 +82,20 @@ static struct pxa_i2s_port pxa_i2s;
82static struct clk *clk_i2s; 82static struct clk *clk_i2s;
83static int clk_ena = 0; 83static int clk_ena = 0;
84 84
85static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { 85static unsigned long pxa2xx_i2s_pcm_stereo_out_req = 3;
86 .name = "I2S PCM Stereo out", 86static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_out = {
87 .dev_addr = __PREG(SADR), 87 .addr = __PREG(SADR),
88 .drcmr = &DRCMR(3), 88 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
89 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 89 .maxburst = 32,
90 DCMD_BURST32 | DCMD_WIDTH4, 90 .filter_data = &pxa2xx_i2s_pcm_stereo_out_req,
91}; 91};
92 92
93static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { 93static unsigned long pxa2xx_i2s_pcm_stereo_in_req = 2;
94 .name = "I2S PCM Stereo in", 94static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_in = {
95 .dev_addr = __PREG(SADR), 95 .addr = __PREG(SADR),
96 .drcmr = &DRCMR(2), 96 .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
97 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 97 .maxburst = 32,
98 DCMD_BURST32 | DCMD_WIDTH4, 98 .filter_data = &pxa2xx_i2s_pcm_stereo_in_req,
99}; 99};
100 100
101static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream, 101static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream,
@@ -163,7 +163,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
163 struct snd_pcm_hw_params *params, 163 struct snd_pcm_hw_params *params,
164 struct snd_soc_dai *dai) 164 struct snd_soc_dai *dai)
165{ 165{
166 struct pxa2xx_pcm_dma_params *dma_data; 166 struct snd_dmaengine_dai_dma_data *dma_data;
167 167
168 BUG_ON(IS_ERR(clk_i2s)); 168 BUG_ON(IS_ERR(clk_i2s));
169 clk_prepare_enable(clk_i2s); 169 clk_prepare_enable(clk_i2s);
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index ecff116cb7b0..0aa2d695064a 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -12,10 +12,12 @@
12 12
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/dmaengine.h>
15 16
16#include <sound/core.h> 17#include <sound/core.h>
17#include <sound/soc.h> 18#include <sound/soc.h>
18#include <sound/pxa2xx-lib.h> 19#include <sound/pxa2xx-lib.h>
20#include <sound/dmaengine_pcm.h>
19 21
20#include "../../arm/pxa2xx-pcm.h" 22#include "../../arm/pxa2xx-pcm.h"
21 23
@@ -25,7 +27,7 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
25 struct snd_pcm_runtime *runtime = substream->runtime; 27 struct snd_pcm_runtime *runtime = substream->runtime;
26 struct pxa2xx_runtime_data *prtd = runtime->private_data; 28 struct pxa2xx_runtime_data *prtd = runtime->private_data;
27 struct snd_soc_pcm_runtime *rtd = substream->private_data; 29 struct snd_soc_pcm_runtime *rtd = substream->private_data;
28 struct pxa2xx_pcm_dma_params *dma; 30 struct snd_dmaengine_dai_dma_data *dma;
29 int ret; 31 int ret;
30 32
31 dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 33 dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
@@ -39,7 +41,7 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
39 * with different params */ 41 * with different params */
40 if (prtd->params == NULL) { 42 if (prtd->params == NULL) {
41 prtd->params = dma; 43 prtd->params = dma;
42 ret = pxa_request_dma(prtd->params->name, DMA_PRIO_LOW, 44 ret = pxa_request_dma("name", DMA_PRIO_LOW,
43 pxa2xx_pcm_dma_irq, substream); 45 pxa2xx_pcm_dma_irq, substream);
44 if (ret < 0) 46 if (ret < 0)
45 return ret; 47 return ret;
@@ -47,7 +49,7 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
47 } else if (prtd->params != dma) { 49 } else if (prtd->params != dma) {
48 pxa_free_dma(prtd->dma_ch); 50 pxa_free_dma(prtd->dma_ch);
49 prtd->params = dma; 51 prtd->params = dma;
50 ret = pxa_request_dma(prtd->params->name, DMA_PRIO_LOW, 52 ret = pxa_request_dma("name", DMA_PRIO_LOW,
51 pxa2xx_pcm_dma_irq, substream); 53 pxa2xx_pcm_dma_irq, substream);
52 if (ret < 0) 54 if (ret < 0)
53 return ret; 55 return ret;