arm64: dts: rockchip: Add analog audio on ODROID-M1
authorAurelien Jarno <aurelien@aurel32.net>
Fri, 30 Sep 2022 05:12:38 +0000 (07:12 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 17 Oct 2022 11:44:40 +0000 (13:44 +0200)
On the ODROID-M1, the I2S1 TDM controller is connected to the rk809
codec in I2S mode. It is used to provide a stereo headphones output and
a mono speaker output. A GPIO with an external pullup is used as an
headphone detection input.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Dan Johansen <strit@manjaro.org>
Link: https://lore.kernel.org/r/20220930051246.391614-6-aurelien@aurel32.net
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts

index 94e839c..634c1bd 100644 (file)
                };
        };
 
+       rk809-sound {
+               compatible = "simple-audio-card";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hp_det_pin>;
+               simple-audio-card,name = "Analog RK817";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
+               simple-audio-card,mclk-fs = <256>;
+               simple-audio-card,widgets =
+                       "Headphone", "Headphones",
+                       "Speaker", "Speaker";
+               simple-audio-card,routing =
+                       "Headphones", "HPOL",
+                       "Headphones", "HPOR",
+                       "Speaker", "SPKO";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&i2s1_8ch>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&rk809>;
+               };
+       };
+
        vcc3v3_sys: vcc3v3-sys-regulator {
                compatible = "regulator-fixed";
                regulator-name = "vcc3v3_sys";
                reg = <0x20>;
                interrupt-parent = <&gpio0>;
                interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
+               assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
+               assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
                #clock-cells = <1>;
+               clock-names = "mclk";
+               clocks = <&cru I2S1_MCLKOUT_TX>;
                pinctrl-names = "default";
-               pinctrl-0 = <&pmic_int_l>;
+               pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>;
                rockchip,system-power-controller;
+               #sound-dai-cells = <0>;
                vcc1-supply = <&vcc3v3_sys>;
                vcc2-supply = <&vcc3v3_sys>;
                vcc3-supply = <&vcc3v3_sys>;
        };
 };
 
+&i2s1_8ch {
+       rockchip,trcm-sync-tx-only;
+       status = "okay";
+};
+
 &mdio0 {
        rgmii_phy0: ethernet-phy@0 {
                compatible = "ethernet-phy-ieee802.3-c22";
                        rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
+
+       rk809 {
+               hp_det_pin: hp-det-pin {
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
 };
 
 &pmu_io_domains {