aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/mpc5200_psc_ac97.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /sound/soc/fsl/mpc5200_psc_ac97.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'sound/soc/fsl/mpc5200_psc_ac97.c')
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index a9560235daee..ad36b095bb79 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,
181static int psc_ac97_trigger(struct snd_pcm_substream *substream, int cmd, 181static 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
210static int psc_ac97_probe(struct platform_device *pdev, 209static 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
240struct snd_soc_dai psc_ac97_dai[] = { 238static 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} };
271EXPORT_SYMBOL_GPL(psc_ac97_dai);
272 267
273 268
274 269
@@ -277,21 +272,13 @@ EXPORT_SYMBOL_GPL(psc_ac97_dai);
277 * - Probe/remove operations 272 * - Probe/remove operations
278 * - OF device match table 273 * - OF device match table
279 */ 274 */
280static int __devinit psc_ac97_of_probe(struct platform_device *op, 275static int __devinit psc_ac97_of_probe(struct platform_device *op)
281 const struct of_device_id *match)
282{ 276{
283 int rc, i; 277 int rc;
284 struct snd_ac97 ac97; 278 struct snd_ac97 ac97;
285 struct mpc52xx_psc __iomem *regs; 279 struct mpc52xx_psc __iomem *regs;
286 280
287 rc = mpc5200_audio_dma_create(op); 281 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) { 282 if (rc != 0) {
296 dev_err(&op->dev, "Failed to register DAI\n"); 283 dev_err(&op->dev, "Failed to register DAI\n");
297 return rc; 284 return rc;
@@ -301,9 +288,6 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op,
301 regs = psc_dma->psc_regs; 288 regs = psc_dma->psc_regs;
302 ac97.private_data = psc_dma; 289 ac97.private_data = psc_dma;
303 290
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; 291 psc_dma->imr = 0;
308 out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr); 292 out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr);
309 293
@@ -319,7 +303,8 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op,
319 303
320static int __devexit psc_ac97_of_remove(struct platform_device *op) 304static int __devexit psc_ac97_of_remove(struct platform_device *op)
321{ 305{
322 return mpc5200_audio_dma_destroy(op); 306 snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai));
307 return 0;
323} 308}
324 309
325/* Match table for of_platform binding */ 310/* Match table for of_platform binding */
@@ -330,7 +315,7 @@ static struct of_device_id psc_ac97_match[] __devinitdata = {
330}; 315};
331MODULE_DEVICE_TABLE(of, psc_ac97_match); 316MODULE_DEVICE_TABLE(of, psc_ac97_match);
332 317
333static struct of_platform_driver psc_ac97_driver = { 318static struct platform_driver psc_ac97_driver = {
334 .probe = psc_ac97_of_probe, 319 .probe = psc_ac97_of_probe,
335 .remove = __devexit_p(psc_ac97_of_remove), 320 .remove = __devexit_p(psc_ac97_of_remove),
336 .driver = { 321 .driver = {
@@ -346,13 +331,13 @@ static struct of_platform_driver psc_ac97_driver = {
346 */ 331 */
347static int __init psc_ac97_init(void) 332static int __init psc_ac97_init(void)
348{ 333{
349 return of_register_platform_driver(&psc_ac97_driver); 334 return platform_driver_register(&psc_ac97_driver);
350} 335}
351module_init(psc_ac97_init); 336module_init(psc_ac97_init);
352 337
353static void __exit psc_ac97_exit(void) 338static void __exit psc_ac97_exit(void)
354{ 339{
355 of_unregister_platform_driver(&psc_ac97_driver); 340 platform_driver_unregister(&psc_ac97_driver);
356} 341}
357module_exit(psc_ac97_exit); 342module_exit(psc_ac97_exit);
358 343