[PATCH] ASoC: snd-soc-dummy: add Device Tree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Support for loading the snd-soc-dummy via DeviceTree.
This is useful to create dummy codec devices where we need to have some
DAI links without a real Codec.

Signed-off-by: Judy Hsiao <judyhsiao@xxxxxxxxxxxx>
---
 .../devicetree/bindings/sound/snd-soc-dummy.txt  | 16 ++++++++++++++++
 sound/soc/soc-utils.c                            | 11 +++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/snd-soc-dummy.txt

diff --git a/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt b/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt
new file mode 100644
index 000000000000..7fa8c5751e62
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/snd-soc-dummy.txt
@@ -0,0 +1,16 @@
+* snd-soc-dummy
+
+This node models the snd-soc-dummy.
+This is useful to create dummy codec devices where we need to have
+some DAI links without a real Codec.
+
+Required properties:
+- compatible   : "asoc,snd-soc-dummy"
+
+
+Example:
+
+dummy_codec {
+	compatible = "asoc,snd-soc-dummy";
+	#sound-dai-cells = <0>;
+};
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 299b5d6ebfd1..def2cc687415 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -7,6 +7,8 @@
 // Author: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
 //         Liam Girdwood <lrg@xxxxxxxxxxxxxxx>
 
+#include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/export.h>
 #include <sound/core.h>
@@ -181,9 +183,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev)
 	return ret;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id soc_dummy_device_id[] = {
+	{ .compatible = "asoc,snd-soc-dummy" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, soc_dummy_device_id);
+#endif
+
 static struct platform_driver soc_dummy_driver = {
 	.driver = {
 		.name = "snd-soc-dummy",
+		.of_match_table = of_match_ptr(soc_dummy_device_id),
 	},
 	.probe = snd_soc_dummy_probe,
 };
-- 
2.31.0




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux