mpc5200_dma.c (a4654e9bde4ecedb4921e6c8fe2088114bdff1b3) | mpc5200_dma.c (17198ae76e0ffcb891d34f59ad3725d9c536ac99) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2// 3// Freescale MPC5200 PSC DMA 4// ALSA SoC Platform driver 5// 6// Copyright (C) 2008 Secret Lab Technologies Ltd. 7// Copyright (C) 2009 Jon Smirl, Digispeaker 8 --- 101 unchanged lines hidden (view full) --- 110 * 111 * This function is called by ALSA to start, stop, pause, and resume the DMA 112 * transfer of data. 113 */ 114static int psc_dma_trigger(struct snd_soc_component *component, 115 struct snd_pcm_substream *substream, int cmd) 116{ 117 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1// SPDX-License-Identifier: GPL-2.0-only 2// 3// Freescale MPC5200 PSC DMA 4// ALSA SoC Platform driver 5// 6// Copyright (C) 2008 Secret Lab Technologies Ltd. 7// Copyright (C) 2009 Jon Smirl, Digispeaker 8 --- 101 unchanged lines hidden (view full) --- 110 * 111 * This function is called by ALSA to start, stop, pause, and resume the DMA 112 * transfer of data. 113 */ 114static int psc_dma_trigger(struct snd_soc_component *component, 115 struct snd_pcm_substream *substream, int cmd) 116{ 117 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
118 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 118 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); |
119 struct snd_pcm_runtime *runtime = substream->runtime; 120 struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); 121 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; 122 u16 imr; 123 unsigned long flags; 124 int i; 125 126 switch (cmd) { --- 85 unchanged lines hidden (view full) --- 212 .fifo_size = 512, 213}; 214 215static int psc_dma_open(struct snd_soc_component *component, 216 struct snd_pcm_substream *substream) 217{ 218 struct snd_pcm_runtime *runtime = substream->runtime; 219 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 119 struct snd_pcm_runtime *runtime = substream->runtime; 120 struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); 121 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; 122 u16 imr; 123 unsigned long flags; 124 int i; 125 126 switch (cmd) { --- 85 unchanged lines hidden (view full) --- 212 .fifo_size = 512, 213}; 214 215static int psc_dma_open(struct snd_soc_component *component, 216 struct snd_pcm_substream *substream) 217{ 218 struct snd_pcm_runtime *runtime = substream->runtime; 219 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
220 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 220 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); |
221 struct psc_dma_stream *s; 222 int rc; 223 224 dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream); 225 226 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 227 s = &psc_dma->capture; 228 else --- 11 unchanged lines hidden (view full) --- 240 s->stream = substream; 241 return 0; 242} 243 244static int psc_dma_close(struct snd_soc_component *component, 245 struct snd_pcm_substream *substream) 246{ 247 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 221 struct psc_dma_stream *s; 222 int rc; 223 224 dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream); 225 226 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 227 s = &psc_dma->capture; 228 else --- 11 unchanged lines hidden (view full) --- 240 s->stream = substream; 241 return 0; 242} 243 244static int psc_dma_close(struct snd_soc_component *component, 245 struct snd_pcm_substream *substream) 246{ 247 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
248 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 248 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); |
249 struct psc_dma_stream *s; 250 251 dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream); 252 253 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 254 s = &psc_dma->capture; 255 else 256 s = &psc_dma->playback; --- 9 unchanged lines hidden (view full) --- 266 return 0; 267} 268 269static snd_pcm_uframes_t 270psc_dma_pointer(struct snd_soc_component *component, 271 struct snd_pcm_substream *substream) 272{ 273 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 249 struct psc_dma_stream *s; 250 251 dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream); 252 253 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 254 s = &psc_dma->capture; 255 else 256 s = &psc_dma->playback; --- 9 unchanged lines hidden (view full) --- 266 return 0; 267} 268 269static snd_pcm_uframes_t 270psc_dma_pointer(struct snd_soc_component *component, 271 struct snd_pcm_substream *substream) 272{ 273 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
274 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); | 274 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); |
275 struct psc_dma_stream *s; 276 dma_addr_t count; 277 278 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 279 s = &psc_dma->capture; 280 else 281 s = &psc_dma->playback; 282 --- 10 unchanged lines hidden (view full) --- 293 294 return 0; 295} 296 297static int psc_dma_new(struct snd_soc_component *component, 298 struct snd_soc_pcm_runtime *rtd) 299{ 300 struct snd_card *card = rtd->card->snd_card; | 275 struct psc_dma_stream *s; 276 dma_addr_t count; 277 278 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 279 s = &psc_dma->capture; 280 else 281 s = &psc_dma->playback; 282 --- 10 unchanged lines hidden (view full) --- 293 294 return 0; 295} 296 297static int psc_dma_new(struct snd_soc_component *component, 298 struct snd_soc_pcm_runtime *rtd) 299{ 300 struct snd_card *card = rtd->card->snd_card; |
301 struct snd_soc_dai *dai = rtd->cpu_dai; | 301 struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0); |
302 struct snd_pcm *pcm = rtd->pcm; 303 size_t size = psc_dma_hardware.buffer_bytes_max; 304 int rc; 305 306 dev_dbg(component->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", 307 card, dai, pcm); 308 309 rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); --- 205 unchanged lines hidden --- | 302 struct snd_pcm *pcm = rtd->pcm; 303 size_t size = psc_dma_hardware.buffer_bytes_max; 304 int rc; 305 306 dev_dbg(component->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", 307 card, dai, pcm); 308 309 rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); --- 205 unchanged lines hidden --- |