]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: dts: ti: k3-j722s-evm: Enable analog audio support
authorJayesh Choudhary <j-choudhary@ti.com>
Tue, 25 Jun 2024 11:33:01 +0000 (17:03 +0530)
committerVignesh Raghavendra <vigneshr@ti.com>
Mon, 1 Jul 2024 16:06:06 +0000 (21:36 +0530)
The audio support on J722S-EVM is using TLV320AIC3106[0] codec
connected to McASP1 serializers.

- Add the nodes for sound-card, audio codec and McASP1.
- Add hog for TRC_MUX_SEL to select between McASP and TRACE signals
- Add hogs for GPIO_AUD_RSTn and MCASP1_FET_SEL which is used to
  switch between HDMI audio and codec audio.
- Add pinmux for MCASP1 and AUDIO_EXT_REFCLK1.

[0]: <https://www.ti.com/lit/gpn/TLV320AIC3106>

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
Reviewed-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240625113301.217369-3-j-choudhary@ti.com
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
arch/arm64/boot/dts/ti/k3-j722s-evm.dts

index 253b02f0437de3397af6f698eb1cc4c0a0c38432..dd3b5f7039d7c1c6fd78bd56b3cd5304f1eb7f7b 100644 (file)
                         <3300000 0x1>;
        };
 
+       vsys_io_3v3: regulator-vsys-io-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vsys_io_3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        vsys_io_1v8: regulator-vsys-io-1v8 {
                compatible = "regulator-fixed";
                regulator-name = "vsys_io_1v8";
                regulator-always-on;
                regulator-boot-on;
        };
+
+       codec_audio: sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "J722S-EVM";
+               simple-audio-card,widgets =
+                       "Headphone",    "Headphone Jack",
+                       "Line",         "Line In",
+                       "Microphone",   "Microphone Jack";
+               simple-audio-card,routing =
+                       "Headphone Jack",       "HPLOUT",
+                       "Headphone Jack",       "HPROUT",
+                       "LINE1L",               "Line In",
+                       "LINE1R",               "Line In",
+                       "MIC3R",                "Microphone Jack",
+                       "Microphone Jack",      "Mic Bias";
+               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 = <&mcasp1>;
+               };
+
+               sound_master: simple-audio-card,codec {
+                       sound-dai = <&tlv320aic3106>;
+                       clocks = <&audio_refclk1>;
+               };
+       };
 };
 
 &main_pmx0 {
                        J722S_IOPAD(0x0258, PIN_INPUT, 0) /* (B27) USB1_DRVVBUS */
                >;
        };
+
+       main_mcasp1_pins_default: main-mcasp1-default-pins {
+               pinctrl-single,pins = <
+                       J722S_IOPAD(0x0090, PIN_INPUT, 2) /* (P27) GPMC0_BE0n_CLE.MCASP1_ACLKX */
+                       J722S_IOPAD(0x0098, PIN_INPUT, 2) /* (V21) GPMC0_WAIT0.MCASP1_AFSX */
+                       J722S_IOPAD(0x008c, PIN_OUTPUT, 2) /* (N23) GPMC0_WEn.MCASP1_AXR0 */
+                       J722S_IOPAD(0x0084, PIN_INPUT, 2) /* (N21) GPMC0_ADVn_ALE.MCASP1_AXR2 */
+               >;
+       };
+
+       audio_ext_refclk1_pins_default: audio-ext-refclk1-default-pins {
+               pinctrl-single,pins = <
+                       J722S_IOPAD(0x00a0, PIN_OUTPUT, 1) /* (N24) GPMC0_WPn.AUDIO_EXT_REFCLK1 */
+               >;
+       };
 };
 
 &cpsw3g {
        bootph-all;
 };
 
+&k3_clks {
+       /* Configure AUDIO_EXT_REFCLK1 pin as output */
+       pinctrl-names = "default";
+       pinctrl-0 = <&audio_ext_refclk1_pins_default>;
+};
+
 &main_i2c0 {
        pinctrl-names = "default";
        pinctrl-0 = <&main_i2c0_pins_default>;
                        gpios = <5 GPIO_ACTIVE_HIGH>;
                        output-high;
                };
+
+               p01_hog: p01-hog {
+                       /* P01 - TRC_MUX_SEL */
+                       gpio-hog;
+                       gpios = <0 GPIO_ACTIVE_HIGH>;
+                       output-low;
+                       line-name = "TRC_MUX_SEL";
+               };
+
+               p02_hog: p02-hog {
+                       /* P02 - MCASP1_FET_SEL */
+                       gpio-hog;
+                       gpios = <2 GPIO_ACTIVE_HIGH>;
+                       output-high;
+                       line-name = "MCASP1_FET_SEL";
+               };
+
+               p13_hog: p13-hog {
+                       /* P13 - GPIO_AUD_RSTn */
+                       gpio-hog;
+                       gpios = <13 GPIO_ACTIVE_HIGH>;
+                       output-high;
+                       line-name = "GPIO_AUD_RSTn";
+               };
+       };
+
+       tlv320aic3106: audio-codec@1b {
+               #sound-dai-cells = <0>;
+               compatible = "ti,tlv320aic3106";
+               reg = <0x1b>;
+               ai3x-micbias-vg = <1>;  /* 2.0V */
+               AVDD-supply = <&vsys_io_3v3>;
+               IOVDD-supply = <&vsys_io_3v3>;
+               DRVDD-supply = <&vsys_io_3v3>;
+               DVDD-supply = <&vsys_io_1v8>;
        };
 };
 
        phys = <&serdes0_usb_link>;
        phy-names = "cdns3,usb3-phy";
 };
+
+&mcasp1 {
+       status = "okay";
+       #sound-dai-cells = <0>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_mcasp1_pins_default>;
+       op-mode = <0>; /* MCASP_IIS_MODE */
+       tdm-slots = <2>;
+       serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
+              1 0 2 0
+              0 0 0 0
+              0 0 0 0
+              0 0 0 0
+       >;
+};