aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/omap/omap3beagle.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/omap3beagle.c')
-rw-r--r--sound/soc/omap/omap3beagle.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c
index 40db813c079..46594a450e0 100644
--- a/sound/soc/omap/omap3beagle.c
+++ b/sound/soc/omap/omap3beagle.c
@@ -105,45 +105,57 @@ static struct snd_soc_card snd_soc_omap3beagle = {
.num_links = 1,
};
-static struct platform_device *omap3beagle_snd_device;
-
-static int __init omap3beagle_soc_init(void)
+static int __devinit omap3beagle_soc_probe(struct platform_device *pdev)
{
+ struct snd_soc_card *card = &snd_soc_omap3beagle;
int ret;
- if (!(machine_is_omap3_beagle() || machine_is_devkit8000()))
- return -ENODEV;
pr_info("OMAP3 Beagle/Devkit8000 SoC init\n");
- omap3beagle_snd_device = platform_device_alloc("soc-audio", -1);
- if (!omap3beagle_snd_device) {
- printk(KERN_ERR "Platform device allocation failed\n");
- return -ENOMEM;
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+ if (ret) {
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
+ ret);
+ return ret;
}
- platform_set_drvdata(omap3beagle_snd_device, &snd_soc_omap3beagle);
+ return 0;
+}
+
+static int __devexit omap3beagle_soc_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
- ret = platform_device_add(omap3beagle_snd_device);
- if (ret)
- goto err1;
+ snd_soc_unregister_card(card);
return 0;
+}
+
+static struct platform_driver omap3beagle_driver = {
+ .driver = {
+ .name = "omap3beagle-soc-audio",
+ .owner = THIS_MODULE,
+ },
-err1:
- printk(KERN_ERR "Unable to add platform device\n");
- platform_device_put(omap3beagle_snd_device);
+ .probe = omap3beagle_soc_probe,
+ .remove = __devexit_p(omap3beagle_soc_remove),
+};
- return ret;
+static int __init omap3beagle_soc_init(void)
+{
+ return platform_driver_register(&omap3beagle_driver);
}
+module_init(omap3beagle_soc_init);
static void __exit omap3beagle_soc_exit(void)
{
- platform_device_unregister(omap3beagle_snd_device);
+ platform_driver_unregister(&omap3beagle_driver);
}
-
-module_init(omap3beagle_soc_init);
module_exit(omap3beagle_soc_exit);
MODULE_AUTHOR("Steve Sakoman <steve@sakoman.com>");
MODULE_DESCRIPTION("ALSA SoC OMAP3 Beagle");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:omap3beagle-soc-audio");