]> www.infradead.org Git - linux.git/commitdiff
arm64: dts: renesas: gray-hawk-single: Add Sound support
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 3 Jul 2024 00:13:42 +0000 (00:13 +0000)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 29 Jul 2024 09:51:24 +0000 (11:51 +0200)
Because R-Car V4M supports only 1 SSI, it cannot use Playback/Capture at
the same time.  Hence select Playback as default.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/87cynvbadm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
arch/arm64/boot/dts/renesas/r8a779h0-gray-hawk-single.dts

index 2b9a19bb1c5d30d5151bfdf4efab73aacec4f6ea..df4025e522e2dff3e2d195e94eaec668bd8b604b 100644 (file)
@@ -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 cannot handle both Playback/Capture
+ * at the same time. You need to switch the direction which is controlled
+ * by the 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/;
 
                        regulator-boot-on;
                        regulator-always-on;
        };
+
+       sound_mux: sound-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 {
        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";
        };
 };
 
+&i2c3 {
+       pinctrl-0 = <&i2c3_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+       clock-frequency = <400000>;
+
+       codec@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>;
                function = "i2c0";
        };
 
+       i2c3_pins: i2c3 {
+               groups = "i2c3";
+               function = "i2c3";
+       };
+
        mmc_pins: mmc {
                groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
                function = "mmc";
                groups = "scif_clk2";
                function = "scif_clk2";
        };
+
+       sound_clk_pins: sound_clk {
+               groups = "audio_clkin", "audio_clkout";
+               function = "audio_clk";
+       };
+
+       sound_pins: sound {
+               groups = "ssi_ctrl", "ssi_data";
+               function = "ssi";
+       };
+};
+
+&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 {