[alsa-devel] [PATCH] ASoC: dmic codec: Support for DT

Peter Ujfalusi peter.ujfalusi at ti.com
Tue May 8 13:55:57 CEST 2012


Add bindings to be able to probe the dmic codec driver via device tree.
The device tree entry of a machine driver can use phandle to provide
the device node for it's dai link structure.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
---
 .../devicetree/bindings/sound/dmic-codec.txt       |   18 ++++++++++++++++++
 sound/soc/codecs/dmic.c                            |    6 ++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/dmic-codec.txt

diff --git a/Documentation/devicetree/bindings/sound/dmic-codec.txt b/Documentation/devicetree/bindings/sound/dmic-codec.txt
new file mode 100644
index 0000000..f23f2e3
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/dmic-codec.txt
@@ -0,0 +1,18 @@
+Generic platform independent codec driver to represent digital microphones
+
+The dmic codec driver basically a dummy driver which exports the needed hooks
+to be used with digital microphone interfaces.
+
+Required properties:
+- compatible : Must be "generic,dmic-codec";
+
+Example:
+
+dmic_codec: dmic_codec at 0 { /* generic DMIC codec */
+	compatible = "generic,dmic-codec";
+};
+
+sound { /* ASoC machine dirver */
+	...
+	dai-link,codec = <&dmic_codec>;
+};
diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
index 3e929f0..90e92f5 100644
--- a/sound/soc/codecs/dmic.c
+++ b/sound/soc/codecs/dmic.c
@@ -78,12 +78,18 @@ static int __devexit dmic_dev_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id dmic_of_match[] = {
+	{.compatible = "generic,dmic-codec", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, dmic_of_match);
 MODULE_ALIAS("platform:dmic-codec");
 
 static struct platform_driver dmic_driver = {
 	.driver = {
 		.name = "dmic-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = dmic_of_match,
 	},
 	.probe = dmic_dev_probe,
 	.remove = __devexit_p(dmic_dev_remove),
-- 
1.7.8.6



More information about the Alsa-devel mailing list