From 35deaefe2a198508903c5657a0fa7cb2ad60f56d Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 17 Jul 2024 14:20:23 +0800
Subject: [PATCH]  Patch:IGKBoard-IMX8MP: Add WM8960 audio codec support

---
 kernel/patches/igkboard-imx8mp/linux-imx-lf-6.1.36-2.1.0.patch |   82 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 76 insertions(+), 6 deletions(-)

diff --git a/kernel/patches/igkboard-imx8mp/linux-imx-lf-6.1.36-2.1.0.patch b/kernel/patches/igkboard-imx8mp/linux-imx-lf-6.1.36-2.1.0.patch
index 9a930f9..733e728 100644
--- a/kernel/patches/igkboard-imx8mp/linux-imx-lf-6.1.36-2.1.0.patch
+++ b/kernel/patches/igkboard-imx8mp/linux-imx-lf-6.1.36-2.1.0.patch
@@ -10,10 +10,10 @@
 +dtb-$(CONFIG_ARCH_MXC) += igkboard-imx8mp.dtb
 diff --git a/arch/arm64/boot/dts/freescale/igkboard-imx8mp.dts b/arch/arm64/boot/dts/freescale/igkboard-imx8mp.dts
 new file mode 100644
-index 000000000..8ce653b69
+index 000000000..ce38a5b4a
 --- /dev/null
 +++ b/arch/arm64/boot/dts/freescale/igkboard-imx8mp.dts
-@@ -0,0 +1,712 @@
+@@ -0,0 +1,782 @@
 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 +/* 
 + * Device Tree Source for LingYun IGKBoard(IoT Gateway Kits Board) - imx8mp
@@ -105,6 +105,25 @@
 +            gpios = <&gpio5 27 GPIO_ACTIVE_LOW>;
 +            linux,code = <BTN_4>;
 +        };
++    };
++
++    sound-wm8960 {
++        compatible = "fsl,imx-audio-wm8960";
++        model = "wm8960-audio";
++        audio-cpu = <&sai3>;
++        audio-codec = <&codec>;
++        audio-asrc = <&easrc>;
++        //hp-det-gpio = <&gpio4 29 0>;
++        audio-routing =
++            "Headphone Jack", "HP_L",
++            "Headphone Jack", "HP_R",
++            "Ext Spk", "SPK_LP",
++            "Ext Spk", "SPK_LN",
++            "Ext Spk", "SPK_RP",
++            "Ext Spk", "SPK_RN",
++            "LINPUT1", "Mic Jack",
++            "LINPUT3", "Mic Jack",
++            "Mic Jack", "MICB";
 +    };
 +};
 +
@@ -272,10 +291,12 @@
 +    pinctrl-0 = <&pinctrl_i2c2>;
 +    status = "okay";
 +
-+    rtc1208@6f {
-+        compatible = "isil,isl1208";
-+        reg = <0x6f>;
-+        status = "okay";
++    codec: wm8960@1a {
++        compatible = "wlf,wm8960";
++        reg = <0x1a>;
++        clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
++        clock-names = "mclk";
++        wlf,shared-lrclk;
 +    };
 +
 +    ms1112@4a {
@@ -299,6 +320,44 @@
 +                ti,mode = <1>;
 +        };
 +    };
++
++    rtc1208@6f {
++        compatible = "isil,isl1208";
++        reg = <0x6f>;
++        status = "okay";
++    };
++};
++
++/*+------------------------+
++  |   WM8960 Audio Codec   |
++  +------------------------+*/
++
++&sai3 {
++    pinctrl-names = "default";
++    pinctrl-0 = <&pinctrl_sai3>;
++    assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
++    assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
++    assigned-clock-rates = <12288000>;
++    clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
++         <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
++         <&clk IMX8MP_CLK_DUMMY>;
++    clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
++    fsl,sai-mclk-direction-output;
++    status = "okay";
++};
++
++&easrc {
++    fsl,asrc-rate  = <48000>;
++    status = "okay";
++};
++
++&xcvr {
++    #sound-dai-cells = <0>;
++    status = "okay";
++};
++
++&sdma2 {
++    status = "okay";
 +};
 +
 +/*+------------------------+
@@ -592,6 +651,17 @@
 +        >;
 +    };
 +
++    pinctrl_sai3: sai3grp {
++        fsl,pins = <
++            MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC               0xd6
++            MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK                0xd6
++            MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_SAI3_RX_DATA00              0xd6
++            MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00              0xd6
++            MX8MP_IOMUXC_SAI3_MCLK__AUDIOMIX_SAI3_MCLK                  0xd6
++            MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29                           0xd6
++        >;
++    };
++
 +    pinctrl_pmic: pmicirq {
 +        fsl,pins = <
 +            MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03                         0x41

--
Gitblit v1.9.1