Skip to contentSkip to conversation

arm64: V4M GrayHawk Sound support

PATCH In review Kuninori Morimoto 2 participants 6 messages Jul 3, 2024 – Jul 29, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm64: V4M GrayHawk Sound support

Hi Geert
Cc Khanh

This patch-set adds V4M GrayHawk Sound support. clock/SoC part patch were already applied on previous patch-set.

Because V4M has only 1 SSI, we need to switch Playback/Capture when use. ASoC will support board original label for MUX on v6.11.

You can find how to use Playback/Capture on DT file. [3/3] is for renesas_defconfig

Kuninori Morimoto (3):
arm64: dts: renesas: gray-hawk-single: Add Sound support
arm64: defconfig: Enable AK4619 codec support
arm64: renesas: defconfig: Enable AK4619/Simple_MUX

 .../dts/renesas/r8a779h0-gray-hawk-single.dts | 108 ++++++++++++++++++
 arch/arm64/configs/defconfig                  |   1 +
 arch/arm64/configs/renesas_defconfig          |   2 +
 3 files changed, 111 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 arm64: dts: renesas: gray-hawk-single: Add Sound support

Because V4M supports only 1 SSI, it can't use Playback/Capture in the same time. It select Playback as default.

---
 .../dts/renesas/r8a779h0-gray-hawk-single.dts | 108 ++++++++++++++++++
 1 file changed, 108 insertions(+)
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +108 -0
index 2b9a19bb1c5d..ecd0a67bb8dc 100644
@@ -5,6 +5,25 @@
  * Copyright (C) 2023 Renesas Electronics Corp.
  * Copyright (C) 2024 Glider bv
  */
+/*
+ * [How to use Sound]
+ *
+ * Because R-Car V4M has only 1 SSI, it can't handle both Playback/Capture
+ * in the same time. You need to switch the direction which is controlled
+ * by GP0_01 pin via amixer.
+ *
+ * Playback (CN9500)
+ *	> amixer set "MUX" "Playback"	// for GP0_01
+ *	> amixer set "DAC 1" 85%
+ *	> aplay xxx.wav
+ *
+ * Capture (CN9501)
+ *	> amixer set "MUX" "Capture"	// for GP0_01
+ *	> amixer set "Mic 1" 80%
+ *	> amixer set "ADC 1" on
+ *	> amixer set 'ADC 1' 80%
+ *	> arecord xxx hoge.wav
+ */
 
 /dts-v1/;
 
@@ -59,6 +78,24 @@ reg_3p3v: regulator-3p3v {
 			regulator-boot-on;
 			regulator-always-on;
 	};
+
+	sound_mux: mux {
+		compatible = "simple-audio-mux";
+		mux-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+		state-labels = "Playback", "Capture";
+	};
+
+	sound_card: sound {
+		compatible = "audio-graph-card2";
+		label = "rcar-sound";
+		aux-devs = <&sound_mux>; // for GP0_01
+
+		links = <&rsnd_port>; /* AK4619 Audio Codec */
+	};
+};
+
+&audio_clkin {
+	clock-frequency = <24576000>;
 };
 
 &avb0 {
@@ -87,6 +124,15 @@ &extalr_clk {
 	clock-frequency = <32768>;
 };
 
+&gpio1 {
+	audio-power-hog {
+		gpio-hog;
+		gpios = <8 GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "Audio-Power";
+	};
+};
+
 &hscif0 {
 	pinctrl-0 = <&hscif0_pins>;
 	pinctrl-names = "default";
@@ -139,6 +185,29 @@ eeprom@53 {
 	};
 };
 
+&i2c3 {
+	pinctrl-0 = <&i2c3_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+	clock-frequency = <400000>;
+
+	ak4619@10 {
+		compatible = "asahi-kasei,ak4619";
+		reg = <0x10>;
+
+		clocks = <&rcar_sound>;
+		clock-names = "mclk";
+
+		#sound-dai-cells = <0>;
+		port {
+			ak4619_endpoint: endpoint {
+				remote-endpoint = <&rsnd_endpoint>;
+			};
+		};
+	};
+};
+
 &mmc0 {
 	pinctrl-0 = <&mmc_pins>;
 	pinctrl-1 = <&mmc_pins>;
@@ -193,6 +262,11 @@ i2c0_pins: i2c0 {
 		function = "i2c0";
 	};
 
+	i2c3_pins: i2c3 {
+		groups = "i2c3";
+		function = "i2c3";
+	};
+
 	mmc_pins: mmc {
 		groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
 		function = "mmc";
@@ -213,6 +287,40 @@ scif_clk2_pins: scif-clk2 {
 		groups = "scif_clk2";
 		function = "scif_clk2";
 	};
+
+	 sound_pins: sound {
+		groups = "ssi_ctrl", "ssi_data";
+		function = "ssi";
+	};
+
+	sound_clk_pins: sound_clk {
+		groups = "audio_clkin", "audio_clkout";
+		function = "audio_clk";
+	};
+};
+
+&rcar_sound {
+	pinctrl-0 = <&sound_clk_pins>, <&sound_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	/* audio_clkout */
+	clock-frequency = <12288000>;
+
+	ports {
+		rsnd_port: port {
+			rsnd_endpoint: endpoint {
+				remote-endpoint = <&ak4619_endpoint>;
+				bitclock-master;
+				frame-master;
+
+				/* see above [How to use Sound] */
+				playback = <&ssi0>;
+				capture  = <&ssi0>;
+			};
+		};
+	};
 };
 
 &rpc {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] arm64: dts: renesas: gray-hawk-single: Add Sound support

Hi Morimoto-san,

Quoted 4 lines · Kuninori Morimoto

Because V4M supports only 1 SSI, it can't use Playback/Capture in the same time. It select Playback as default.

Thanks for your patch^W^Wthe update!

arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts reg_3p3v: regulator-3p3v { · line 82

Quoted 8 lines
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +2 -0
@@ -59,6 +78,24 @@ reg_3p3v: regulator-3p3v {
                        regulator-boot-on;
                        regulator-always-on;
        };
+
+       sound_mux: mux {

"sound-mux", to avoid potential conflicts.

Quoted 7 lines
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +4 -0
+               compatible = "simple-audio-mux";
+               mux-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+               state-labels = "Playback", "Capture";
+       };
 
@@ -139,6 +185,29 @@ eeprom@53 {
        };

arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts eeprom@53 { · line 195

Quoted 10 lines
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +8 -0
 };
 
+&i2c3 {
+       pinctrl-0 = <&i2c3_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+       clock-frequency = <400000>;
+
+       ak4619@10 {

codec@10

arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts eeprom@53 { · line 196

Quoted 1 line
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts +1 -0
+               compatible = "asahi-kasei,ak4619";

i.e. will queue in renesas-devel for v6.12, with the above fixed.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#3 lore raw

PATCH 2/3 arm64: defconfig: Enable AK4619 codec support

In reply to Kuninori Morimoto

This patch enables AK4619 codec support

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 66d779547f0f..e8b47b07a921 100644
@@ -998,6 +998,7 @@ CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD=m
 CONFIG_SND_SOC_DAVINCI_MCASP=m
 CONFIG_SND_SOC_J721E_EVM=m
 CONFIG_SND_SOC_AK4613=m
+CONFIG_SND_SOC_AK4619=m
 CONFIG_SND_SOC_DA7213=m
 CONFIG_SND_SOC_ES7134=m
 CONFIG_SND_SOC_ES7241=m
Signature · 1 line
2.43.0
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] arm64: defconfig: Enable AK4619 codec support

Quoted 1 line · Kuninori Morimoto

This patch enables AK4619 codec support

as used on the Gray Hawk Single development board.

Quoted 1 line

My

on the previous version is still valid.
Queuing in renesas-devel for v6.12.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#5 lore raw

PATCH 3/3 arm64: renesas: defconfig: Enable AK4619/Simple_MUX

In reply to Kuninori Morimoto

This patch enables AK4619/Simple_MUX codec which is needed for V4M GrayHawk Sound.

---
 arch/arm64/configs/renesas_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/configs/renesas_defconfig +2 -0
index d0bc1a04c3a8..7f36fe041fb0 100644
@@ -304,8 +304,10 @@ CONFIG_SND_SOC=y
 CONFIG_SND_SOC_RCAR=y
 CONFIG_SND_SOC_RZ=y
 CONFIG_SND_SOC_AK4613=y
+CONFIG_SND_SOC_AK4619=y
 CONFIG_SND_SOC_DA7213=y
 CONFIG_SND_SOC_PCM3168A_I2C=y
+CONFIG_SND_SOC_SIMPLE_MUX=y
 CONFIG_SND_SOC_WM8978=y
 CONFIG_SND_SIMPLE_CARD=y
 CONFIG_SND_AUDIO_GRAPH_CARD=y
Signature · 1 line
2.43.0