diff options
Diffstat (limited to 'sound/soc/fsl/mpc5200_dma.c')
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.c | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 4bae8d6e1a6a..685039213f05 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
@@ -34,21 +34,21 @@ MODULE_LICENSE("GPL"); | |||
34 | /* | 34 | /* |
35 | * Interrupt handlers | 35 | * Interrupt handlers |
36 | */ | 36 | */ |
37 | static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s) | 37 | static irqreturn_t psc_dma_status_irq(int irq, void *_psc_dma) |
38 | { | 38 | { |
39 | struct psc_i2s *psc_i2s = _psc_i2s; | 39 | struct psc_dma *psc_dma = _psc_dma; |
40 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; | 40 | struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; |
41 | u16 isr; | 41 | u16 isr; |
42 | 42 | ||
43 | isr = in_be16(®s->mpc52xx_psc_isr); | 43 | isr = in_be16(®s->mpc52xx_psc_isr); |
44 | 44 | ||
45 | /* Playback underrun error */ | 45 | /* Playback underrun error */ |
46 | if (psc_i2s->playback.active && (isr & MPC52xx_PSC_IMR_TXEMP)) | 46 | if (psc_dma->playback.active && (isr & MPC52xx_PSC_IMR_TXEMP)) |
47 | psc_i2s->stats.underrun_count++; | 47 | psc_dma->stats.underrun_count++; |
48 | 48 | ||
49 | /* Capture overrun error */ | 49 | /* Capture overrun error */ |
50 | if (psc_i2s->capture.active && (isr & MPC52xx_PSC_IMR_ORERR)) | 50 | if (psc_dma->capture.active && (isr & MPC52xx_PSC_IMR_ORERR)) |
51 | psc_i2s->stats.overrun_count++; | 51 | psc_dma->stats.overrun_count++; |
52 | 52 | ||
53 | out_8(®s->command, 4 << 4); /* reset the error status */ | 53 | out_8(®s->command, 4 << 4); /* reset the error status */ |
54 | 54 | ||
@@ -56,7 +56,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer | 59 | * psc_dma_bcom_enqueue_next_buffer - Enqueue another audio buffer |
60 | * @s: pointer to stream private data structure | 60 | * @s: pointer to stream private data structure |
61 | * | 61 | * |
62 | * Enqueues another audio period buffer into the bestcomm queue. | 62 | * Enqueues another audio period buffer into the bestcomm queue. |
@@ -65,7 +65,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s) | |||
65 | * the queue. Otherwise the enqueue will fail and the audio ring buffer | 65 | * the queue. Otherwise the enqueue will fail and the audio ring buffer |
66 | * will get out of sync | 66 | * will get out of sync |
67 | */ | 67 | */ |
68 | static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s) | 68 | static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s) |
69 | { | 69 | { |
70 | struct bcom_bd *bd; | 70 | struct bcom_bd *bd; |
71 | 71 | ||
@@ -82,9 +82,9 @@ static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | /* Bestcomm DMA irq handler */ | 84 | /* Bestcomm DMA irq handler */ |
85 | static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream) | 85 | static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream) |
86 | { | 86 | { |
87 | struct psc_i2s_stream *s = _psc_i2s_stream; | 87 | struct psc_dma_stream *s = _psc_dma_stream; |
88 | 88 | ||
89 | /* For each finished period, dequeue the completed period buffer | 89 | /* For each finished period, dequeue the completed period buffer |
90 | * and enqueue a new one in it's place. */ | 90 | * and enqueue a new one in it's place. */ |
@@ -93,7 +93,7 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream) | |||
93 | s->period_current_pt += s->period_bytes; | 93 | s->period_current_pt += s->period_bytes; |
94 | if (s->period_current_pt >= s->period_end) | 94 | if (s->period_current_pt >= s->period_end) |
95 | s->period_current_pt = s->period_start; | 95 | s->period_current_pt = s->period_start; |
96 | psc_i2s_bcom_enqueue_next_buffer(s); | 96 | psc_dma_bcom_enqueue_next_buffer(s); |
97 | bcom_enable(s->bcom_task); | 97 | bcom_enable(s->bcom_task); |
98 | } | 98 | } |
99 | 99 | ||
@@ -106,39 +106,39 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * psc_i2s_startup: create a new substream | 109 | * psc_dma_startup: create a new substream |
110 | * | 110 | * |
111 | * This is the first function called when a stream is opened. | 111 | * This is the first function called when a stream is opened. |
112 | * | 112 | * |
113 | * If this is the first stream open, then grab the IRQ and program most of | 113 | * If this is the first stream open, then grab the IRQ and program most of |
114 | * the PSC registers. | 114 | * the PSC registers. |
115 | */ | 115 | */ |
116 | int psc_i2s_startup(struct snd_pcm_substream *substream, | 116 | int psc_dma_startup(struct snd_pcm_substream *substream, |
117 | struct snd_soc_dai *dai) | 117 | struct snd_soc_dai *dai) |
118 | { | 118 | { |
119 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 119 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
120 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 120 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
121 | int rc; | 121 | int rc; |
122 | 122 | ||
123 | dev_dbg(psc_i2s->dev, "psc_i2s_startup(substream=%p)\n", substream); | 123 | dev_dbg(psc_dma->dev, "psc_dma_startup(substream=%p)\n", substream); |
124 | 124 | ||
125 | if (!psc_i2s->playback.active && | 125 | if (!psc_dma->playback.active && |
126 | !psc_i2s->capture.active) { | 126 | !psc_dma->capture.active) { |
127 | /* Setup the IRQs */ | 127 | /* Setup the IRQs */ |
128 | rc = request_irq(psc_i2s->irq, &psc_i2s_status_irq, IRQF_SHARED, | 128 | rc = request_irq(psc_dma->irq, &psc_dma_status_irq, IRQF_SHARED, |
129 | "psc-i2s-status", psc_i2s); | 129 | "psc-dma-status", psc_dma); |
130 | rc |= request_irq(psc_i2s->capture.irq, | 130 | rc |= request_irq(psc_dma->capture.irq, |
131 | &psc_i2s_bcom_irq, IRQF_SHARED, | 131 | &psc_dma_bcom_irq, IRQF_SHARED, |
132 | "psc-i2s-capture", &psc_i2s->capture); | 132 | "psc-dma-capture", &psc_dma->capture); |
133 | rc |= request_irq(psc_i2s->playback.irq, | 133 | rc |= request_irq(psc_dma->playback.irq, |
134 | &psc_i2s_bcom_irq, IRQF_SHARED, | 134 | &psc_dma_bcom_irq, IRQF_SHARED, |
135 | "psc-i2s-playback", &psc_i2s->playback); | 135 | "psc-dma-playback", &psc_dma->playback); |
136 | if (rc) { | 136 | if (rc) { |
137 | free_irq(psc_i2s->irq, psc_i2s); | 137 | free_irq(psc_dma->irq, psc_dma); |
138 | free_irq(psc_i2s->capture.irq, | 138 | free_irq(psc_dma->capture.irq, |
139 | &psc_i2s->capture); | 139 | &psc_dma->capture); |
140 | free_irq(psc_i2s->playback.irq, | 140 | free_irq(psc_dma->playback.irq, |
141 | &psc_i2s->playback); | 141 | &psc_dma->playback); |
142 | return -ENODEV; | 142 | return -ENODEV; |
143 | } | 143 | } |
144 | } | 144 | } |
@@ -146,7 +146,7 @@ int psc_i2s_startup(struct snd_pcm_substream *substream, | |||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
149 | int psc_i2s_hw_free(struct snd_pcm_substream *substream, | 149 | int psc_dma_hw_free(struct snd_pcm_substream *substream, |
150 | struct snd_soc_dai *dai) | 150 | struct snd_soc_dai *dai) |
151 | { | 151 | { |
152 | snd_pcm_set_runtime_buffer(substream, NULL); | 152 | snd_pcm_set_runtime_buffer(substream, NULL); |
@@ -154,29 +154,29 @@ int psc_i2s_hw_free(struct snd_pcm_substream *substream, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * psc_i2s_trigger: start and stop the DMA transfer. | 157 | * psc_dma_trigger: start and stop the DMA transfer. |
158 | * | 158 | * |
159 | * This function is called by ALSA to start, stop, pause, and resume the DMA | 159 | * This function is called by ALSA to start, stop, pause, and resume the DMA |
160 | * transfer of data. | 160 | * transfer of data. |
161 | */ | 161 | */ |
162 | int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | 162 | int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd, |
163 | struct snd_soc_dai *dai) | 163 | struct snd_soc_dai *dai) |
164 | { | 164 | { |
165 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 165 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
166 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 166 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
167 | struct snd_pcm_runtime *runtime = substream->runtime; | 167 | struct snd_pcm_runtime *runtime = substream->runtime; |
168 | struct psc_i2s_stream *s; | 168 | struct psc_dma_stream *s; |
169 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; | 169 | struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; |
170 | u16 imr; | 170 | u16 imr; |
171 | u8 psc_cmd; | 171 | u8 psc_cmd; |
172 | unsigned long flags; | 172 | unsigned long flags; |
173 | 173 | ||
174 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 174 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
175 | s = &psc_i2s->capture; | 175 | s = &psc_dma->capture; |
176 | else | 176 | else |
177 | s = &psc_i2s->playback; | 177 | s = &psc_dma->playback; |
178 | 178 | ||
179 | dev_dbg(psc_i2s->dev, "psc_i2s_trigger(substream=%p, cmd=%i)" | 179 | dev_dbg(psc_dma->dev, "psc_dma_trigger(substream=%p, cmd=%i)" |
180 | " stream_id=%i\n", | 180 | " stream_id=%i\n", |
181 | substream, cmd, substream->pstr->stream); | 181 | substream, cmd, substream->pstr->stream); |
182 | 182 | ||
@@ -207,14 +207,14 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
207 | else | 207 | else |
208 | bcom_gen_bd_tx_reset(s->bcom_task); | 208 | bcom_gen_bd_tx_reset(s->bcom_task); |
209 | while (!bcom_queue_full(s->bcom_task)) | 209 | while (!bcom_queue_full(s->bcom_task)) |
210 | psc_i2s_bcom_enqueue_next_buffer(s); | 210 | psc_dma_bcom_enqueue_next_buffer(s); |
211 | bcom_enable(s->bcom_task); | 211 | bcom_enable(s->bcom_task); |
212 | 212 | ||
213 | /* Due to errata in the i2s mode; need to line up enabling | 213 | /* Due to errata in the dma mode; need to line up enabling |
214 | * the transmitter with a transition on the frame sync | 214 | * the transmitter with a transition on the frame sync |
215 | * line */ | 215 | * line */ |
216 | 216 | ||
217 | spin_lock_irqsave(&psc_i2s->lock, flags); | 217 | spin_lock_irqsave(&psc_dma->lock, flags); |
218 | /* first make sure it is low */ | 218 | /* first make sure it is low */ |
219 | while ((in_8(®s->ipcr_acr.ipcr) & 0x80) != 0) | 219 | while ((in_8(®s->ipcr_acr.ipcr) & 0x80) != 0) |
220 | ; | 220 | ; |
@@ -228,7 +228,7 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
228 | if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) | 228 | if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) |
229 | psc_cmd |= MPC52xx_PSC_TX_ENABLE; | 229 | psc_cmd |= MPC52xx_PSC_TX_ENABLE; |
230 | out_8(®s->command, psc_cmd); | 230 | out_8(®s->command, psc_cmd); |
231 | spin_unlock_irqrestore(&psc_i2s->lock, flags); | 231 | spin_unlock_irqrestore(&psc_dma->lock, flags); |
232 | 232 | ||
233 | break; | 233 | break; |
234 | 234 | ||
@@ -236,7 +236,7 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
236 | /* Turn off the PSC */ | 236 | /* Turn off the PSC */ |
237 | s->active = 0; | 237 | s->active = 0; |
238 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) { | 238 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) { |
239 | if (!psc_i2s->playback.active) { | 239 | if (!psc_dma->playback.active) { |
240 | out_8(®s->command, 2 << 4); /* reset rx */ | 240 | out_8(®s->command, 2 << 4); /* reset rx */ |
241 | out_8(®s->command, 3 << 4); /* reset tx */ | 241 | out_8(®s->command, 3 << 4); /* reset tx */ |
242 | out_8(®s->command, 4 << 4); /* reset err */ | 242 | out_8(®s->command, 4 << 4); /* reset err */ |
@@ -244,7 +244,7 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
244 | } else { | 244 | } else { |
245 | out_8(®s->command, 3 << 4); /* reset tx */ | 245 | out_8(®s->command, 3 << 4); /* reset tx */ |
246 | out_8(®s->command, 4 << 4); /* reset err */ | 246 | out_8(®s->command, 4 << 4); /* reset err */ |
247 | if (!psc_i2s->capture.active) | 247 | if (!psc_dma->capture.active) |
248 | out_8(®s->command, 2 << 4); /* reset rx */ | 248 | out_8(®s->command, 2 << 4); /* reset rx */ |
249 | } | 249 | } |
250 | 250 | ||
@@ -255,15 +255,15 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
255 | break; | 255 | break; |
256 | 256 | ||
257 | default: | 257 | default: |
258 | dev_dbg(psc_i2s->dev, "invalid command\n"); | 258 | dev_dbg(psc_dma->dev, "invalid command\n"); |
259 | return -EINVAL; | 259 | return -EINVAL; |
260 | } | 260 | } |
261 | 261 | ||
262 | /* Update interrupt enable settings */ | 262 | /* Update interrupt enable settings */ |
263 | imr = 0; | 263 | imr = 0; |
264 | if (psc_i2s->playback.active) | 264 | if (psc_dma->playback.active) |
265 | imr |= MPC52xx_PSC_IMR_TXEMP; | 265 | imr |= MPC52xx_PSC_IMR_TXEMP; |
266 | if (psc_i2s->capture.active) | 266 | if (psc_dma->capture.active) |
267 | imr |= MPC52xx_PSC_IMR_ORERR; | 267 | imr |= MPC52xx_PSC_IMR_ORERR; |
268 | out_be16(®s->isr_imr.imr, imr); | 268 | out_be16(®s->isr_imr.imr, imr); |
269 | 269 | ||
@@ -271,36 +271,36 @@ int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
271 | } | 271 | } |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * psc_i2s_shutdown: shutdown the data transfer on a stream | 274 | * psc_dma_shutdown: shutdown the data transfer on a stream |
275 | * | 275 | * |
276 | * Shutdown the PSC if there are no other substreams open. | 276 | * Shutdown the PSC if there are no other substreams open. |
277 | */ | 277 | */ |
278 | void psc_i2s_shutdown(struct snd_pcm_substream *substream, | 278 | void psc_dma_shutdown(struct snd_pcm_substream *substream, |
279 | struct snd_soc_dai *dai) | 279 | struct snd_soc_dai *dai) |
280 | { | 280 | { |
281 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 281 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
282 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 282 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
283 | 283 | ||
284 | dev_dbg(psc_i2s->dev, "psc_i2s_shutdown(substream=%p)\n", substream); | 284 | dev_dbg(psc_dma->dev, "psc_dma_shutdown(substream=%p)\n", substream); |
285 | 285 | ||
286 | /* | 286 | /* |
287 | * If this is the last active substream, disable the PSC and release | 287 | * If this is the last active substream, disable the PSC and release |
288 | * the IRQ. | 288 | * the IRQ. |
289 | */ | 289 | */ |
290 | if (!psc_i2s->playback.active && | 290 | if (!psc_dma->playback.active && |
291 | !psc_i2s->capture.active) { | 291 | !psc_dma->capture.active) { |
292 | 292 | ||
293 | /* Disable all interrupts and reset the PSC */ | 293 | /* Disable all interrupts and reset the PSC */ |
294 | out_be16(&psc_i2s->psc_regs->isr_imr.imr, 0); | 294 | out_be16(&psc_dma->psc_regs->isr_imr.imr, 0); |
295 | out_8(&psc_i2s->psc_regs->command, 3 << 4); /* reset tx */ | 295 | out_8(&psc_dma->psc_regs->command, 3 << 4); /* reset tx */ |
296 | out_8(&psc_i2s->psc_regs->command, 2 << 4); /* reset rx */ | 296 | out_8(&psc_dma->psc_regs->command, 2 << 4); /* reset rx */ |
297 | out_8(&psc_i2s->psc_regs->command, 1 << 4); /* reset mode */ | 297 | out_8(&psc_dma->psc_regs->command, 1 << 4); /* reset mode */ |
298 | out_8(&psc_i2s->psc_regs->command, 4 << 4); /* reset error */ | 298 | out_8(&psc_dma->psc_regs->command, 4 << 4); /* reset error */ |
299 | 299 | ||
300 | /* Release irqs */ | 300 | /* Release irqs */ |
301 | free_irq(psc_i2s->irq, psc_i2s); | 301 | free_irq(psc_dma->irq, psc_dma); |
302 | free_irq(psc_i2s->capture.irq, &psc_i2s->capture); | 302 | free_irq(psc_dma->capture.irq, &psc_dma->capture); |
303 | free_irq(psc_i2s->playback.irq, &psc_i2s->playback); | 303 | free_irq(psc_dma->playback.irq, &psc_dma->playback); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
@@ -312,7 +312,7 @@ void psc_i2s_shutdown(struct snd_pcm_substream *substream, | |||
312 | * interaction with the attached codec | 312 | * interaction with the attached codec |
313 | */ | 313 | */ |
314 | 314 | ||
315 | static const struct snd_pcm_hardware psc_i2s_pcm_hardware = { | 315 | static const struct snd_pcm_hardware psc_dma_pcm_hardware = { |
316 | .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | | 316 | .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | |
317 | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 317 | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
318 | SNDRV_PCM_INFO_BATCH, | 318 | SNDRV_PCM_INFO_BATCH, |
@@ -330,80 +330,80 @@ static const struct snd_pcm_hardware psc_i2s_pcm_hardware = { | |||
330 | .fifo_size = 0, | 330 | .fifo_size = 0, |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static int psc_i2s_pcm_open(struct snd_pcm_substream *substream) | 333 | static int psc_dma_pcm_open(struct snd_pcm_substream *substream) |
334 | { | 334 | { |
335 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 335 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
336 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 336 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
337 | struct psc_i2s_stream *s; | 337 | struct psc_dma_stream *s; |
338 | 338 | ||
339 | dev_dbg(psc_i2s->dev, "psc_i2s_pcm_open(substream=%p)\n", substream); | 339 | dev_dbg(psc_dma->dev, "psc_dma_pcm_open(substream=%p)\n", substream); |
340 | 340 | ||
341 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 341 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
342 | s = &psc_i2s->capture; | 342 | s = &psc_dma->capture; |
343 | else | 343 | else |
344 | s = &psc_i2s->playback; | 344 | s = &psc_dma->playback; |
345 | 345 | ||
346 | snd_soc_set_runtime_hwparams(substream, &psc_i2s_pcm_hardware); | 346 | snd_soc_set_runtime_hwparams(substream, &psc_dma_pcm_hardware); |
347 | 347 | ||
348 | s->stream = substream; | 348 | s->stream = substream; |
349 | return 0; | 349 | return 0; |
350 | } | 350 | } |
351 | 351 | ||
352 | static int psc_i2s_pcm_close(struct snd_pcm_substream *substream) | 352 | static int psc_dma_pcm_close(struct snd_pcm_substream *substream) |
353 | { | 353 | { |
354 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 354 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
355 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 355 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
356 | struct psc_i2s_stream *s; | 356 | struct psc_dma_stream *s; |
357 | 357 | ||
358 | dev_dbg(psc_i2s->dev, "psc_i2s_pcm_close(substream=%p)\n", substream); | 358 | dev_dbg(psc_dma->dev, "psc_dma_pcm_close(substream=%p)\n", substream); |
359 | 359 | ||
360 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 360 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
361 | s = &psc_i2s->capture; | 361 | s = &psc_dma->capture; |
362 | else | 362 | else |
363 | s = &psc_i2s->playback; | 363 | s = &psc_dma->playback; |
364 | 364 | ||
365 | s->stream = NULL; | 365 | s->stream = NULL; |
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | static snd_pcm_uframes_t | 369 | static snd_pcm_uframes_t |
370 | psc_i2s_pcm_pointer(struct snd_pcm_substream *substream) | 370 | psc_dma_pcm_pointer(struct snd_pcm_substream *substream) |
371 | { | 371 | { |
372 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 372 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
373 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 373 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
374 | struct psc_i2s_stream *s; | 374 | struct psc_dma_stream *s; |
375 | dma_addr_t count; | 375 | dma_addr_t count; |
376 | 376 | ||
377 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 377 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
378 | s = &psc_i2s->capture; | 378 | s = &psc_dma->capture; |
379 | else | 379 | else |
380 | s = &psc_i2s->playback; | 380 | s = &psc_dma->playback; |
381 | 381 | ||
382 | count = s->period_current_pt - s->period_start; | 382 | count = s->period_current_pt - s->period_start; |
383 | 383 | ||
384 | return bytes_to_frames(substream->runtime, count); | 384 | return bytes_to_frames(substream->runtime, count); |
385 | } | 385 | } |
386 | 386 | ||
387 | static struct snd_pcm_ops psc_i2s_pcm_ops = { | 387 | static struct snd_pcm_ops psc_dma_pcm_ops = { |
388 | .open = psc_i2s_pcm_open, | 388 | .open = psc_dma_pcm_open, |
389 | .close = psc_i2s_pcm_close, | 389 | .close = psc_dma_pcm_close, |
390 | .ioctl = snd_pcm_lib_ioctl, | 390 | .ioctl = snd_pcm_lib_ioctl, |
391 | .pointer = psc_i2s_pcm_pointer, | 391 | .pointer = psc_dma_pcm_pointer, |
392 | }; | 392 | }; |
393 | 393 | ||
394 | static u64 psc_i2s_pcm_dmamask = 0xffffffff; | 394 | static u64 psc_dma_pcm_dmamask = 0xffffffff; |
395 | static int psc_i2s_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | 395 | static int psc_dma_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, |
396 | struct snd_pcm *pcm) | 396 | struct snd_pcm *pcm) |
397 | { | 397 | { |
398 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; | 398 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; |
399 | size_t size = psc_i2s_pcm_hardware.buffer_bytes_max; | 399 | size_t size = psc_dma_pcm_hardware.buffer_bytes_max; |
400 | int rc = 0; | 400 | int rc = 0; |
401 | 401 | ||
402 | dev_dbg(rtd->socdev->dev, "psc_i2s_pcm_new(card=%p, dai=%p, pcm=%p)\n", | 402 | dev_dbg(rtd->socdev->dev, "psc_dma_pcm_new(card=%p, dai=%p, pcm=%p)\n", |
403 | card, dai, pcm); | 403 | card, dai, pcm); |
404 | 404 | ||
405 | if (!card->dev->dma_mask) | 405 | if (!card->dev->dma_mask) |
406 | card->dev->dma_mask = &psc_i2s_pcm_dmamask; | 406 | card->dev->dma_mask = &psc_dma_pcm_dmamask; |
407 | if (!card->dev->coherent_dma_mask) | 407 | if (!card->dev->coherent_dma_mask) |
408 | card->dev->coherent_dma_mask = 0xffffffff; | 408 | card->dev->coherent_dma_mask = 0xffffffff; |
409 | 409 | ||
@@ -431,13 +431,13 @@ static int psc_i2s_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
431 | return -ENOMEM; | 431 | return -ENOMEM; |
432 | } | 432 | } |
433 | 433 | ||
434 | static void psc_i2s_pcm_free(struct snd_pcm *pcm) | 434 | static void psc_dma_pcm_free(struct snd_pcm *pcm) |
435 | { | 435 | { |
436 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; | 436 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; |
437 | struct snd_pcm_substream *substream; | 437 | struct snd_pcm_substream *substream; |
438 | int stream; | 438 | int stream; |
439 | 439 | ||
440 | dev_dbg(rtd->socdev->dev, "psc_i2s_pcm_free(pcm=%p)\n", pcm); | 440 | dev_dbg(rtd->socdev->dev, "psc_dma_pcm_free(pcm=%p)\n", pcm); |
441 | 441 | ||
442 | for (stream = 0; stream < 2; stream++) { | 442 | for (stream = 0; stream < 2; stream++) { |
443 | substream = pcm->streams[stream].substream; | 443 | substream = pcm->streams[stream].substream; |
@@ -449,10 +449,10 @@ static void psc_i2s_pcm_free(struct snd_pcm *pcm) | |||
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | struct snd_soc_platform psc_i2s_pcm_soc_platform = { | 452 | struct snd_soc_platform psc_dma_pcm_soc_platform = { |
453 | .name = "mpc5200-psc-audio", | 453 | .name = "mpc5200-psc-audio", |
454 | .pcm_ops = &psc_i2s_pcm_ops, | 454 | .pcm_ops = &psc_dma_pcm_ops, |
455 | .pcm_new = &psc_i2s_pcm_new, | 455 | .pcm_new = &psc_dma_pcm_new, |
456 | .pcm_free = &psc_i2s_pcm_free, | 456 | .pcm_free = &psc_dma_pcm_free, |
457 | }; | 457 | }; |
458 | 458 | ||