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

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>

authored by

Daniel Mack and committed by
Mark Brown
d65a1458 2023c90c

+142 -113
-7
include/sound/pxa2xx-lib.h
··· 6 6 7 7 /* PCM */ 8 8 9 - struct 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 - 16 9 extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, 17 10 struct snd_pcm_hw_params *params); 18 11 extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
+14 -12
sound/arm/pxa2xx-ac97.c
··· 14 14 #include <linux/io.h> 15 15 #include <linux/module.h> 16 16 #include <linux/platform_device.h> 17 + #include <linux/dmaengine.h> 17 18 18 19 #include <sound/core.h> 19 20 #include <sound/pcm.h> 20 21 #include <sound/ac97_codec.h> 21 22 #include <sound/initval.h> 22 23 #include <sound/pxa2xx-lib.h> 24 + #include <sound/dmaengine_pcm.h> 23 25 24 26 #include <mach/regs-ac97.h> 25 27 #include <mach/audio.h> ··· 43 41 .reset = pxa2xx_ac97_reset, 44 42 }; 45 43 46 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { 47 - .name = "AC97 PCM out", 48 - .dev_addr = __PREG(PCDR), 49 - .drcmr = &DRCMR(12), 50 - .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 51 - DCMD_BURST32 | DCMD_WIDTH4, 44 + static unsigned long pxa2xx_ac97_pcm_out_req = 12; 45 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = { 46 + .addr = __PREG(PCDR), 47 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 48 + .maxburst = 32, 49 + .filter_data = &pxa2xx_ac97_pcm_out_req, 52 50 }; 53 51 54 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { 55 - .name = "AC97 PCM in", 56 - .dev_addr = __PREG(PCDR), 57 - .drcmr = &DRCMR(11), 58 - .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 59 - DCMD_BURST32 | DCMD_WIDTH4, 52 + static unsigned long pxa2xx_ac97_pcm_in_req = 11; 53 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = { 54 + .addr = __PREG(PCDR), 55 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 56 + .maxburst = 32, 57 + .filter_data = &pxa2xx_ac97_pcm_in_req, 60 58 }; 61 59 62 60 static struct snd_pcm *pxa2xx_ac97_pcm;
+43 -9
sound/arm/pxa2xx-pcm-lib.c
··· 7 7 #include <linux/slab.h> 8 8 #include <linux/module.h> 9 9 #include <linux/dma-mapping.h> 10 + #include <linux/dmaengine.h> 10 11 11 12 #include <sound/core.h> 12 13 #include <sound/pcm.h> 13 14 #include <sound/pcm_params.h> 14 15 #include <sound/pxa2xx-lib.h> 16 + #include <sound/dmaengine_pcm.h> 15 17 16 18 #include <mach/dma.h> 17 19 ··· 45 43 size_t period = params_period_bytes(params); 46 44 pxa_dma_desc *dma_desc; 47 45 dma_addr_t dma_buff_phys, next_desc_phys; 46 + u32 dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG; 47 + 48 + /* temporary transition hack */ 49 + switch (rtd->params->addr_width) { 50 + case DMA_SLAVE_BUSWIDTH_1_BYTE: 51 + dcmd |= DCMD_WIDTH1; 52 + break; 53 + case DMA_SLAVE_BUSWIDTH_2_BYTES: 54 + dcmd |= DCMD_WIDTH2; 55 + break; 56 + case DMA_SLAVE_BUSWIDTH_4_BYTES: 57 + dcmd |= DCMD_WIDTH4; 58 + break; 59 + default: 60 + /* can't happen */ 61 + break; 62 + } 63 + 64 + switch (rtd->params->maxburst) { 65 + case 8: 66 + dcmd |= DCMD_BURST8; 67 + break; 68 + case 16: 69 + dcmd |= DCMD_BURST16; 70 + break; 71 + case 32: 72 + dcmd |= DCMD_BURST32; 73 + break; 74 + } 48 75 49 76 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 50 77 runtime->dma_bytes = totsize; ··· 86 55 dma_desc->ddadr = next_desc_phys; 87 56 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 88 57 dma_desc->dsadr = dma_buff_phys; 89 - dma_desc->dtadr = rtd->params->dev_addr; 58 + dma_desc->dtadr = rtd->params->addr; 90 59 } else { 91 - dma_desc->dsadr = rtd->params->dev_addr; 60 + dma_desc->dsadr = rtd->params->addr; 92 61 dma_desc->dtadr = dma_buff_phys; 93 62 } 94 63 if (period > totsize) 95 64 period = totsize; 96 - dma_desc->dcmd = rtd->params->dcmd | period | DCMD_ENDIRQEN; 65 + dma_desc->dcmd = dcmd | period | DCMD_ENDIRQEN; 97 66 dma_desc++; 98 67 dma_buff_phys += period; 99 68 } while (totsize -= period); ··· 107 76 { 108 77 struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; 109 78 110 - if (rtd && rtd->params && rtd->params->drcmr) 111 - *rtd->params->drcmr = 0; 79 + if (rtd && rtd->params && rtd->params->filter_data) { 80 + unsigned long req = *(unsigned long *) rtd->params->filter_data; 81 + DRCMR(req) = 0; 82 + } 112 83 113 84 snd_pcm_set_runtime_buffer(substream, NULL); 114 85 return 0; ··· 169 136 int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) 170 137 { 171 138 struct pxa2xx_runtime_data *prtd = substream->runtime->private_data; 139 + unsigned long req; 172 140 173 141 if (!prtd || !prtd->params) 174 142 return 0; ··· 180 146 DCSR(prtd->dma_ch) &= ~DCSR_RUN; 181 147 DCSR(prtd->dma_ch) = 0; 182 148 DCMD(prtd->dma_ch) = 0; 183 - *prtd->params->drcmr = prtd->dma_ch | DRCMR_MAPVLD; 149 + req = *(unsigned long *) prtd->params->filter_data; 150 + DRCMR(req) = prtd->dma_ch | DRCMR_MAPVLD; 184 151 185 152 return 0; 186 153 } ··· 190 155 void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id) 191 156 { 192 157 struct snd_pcm_substream *substream = dev_id; 193 - struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; 194 158 int dcsr; 195 159 196 160 dcsr = DCSR(dma_ch); ··· 198 164 if (dcsr & DCSR_ENDINTR) { 199 165 snd_pcm_period_elapsed(substream); 200 166 } else { 201 - printk(KERN_ERR "%s: DMA error on channel %d (DCSR=%#x)\n", 202 - rtd->params->name, dma_ch, dcsr); 167 + printk(KERN_ERR "DMA error on channel %d (DCSR=%#x)\n", 168 + dma_ch, dcsr); 203 169 snd_pcm_stream_lock(substream); 204 170 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 205 171 snd_pcm_stream_unlock(substream);
+4 -1
sound/arm/pxa2xx-pcm.c
··· 11 11 */ 12 12 13 13 #include <linux/module.h> 14 + #include <linux/dmaengine.h> 15 + 14 16 #include <sound/core.h> 15 17 #include <sound/pxa2xx-lib.h> 18 + #include <sound/dmaengine_pcm.h> 16 19 17 20 #include "pxa2xx-pcm.h" 18 21 ··· 43 40 44 41 rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 45 42 client->playback_params : client->capture_params; 46 - ret = pxa_request_dma(rtd->params->name, DMA_PRIO_LOW, 43 + ret = pxa_request_dma("dma", DMA_PRIO_LOW, 47 44 pxa2xx_pcm_dma_irq, substream); 48 45 if (ret < 0) 49 46 goto err2;
+3 -3
sound/arm/pxa2xx-pcm.h
··· 13 13 14 14 struct pxa2xx_runtime_data { 15 15 int dma_ch; 16 - struct pxa2xx_pcm_dma_params *params; 16 + struct snd_dmaengine_dai_dma_data *params; 17 17 pxa_dma_desc *dma_desc_array; 18 18 dma_addr_t dma_desc_array_phys; 19 19 }; 20 20 21 21 struct pxa2xx_pcm_client { 22 - struct pxa2xx_pcm_dma_params *playback_params; 23 - struct pxa2xx_pcm_dma_params *capture_params; 22 + struct snd_dmaengine_dai_dma_data *playback_params; 23 + struct snd_dmaengine_dai_dma_data *capture_params; 24 24 int (*startup)(struct snd_pcm_substream *); 25 25 void (*shutdown)(struct snd_pcm_substream *); 26 26 int (*prepare)(struct snd_pcm_substream *);
+5 -3
sound/soc/pxa/mmp-pcm.c
··· 17 17 #include <linux/dmaengine.h> 18 18 #include <linux/platform_data/dma-mmp_tdma.h> 19 19 #include <linux/platform_data/mmp_audio.h> 20 + #include <linux/dmaengine.h> 21 + 20 22 #include <sound/pxa2xx-lib.h> 21 23 #include <sound/core.h> 22 24 #include <sound/pcm.h> ··· 69 67 { 70 68 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); 71 69 struct snd_soc_pcm_runtime *rtd = substream->private_data; 72 - struct pxa2xx_pcm_dma_params *dma_params; 70 + struct snd_dmaengine_dai_dma_data *dma_params; 73 71 struct dma_slave_config slave_config; 74 72 int ret; 75 73 ··· 82 80 return ret; 83 81 84 82 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 85 - slave_config.dst_addr = dma_params->dev_addr; 83 + slave_config.dst_addr = dma_params->addr; 86 84 slave_config.dst_maxburst = 4; 87 85 } else { 88 - slave_config.src_addr = dma_params->dev_addr; 86 + slave_config.src_addr = dma_params->addr; 89 87 slave_config.src_maxburst = 4; 90 88 } 91 89
+8 -4
sound/soc/pxa/mmp-sspa.c
··· 27 27 #include <linux/slab.h> 28 28 #include <linux/pxa2xx_ssp.h> 29 29 #include <linux/io.h> 30 + #include <linux/dmaengine.h> 31 + 30 32 #include <sound/core.h> 31 33 #include <sound/pcm.h> 32 34 #include <sound/initval.h> 33 35 #include <sound/pcm_params.h> 34 36 #include <sound/soc.h> 35 37 #include <sound/pxa2xx-lib.h> 38 + #include <sound/dmaengine_pcm.h> 36 39 #include "mmp-sspa.h" 37 40 38 41 /* ··· 43 40 */ 44 41 struct sspa_priv { 45 42 struct ssp_device *sspa; 46 - struct pxa2xx_pcm_dma_params *dma_params; 43 + struct snd_dmaengine_dai_dma_data *dma_params; 47 44 struct clk *audio_clk; 48 45 struct clk *sysclk; 49 46 int dai_fmt; ··· 269 266 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 270 267 struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai); 271 268 struct ssp_device *sspa = sspa_priv->sspa; 272 - struct pxa2xx_pcm_dma_params *dma_params; 269 + struct snd_dmaengine_dai_dma_data *dma_params; 273 270 u32 sspa_ctrl; 274 271 275 272 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ··· 312 309 } 313 310 314 311 dma_params = &sspa_priv->dma_params[substream->stream]; 315 - dma_params->dev_addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 312 + dma_params->addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 316 313 (sspa->phys_base + SSPA_TXD) : 317 314 (sspa->phys_base + SSPA_RXD); 318 315 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_params); ··· 428 425 return -ENOMEM; 429 426 430 427 priv->dma_params = devm_kzalloc(&pdev->dev, 431 - 2 * sizeof(struct pxa2xx_pcm_dma_params), GFP_KERNEL); 428 + 2 * sizeof(struct snd_dmaengine_dai_dma_data), 429 + GFP_KERNEL); 432 430 if (priv->dma_params == NULL) 433 431 return -ENOMEM; 434 432
+12 -24
sound/soc/pxa/pxa-ssp.c
··· 22 22 #include <linux/io.h> 23 23 #include <linux/pxa2xx_ssp.h> 24 24 #include <linux/of.h> 25 + #include <linux/dmaengine.h> 25 26 26 27 #include <asm/irq.h> 27 28 ··· 32 31 #include <sound/pcm_params.h> 33 32 #include <sound/soc.h> 34 33 #include <sound/pxa2xx-lib.h> 34 + #include <sound/dmaengine_pcm.h> 35 35 36 36 #include <mach/hardware.h> 37 - #include <mach/dma.h> 38 37 39 38 #include "../../arm/pxa2xx-pcm.h" 40 39 #include "pxa-ssp.h" ··· 81 80 __raw_writel(sscr0, ssp->mmio_base + SSCR0); 82 81 } 83 82 84 - struct pxa2xx_pcm_dma_data { 85 - struct pxa2xx_pcm_dma_params params; 86 - char name[20]; 87 - }; 88 - 89 83 static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4, 90 - int out, struct pxa2xx_pcm_dma_params *dma_data) 84 + int out, struct snd_dmaengine_dai_dma_data *dma) 91 85 { 92 - struct pxa2xx_pcm_dma_data *dma; 93 - 94 - dma = container_of(dma_data, struct pxa2xx_pcm_dma_data, params); 95 - 96 - snprintf(dma->name, 20, "SSP%d PCM %s %s", ssp->port_id, 97 - width4 ? "32-bit" : "16-bit", out ? "out" : "in"); 98 - 99 - dma->params.name = dma->name; 100 - dma->params.drcmr = &DRCMR(out ? ssp->drcmr_tx : ssp->drcmr_rx); 101 - dma->params.dcmd = (out ? (DCMD_INCSRCADDR | DCMD_FLOWTRG) : 102 - (DCMD_INCTRGADDR | DCMD_FLOWSRC)) | 103 - (width4 ? DCMD_WIDTH4 : DCMD_WIDTH2) | DCMD_BURST16; 104 - dma->params.dev_addr = ssp->phys_base + SSDR; 86 + dma->filter_data = out ? &ssp->drcmr_tx : &ssp->drcmr_rx; 87 + dma->addr_width = width4 ? DMA_SLAVE_BUSWIDTH_4_BYTES : 88 + DMA_SLAVE_BUSWIDTH_2_BYTES; 89 + dma->maxburst = 16; 90 + dma->addr = ssp->phys_base + SSDR; 105 91 } 106 92 107 93 static int pxa_ssp_startup(struct snd_pcm_substream *substream, ··· 96 108 { 97 109 struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); 98 110 struct ssp_device *ssp = priv->ssp; 99 - struct pxa2xx_pcm_dma_data *dma; 111 + struct snd_dmaengine_dai_dma_data *dma; 100 112 int ret = 0; 101 113 102 114 if (!cpu_dai->active) { ··· 104 116 pxa_ssp_disable(ssp); 105 117 } 106 118 107 - dma = kzalloc(sizeof(struct pxa2xx_pcm_dma_data), GFP_KERNEL); 119 + dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL); 108 120 if (!dma) 109 121 return -ENOMEM; 110 - snd_soc_dai_set_dma_data(cpu_dai, substream, &dma->params); 122 + snd_soc_dai_set_dma_data(cpu_dai, substream, dma); 111 123 112 124 return ret; 113 125 } ··· 548 560 u32 sspsp; 549 561 int width = snd_pcm_format_physical_width(params_format(params)); 550 562 int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; 551 - struct pxa2xx_pcm_dma_params *dma_data; 563 + struct snd_dmaengine_dai_dma_data *dma_data; 552 564 553 565 dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); 554 566
+34 -33
sound/soc/pxa/pxa2xx-ac97.c
··· 14 14 #include <linux/io.h> 15 15 #include <linux/module.h> 16 16 #include <linux/platform_device.h> 17 + #include <linux/dmaengine.h> 17 18 18 19 #include <sound/core.h> 19 20 #include <sound/ac97_codec.h> 20 21 #include <sound/soc.h> 21 22 #include <sound/pxa2xx-lib.h> 23 + #include <sound/dmaengine_pcm.h> 22 24 23 25 #include <mach/hardware.h> 24 26 #include <mach/regs-ac97.h> 25 - #include <mach/dma.h> 26 27 #include <mach/audio.h> 27 28 28 29 #include "pxa2xx-ac97.h" ··· 49 48 .reset = pxa2xx_ac97_cold_reset, 50 49 }; 51 50 52 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { 53 - .name = "AC97 PCM Stereo out", 54 - .dev_addr = __PREG(PCDR), 55 - .drcmr = &DRCMR(12), 56 - .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 57 - DCMD_BURST32 | DCMD_WIDTH4, 51 + static unsigned long pxa2xx_ac97_pcm_stereo_in_req = 12; 52 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = { 53 + .addr = __PREG(PCDR), 54 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 55 + .maxburst = 32, 56 + .filter_data = &pxa2xx_ac97_pcm_stereo_in_req, 58 57 }; 59 58 60 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { 61 - .name = "AC97 PCM Stereo in", 62 - .dev_addr = __PREG(PCDR), 63 - .drcmr = &DRCMR(11), 64 - .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 65 - DCMD_BURST32 | DCMD_WIDTH4, 59 + static unsigned long pxa2xx_ac97_pcm_stereo_out_req = 11; 60 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = { 61 + .addr = __PREG(PCDR), 62 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 63 + .maxburst = 32, 64 + .filter_data = &pxa2xx_ac97_pcm_stereo_out_req, 66 65 }; 67 66 68 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { 69 - .name = "AC97 Aux PCM (Slot 5) Mono out", 70 - .dev_addr = __PREG(MODR), 71 - .drcmr = &DRCMR(10), 72 - .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 73 - DCMD_BURST16 | DCMD_WIDTH2, 67 + static unsigned long pxa2xx_ac97_pcm_aux_mono_out_req = 10; 68 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_out = { 69 + .addr = __PREG(MODR), 70 + .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 71 + .maxburst = 16, 72 + .filter_data = &pxa2xx_ac97_pcm_aux_mono_out_req, 74 73 }; 75 74 76 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { 77 - .name = "AC97 Aux PCM (Slot 5) Mono in", 78 - .dev_addr = __PREG(MODR), 79 - .drcmr = &DRCMR(9), 80 - .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 81 - DCMD_BURST16 | DCMD_WIDTH2, 75 + static unsigned long pxa2xx_ac97_pcm_aux_mono_in_req = 9; 76 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_in = { 77 + .addr = __PREG(MODR), 78 + .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 79 + .maxburst = 16, 80 + .filter_data = &pxa2xx_ac97_pcm_aux_mono_in_req, 82 81 }; 83 82 84 - static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { 85 - .name = "AC97 Mic PCM (Slot 6) Mono in", 86 - .dev_addr = __PREG(MCDR), 87 - .drcmr = &DRCMR(8), 88 - .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 89 - DCMD_BURST16 | DCMD_WIDTH2, 83 + static unsigned long pxa2xx_ac97_pcm_aux_mic_mono_req = 8; 84 + static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_mic_mono_in = { 85 + .addr = __PREG(MCDR), 86 + .addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 87 + .maxburst = 16, 88 + .filter_data = &pxa2xx_ac97_pcm_aux_mic_mono_req, 90 89 }; 91 90 92 91 #ifdef CONFIG_PM ··· 120 119 struct snd_pcm_hw_params *params, 121 120 struct snd_soc_dai *cpu_dai) 122 121 { 123 - struct pxa2xx_pcm_dma_params *dma_data; 122 + struct snd_dmaengine_dai_dma_data *dma_data; 124 123 125 124 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 126 125 dma_data = &pxa2xx_ac97_pcm_stereo_out; ··· 136 135 struct snd_pcm_hw_params *params, 137 136 struct snd_soc_dai *cpu_dai) 138 137 { 139 - struct pxa2xx_pcm_dma_params *dma_data; 138 + struct snd_dmaengine_dai_dma_data *dma_data; 140 139 141 140 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 142 141 dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
+14 -14
sound/soc/pxa/pxa2xx-i2s.c
··· 23 23 #include <sound/initval.h> 24 24 #include <sound/soc.h> 25 25 #include <sound/pxa2xx-lib.h> 26 + #include <sound/dmaengine_pcm.h> 26 27 27 28 #include <mach/hardware.h> 28 - #include <mach/dma.h> 29 29 #include <mach/audio.h> 30 30 31 31 #include "pxa2xx-i2s.h" ··· 82 82 static struct clk *clk_i2s; 83 83 static int clk_ena = 0; 84 84 85 - static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { 86 - .name = "I2S PCM Stereo out", 87 - .dev_addr = __PREG(SADR), 88 - .drcmr = &DRCMR(3), 89 - .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | 90 - DCMD_BURST32 | DCMD_WIDTH4, 85 + static unsigned long pxa2xx_i2s_pcm_stereo_out_req = 3; 86 + static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_out = { 87 + .addr = __PREG(SADR), 88 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 89 + .maxburst = 32, 90 + .filter_data = &pxa2xx_i2s_pcm_stereo_out_req, 91 91 }; 92 92 93 - static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { 94 - .name = "I2S PCM Stereo in", 95 - .dev_addr = __PREG(SADR), 96 - .drcmr = &DRCMR(2), 97 - .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | 98 - DCMD_BURST32 | DCMD_WIDTH4, 93 + static unsigned long pxa2xx_i2s_pcm_stereo_in_req = 2; 94 + static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_in = { 95 + .addr = __PREG(SADR), 96 + .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 97 + .maxburst = 32, 98 + .filter_data = &pxa2xx_i2s_pcm_stereo_in_req, 99 99 }; 100 100 101 101 static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream, ··· 163 163 struct snd_pcm_hw_params *params, 164 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 168 BUG_ON(IS_ERR(clk_i2s)); 169 169 clk_prepare_enable(clk_i2s);
+5 -3
sound/soc/pxa/pxa2xx-pcm.c
··· 12 12 13 13 #include <linux/dma-mapping.h> 14 14 #include <linux/module.h> 15 + #include <linux/dmaengine.h> 15 16 16 17 #include <sound/core.h> 17 18 #include <sound/soc.h> 18 19 #include <sound/pxa2xx-lib.h> 20 + #include <sound/dmaengine_pcm.h> 19 21 20 22 #include "../../arm/pxa2xx-pcm.h" 21 23 ··· 27 25 struct snd_pcm_runtime *runtime = substream->runtime; 28 26 struct pxa2xx_runtime_data *prtd = runtime->private_data; 29 27 struct snd_soc_pcm_runtime *rtd = substream->private_data; 30 - struct pxa2xx_pcm_dma_params *dma; 28 + struct snd_dmaengine_dai_dma_data *dma; 31 29 int ret; 32 30 33 31 dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); ··· 41 39 * with different params */ 42 40 if (prtd->params == NULL) { 43 41 prtd->params = dma; 44 - ret = pxa_request_dma(prtd->params->name, DMA_PRIO_LOW, 42 + ret = pxa_request_dma("name", DMA_PRIO_LOW, 45 43 pxa2xx_pcm_dma_irq, substream); 46 44 if (ret < 0) 47 45 return ret; ··· 49 47 } else if (prtd->params != dma) { 50 48 pxa_free_dma(prtd->dma_ch); 51 49 prtd->params = dma; 52 - ret = pxa_request_dma(prtd->params->name, DMA_PRIO_LOW, 50 + ret = pxa_request_dma("name", DMA_PRIO_LOW, 53 51 pxa2xx_pcm_dma_irq, substream); 54 52 if (ret < 0) 55 53 return ret;