aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/ams-delta.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/ams-delta.c')
-rw-r--r--sound/soc/omap/ams-delta.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index dc0ee7626626..d8e96b2cd03e 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -575,56 +575,53 @@ static struct snd_soc_card ams_delta_audio_card = {
575}; 575};
576 576
577/* Module init/exit */ 577/* Module init/exit */
578static struct platform_device *ams_delta_audio_platform_device; 578static __devinit int ams_delta_probe(struct platform_device *pdev)
579static struct platform_device *cx20442_platform_device;
580
581static int __init ams_delta_module_init(void)
582{ 579{
580 struct snd_soc_card *card = &ams_delta_audio_card;
583 int ret; 581 int ret;
584 582
585 if (!(machine_is_ams_delta())) 583 card->dev = &pdev->dev;
586 return -ENODEV;
587
588 ams_delta_audio_platform_device =
589 platform_device_alloc("soc-audio", -1);
590 if (!ams_delta_audio_platform_device)
591 return -ENOMEM;
592 584
593 platform_set_drvdata(ams_delta_audio_platform_device, 585 ret = snd_soc_register_card(card);
594 &ams_delta_audio_card); 586 if (ret) {
595 587 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
596 ret = platform_device_add(ams_delta_audio_platform_device); 588 card->dev = NULL;
597 if (ret) 589 return ret;
598 goto err; 590 }
599
600 /*
601 * Codec platform device could be registered from elsewhere (board?),
602 * but I do it here as it makes sense only if used with the card.
603 */
604 cx20442_platform_device =
605 platform_device_register_simple("cx20442-codec", -1, NULL, 0);
606 return 0; 591 return 0;
607err:
608 platform_device_put(ams_delta_audio_platform_device);
609 return ret;
610} 592}
611late_initcall(ams_delta_module_init);
612 593
613static void __exit ams_delta_module_exit(void) 594static int __devexit ams_delta_remove(struct platform_device *pdev)
614{ 595{
596 struct snd_soc_card *card = platform_get_drvdata(pdev);
597
615 if (tty_unregister_ldisc(N_V253) != 0) 598 if (tty_unregister_ldisc(N_V253) != 0)
616 dev_warn(&ams_delta_audio_platform_device->dev, 599 dev_warn(&pdev->dev,
617 "failed to unregister V253 line discipline\n"); 600 "failed to unregister V253 line discipline\n");
618 601
619 snd_soc_jack_free_gpios(&ams_delta_hook_switch, 602 snd_soc_jack_free_gpios(&ams_delta_hook_switch,
620 ARRAY_SIZE(ams_delta_hook_switch_gpios), 603 ARRAY_SIZE(ams_delta_hook_switch_gpios),
621 ams_delta_hook_switch_gpios); 604 ams_delta_hook_switch_gpios);
622 605
623 platform_device_unregister(cx20442_platform_device); 606 snd_soc_unregister_card(card);
624 platform_device_unregister(ams_delta_audio_platform_device); 607 card->dev = NULL;
608 return 0;
625} 609}
626module_exit(ams_delta_module_exit); 610
611#define DRV_NAME "ams-delta-audio"
612
613static struct platform_driver ams_delta_driver = {
614 .driver = {
615 .name = DRV_NAME,
616 .owner = THIS_MODULE,
617 },
618 .probe = ams_delta_probe,
619 .remove = __devexit_p(ams_delta_remove),
620};
621
622module_platform_driver(ams_delta_driver);
627 623
628MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>"); 624MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
629MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone"); 625MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone");
630MODULE_LICENSE("GPL"); 626MODULE_LICENSE("GPL");
627MODULE_ALIAS("platform:" DRV_NAME);