]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: dts: ti: var-som-am62p: Add support for WM8904 audio codec
authorStefano Radaelli <stefano.radaelli21@gmail.com>
Fri, 3 Oct 2025 12:50:28 +0000 (14:50 +0200)
committerVignesh Raghavendra <vigneshr@ti.com>
Thu, 30 Oct 2025 13:43:26 +0000 (19:13 +0530)
The VAR-SOM-AM62P can integrate the WM8904, a high-performance
ultra-low-power stereo codec optimized for portable audio applications.

This patch adds the WM8904 device to the appropriate I2C bus, enables
the McASP1 peripheral, and introduces the sound node to expose the
sound card to the system.

Signed-off-by: Stefano Radaelli <stefano.radaelli21@gmail.com>
Link: https://patch.msgid.link/20251003125031.30539-3-stefano.radaelli21@gmail.com
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
arch/arm64/boot/dts/ti/k3-am62p5-var-som.dtsi

index b93372f22732ed7371293d7a33b3a94c240afd59..aba72d0b767c1d69a545d4aec448beb3df848531 100644 (file)
                enable-active-high;
                regulator-always-on;
        };
+
+       sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,bitclock-master = <&codec_dai>;
+               simple-audio-card,format = "dsp_b";
+               simple-audio-card,frame-master = <&codec_dai>;
+               simple-audio-card,name = "wm8904-audio";
+               simple-audio-card,mclk-fs = <256>;
+               simple-audio-card,routing =
+                       "Headphone Jack", "HPOUTL",
+                       "Headphone Jack", "HPOUTR",
+                       "IN2L", "Line In Jack",
+                       "IN2R", "Line In Jack",
+                       "IN1L", "Microphone Jack",
+                       "IN1R", "Microphone Jack";
+               simple-audio-card,widgets =
+                       "Microphone", "Microphone Jack",
+                       "Headphone", "Headphone Jack",
+                       "Line", "Line In Jack";
+
+               codec_dai: simple-audio-card,codec {
+                       sound-dai = <&wm8904>;
+               };
+
+               simple-audio-card,cpu {
+                       sound-dai = <&mcasp1>;
+               };
+       };
+};
+
+&audio_refclk1 {
+       assigned-clock-rates = <100000000>;
 };
 
 &cpsw3g {
        pinctrl-0 = <&pinctrl_i2c2>;
        clock-frequency = <400000>;
        status = "okay";
+
+       wm8904: audio-codec@1a {
+               compatible = "wlf,wm8904";
+               reg = <0x1a>;
+               #sound-dai-cells = <0>;
+               clocks = <&audio_refclk1>;
+               clock-names = "mclk";
+               AVDD-supply = <&reg_1v8>;
+               CPVDD-supply = <&reg_1v8>;
+               DBVDD-supply = <&reg_3v3>;
+               DCVDD-supply = <&reg_1v8>;
+               MICVDD-supply = <&reg_1v8>;
+       };
 };
 
 &main_i2c3 {
                >;
        };
 
+       pinctrl_mcasp1: main-mcasp1-default-pins {
+               pinctrl-single,pins = <
+                       AM62PX_IOPAD(0x0090, PIN_INPUT, 2) /* (U24) GPMC0_BE0n_CLE.MCASP1_ACLKX */
+                       AM62PX_IOPAD(0x0098, PIN_INPUT, 2) /* (AA24) GPMC0_WAIT0.MCASP1_AFSX */
+                       AM62PX_IOPAD(0x008c, PIN_OUTPUT, 2) /* (T25) GPMC0_WEn.MCASP1_AXR0 */
+                       AM62PX_IOPAD(0x0084, PIN_INPUT, 2) /* (R25) GPMC0_ADVn_ALE.MCASP1_AXR2 */
+                       AM62PX_IOPAD(0x00a0, PIN_OUTPUT, 1) /* (P24) GPMC0_WPn.AUDIO_EXT_REFCLK1 */
+               >;
+       };
+
        pinctrl_mdio1: main-mdio1-default-pins {
                pinctrl-single,pins = <
                        AM62PX_IOPAD(0x0160, PIN_OUTPUT, 0) /* (F17) MDIO0_MDC */
        };
 };
 
+&mcasp1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_mcasp1>;
+       op-mode = <0>;  /* MCASP_IIS_MODE */
+       serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
+               1 0 2 0
+               0 0 0 0
+               0 0 0 0
+               0 0 0 0
+       >;
+       tdm-slots = <2>;
+       tx-num-evt = <0>;
+       rx-num-evt = <0>;
+       #sound-dai-cells = <0>;
+       status = "okay";
+};
+
 &sdhci0 {
        /* On-module eMMC */
        ti,driver-strength-ohm = <50>;