diff mbox series

[6/8] arm64: dts: renesas: add ulcb{-kf} Audio Graph Card2 dtsi MIX + TDM Split dtsi

Message ID 875yeepxfw.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series arm64: dts: renesas: Simple-Card / Audio-Graph-Card/Card2 dts for ULCB/KF | expand

Commit Message

Kuninori Morimoto Dec. 14, 2022, 1:48 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ALSA SoC has many type of Generic Audio Card driver (Simple Audio Card,
Audio Graph Card, Audio Graph Card2), and Renesas/Kuninori Morimoto want
to test these.

Generic Audio Card driver had been requested on ALSA SoC.
It has many type of device connection method, and historically,
requested connection support range of generic driver have been
upgraded.

Upgrading connection support range itself was possible on generic
driver, but could not implemented, because we need to keep compatibility
on Device-Tree. This is one of the reason why we have many type of
Generic Audio Card driver.

ULCB/KF is good board to test these.
Kuninori has been testing these Generic Audio Card driver by using his
local patch to switching drivers. But it is good idea to upstream these
from information sharing point of view, because DT setting is complex.
It can be good sample for user. This patch is one of them.

From normal user point of view who don't need to test the driver,
it should keep as-is, nothing changed.

This patch adds "Audio Graph Card2 + MIXer + TDM Split" DT setting file
for ULCB/KF. Because it reach to subdevice maximum, it ignore HDMI.
We can switch to use it if ulcb.dtsi / ulcb-kf.dtsi were updated.

Because it needs "switching driver", not "add extra feature",
it doesn't use Device-Tree overlay.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../ulcb-audio-graph-card2-mix+split.dtsi     | 111 +++++++++++
 .../ulcb-kf-audio-graph-card2-mix+split.dtsi  | 177 ++++++++++++++++++
 arch/arm64/boot/dts/renesas/ulcb-kf.dtsi      |   1 +
 arch/arm64/boot/dts/renesas/ulcb.dtsi         |   1 +
 4 files changed, 290 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/ulcb-audio-graph-card2-mix+split.dtsi
 create mode 100644 arch/arm64/boot/dts/renesas/ulcb-kf-audio-graph-card2-mix+split.dtsi

Comments

Geert Uytterhoeven Jan. 12, 2023, 11:28 a.m. UTC | #1
Hi Morimoto-san,

On Wed, Dec 14, 2022 at 2:48 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> ALSA SoC has many type of Generic Audio Card driver (Simple Audio Card,
> Audio Graph Card, Audio Graph Card2), and Renesas/Kuninori Morimoto want
> to test these.
>
> Generic Audio Card driver had been requested on ALSA SoC.
> It has many type of device connection method, and historically,
> requested connection support range of generic driver have been
> upgraded.
>
> Upgrading connection support range itself was possible on generic
> driver, but could not implemented, because we need to keep compatibility
> on Device-Tree. This is one of the reason why we have many type of
> Generic Audio Card driver.
>
> ULCB/KF is good board to test these.
> Kuninori has been testing these Generic Audio Card driver by using his
> local patch to switching drivers. But it is good idea to upstream these
> from information sharing point of view, because DT setting is complex.
> It can be good sample for user. This patch is one of them.
>
> From normal user point of view who don't need to test the driver,
> it should keep as-is, nothing changed.
>
> This patch adds "Audio Graph Card2 + MIXer + TDM Split" DT setting file
> for ULCB/KF. Because it reach to subdevice maximum, it ignore HDMI.
> We can switch to use it if ulcb.dtsi / ulcb-kf.dtsi were updated.
>
> Because it needs "switching driver", not "add extra feature",
> it doesn't use Device-Tree overlay.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thanks for your patch!

> --- /dev/null
> +++ b/arch/arm64/boot/dts/renesas/ulcb-audio-graph-card2-mix+split.dtsi
> @@ -0,0 +1,111 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Device Tree for ULCB + Audio Graph Card2 (MIX + TDM Split)
> + *
> + * Copyright (C) 2022 Renesas Electronics Corp.
> + */
> +
> +/*
> + * Note:
> + * Because there is subdevice maximum, it will ignore HDMI output
> + *
> + *     (A) CPU0 (2ch) ------ (2ch) (X) ak4613  (MIX-0)
> + *     (B) CPU1 (2ch) --/                      (MIX-1)
> + *
> + *     (A) aplay   -D plughw:0,0 xxx.wav
> + *     (B) aplay   -D plughw:0,1 xxx.wav
> + *
> + *     (A) arecord -D plughw:0,0 xxx.wav
> + */
> +/ {
> +       sound_card: sound {
> +               compatible = "audio-graph-card2";
> +               label = "rcar-sound";
> +
> +               routing = "ak4613 Playback", "DAI0 Playback",
> +               "ak4613 Playback", "DAI1 Playback",
> +               "DAI0 Capture",    "ak4613 Capture";
> +
> +               /delete-property/ dais;
> +               links = <&fe_a          /* (A) CPU0   */
> +                        &fe_b          /* (B) CPU1   */
> +                        &be_x          /* (X) ak4613 */
> +               >;
> +
> +               dpcm {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       ports@0 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <0>;
> +                               /*
> +                                * FE

FE = Front End?

> +                                * (A) CPU0 (MIX-0)
> +                                * (B) CPU1 (MIX-1)
> +                                */
> +                       fe_a:   port@0 { reg = <0>; fe_a_ep: endpoint { remote-endpoint = <&rsnd_a_ep>; }; };
> +                       fe_b:   port@1 { reg = <1>; fe_b_ep: endpoint { remote-endpoint = <&rsnd_b_ep>; }; };

Please preserve alignment (i.e. insert TAB before fe_[ab] labels).

> +                       };
> +
> +                       ports@1 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <1>;
> +                               /*
> +                                * BE

Back End? (I guess not Big Endian ;-)

> +                                * (X) ak4613
> +                                */
> +                       be_x:   port@0 { reg = <0>; be_x_ep: endpoint { remote-endpoint = <&ak4613_x_ep>; }; };

Likewise

> +                       };
> +               };
> +       };
> +};
> +
> +&ak4613 {
> +       port {
> +               /*
> +                * (X) ak4613

Perhaps add an arrow, and a target, like in the other patches?
(everywhere)

> +                */
> +               prefix = "ak4613";
> +               convert-rate = <48000>;
> +
> +               ak4613_x_ep: endpoint {
> +                       remote-endpoint = <&be_x_ep>;
> +               };
> +       };
> +};

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Kuninori Morimoto Jan. 12, 2023, 11:30 p.m. UTC | #2
Hi Geert


> FE = Front End?
(snip)
> Back End? (I guess not Big Endian ;-)

Yes

> > +               /*
> > +                * (X) ak4613
> 
> Perhaps add an arrow, and a target, like in the other patches?
> (everywhere)

It is difficult to explain via text, but on normal connection case,
SoC <-> Codec are connected, thus the comment like
"CPU0 <-> ak4613" is correct.

But On MIX+Split case, it is using DPCM which connects
"FE" and "BE" at runtime.
So there are no connection between (FE)SoC <-> (BE)Codec
at this time. So the above comment (= no arrow) is correct.


Thank you for your help !!

Best regards
---
Kuninori Morimoto
Geert Uytterhoeven Jan. 13, 2023, 9:14 a.m. UTC | #3
Hi Morimoto-san,

On Fri, Jan 13, 2023 at 12:30 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> > > +               /*
> > > +                * (X) ak4613
> >
> > Perhaps add an arrow, and a target, like in the other patches?
> > (everywhere)
>
> It is difficult to explain via text, but on normal connection case,
> SoC <-> Codec are connected, thus the comment like
> "CPU0 <-> ak4613" is correct.
>
> But On MIX+Split case, it is using DPCM which connects
> "FE" and "BE" at runtime.
> So there are no connection between (FE)SoC <-> (BE)Codec
> at this time. So the above comment (= no arrow) is correct.

So this is software policy, not hardware description?
Does it belong in DTS?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Kuninori Morimoto Jan. 15, 2023, 10:52 p.m. UTC | #4
Hi Geert

> > It is difficult to explain via text, but on normal connection case,
> > SoC <-> Codec are connected, thus the comment like
> > "CPU0 <-> ak4613" is correct.
> >
> > But On MIX+Split case, it is using DPCM which connects
> > "FE" and "BE" at runtime.
> > So there are no connection between (FE)SoC <-> (BE)Codec
> > at this time. So the above comment (= no arrow) is correct.
> 
> So this is software policy, not hardware description?
> Does it belong in DTS?

I'm not sure how to answer to it.
It is the description to indicate switchable hardware connection.


Thank you for your help !!

Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/renesas/ulcb-audio-graph-card2-mix+split.dtsi b/arch/arm64/boot/dts/renesas/ulcb-audio-graph-card2-mix+split.dtsi
new file mode 100644
index 000000000000..af84b03c2a94
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/ulcb-audio-graph-card2-mix+split.dtsi
@@ -0,0 +1,111 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree for ULCB + Audio Graph Card2 (MIX + TDM Split)
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ */
+
+/*
+ * Note:
+ * Because there is subdevice maximum, it will ignore HDMI output
+ *
+ *	(A) CPU0 (2ch) ------ (2ch) (X) ak4613  (MIX-0)
+ *	(B) CPU1 (2ch) --/                      (MIX-1)
+ *
+ *	(A) aplay   -D plughw:0,0 xxx.wav
+ *	(B) aplay   -D plughw:0,1 xxx.wav
+ *
+ *	(A) arecord -D plughw:0,0 xxx.wav
+ */
+/ {
+	sound_card: sound {
+		compatible = "audio-graph-card2";
+		label = "rcar-sound";
+
+		routing = "ak4613 Playback", "DAI0 Playback",
+		"ak4613 Playback", "DAI1 Playback",
+		"DAI0 Capture",    "ak4613 Capture";
+
+		/delete-property/ dais;
+		links = <&fe_a		/* (A) CPU0   */
+			 &fe_b		/* (B) CPU1   */
+			 &be_x		/* (X) ak4613 */
+		>;
+
+		dpcm {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			ports@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;
+				/*
+				 * FE
+				 * (A) CPU0 (MIX-0)
+				 * (B) CPU1 (MIX-1)
+				 */
+			fe_a:	port@0 { reg = <0>; fe_a_ep: endpoint { remote-endpoint = <&rsnd_a_ep>; }; };
+			fe_b:	port@1 { reg = <1>; fe_b_ep: endpoint { remote-endpoint = <&rsnd_b_ep>; }; };
+			};
+
+			ports@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+				/*
+				 * BE
+				 * (X) ak4613
+				 */
+			be_x:	port@0 { reg = <0>; be_x_ep: endpoint { remote-endpoint = <&ak4613_x_ep>; }; };
+			};
+		};
+	};
+};
+
+&ak4613 {
+	port {
+		/*
+		 * (X) ak4613
+		 */
+		prefix = "ak4613";
+		convert-rate = <48000>;
+
+		ak4613_x_ep: endpoint {
+			remote-endpoint = <&be_x_ep>;
+		};
+	};
+};
+
+&rcar_sound {
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/*
+		 * (A) CPU0 (MIX-0)
+		 */
+		port@0 {
+			reg = <0>;
+			rsnd_a_ep: endpoint {
+				remote-endpoint = <&fe_a_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&src1 &ctu02 &mix0 &dvc0 &ssi0>;
+				capture  = <&ssi1 &src0 &dvc1>;
+			};
+		};
+		/*
+		 * (B) CPU1 (MIX-1)
+		 */
+		port@1 {
+			reg = <1>;
+			rsnd_b_ep: endpoint {
+				remote-endpoint = <&fe_b_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;
+			};
+		};
+	};
+};
diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf-audio-graph-card2-mix+split.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf-audio-graph-card2-mix+split.dtsi
new file mode 100644
index 000000000000..505ed1e3d2bb
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/ulcb-kf-audio-graph-card2-mix+split.dtsi
@@ -0,0 +1,177 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree for ULCB + Kingfisher + Audio Graph Card2 (MIX + TDM Split)
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ */
+
+/*
+ * Because it reach to subdevice maximum, it ignore HDMI
+ *
+ *	(A) CPU0 (2ch) ------ (2ch) (X)	ak4613	   (MIX-0)
+ *	(B) CPU1 (2ch) --/			   (MIX-1)
+ *	(C) CPU3 (2ch) ------ (8ch) (Y)	PCM3168A-p (TDM-0 : 0,1ch)
+ *	(D) CPU2 (2ch) --/			   (TDM-1 : 2,3ch)
+ *	(E) CPU4 (2ch) --/			   (TDM-2 : 4,5ch)
+ *	(F) CPU5 (2ch) --/			   (TDM-3 : 6,7ch)
+ *	(G) CPU6 (6ch) ------ (6ch) (Z)	PCM3168A-c
+ *
+ *	(A) aplay   -D plughw:0,0 xxx.wav (MIX-0)
+ *	(B) aplay   -D plughw:0,1 xxx.wav (MIX-1)
+ *	(C) aplay   -D plughw:0,2 xxx.wav (TDM-0)
+ *	(D) aplay   -D plughw:0,3 xxx.wav (TDM-1)
+ *	(E) aplay   -D plughw:0,4 xxx.wav (TDM-2)
+ *	(F) aplay   -D plughw:0,5 xxx.wav (TDM-3)
+ *
+ *	(A) arecord -D plughw:0,0 xxx.wav
+ *	(G) arecord -D plughw:0,6 xxx.wav
+ */
+&sound_card {
+	routing = "ak4613 Playback",   "DAI0 Playback",
+		  "ak4613 Playback",   "DAI1 Playback",
+		  "DAI0 Capture",      "ak4613 Capture",
+		  "pcm3168a Playback", "DAI2 Playback",
+		  "pcm3168a Playback", "DAI3 Playback",
+		  "pcm3168a Playback", "DAI4 Playback",
+		  "pcm3168a Playback", "DAI5 Playback",
+		  "DAI6 Capture",      "pcm3168a Capture";
+
+	/delete-property/ dais;
+	links = <&fe_a		/* (A) CPU0		 */
+		 &fe_b		/* (B) CPU1		 */
+		 &fe_c		/* (C) CPU2		 */
+		 &fe_d		/* (D) CPU3		 */
+		 &fe_e		/* (E) CPU4		 */
+		 &fe_f		/* (F) CPU5		 */
+		 &rsnd_g	/* (G) CPU6 - PCM3168A-c */
+		 &be_x		/* (X) ak4613		 */
+		 &be_y		/* (Y) PCM3168A-p	 */
+	>;
+
+	dpcm {
+		ports@0 {
+		/*
+		 * FE
+		 *
+		 * (A)/(B) are defined on ulcb
+		 * (C) CPU2
+		 * (D) CPU3
+		 * (E) CPU4
+		 * (F) CPU5
+		 */
+		fe_c:	port@2 { reg = <2>; fe_c_ep: endpoint { remote-endpoint = <&rsnd_c_ep>; }; };
+		fe_d:	port@3 { reg = <3>; fe_d_ep: endpoint { remote-endpoint = <&rsnd_d_ep>; }; };
+		fe_e:	port@4 { reg = <4>; fe_e_ep: endpoint { remote-endpoint = <&rsnd_e_ep>; }; };
+		fe_f:	port@5 { reg = <5>; fe_f_ep: endpoint { remote-endpoint = <&rsnd_f_ep>; }; };
+		};
+
+		ports@1 {
+		/*
+		 * BE
+		 *
+		 * (X) is defined on ulcb
+		 * (Y) PCM3168A-p
+		 */
+		be_y:	port@1 { reg = <1>; be_y_ep: endpoint { remote-endpoint = <&pcm3168a_y_ep>; }; };
+		};
+	};
+};
+
+&pcm3168a {
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		mclk-fs = <512>;
+		prefix = "pcm3168a";
+
+		/*
+		 * (Y) pcm3168a-p
+		 */
+		port@0 {
+			reg = <0>;
+			convert-channels = <8>; /* to 8ch TDM */
+			pcm3168a_y_ep: endpoint {
+				remote-endpoint = <&be_y_ep>;
+				clocks = <&clksndsel>;
+			};
+		};
+		/*
+		 * (Z) pcm3168a-c
+		 */
+		port@1 {
+			reg = <1>;
+			pcm3168a_z_ep: endpoint {
+				remote-endpoint = <&rsnd_g_ep>;
+				clocks = <&clksndsel>;
+			};
+		};
+	};
+};
+
+&rcar_sound {
+	ports {
+		/* (A)/(B) are defined in ulcb.dtsi */
+
+		/*
+		 * (C) CPU2
+		 */
+		port@2 {
+			reg = <2>;
+			rsnd_c_ep: endpoint {
+				remote-endpoint = <&fe_c_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&ssiu30 &ssi3>;
+			};
+		};
+		/*
+		 * (D) CPU3
+		 */
+		port@3 {
+			reg = <3>;
+			rsnd_d_ep: endpoint {
+				remote-endpoint = <&fe_d_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&ssiu31 &ssi3>;
+			};
+		};
+		/*
+		 * (E) CPU4
+		 */
+		port@4 {
+			reg = <4>;
+			rsnd_e_ep: endpoint {
+				remote-endpoint = <&fe_e_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&ssiu32 &ssi3>;
+			};
+		};
+		/*
+		 * (F) CPU5
+		 */
+		port@5 {
+			reg = <5>;
+			rsnd_f_ep: endpoint {
+				remote-endpoint = <&fe_f_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&ssiu33 &ssi3>;
+			};
+		};
+		/*
+		 * (G) CPU6
+		 */
+		rsnd_g: port@6 {
+			reg = <6>;
+			rsnd_g_ep: endpoint {
+				remote-endpoint = <&pcm3168a_z_ep>;
+				bitclock-master;
+				frame-master;
+				playback = <&ssi4>;
+			};
+		};
+	};
+};
diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
index 6913d778a40b..0690c1b1b5e9 100644
--- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
@@ -455,5 +455,6 @@  &xhci0 {
  *
  * #include "ulcb-kf-simple-audio-card.dtsi"
  * #include "ulcb-kf-audio-graph-card.dtsi"
+ * #include "ulcb-kf-audio-graph-card2-mix+split.dtsi"
  */
 #include "ulcb-kf-audio-graph-card2.dtsi"
diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi
index 497d07df6944..b357267a9083 100644
--- a/arch/arm64/boot/dts/renesas/ulcb.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi
@@ -503,5 +503,6 @@  &usb2_phy1 {
  *
  * #include "ulcb-simple-audio-card.dtsi"
  * #include "ulcb-audio-graph-card.dtsi"
+ * #include "ulcb-audio-graph-card2-mix+split.dtsi"
  */
 #include "ulcb-audio-graph-card2.dtsi"