diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2011-07-25 07:45:03 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-27 14:16:47 -0400 |
commit | adbc7a5a61ee9225e0b80d3f5719e05a88db2b4c (patch) | |
tree | 103e02cb906e41aae0cd1610064b74259c229e8b | |
parent | 5b0912be7a8ff1dbfe56358c5f933d65445bb8af (diff) |
ASoC: au1x: update db1200 machine to the new way of things
The use of the "soc-audio" platform device is no longer en vogue,
update the code to the newer, simpler way of doing things.
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | arch/mips/alchemy/devboards/db1200/platform.c | 10 | ||||
-rw-r--r-- | sound/soc/au1x/db1200.c | 64 |
2 files changed, 53 insertions, 21 deletions
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c index cfb71aed4cb9..dda090bf74e6 100644 --- a/arch/mips/alchemy/devboards/db1200/platform.c +++ b/arch/mips/alchemy/devboards/db1200/platform.c | |||
@@ -422,6 +422,7 @@ static struct resource au1200_psc1_res[] = { | |||
422 | }, | 422 | }, |
423 | }; | 423 | }; |
424 | 424 | ||
425 | /* AC97 or I2S device */ | ||
425 | static struct platform_device db1200_audio_dev = { | 426 | static struct platform_device db1200_audio_dev = { |
426 | /* name assigned later based on switch setting */ | 427 | /* name assigned later based on switch setting */ |
427 | .id = 1, /* PSC ID */ | 428 | .id = 1, /* PSC ID */ |
@@ -429,6 +430,12 @@ static struct platform_device db1200_audio_dev = { | |||
429 | .resource = au1200_psc1_res, | 430 | .resource = au1200_psc1_res, |
430 | }; | 431 | }; |
431 | 432 | ||
433 | /* DB1200 ASoC card device */ | ||
434 | static struct platform_device db1200_sound_dev = { | ||
435 | /* name assigned later based on switch setting */ | ||
436 | .id = 1, /* PSC ID */ | ||
437 | }; | ||
438 | |||
432 | static struct platform_device db1200_stac_dev = { | 439 | static struct platform_device db1200_stac_dev = { |
433 | .name = "ac97-codec", | 440 | .name = "ac97-codec", |
434 | .id = 1, /* on PSC1 */ | 441 | .id = 1, /* on PSC1 */ |
@@ -448,6 +455,7 @@ static struct platform_device *db1200_devs[] __initdata = { | |||
448 | &db1200_audiodma_dev, | 455 | &db1200_audiodma_dev, |
449 | &db1200_audio_dev, | 456 | &db1200_audio_dev, |
450 | &db1200_stac_dev, | 457 | &db1200_stac_dev, |
458 | &db1200_sound_dev, | ||
451 | }; | 459 | }; |
452 | 460 | ||
453 | static int __init db1200_dev_init(void) | 461 | static int __init db1200_dev_init(void) |
@@ -507,10 +515,12 @@ static int __init db1200_dev_init(void) | |||
507 | if (sw == BCSR_SWITCHES_DIP_8) { | 515 | if (sw == BCSR_SWITCHES_DIP_8) { |
508 | bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX); | 516 | bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX); |
509 | db1200_audio_dev.name = "au1xpsc_i2s"; | 517 | db1200_audio_dev.name = "au1xpsc_i2s"; |
518 | db1200_sound_dev.name = "db1200-i2s"; | ||
510 | printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n"); | 519 | printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n"); |
511 | } else { | 520 | } else { |
512 | bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0); | 521 | bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0); |
513 | db1200_audio_dev.name = "au1xpsc_ac97"; | 522 | db1200_audio_dev.name = "au1xpsc_ac97"; |
523 | db1200_sound_dev.name = "db1200-ac97"; | ||
514 | printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n"); | 524 | printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n"); |
515 | } | 525 | } |
516 | 526 | ||
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c index 1d3e258c9ea8..289312c14b99 100644 --- a/sound/soc/au1x/db1200.c +++ b/sound/soc/au1x/db1200.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DB1200 ASoC audio fabric support code. | 2 | * DB1200 ASoC audio fabric support code. |
3 | * | 3 | * |
4 | * (c) 2008-9 Manuel Lauss <manuel.lauss@gmail.com> | 4 | * (c) 2008-2011 Manuel Lauss <manuel.lauss@googlemail.com> |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
@@ -21,6 +21,17 @@ | |||
21 | #include "../codecs/wm8731.h" | 21 | #include "../codecs/wm8731.h" |
22 | #include "psc.h" | 22 | #include "psc.h" |
23 | 23 | ||
24 | static struct platform_device_id db1200_pids[] = { | ||
25 | { | ||
26 | .name = "db1200-ac97", | ||
27 | .driver_data = 0, | ||
28 | }, { | ||
29 | .name = "db1200-i2s", | ||
30 | .driver_data = 1, | ||
31 | }, | ||
32 | {}, | ||
33 | }; | ||
34 | |||
24 | /*------------------------- AC97 PART ---------------------------*/ | 35 | /*------------------------- AC97 PART ---------------------------*/ |
25 | 36 | ||
26 | static struct snd_soc_dai_link db1200_ac97_dai = { | 37 | static struct snd_soc_dai_link db1200_ac97_dai = { |
@@ -89,36 +100,47 @@ static struct snd_soc_card db1200_i2s_machine = { | |||
89 | 100 | ||
90 | /*------------------------- COMMON PART ---------------------------*/ | 101 | /*------------------------- COMMON PART ---------------------------*/ |
91 | 102 | ||
92 | static struct platform_device *db1200_asoc_dev; | 103 | static struct snd_soc_card *db1200_cards[] __devinitdata = { |
104 | &db1200_ac97_machine, | ||
105 | &db1200_i2s_machine, | ||
106 | }; | ||
93 | 107 | ||
94 | static int __init db1200_audio_load(void) | 108 | static int __devinit db1200_audio_probe(struct platform_device *pdev) |
95 | { | 109 | { |
96 | int ret; | 110 | const struct platform_device_id *pid = platform_get_device_id(pdev); |
111 | struct snd_soc_card *card; | ||
97 | 112 | ||
98 | ret = -ENOMEM; | 113 | card = db1200_cards[pid->driver_data]; |
99 | db1200_asoc_dev = platform_device_alloc("soc-audio", 1); /* PSC1 */ | 114 | card->dev = &pdev->dev; |
100 | if (!db1200_asoc_dev) | 115 | return snd_soc_register_card(card); |
101 | goto out; | 116 | } |
102 | 117 | ||
103 | /* DB1200 board setup set PSC1MUX to preferred audio device */ | 118 | static int __devexit db1200_audio_remove(struct platform_device *pdev) |
104 | if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX) | 119 | { |
105 | platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_machine); | 120 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
106 | else | 121 | snd_soc_unregister_card(card); |
107 | platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_machine); | 122 | return 0; |
123 | } | ||
108 | 124 | ||
109 | ret = platform_device_add(db1200_asoc_dev); | 125 | static struct platform_driver db1200_audio_driver = { |
126 | .driver = { | ||
127 | .name = "db1200-ac97", | ||
128 | .owner = THIS_MODULE, | ||
129 | .pm = &snd_soc_pm_ops, | ||
130 | }, | ||
131 | .id_table = db1200_pids, | ||
132 | .probe = db1200_audio_probe, | ||
133 | .remove = __devexit_p(db1200_audio_remove), | ||
134 | }; | ||
110 | 135 | ||
111 | if (ret) { | 136 | static int __init db1200_audio_load(void) |
112 | platform_device_put(db1200_asoc_dev); | 137 | { |
113 | db1200_asoc_dev = NULL; | 138 | return platform_driver_register(&db1200_audio_driver); |
114 | } | ||
115 | out: | ||
116 | return ret; | ||
117 | } | 139 | } |
118 | 140 | ||
119 | static void __exit db1200_audio_unload(void) | 141 | static void __exit db1200_audio_unload(void) |
120 | { | 142 | { |
121 | platform_device_unregister(db1200_asoc_dev); | 143 | platform_driver_unregister(&db1200_audio_driver); |
122 | } | 144 | } |
123 | 145 | ||
124 | module_init(db1200_audio_load); | 146 | module_init(db1200_audio_load); |