aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>2012-10-03 06:46:57 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-04 13:50:36 -0400
commitb764de2d8bafff3a52aa6ee66cedf435486974f4 (patch)
tree7f0713d5ab53f7df3c25bfe0f05a2a3d78b4b945 /sound
parent68214d998a2e3102854cf10ebe505243035702fc (diff)
ASoC: ams-delta: Convert to use snd_soc_register_card()
The old method of registering with the ASoC core by creating a "soc-audio" platform device no longer works for Amstrad Delta sound card after recent changes to drvdata handling (commit 0998d0631001288a5974afc0b2a5f568bcdecb4d, 'device-core: Ensure drvdata = NULL when no driver is bound'. Use snd_soc_register_card() method instead, as suggested by the ASoC core generated warning message, and move both the card and codec platform device registration to the arch board file where those belong. Created and tested against linux-3.6-rc5. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-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 7d4fa8ed669..7b18b748c17 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);