[alsa-devel] [PATCH 8/8] ASoC: add snd-soc-dummy DT support

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Aug 20 09:13:08 CEST 2014


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

This patch adds snd-soc-dummy DT binding support.
It removes .stream_name from dummy_dai,
because "Playback" / "Capture" is very popular naming.

The DAPM will lost correct route settings
if other CPU/Codec was using same stream name.
And it will be problem when DPCM case.
Like below

FE CPU   (rsnd):   "DAI0 Playback"
   Codec (dummy):  "Playback"

BE CPU   (dummy):  "Playback"
   Codec (ak4642): "Playback"

simple-audio-card,routing = "Playback", "DAI0 Playback";

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 .../devicetree/bindings/sound/snd-soc-dummy        |   13 +++++++++++++
 sound/soc/soc-utils.c                              |   12 +++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/snd-soc-dummy

diff --git a/Documentation/devicetree/bindings/sound/snd-soc-dummy b/Documentation/devicetree/bindings/sound/snd-soc-dummy
new file mode 100644
index 0000000..ea3fe0c
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/snd-soc-dummy
@@ -0,0 +1,13 @@
+snd-soc-dummy:
+
+ALSA SoC dummy codec.
+
+Required properties:
+
+  - compatible : "alsa-soc-dummy"
+
+Example:
+
+sound_dummy {
+	compatible = "alsa-soc-dummy";
+};
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 7f22ca3..df11010 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -12,7 +12,8 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
-
+#include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/export.h>
 #include <sound/core.h>
@@ -104,14 +105,12 @@ static struct snd_soc_codec_driver dummy_codec;
 static struct snd_soc_dai_driver dummy_dai = {
 	.name = "snd-soc-dummy-dai",
 	.playback = {
-		.stream_name	= "Playback",
 		.channels_min	= 1,
 		.channels_max	= 384,
 		.rates		= STUB_RATES,
 		.formats	= STUB_FORMATS,
 	},
 	.capture = {
-		.stream_name	= "Capture",
 		.channels_min	= 1,
 		.channels_max	= 384,
 		.rates = STUB_RATES,
@@ -151,10 +150,17 @@ static int snd_soc_dummy_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct of_device_id soc_dummy_of_match[] = {
+	{ .compatible = "alsa-soc-dummy" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, soc_dummy_of_match);
+
 static struct platform_driver soc_dummy_driver = {
 	.driver = {
 		.name = "snd-soc-dummy",
 		.owner = THIS_MODULE,
+		.of_match_table = soc_dummy_of_match,
 	},
 	.probe = snd_soc_dummy_probe,
 	.remove = snd_soc_dummy_remove,
-- 
1.7.9.5



More information about the Alsa-devel mailing list