diff mbox series

[RFC,12/15] ASoC: audio-graph-card2-sample.dtsi: add Sample DT for Audio Graph Card2

Message ID 87k0mm3dji.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series ASoC: add Audio Graph Card2 driver | expand

Commit Message

Kuninori Morimoto June 22, 2021, 1:15 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Audio Graph Card2 settings is a little bit difficult for beginner,
and Customizing it also difficult/confusable too.
So, this patch adds sample for it.

You can easily use it by adding below line on your DT file,
and select CONFIGs to your .config.

	#include "../../../../../sound/soc/generic/audio-graph-card2-sample.dtsi"

	CONFIG_SND_AUDIO_GRAPH_CARD2
	CONFIG_SND_SAMPLE_CUSTOM_CARD
	CONFIG_SND_TEST_COMPONENT

This patch uses audio-graph-card2 base sample custom driver.
You can directly use audio-graph-card2 instead of custom driver
by modifing compatible.

	- compatible = "sample-custom-card";
	+ compatible = "audio-graph-card2";

Sample custom driver will indicate customized print.

Previous "audio-graph-card" and new "audio-graph-card2" doesn't
have full compatibility.
The differenct from audio-graph-card are

	- audio-graph-card2 uses "links" instead of "dais".
	- audio-graph-card2 uses flags for bitclock/frame-master
	  instead of phandle.
	- audio-graph-card2 uses .get_fmt instead of having "format"

It is using Test-Component driver for CPU/Codec.
It can indicate more detail print of each behavior if user want to.
In such case, you need to update compatible to "xxx-nv" or "xxx-vv".

	- compatible = "test-cpu";
	+ compatible = "test-cpu-nv";

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../soc/generic/audio-graph-card2-sample.dtsi | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 sound/soc/generic/audio-graph-card2-sample.dtsi
diff mbox series

Patch

diff --git a/sound/soc/generic/audio-graph-card2-sample.dtsi b/sound/soc/generic/audio-graph-card2-sample.dtsi
new file mode 100644
index 000000000000..5e83bfed1781
--- /dev/null
+++ b/sound/soc/generic/audio-graph-card2-sample.dtsi
@@ -0,0 +1,68 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * audio-graph-card2-sample dtsi
+ *
+ *
+ * This sample indicates how to use audio-graph-card2 and its
+ * custom driver. "sample-custom-card" is the custome driver
+ * which is using audio-graph-card2.
+ *
+ * You can easily use this sample by adding below line on your DT file,
+ * and add new CONFIG to your .config.
+ *
+ *	#include "../../../../../sound/soc/generic/audio-graph-card2-sample.dtsi"
+ *
+ *	CONFIG_SND_AUDIO_GRAPH_CARD2
+ *	CONFIG_SND_SAMPLE_CUSTOM_CARD
+ *	CONFIG_SND_TEST_COMPONENT
+ */
+/ {
+	/*
+	 * cpu0 <--> codec0	// Normal
+	 * cpu1 <--> codec1	// Normal
+	 */
+	card2 {
+		/*
+		 * You can use audio-graph-card2 directly
+		 * by using
+		 *
+		 * compatible = "audio-graph-card2";
+		 */
+		compatible = "sample-custom-card";
+
+		links = <&cpu0 &cpu1			/* normal: cpu side only  */
+		>;
+	};
+
+	test_cpu {
+		/*
+		 * update compatible to indicate more detail behaviour
+		 * if you want. see test-compatible for more detail.
+		 *
+		 *	- compatible = "test-cpu";
+		 *	+ compatible = "test-cpu-nv";
+		 */
+		compatible = "test-cpu";
+		ports {
+			bitclock-master;
+			frame-master;
+			cpu0: port@0 { cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
+			cpu1: port@1 { cpu1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
+		};
+	};
+
+	test_codec {
+		/*
+		 * update compatible to indicate more detail behaviour
+		 * if you want. see test-compatible for more detail.
+		 *
+		 *	- compatible = "test-codec";
+		 *	+ compatible = "test-codec-nv";
+		 */
+		compatible = "test-codec";
+		ports {
+			port@0 { codec0_ep: endpoint { remote-endpoint = <&cpu0_ep>; }; };
+			port@1 { codec1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
+		};
+	};
+};