diff options
author | Jon Smirl <jonsmirl@gmail.com> | 2009-05-23 19:13:01 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-05-24 14:31:03 -0400 |
commit | cebe77674cab51a9ff1deaa077ab74aff3996764 (patch) | |
tree | 5f64370d795ffc835b39db88dfe67bdcf6de2de0 /sound/soc/fsl | |
parent | 89dd08425273773fd33fc85d48d152c5679b2fb4 (diff) |
ASoC: Rename the PSC functions to DMA
Rename the functions in the mpc5200 DMA file from i2s based names to dma
ones to reflect the file they are in.
Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.c | 194 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.h | 26 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_i2s.c | 160 |
3 files changed, 190 insertions, 190 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 | ||
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h index 9a19e8a70c5f..a33232c0c59e 100644 --- a/sound/soc/fsl/mpc5200_dma.h +++ b/sound/soc/fsl/mpc5200_dma.h | |||
@@ -6,9 +6,9 @@ | |||
6 | #define __SOUND_SOC_FSL_MPC5200_DMA_H__ | 6 | #define __SOUND_SOC_FSL_MPC5200_DMA_H__ |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * psc_i2s_stream - Data specific to a single stream (playback or capture) | 9 | * psc_dma_stream - Data specific to a single stream (playback or capture) |
10 | * @active: flag indicating if the stream is active | 10 | * @active: flag indicating if the stream is active |
11 | * @psc_i2s: pointer back to parent psc_i2s data structure | 11 | * @psc_dma: pointer back to parent psc_dma data structure |
12 | * @bcom_task: bestcomm task structure | 12 | * @bcom_task: bestcomm task structure |
13 | * @irq: irq number for bestcomm task | 13 | * @irq: irq number for bestcomm task |
14 | * @period_start: physical address of start of DMA region | 14 | * @period_start: physical address of start of DMA region |
@@ -16,9 +16,9 @@ | |||
16 | * @period_next_pt: physical address of next DMA buffer to enqueue | 16 | * @period_next_pt: physical address of next DMA buffer to enqueue |
17 | * @period_bytes: size of DMA period in bytes | 17 | * @period_bytes: size of DMA period in bytes |
18 | */ | 18 | */ |
19 | struct psc_i2s_stream { | 19 | struct psc_dma_stream { |
20 | int active; | 20 | int active; |
21 | struct psc_i2s *psc_i2s; | 21 | struct psc_dma *psc_dma; |
22 | struct bcom_task *bcom_task; | 22 | struct bcom_task *bcom_task; |
23 | int irq; | 23 | int irq; |
24 | struct snd_pcm_substream *stream; | 24 | struct snd_pcm_substream *stream; |
@@ -30,7 +30,7 @@ struct psc_i2s_stream { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * psc_i2s - Private driver data | 33 | * psc_dma - Private driver data |
34 | * @name: short name for this device ("PSC0", "PSC1", etc) | 34 | * @name: short name for this device ("PSC0", "PSC1", etc) |
35 | * @psc_regs: pointer to the PSC's registers | 35 | * @psc_regs: pointer to the PSC's registers |
36 | * @fifo_regs: pointer to the PSC's FIFO registers | 36 | * @fifo_regs: pointer to the PSC's FIFO registers |
@@ -42,7 +42,7 @@ struct psc_i2s_stream { | |||
42 | * @playback: Playback stream context data | 42 | * @playback: Playback stream context data |
43 | * @capture: Capture stream context data | 43 | * @capture: Capture stream context data |
44 | */ | 44 | */ |
45 | struct psc_i2s { | 45 | struct psc_dma { |
46 | char name[32]; | 46 | char name[32]; |
47 | struct mpc52xx_psc __iomem *psc_regs; | 47 | struct mpc52xx_psc __iomem *psc_regs; |
48 | struct mpc52xx_psc_fifo __iomem *fifo_regs; | 48 | struct mpc52xx_psc_fifo __iomem *fifo_regs; |
@@ -53,8 +53,8 @@ struct psc_i2s { | |||
53 | u32 sicr; | 53 | u32 sicr; |
54 | 54 | ||
55 | /* per-stream data */ | 55 | /* per-stream data */ |
56 | struct psc_i2s_stream playback; | 56 | struct psc_dma_stream playback; |
57 | struct psc_i2s_stream capture; | 57 | struct psc_dma_stream capture; |
58 | 58 | ||
59 | /* Statistics */ | 59 | /* Statistics */ |
60 | struct { | 60 | struct { |
@@ -64,18 +64,18 @@ struct psc_i2s { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | 66 | ||
67 | int psc_i2s_startup(struct snd_pcm_substream *substream, | 67 | int psc_dma_startup(struct snd_pcm_substream *substream, |
68 | struct snd_soc_dai *dai); | 68 | struct snd_soc_dai *dai); |
69 | 69 | ||
70 | int psc_i2s_hw_free(struct snd_pcm_substream *substream, | 70 | int psc_dma_hw_free(struct snd_pcm_substream *substream, |
71 | struct snd_soc_dai *dai); | 71 | struct snd_soc_dai *dai); |
72 | 72 | ||
73 | void psc_i2s_shutdown(struct snd_pcm_substream *substream, | 73 | void psc_dma_shutdown(struct snd_pcm_substream *substream, |
74 | struct snd_soc_dai *dai); | 74 | struct snd_soc_dai *dai); |
75 | 75 | ||
76 | int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | 76 | int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd, |
77 | struct snd_soc_dai *dai); | 77 | struct snd_soc_dai *dai); |
78 | 78 | ||
79 | extern struct snd_soc_platform psc_i2s_pcm_soc_platform; | 79 | extern struct snd_soc_platform psc_dma_pcm_soc_platform; |
80 | 80 | ||
81 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ | 81 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 8974b53eec9f..12a7917b57b0 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
@@ -54,10 +54,10 @@ static int psc_i2s_hw_params(struct snd_pcm_substream *substream, | |||
54 | struct snd_soc_dai *dai) | 54 | struct snd_soc_dai *dai) |
55 | { | 55 | { |
56 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 56 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
57 | struct psc_i2s *psc_i2s = rtd->dai->cpu_dai->private_data; | 57 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
58 | u32 mode; | 58 | u32 mode; |
59 | 59 | ||
60 | dev_dbg(psc_i2s->dev, "%s(substream=%p) p_size=%i p_bytes=%i" | 60 | dev_dbg(psc_dma->dev, "%s(substream=%p) p_size=%i p_bytes=%i" |
61 | " periods=%i buffer_size=%i buffer_bytes=%i\n", | 61 | " periods=%i buffer_size=%i buffer_bytes=%i\n", |
62 | __func__, substream, params_period_size(params), | 62 | __func__, substream, params_period_size(params), |
63 | params_period_bytes(params), params_periods(params), | 63 | params_period_bytes(params), params_periods(params), |
@@ -77,10 +77,10 @@ static int psc_i2s_hw_params(struct snd_pcm_substream *substream, | |||
77 | mode = MPC52xx_PSC_SICR_SIM_CODEC_32; | 77 | mode = MPC52xx_PSC_SICR_SIM_CODEC_32; |
78 | break; | 78 | break; |
79 | default: | 79 | default: |
80 | dev_dbg(psc_i2s->dev, "invalid format\n"); | 80 | dev_dbg(psc_dma->dev, "invalid format\n"); |
81 | return -EINVAL; | 81 | return -EINVAL; |
82 | } | 82 | } |
83 | out_be32(&psc_i2s->psc_regs->sicr, psc_i2s->sicr | mode); | 83 | out_be32(&psc_dma->psc_regs->sicr, psc_dma->sicr | mode); |
84 | 84 | ||
85 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 85 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
86 | 86 | ||
@@ -104,8 +104,8 @@ static int psc_i2s_hw_params(struct snd_pcm_substream *substream, | |||
104 | static int psc_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | 104 | static int psc_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, |
105 | int clk_id, unsigned int freq, int dir) | 105 | int clk_id, unsigned int freq, int dir) |
106 | { | 106 | { |
107 | struct psc_i2s *psc_i2s = cpu_dai->private_data; | 107 | struct psc_dma *psc_dma = cpu_dai->private_data; |
108 | dev_dbg(psc_i2s->dev, "psc_i2s_set_sysclk(cpu_dai=%p, dir=%i)\n", | 108 | dev_dbg(psc_dma->dev, "psc_i2s_set_sysclk(cpu_dai=%p, dir=%i)\n", |
109 | cpu_dai, dir); | 109 | cpu_dai, dir); |
110 | return (dir == SND_SOC_CLOCK_IN) ? 0 : -EINVAL; | 110 | return (dir == SND_SOC_CLOCK_IN) ? 0 : -EINVAL; |
111 | } | 111 | } |
@@ -123,8 +123,8 @@ static int psc_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | |||
123 | */ | 123 | */ |
124 | static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format) | 124 | static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format) |
125 | { | 125 | { |
126 | struct psc_i2s *psc_i2s = cpu_dai->private_data; | 126 | struct psc_dma *psc_dma = cpu_dai->private_data; |
127 | dev_dbg(psc_i2s->dev, "psc_i2s_set_fmt(cpu_dai=%p, format=%i)\n", | 127 | dev_dbg(psc_dma->dev, "psc_i2s_set_fmt(cpu_dai=%p, format=%i)\n", |
128 | cpu_dai, format); | 128 | cpu_dai, format); |
129 | return (format == SND_SOC_DAIFMT_I2S) ? 0 : -EINVAL; | 129 | return (format == SND_SOC_DAIFMT_I2S) ? 0 : -EINVAL; |
130 | } | 130 | } |
@@ -140,11 +140,11 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format) | |||
140 | * psc_i2s_dai_template: template CPU Digital Audio Interface | 140 | * psc_i2s_dai_template: template CPU Digital Audio Interface |
141 | */ | 141 | */ |
142 | static struct snd_soc_dai_ops psc_i2s_dai_ops = { | 142 | static struct snd_soc_dai_ops psc_i2s_dai_ops = { |
143 | .startup = psc_i2s_startup, | 143 | .startup = psc_dma_startup, |
144 | .hw_params = psc_i2s_hw_params, | 144 | .hw_params = psc_i2s_hw_params, |
145 | .hw_free = psc_i2s_hw_free, | 145 | .hw_free = psc_dma_hw_free, |
146 | .shutdown = psc_i2s_shutdown, | 146 | .shutdown = psc_dma_shutdown, |
147 | .trigger = psc_i2s_trigger, | 147 | .trigger = psc_dma_trigger, |
148 | .set_sysclk = psc_i2s_set_sysclk, | 148 | .set_sysclk = psc_i2s_set_sysclk, |
149 | .set_fmt = psc_i2s_set_fmt, | 149 | .set_fmt = psc_i2s_set_fmt, |
150 | }; | 150 | }; |
@@ -172,24 +172,24 @@ static struct snd_soc_dai psc_i2s_dai_template = { | |||
172 | static ssize_t psc_i2s_status_show(struct device *dev, | 172 | static ssize_t psc_i2s_status_show(struct device *dev, |
173 | struct device_attribute *attr, char *buf) | 173 | struct device_attribute *attr, char *buf) |
174 | { | 174 | { |
175 | struct psc_i2s *psc_i2s = dev_get_drvdata(dev); | 175 | struct psc_dma *psc_dma = dev_get_drvdata(dev); |
176 | 176 | ||
177 | return sprintf(buf, "status=%.4x sicr=%.8x rfnum=%i rfstat=0x%.4x " | 177 | return sprintf(buf, "status=%.4x sicr=%.8x rfnum=%i rfstat=0x%.4x " |
178 | "tfnum=%i tfstat=0x%.4x\n", | 178 | "tfnum=%i tfstat=0x%.4x\n", |
179 | in_be16(&psc_i2s->psc_regs->sr_csr.status), | 179 | in_be16(&psc_dma->psc_regs->sr_csr.status), |
180 | in_be32(&psc_i2s->psc_regs->sicr), | 180 | in_be32(&psc_dma->psc_regs->sicr), |
181 | in_be16(&psc_i2s->fifo_regs->rfnum) & 0x1ff, | 181 | in_be16(&psc_dma->fifo_regs->rfnum) & 0x1ff, |
182 | in_be16(&psc_i2s->fifo_regs->rfstat), | 182 | in_be16(&psc_dma->fifo_regs->rfstat), |
183 | in_be16(&psc_i2s->fifo_regs->tfnum) & 0x1ff, | 183 | in_be16(&psc_dma->fifo_regs->tfnum) & 0x1ff, |
184 | in_be16(&psc_i2s->fifo_regs->tfstat)); | 184 | in_be16(&psc_dma->fifo_regs->tfstat)); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int *psc_i2s_get_stat_attr(struct psc_i2s *psc_i2s, const char *name) | 187 | static int *psc_i2s_get_stat_attr(struct psc_dma *psc_dma, const char *name) |
188 | { | 188 | { |
189 | if (strcmp(name, "playback_underrun") == 0) | 189 | if (strcmp(name, "playback_underrun") == 0) |
190 | return &psc_i2s->stats.underrun_count; | 190 | return &psc_dma->stats.underrun_count; |
191 | if (strcmp(name, "capture_overrun") == 0) | 191 | if (strcmp(name, "capture_overrun") == 0) |
192 | return &psc_i2s->stats.overrun_count; | 192 | return &psc_dma->stats.overrun_count; |
193 | 193 | ||
194 | return NULL; | 194 | return NULL; |
195 | } | 195 | } |
@@ -197,10 +197,10 @@ static int *psc_i2s_get_stat_attr(struct psc_i2s *psc_i2s, const char *name) | |||
197 | static ssize_t psc_i2s_stat_show(struct device *dev, | 197 | static ssize_t psc_i2s_stat_show(struct device *dev, |
198 | struct device_attribute *attr, char *buf) | 198 | struct device_attribute *attr, char *buf) |
199 | { | 199 | { |
200 | struct psc_i2s *psc_i2s = dev_get_drvdata(dev); | 200 | struct psc_dma *psc_dma = dev_get_drvdata(dev); |
201 | int *attrib; | 201 | int *attrib; |
202 | 202 | ||
203 | attrib = psc_i2s_get_stat_attr(psc_i2s, attr->attr.name); | 203 | attrib = psc_i2s_get_stat_attr(psc_dma, attr->attr.name); |
204 | if (!attrib) | 204 | if (!attrib) |
205 | return 0; | 205 | return 0; |
206 | 206 | ||
@@ -212,10 +212,10 @@ static ssize_t psc_i2s_stat_store(struct device *dev, | |||
212 | const char *buf, | 212 | const char *buf, |
213 | size_t count) | 213 | size_t count) |
214 | { | 214 | { |
215 | struct psc_i2s *psc_i2s = dev_get_drvdata(dev); | 215 | struct psc_dma *psc_dma = dev_get_drvdata(dev); |
216 | int *attrib; | 216 | int *attrib; |
217 | 217 | ||
218 | attrib = psc_i2s_get_stat_attr(psc_i2s, attr->attr.name); | 218 | attrib = psc_i2s_get_stat_attr(psc_dma, attr->attr.name); |
219 | if (!attrib) | 219 | if (!attrib) |
220 | return 0; | 220 | return 0; |
221 | 221 | ||
@@ -238,7 +238,7 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
238 | const struct of_device_id *match) | 238 | const struct of_device_id *match) |
239 | { | 239 | { |
240 | phys_addr_t fifo; | 240 | phys_addr_t fifo; |
241 | struct psc_i2s *psc_i2s; | 241 | struct psc_dma *psc_dma; |
242 | struct resource res; | 242 | struct resource res; |
243 | int size, psc_id, irq, rc; | 243 | int size, psc_id, irq, rc; |
244 | const __be32 *prop; | 244 | const __be32 *prop; |
@@ -265,56 +265,56 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /* Allocate and initialize the driver private data */ | 267 | /* Allocate and initialize the driver private data */ |
268 | psc_i2s = kzalloc(sizeof *psc_i2s, GFP_KERNEL); | 268 | psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL); |
269 | if (!psc_i2s) { | 269 | if (!psc_dma) { |
270 | iounmap(regs); | 270 | iounmap(regs); |
271 | return -ENOMEM; | 271 | return -ENOMEM; |
272 | } | 272 | } |
273 | spin_lock_init(&psc_i2s->lock); | 273 | spin_lock_init(&psc_dma->lock); |
274 | psc_i2s->irq = irq; | 274 | psc_dma->irq = irq; |
275 | psc_i2s->psc_regs = regs; | 275 | psc_dma->psc_regs = regs; |
276 | psc_i2s->fifo_regs = regs + sizeof *psc_i2s->psc_regs; | 276 | psc_dma->fifo_regs = regs + sizeof *psc_dma->psc_regs; |
277 | psc_i2s->dev = &op->dev; | 277 | psc_dma->dev = &op->dev; |
278 | psc_i2s->playback.psc_i2s = psc_i2s; | 278 | psc_dma->playback.psc_dma = psc_dma; |
279 | psc_i2s->capture.psc_i2s = psc_i2s; | 279 | psc_dma->capture.psc_dma = psc_dma; |
280 | snprintf(psc_i2s->name, sizeof psc_i2s->name, "PSC%u", psc_id+1); | 280 | snprintf(psc_dma->name, sizeof psc_dma->name, "PSC%u", psc_id+1); |
281 | 281 | ||
282 | /* Fill out the CPU DAI structure */ | 282 | /* Fill out the CPU DAI structure */ |
283 | memcpy(&psc_i2s->dai, &psc_i2s_dai_template, sizeof psc_i2s->dai); | 283 | memcpy(&psc_dma->dai, &psc_i2s_dai_template, sizeof psc_dma->dai); |
284 | psc_i2s->dai.private_data = psc_i2s; | 284 | psc_dma->dai.private_data = psc_dma; |
285 | psc_i2s->dai.name = psc_i2s->name; | 285 | psc_dma->dai.name = psc_dma->name; |
286 | psc_i2s->dai.id = psc_id; | 286 | psc_dma->dai.id = psc_id; |
287 | 287 | ||
288 | /* Find the address of the fifo data registers and setup the | 288 | /* Find the address of the fifo data registers and setup the |
289 | * DMA tasks */ | 289 | * DMA tasks */ |
290 | fifo = res.start + offsetof(struct mpc52xx_psc, buffer.buffer_32); | 290 | fifo = res.start + offsetof(struct mpc52xx_psc, buffer.buffer_32); |
291 | psc_i2s->capture.bcom_task = | 291 | psc_dma->capture.bcom_task = |
292 | bcom_psc_gen_bd_rx_init(psc_id, 10, fifo, 512); | 292 | bcom_psc_gen_bd_rx_init(psc_id, 10, fifo, 512); |
293 | psc_i2s->playback.bcom_task = | 293 | psc_dma->playback.bcom_task = |
294 | bcom_psc_gen_bd_tx_init(psc_id, 10, fifo); | 294 | bcom_psc_gen_bd_tx_init(psc_id, 10, fifo); |
295 | if (!psc_i2s->capture.bcom_task || | 295 | if (!psc_dma->capture.bcom_task || |
296 | !psc_i2s->playback.bcom_task) { | 296 | !psc_dma->playback.bcom_task) { |
297 | dev_err(&op->dev, "Could not allocate bestcomm tasks\n"); | 297 | dev_err(&op->dev, "Could not allocate bestcomm tasks\n"); |
298 | iounmap(regs); | 298 | iounmap(regs); |
299 | kfree(psc_i2s); | 299 | kfree(psc_dma); |
300 | return -ENODEV; | 300 | return -ENODEV; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* Disable all interrupts and reset the PSC */ | 303 | /* Disable all interrupts and reset the PSC */ |
304 | out_be16(&psc_i2s->psc_regs->isr_imr.imr, 0); | 304 | out_be16(&psc_dma->psc_regs->isr_imr.imr, 0); |
305 | out_8(&psc_i2s->psc_regs->command, 3 << 4); /* reset transmitter */ | 305 | out_8(&psc_dma->psc_regs->command, 3 << 4); /* reset transmitter */ |
306 | out_8(&psc_i2s->psc_regs->command, 2 << 4); /* reset receiver */ | 306 | out_8(&psc_dma->psc_regs->command, 2 << 4); /* reset receiver */ |
307 | out_8(&psc_i2s->psc_regs->command, 1 << 4); /* reset mode */ | 307 | out_8(&psc_dma->psc_regs->command, 1 << 4); /* reset mode */ |
308 | out_8(&psc_i2s->psc_regs->command, 4 << 4); /* reset error */ | 308 | out_8(&psc_dma->psc_regs->command, 4 << 4); /* reset error */ |
309 | 309 | ||
310 | /* Configure the serial interface mode; defaulting to CODEC8 mode */ | 310 | /* Configure the serial interface mode; defaulting to CODEC8 mode */ |
311 | psc_i2s->sicr = MPC52xx_PSC_SICR_DTS1 | MPC52xx_PSC_SICR_I2S | | 311 | psc_dma->sicr = MPC52xx_PSC_SICR_DTS1 | MPC52xx_PSC_SICR_I2S | |
312 | MPC52xx_PSC_SICR_CLKPOL; | 312 | MPC52xx_PSC_SICR_CLKPOL; |
313 | if (of_get_property(op->node, "fsl,cellslave", NULL)) | 313 | if (of_get_property(op->node, "fsl,cellslave", NULL)) |
314 | psc_i2s->sicr |= MPC52xx_PSC_SICR_CELLSLAVE | | 314 | psc_dma->sicr |= MPC52xx_PSC_SICR_CELLSLAVE | |
315 | MPC52xx_PSC_SICR_GENCLK; | 315 | MPC52xx_PSC_SICR_GENCLK; |
316 | out_be32(&psc_i2s->psc_regs->sicr, | 316 | out_be32(&psc_dma->psc_regs->sicr, |
317 | psc_i2s->sicr | MPC52xx_PSC_SICR_SIM_CODEC_8); | 317 | psc_dma->sicr | MPC52xx_PSC_SICR_SIM_CODEC_8); |
318 | 318 | ||
319 | /* Check for the codec handle. If it is not present then we | 319 | /* Check for the codec handle. If it is not present then we |
320 | * are done */ | 320 | * are done */ |
@@ -325,54 +325,54 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
325 | * First write: RxRdy (FIFO Alarm) generates rx FIFO irq | 325 | * First write: RxRdy (FIFO Alarm) generates rx FIFO irq |
326 | * Second write: register Normal mode for non loopback | 326 | * Second write: register Normal mode for non loopback |
327 | */ | 327 | */ |
328 | out_8(&psc_i2s->psc_regs->mode, 0); | 328 | out_8(&psc_dma->psc_regs->mode, 0); |
329 | out_8(&psc_i2s->psc_regs->mode, 0); | 329 | out_8(&psc_dma->psc_regs->mode, 0); |
330 | 330 | ||
331 | /* Set the TX and RX fifo alarm thresholds */ | 331 | /* Set the TX and RX fifo alarm thresholds */ |
332 | out_be16(&psc_i2s->fifo_regs->rfalarm, 0x100); | 332 | out_be16(&psc_dma->fifo_regs->rfalarm, 0x100); |
333 | out_8(&psc_i2s->fifo_regs->rfcntl, 0x4); | 333 | out_8(&psc_dma->fifo_regs->rfcntl, 0x4); |
334 | out_be16(&psc_i2s->fifo_regs->tfalarm, 0x100); | 334 | out_be16(&psc_dma->fifo_regs->tfalarm, 0x100); |
335 | out_8(&psc_i2s->fifo_regs->tfcntl, 0x7); | 335 | out_8(&psc_dma->fifo_regs->tfcntl, 0x7); |
336 | 336 | ||
337 | /* Lookup the IRQ numbers */ | 337 | /* Lookup the IRQ numbers */ |
338 | psc_i2s->playback.irq = | 338 | psc_dma->playback.irq = |
339 | bcom_get_task_irq(psc_i2s->playback.bcom_task); | 339 | bcom_get_task_irq(psc_dma->playback.bcom_task); |
340 | psc_i2s->capture.irq = | 340 | psc_dma->capture.irq = |
341 | bcom_get_task_irq(psc_i2s->capture.bcom_task); | 341 | bcom_get_task_irq(psc_dma->capture.bcom_task); |
342 | 342 | ||
343 | /* Save what we've done so it can be found again later */ | 343 | /* Save what we've done so it can be found again later */ |
344 | dev_set_drvdata(&op->dev, psc_i2s); | 344 | dev_set_drvdata(&op->dev, psc_dma); |
345 | 345 | ||
346 | /* Register the SYSFS files */ | 346 | /* Register the SYSFS files */ |
347 | rc = device_create_file(psc_i2s->dev, &dev_attr_status); | 347 | rc = device_create_file(psc_dma->dev, &dev_attr_status); |
348 | rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); | 348 | rc |= device_create_file(psc_dma->dev, &dev_attr_capture_overrun); |
349 | rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); | 349 | rc |= device_create_file(psc_dma->dev, &dev_attr_playback_underrun); |
350 | if (rc) | 350 | if (rc) |
351 | dev_info(psc_i2s->dev, "error creating sysfs files\n"); | 351 | dev_info(psc_dma->dev, "error creating sysfs files\n"); |
352 | 352 | ||
353 | snd_soc_register_platform(&psc_i2s_pcm_soc_platform); | 353 | snd_soc_register_platform(&psc_dma_pcm_soc_platform); |
354 | 354 | ||
355 | /* Tell the ASoC OF helpers about it */ | 355 | /* Tell the ASoC OF helpers about it */ |
356 | of_snd_soc_register_platform(&psc_i2s_pcm_soc_platform, op->node, | 356 | of_snd_soc_register_platform(&psc_dma_pcm_soc_platform, op->node, |
357 | &psc_i2s->dai); | 357 | &psc_dma->dai); |
358 | 358 | ||
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | static int __devexit psc_i2s_of_remove(struct of_device *op) | 362 | static int __devexit psc_i2s_of_remove(struct of_device *op) |
363 | { | 363 | { |
364 | struct psc_i2s *psc_i2s = dev_get_drvdata(&op->dev); | 364 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); |
365 | 365 | ||
366 | dev_dbg(&op->dev, "psc_i2s_remove()\n"); | 366 | dev_dbg(&op->dev, "psc_i2s_remove()\n"); |
367 | 367 | ||
368 | snd_soc_unregister_platform(&psc_i2s_pcm_soc_platform); | 368 | snd_soc_unregister_platform(&psc_dma_pcm_soc_platform); |
369 | 369 | ||
370 | bcom_gen_bd_rx_release(psc_i2s->capture.bcom_task); | 370 | bcom_gen_bd_rx_release(psc_dma->capture.bcom_task); |
371 | bcom_gen_bd_tx_release(psc_i2s->playback.bcom_task); | 371 | bcom_gen_bd_tx_release(psc_dma->playback.bcom_task); |
372 | 372 | ||
373 | iounmap(psc_i2s->psc_regs); | 373 | iounmap(psc_dma->psc_regs); |
374 | iounmap(psc_i2s->fifo_regs); | 374 | iounmap(psc_dma->fifo_regs); |
375 | kfree(psc_i2s); | 375 | kfree(psc_dma); |
376 | dev_set_drvdata(&op->dev, NULL); | 376 | dev_set_drvdata(&op->dev, NULL); |
377 | 377 | ||
378 | return 0; | 378 | return 0; |