diff mbox

[4/4] ASoC: simple-card: probe both sound-dai and remote-endpoint

Message ID 87vb3kvj7i.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto April 14, 2016, 5:48 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current simple-card can probe "sound-dai" base connection on DT.
OTOH, V4L2 soc is using graph base connection. Because of this
different style, DT will be confusable if it support both
video/sound in same time.

This patch enables both "sound-dai" (= current simple-card style)
and "remote-endpoint" (= current V4L2 style) on simple-card.

	sound {
		compatible = "simple-audio-card";
		...
		sndcpu: simple-audio-card,cpu {
			sound-dai = <&xxxx>;
		};
		sndcodec: simple-audio-card,codec {
			remote-endpoint = <&yyyy>;
		};
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/sound/simple-card.txt         | 19 +++++++++++++++++++
 sound/soc/generic/simple-card.c                       |  9 ++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index cf3979e..030edca 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -70,6 +70,7 @@  properties should also be placed in the codec node if needed.
 Required CPU/CODEC subnodes properties:
 
 - sound-dai				: phandle and port of CPU/CODEC
+- remote-endpoint			: graph endpoint of CPU/CODEC
 
 Optional CPU/CODEC subnodes properties:
 
@@ -162,3 +163,21 @@  sound {
 		};
 	};
 };
+
+Example 3 - sound-dai and remote-endpoint
+
+rsnd_ak4613: sound {
+	compatible = "simple-audio-card";
+
+	simple-audio-card,name = "R-Sound";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,bitclock-master = <&sndcpu>;
+	simple-audio-card,frame-master = <&sndcpu>;
+
+	sndcpu: simple-audio-card,cpu {
+		sound-dai = <&rcar_sound 1>;
+	};
+	sndcodec: simple-audio-card,codec {
+		remote-endpoint = <&du_out_hdmi0>;
+	};
+};
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2389ab4..a1d6001 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -14,6 +14,7 @@ 
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
+#include <linux/of_graph.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
 #include <sound/jack.h>
@@ -224,11 +225,13 @@  asoc_simple_card_sub_parse_of(struct device_node *np,
 	int ret;
 
 	/*
-	 * Get node via "sound-dai = <&phandle port>"
+	 * Get node via
+	 *	sound-dai = <&phandle port>
+	 * or
+	 *	remote-endpoint = <&phandle>
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
 	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
+	ret = of_parse_snd_soc_connection_with_args(np, &args);
 	if (ret)
 		return ret;