diff options
Diffstat (limited to 'sound/soc/fsl/mpc5200_psc_ac97.c')
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_ac97.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index a9560235daee..40acc8e2b1ca 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
@@ -143,7 +143,7 @@ static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream, | |||
143 | struct snd_pcm_hw_params *params, | 143 | struct snd_pcm_hw_params *params, |
144 | struct snd_soc_dai *cpu_dai) | 144 | struct snd_soc_dai *cpu_dai) |
145 | { | 145 | { |
146 | struct psc_dma *psc_dma = cpu_dai->private_data; | 146 | struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(cpu_dai); |
147 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); | 147 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); |
148 | 148 | ||
149 | dev_dbg(psc_dma->dev, "%s(substream=%p) p_size=%i p_bytes=%i" | 149 | dev_dbg(psc_dma->dev, "%s(substream=%p) p_size=%i p_bytes=%i" |
@@ -166,7 +166,7 @@ static int psc_ac97_hw_digital_params(struct snd_pcm_substream *substream, | |||
166 | struct snd_pcm_hw_params *params, | 166 | struct snd_pcm_hw_params *params, |
167 | struct snd_soc_dai *cpu_dai) | 167 | struct snd_soc_dai *cpu_dai) |
168 | { | 168 | { |
169 | struct psc_dma *psc_dma = cpu_dai->private_data; | 169 | struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(cpu_dai); |
170 | 170 | ||
171 | dev_dbg(psc_dma->dev, "%s(substream=%p)\n", __func__, substream); | 171 | dev_dbg(psc_dma->dev, "%s(substream=%p)\n", __func__, substream); |
172 | 172 | ||
@@ -181,8 +181,7 @@ static int psc_ac97_hw_digital_params(struct snd_pcm_substream *substream, | |||
181 | static int psc_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | 181 | static int psc_ac97_trigger(struct snd_pcm_substream *substream, int cmd, |
182 | struct snd_soc_dai *dai) | 182 | struct snd_soc_dai *dai) |
183 | { | 183 | { |
184 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 184 | struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(dai); |
185 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; | ||
186 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); | 185 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); |
187 | 186 | ||
188 | switch (cmd) { | 187 | switch (cmd) { |
@@ -207,10 +206,9 @@ static int psc_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
207 | return 0; | 206 | return 0; |
208 | } | 207 | } |
209 | 208 | ||
210 | static int psc_ac97_probe(struct platform_device *pdev, | 209 | static int psc_ac97_probe(struct snd_soc_dai *cpu_dai) |
211 | struct snd_soc_dai *cpu_dai) | ||
212 | { | 210 | { |
213 | struct psc_dma *psc_dma = cpu_dai->private_data; | 211 | struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(cpu_dai); |
214 | struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; | 212 | struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; |
215 | 213 | ||
216 | /* Go */ | 214 | /* Go */ |
@@ -237,9 +235,8 @@ static struct snd_soc_dai_ops psc_ac97_digital_ops = { | |||
237 | .hw_params = psc_ac97_hw_digital_params, | 235 | .hw_params = psc_ac97_hw_digital_params, |
238 | }; | 236 | }; |
239 | 237 | ||
240 | struct snd_soc_dai psc_ac97_dai[] = { | 238 | static struct snd_soc_dai_driver psc_ac97_dai[] = { |
241 | { | 239 | { |
242 | .name = "AC97", | ||
243 | .ac97_control = 1, | 240 | .ac97_control = 1, |
244 | .probe = psc_ac97_probe, | 241 | .probe = psc_ac97_probe, |
245 | .playback = { | 242 | .playback = { |
@@ -257,7 +254,6 @@ struct snd_soc_dai psc_ac97_dai[] = { | |||
257 | .ops = &psc_ac97_analog_ops, | 254 | .ops = &psc_ac97_analog_ops, |
258 | }, | 255 | }, |
259 | { | 256 | { |
260 | .name = "SPDIF", | ||
261 | .ac97_control = 1, | 257 | .ac97_control = 1, |
262 | .playback = { | 258 | .playback = { |
263 | .channels_min = 1, | 259 | .channels_min = 1, |
@@ -268,7 +264,6 @@ struct snd_soc_dai psc_ac97_dai[] = { | |||
268 | }, | 264 | }, |
269 | .ops = &psc_ac97_digital_ops, | 265 | .ops = &psc_ac97_digital_ops, |
270 | } }; | 266 | } }; |
271 | EXPORT_SYMBOL_GPL(psc_ac97_dai); | ||
272 | 267 | ||
273 | 268 | ||
274 | 269 | ||
@@ -280,18 +275,11 @@ EXPORT_SYMBOL_GPL(psc_ac97_dai); | |||
280 | static int __devinit psc_ac97_of_probe(struct platform_device *op, | 275 | static int __devinit psc_ac97_of_probe(struct platform_device *op, |
281 | const struct of_device_id *match) | 276 | const struct of_device_id *match) |
282 | { | 277 | { |
283 | int rc, i; | 278 | int rc; |
284 | struct snd_ac97 ac97; | 279 | struct snd_ac97 ac97; |
285 | struct mpc52xx_psc __iomem *regs; | 280 | struct mpc52xx_psc __iomem *regs; |
286 | 281 | ||
287 | rc = mpc5200_audio_dma_create(op); | 282 | rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); |
288 | if (rc != 0) | ||
289 | return rc; | ||
290 | |||
291 | for (i = 0; i < ARRAY_SIZE(psc_ac97_dai); i++) | ||
292 | psc_ac97_dai[i].dev = &op->dev; | ||
293 | |||
294 | rc = snd_soc_register_dais(psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); | ||
295 | if (rc != 0) { | 283 | if (rc != 0) { |
296 | dev_err(&op->dev, "Failed to register DAI\n"); | 284 | dev_err(&op->dev, "Failed to register DAI\n"); |
297 | return rc; | 285 | return rc; |
@@ -301,9 +289,6 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op, | |||
301 | regs = psc_dma->psc_regs; | 289 | regs = psc_dma->psc_regs; |
302 | ac97.private_data = psc_dma; | 290 | ac97.private_data = psc_dma; |
303 | 291 | ||
304 | for (i = 0; i < ARRAY_SIZE(psc_ac97_dai); i++) | ||
305 | psc_ac97_dai[i].private_data = psc_dma; | ||
306 | |||
307 | psc_dma->imr = 0; | 292 | psc_dma->imr = 0; |
308 | out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr); | 293 | out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr); |
309 | 294 | ||
@@ -319,7 +304,8 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op, | |||
319 | 304 | ||
320 | static int __devexit psc_ac97_of_remove(struct platform_device *op) | 305 | static int __devexit psc_ac97_of_remove(struct platform_device *op) |
321 | { | 306 | { |
322 | return mpc5200_audio_dma_destroy(op); | 307 | snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai)); |
308 | return 0; | ||
323 | } | 309 | } |
324 | 310 | ||
325 | /* Match table for of_platform binding */ | 311 | /* Match table for of_platform binding */ |