diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-12-29 20:16:11 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-29 21:00:06 -0500 |
commit | 2445ecc3c036ae5f1cc0c3dfed4731d9519a3811 (patch) | |
tree | 2933161346e760b1052cb92227c5f47b485ea734 | |
parent | 1b39bf3468e03016ffdcadef3dac1fd75d2db6fa (diff) |
ASoC: pxa: Convert poodle to use snd_soc_register_card()
Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 6 | ||||
-rw-r--r-- | sound/soc/pxa/poodle.c | 42 |
2 files changed, 29 insertions, 19 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 50c833177866..bd5682a31f34 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -158,6 +158,11 @@ static struct scoop_pcmcia_config poodle_pcmcia_config = { | |||
158 | EXPORT_SYMBOL(poodle_scoop_device); | 158 | EXPORT_SYMBOL(poodle_scoop_device); |
159 | 159 | ||
160 | 160 | ||
161 | static struct platform_device poodle_audio_device = { | ||
162 | .name = "poodle-audio", | ||
163 | .id = -1, | ||
164 | }; | ||
165 | |||
161 | /* LoCoMo device */ | 166 | /* LoCoMo device */ |
162 | static struct resource locomo_resources[] = { | 167 | static struct resource locomo_resources[] = { |
163 | [0] = { | 168 | [0] = { |
@@ -407,6 +412,7 @@ static struct platform_device sharpsl_rom_device = { | |||
407 | static struct platform_device *devices[] __initdata = { | 412 | static struct platform_device *devices[] __initdata = { |
408 | &poodle_locomo_device, | 413 | &poodle_locomo_device, |
409 | &poodle_scoop_device, | 414 | &poodle_scoop_device, |
415 | &poodle_audio_device, | ||
410 | &sharpsl_nand_device, | 416 | &sharpsl_nand_device, |
411 | &sharpsl_rom_device, | 417 | &sharpsl_rom_device, |
412 | }; | 418 | }; |
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 4c29bc1f9cfe..c9e24bf51763 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
@@ -281,22 +281,18 @@ static struct snd_soc_dai_link poodle_dai = { | |||
281 | }; | 281 | }; |
282 | 282 | ||
283 | /* poodle audio machine driver */ | 283 | /* poodle audio machine driver */ |
284 | static struct snd_soc_card snd_soc_poodle = { | 284 | static struct snd_soc_card poodle = { |
285 | .name = "Poodle", | 285 | .name = "Poodle", |
286 | .dai_link = &poodle_dai, | 286 | .dai_link = &poodle_dai, |
287 | .num_links = 1, | 287 | .num_links = 1, |
288 | .owner = THIS_MODULE, | 288 | .owner = THIS_MODULE, |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static struct platform_device *poodle_snd_device; | 291 | static int __devinit poodle_probe(struct platform_device *pdev) |
292 | |||
293 | static int __init poodle_init(void) | ||
294 | { | 292 | { |
293 | struct snd_soc_card *card = &poodle; | ||
295 | int ret; | 294 | int ret; |
296 | 295 | ||
297 | if (!machine_is_poodle()) | ||
298 | return -ENODEV; | ||
299 | |||
300 | locomo_gpio_set_dir(&poodle_locomo_device.dev, | 296 | locomo_gpio_set_dir(&poodle_locomo_device.dev, |
301 | POODLE_LOCOMO_GPIO_AMP_ON, 0); | 297 | POODLE_LOCOMO_GPIO_AMP_ON, 0); |
302 | /* should we mute HP at startup - burning power ?*/ | 298 | /* should we mute HP at startup - burning power ?*/ |
@@ -305,28 +301,36 @@ static int __init poodle_init(void) | |||
305 | locomo_gpio_set_dir(&poodle_locomo_device.dev, | 301 | locomo_gpio_set_dir(&poodle_locomo_device.dev, |
306 | POODLE_LOCOMO_GPIO_MUTE_R, 0); | 302 | POODLE_LOCOMO_GPIO_MUTE_R, 0); |
307 | 303 | ||
308 | poodle_snd_device = platform_device_alloc("soc-audio", -1); | 304 | card->dev = &pdev->dev; |
309 | if (!poodle_snd_device) | ||
310 | return -ENOMEM; | ||
311 | |||
312 | platform_set_drvdata(poodle_snd_device, &snd_soc_poodle); | ||
313 | ret = platform_device_add(poodle_snd_device); | ||
314 | 305 | ||
306 | ret = snd_soc_register_card(card); | ||
315 | if (ret) | 307 | if (ret) |
316 | platform_device_put(poodle_snd_device); | 308 | dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", |
317 | 309 | ret); | |
318 | return ret; | 310 | return ret; |
319 | } | 311 | } |
320 | 312 | ||
321 | static void __exit poodle_exit(void) | 313 | static int __devexit poodle_remove(struct platform_device *pdev) |
322 | { | 314 | { |
323 | platform_device_unregister(poodle_snd_device); | 315 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
316 | |||
317 | snd_soc_unregister_card(card); | ||
318 | return 0; | ||
324 | } | 319 | } |
325 | 320 | ||
326 | module_init(poodle_init); | 321 | static struct platform_driver poodle_driver = { |
327 | module_exit(poodle_exit); | 322 | .driver = { |
323 | .name = "poodle-audio", | ||
324 | .owner = THIS_MODULE, | ||
325 | }, | ||
326 | .probe = poodle_probe, | ||
327 | .remove = __devexit_p(poodle_remove), | ||
328 | }; | ||
329 | |||
330 | module_platform_driver(poodle_driver); | ||
328 | 331 | ||
329 | /* Module information */ | 332 | /* Module information */ |
330 | MODULE_AUTHOR("Richard Purdie"); | 333 | MODULE_AUTHOR("Richard Purdie"); |
331 | MODULE_DESCRIPTION("ALSA SoC Poodle"); | 334 | MODULE_DESCRIPTION("ALSA SoC Poodle"); |
332 | MODULE_LICENSE("GPL"); | 335 | MODULE_LICENSE("GPL"); |
336 | MODULE_ALIAS("platform:poodle-audio"); | ||