Patchwork [2/7] ASoC: allow wolfson wm9712 codec to be instantiated using device tree

login
register
mail settings
Submitter Lucas Stach
Date Dec. 19, 2012, 11:17 p.m.
Message ID <1355959056-6009-2-git-send-email-dev@lynxeye.de>
Download mbox | patch
Permalink /patch/207542/
State Not Applicable, archived
Headers show

Comments

Lucas Stach - Dec. 19, 2012, 11:17 p.m.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 sound/soc/codecs/wm9712.c | 7 +++++++
 1 Datei geändert, 7 Zeilen hinzugefügt(+)
Mark Brown - Dec. 20, 2012, 9:32 a.m.
On Thu, Dec 20, 2012 at 12:17:31AM +0100, Lucas Stach wrote:

>  static struct platform_driver wm9712_codec_driver = {
>  	.driver = {
>  		.name = "wm9712-codec",
>  		.owner = THIS_MODULE,
> +		.of_match_table = wm9712_of_match,
>  	},

No, this is really not a sane way of handling AC'97 at all.  They're not
platform devices, there is no sane reason why they should appear in the
device tree as such.  Really we ought to be just hotplugging them, AC'97
is perfectly enumerable.

Patch

diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 8e9a6a3..4050e6a 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -697,10 +697,17 @@  static int wm9712_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id wm9712_of_match[] = {
+	{ .compatible = "wlf,wm9712", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, wm9712_of_match);
+
 static struct platform_driver wm9712_codec_driver = {
 	.driver = {
 		.name = "wm9712-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = wm9712_of_match,
 	},
 
 	.probe = wm9712_probe,