aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/omap/sdp4430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r--sound/soc/omap/sdp4430.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index b80efb02bfc..8a7085b75f0 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -180,44 +180,57 @@ static struct snd_soc_card snd_soc_sdp4430 = {
.num_links = 1,
};
-static struct platform_device *sdp4430_snd_device;
-
-static int __init sdp4430_soc_init(void)
+static int __devinit sdp4430_soc_probe(struct platform_device *pdev)
{
+ struct snd_soc_card *card = &snd_soc_sdp4430;
int ret;
- if (!machine_is_omap_4430sdp())
- return -ENODEV;
- printk(KERN_INFO "SDP4430 SoC init\n");
+ pr_info("SDP4430 SoC init\n");
+
+ card->dev = &pdev->dev;
- sdp4430_snd_device = platform_device_alloc("soc-audio", -1);
- if (!sdp4430_snd_device) {
- printk(KERN_ERR "Platform device allocation failed\n");
- return -ENOMEM;
+ 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(sdp4430_snd_device, &snd_soc_sdp4430);
+ return 0;
+}
- ret = platform_device_add(sdp4430_snd_device);
- if (ret)
- goto err;
+static int __devexit sdp4430_soc_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
return 0;
+}
-err:
- printk(KERN_ERR "Unable to add platform device\n");
- platform_device_put(sdp4430_snd_device);
- return ret;
+static struct platform_driver sdp4430_driver = {
+ .driver = {
+ .name = "sdp4430-soc-audio",
+ .owner = THIS_MODULE,
+ },
+
+ .probe = sdp4430_soc_probe,
+ .remove = __devexit_p(sdp4430_soc_remove),
+};
+
+static int __init sdp4430_soc_init(void)
+{
+ return platform_driver_register(&sdp4430_driver);
}
module_init(sdp4430_soc_init);
static void __exit sdp4430_soc_exit(void)
{
- platform_device_unregister(sdp4430_snd_device);
+ platform_driver_unregister(&sdp4430_driver);
}
module_exit(sdp4430_soc_exit);
MODULE_AUTHOR("Misael Lopez Cruz <x0052729@ti.com>");
MODULE_DESCRIPTION("ALSA SoC SDP4430");
MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("platform:sdp4430-soc-audio");