arm64: dts: ti: k3-am625-phyboard-lyra-rdk: Add Audio Codec
authorGarrett Giordano <ggiordano@phytec.com>
Thu, 4 Apr 2024 18:42:50 +0000 (11:42 -0700)
committerNishanth Menon <nm@ti.com>
Mon, 29 Apr 2024 19:35:28 +0000 (14:35 -0500)
The Audio Codec runs over the MCASP (Multichannel Audio Serial Port).

Add pinmux for the Audio Reference Clock and MCASP2.

Add DT nodes for Audio Codec, MCASP2, VCC 1v8 and VCC 3v3 regulators.

Additionally, create a sound node that connects our sound card and the
MCASP2.

Signed-off-by: Garrett Giordano <ggiordano@phytec.com>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
Link: https://lore.kernel.org/r/20240404184250.3772829-1-ggiordano@phytec.com
Signed-off-by: Nishanth Menon <nm@ti.com>
arch/arm64/boot/dts/ti/k3-am625-phyboard-lyra-rdk.dts

index e225d76d02c8c60a587e92e6f826a57d38883b21..d7b8aa607c8cd3b55035fa2f5c295cfa72951b5c 100644 (file)
                };
        };
 
+       sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "phyBOARD-Lyra";
+               simple-audio-card,widgets =
+                       "Microphone",           "Mic Jack",
+                       "Headphone",            "Headphone Jack",
+                       "Speaker",              "External Speaker";
+               simple-audio-card,routing =
+                       "MIC3R",                "Mic Jack",
+                       "Mic Jack",             "Mic Bias",
+                       "Headphone Jack",       "HPLOUT",
+                       "Headphone Jack",       "HPROUT",
+                       "External Speaker",     "SPOP",
+                       "External Speaker",     "SPOM";
+               simple-audio-card,format = "dsp_b";
+               simple-audio-card,bitclock-master = <&sound_master>;
+               simple-audio-card,frame-master = <&sound_master>;
+               simple-audio-card,bitclock-inversion;
+
+               simple-audio-card,cpu {
+                       sound-dai = <&mcasp2>;
+               };
+
+               sound_master: simple-audio-card,codec {
+                               sound-dai = <&audio_codec>;
+                               clocks = <&audio_refclk1>;
+               };
+       };
+
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
                };
        };
 
+       vcc_1v8: regulator-vcc-1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        vcc_3v3_mmc: regulator-vcc-3v3-mmc {
                compatible = "regulator-fixed";
                regulator-name = "VCC_3V3_MMC";
                regulator-always-on;
                regulator-boot-on;
        };
+
+       vcc_3v3_sw: regulator-vcc-3v3-sw {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_3V3_SW";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
 };
 
 &main_pmx0 {
+       audio_ext_refclk1_pins_default: audio-ext-refclk1-default-pins {
+               pinctrl-single,pins = <
+                       AM62X_IOPAD(0x0a0, PIN_OUTPUT, 1) /* (K25) GPMC0_WPn.AUDIO_EXT_REFCLK1 */
+               >;
+       };
+
        gpio_keys_pins_default: gpio-keys-default-pins {
                pinctrl-single,pins = <
                        AM62X_IOPAD(0x1d4, PIN_INPUT, 7) /* (B15) UART0_RTSn.GPIO1_23 */
                >;
        };
 
+       main_mcasp2_pins_default: main-mcasp2-default-pins {
+               pinctrl-single,pins = <
+                       AM62X_IOPAD(0x070, PIN_INPUT, 3) /* (T24) GPMC0_AD13.MCASP2_ACLKX */
+                       AM62X_IOPAD(0x06c, PIN_INPUT, 3) /* (T22) GPMC0_AD12.MCASP2_AFSX */
+                       AM62X_IOPAD(0x064, PIN_OUTPUT, 3) /* (T25) GPMC0_AD10.MCASP2_AXR2 */
+                       AM62X_IOPAD(0x068, PIN_INPUT, 3) /* (R21) GPMC0_AD11.MCASP2_AXR3 */
+               >;
+       };
+
        main_mmc1_pins_default: main-mmc1-default-pins {
                pinctrl-single,pins = <
                        AM62X_IOPAD(0x23c, PIN_INPUT_PULLUP, 0) /* (A21) MMC1_CMD */
        clock-frequency = <100000>;
        status = "okay";
 
+       audio_codec: audio-codec@18 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&audio_ext_refclk1_pins_default>;
+
+               #sound-dai-cells = <0>;
+               compatible = "ti,tlv320aic3007";
+               reg = <0x18>;
+               ai3x-micbias-vg = <2>;
+
+               AVDD-supply = <&vcc_3v3_sw>;
+               IOVDD-supply = <&vcc_3v3_sw>;
+               DRVDD-supply = <&vcc_3v3_sw>;
+               DVDD-supply = <&vcc_1v8>;
+       };
+
        gpio_exp: gpio-expander@21 {
                pinctrl-names = "default";
                pinctrl-0 = <&gpio_exp_int_pins_default>;
        status = "okay";
 };
 
+&mcasp2 {
+       #sound-dai-cells = <0>;
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_mcasp2_pins_default>;
+
+       /* MCASP_IIS_MODE */
+       op-mode = <0>;
+       tdm-slots = <2>;
+
+       /* 0: INACTIVE, 1: TX, 2: RX */
+       serial-dir = <
+                       0 0 1 2
+                       0 0 0 0
+                       0 0 0 0
+                       0 0 0 0
+       >;
+       tx-num-evt = <32>;
+       rx-num-evt = <32>;
+       status = "okay";
+};
+
 &sdhci1 {
        vmmc-supply = <&vcc_3v3_mmc>;
        vqmmc-supply = <&vddshv5_sdio>;