diff options
Diffstat (limited to 'sound/arm')
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 26 | ||||
-rw-r--r-- | sound/arm/pxa2xx-pcm-lib.c | 52 | ||||
-rw-r--r-- | sound/arm/pxa2xx-pcm.c | 5 | ||||
-rw-r--r-- | sound/arm/pxa2xx-pcm.h | 6 |
4 files changed, 64 insertions, 25 deletions
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 | ||
44 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { | 46 | static unsigned long pxa2xx_ac97_pcm_out_req = 12; |
45 | .name = "AC97 PCM out", | 47 | static 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 | ||
52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { | 54 | static unsigned long pxa2xx_ac97_pcm_in_req = 11; |
53 | .name = "AC97 PCM in", | 55 | static 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 | ||
60 | static struct snd_pcm *pxa2xx_ac97_pcm; | 62 | static 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); | |||
136 | int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) | 169 | int __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); | |||
155 | void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id) | 190 | void 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 | ||
14 | struct pxa2xx_runtime_data { | 14 | struct 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 | ||
21 | struct pxa2xx_pcm_client { | 21 | struct 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 *); |