i.MX8MM has one wm8524 audio codec connected with
SAI3 digital audio interface.
This patch uses simple-card machine driver in order
to enable wm8524 codec.
We need to set:
* SAI3 pinctrl configuration
* codec reset gpio pinctrl configuration
* clock hierarchy
* codec node
* simple-card configuration
Signed-off-by: Daniel Baluta <[email protected]>
---
arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 55 ++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
index 2d5d89475b76..7c578d8762b9 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
@@ -37,6 +37,37 @@
gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
+
+ wm8524: audio-codec {
+ #sound-dai-cells = <0>;
+ compatible = "wlf,wm8524";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_gpio_wlf>;
+ wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
+ };
+
+ sound-wm8524 {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "wm8524-audio";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,frame-master = <&cpudai>;
+ simple-audio-card,bitclock-master = <&cpudai>;
+ simple-audio-card,widgets =
+ "Line", "Left Line Out Jack",
+ "Line", "Right Line Out Jack";
+ simple-audio-card,routing =
+ "Left Line Out Jack", "LINEVOUTL",
+ "Right Line Out Jack", "LINEVOUTR";
+
+ cpudai: simple-audio-card,cpu {
+ sound-dai = <&sai3>;
+ };
+
+ simple-audio-card,codec {
+ sound-dai = <&wm8524>;
+ clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
+ };
+ };
};
&fec1 {
@@ -61,6 +92,15 @@
};
};
+&sai3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_sai3>;
+ assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
+ assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
+ assigned-clock-rates = <24576000>;
+ status = "okay";
+};
+
&uart2 { /* console */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart2>;
@@ -124,12 +164,27 @@
>;
};
+ pinctrl_gpio_wlf: gpiowlfgrp {
+ fsl,pins = <
+ MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21 0xd6
+ >;
+ };
+
pinctrl_reg_usdhc2_vmmc: regusdhc2vmmc {
fsl,pins = <
MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x41
>;
};
+ pinctrl_sai3: sai3grp {
+ fsl,pins = <
+ MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6
+ MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6
+ MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6
+ MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6
+ >;
+ };
+
pinctrl_uart2: uart2grp {
fsl,pins = <
MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX 0x140
--
2.17.1
On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
> + simple-audio-card,codec {
> + sound-dai = <&wm8524>;
> + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
interface, not an external clock that feeds the codec.
It seems you should remove this 'clocks' entry.
<reduce audience to linux-imx>
Shengjiu,
Can you help me with this? Specifically: I couldn't find the schematic
showing the
exact connection pins between SAI and wm8524 codec.
I looked into our internal tree and the wm8524 codec always handles
CLK_SAIX_ROOT
but Fabio has a good point. This clock doesn't feeds the codec.
Unless, we can really look into the schematics and prove it otherwise.
On Thu, May 16, 2019 at 10:14 PM Fabio Estevam <[email protected]> wrote:
>
> On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
>
> > + simple-audio-card,codec {
> > + sound-dai = <&wm8524>;
> > + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
>
> IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
> interface, not an external clock that feeds the codec.
>
> It seems you should remove this 'clocks' entry.
On Thu, May 16, 2019 at 3:35 PM Fabio Estevam <[email protected]> wrote:
>
> On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
>
> > + simple-audio-card,codec {
> > + sound-dai = <&wm8524>;
> > + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
>
> IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
> interface, not an external clock that feeds the codec.
>
> It seems you should remove this 'clocks' entry.
Just checked the schematics and the SAI3_MCLK pin clocks the codec, so
the representation is correct:
Reviewed-by: Fabio Estevam <[email protected]>
On Mon, May 20, 2019 at 7:12 AM Daniel Baluta <[email protected]> wrote:
>
> <reduce audience to linux-imx>
>
> Shengjiu,
>
> Can you help me with this? Specifically: I couldn't find the schematic
> showing the
> exact connection pins between SAI and wm8524 codec.
>
> I looked into our internal tree and the wm8524 codec always handles
> CLK_SAIX_ROOT
> but Fabio has a good point. This clock doesn't feeds the codec.
>
> Unless, we can really look into the schematics and prove it otherwise.
Yes, I just checked and the devicetree patch is correct. Sorry for the
confusion.
On Mon, May 20, 2019 at 10:33 PM Fabio Estevam <[email protected]> wrote:
>
> On Thu, May 16, 2019 at 3:35 PM Fabio Estevam <[email protected]> wrote:
> >
> > On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
> >
> > > + simple-audio-card,codec {
> > > + sound-dai = <&wm8524>;
> > > + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
> >
> > IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
> > interface, not an external clock that feeds the codec.
> >
> > It seems you should remove this 'clocks' entry.
>
> Just checked the schematics and the SAI3_MCLK pin clocks the codec, so
> the representation is correct:
>
> Reviewed-by: Fabio Estevam <[email protected]>
Shawn,
Can you have a look?
On Tue, May 28, 2019 at 10:10:43AM +0300, Daniel Baluta wrote:
> On Mon, May 20, 2019 at 10:33 PM Fabio Estevam <[email protected]> wrote:
> >
> > On Thu, May 16, 2019 at 3:35 PM Fabio Estevam <[email protected]> wrote:
> > >
> > > On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
> > >
> > > > + simple-audio-card,codec {
> > > > + sound-dai = <&wm8524>;
> > > > + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
> > >
> > > IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
> > > interface, not an external clock that feeds the codec.
> > >
> > > It seems you should remove this 'clocks' entry.
> >
> > Just checked the schematics and the SAI3_MCLK pin clocks the codec, so
> > the representation is correct:
> >
> > Reviewed-by: Fabio Estevam <[email protected]>
>
> Shawn,
>
> Can you have a look?
I cannot apply this one, because there are '=20' in the patch content.
Shawn
On Fri, May 31, 2019 at 03:28:33PM +0800, Shawn Guo wrote:
> On Tue, May 28, 2019 at 10:10:43AM +0300, Daniel Baluta wrote:
> > On Mon, May 20, 2019 at 10:33 PM Fabio Estevam <[email protected]> wrote:
> > >
> > > On Thu, May 16, 2019 at 3:35 PM Fabio Estevam <[email protected]> wrote:
> > > >
> > > > On Wed, May 15, 2019 at 11:42 AM Daniel Baluta <[email protected]> wrote:
> > > >
> > > > > + simple-audio-card,codec {
> > > > > + sound-dai = <&wm8524>;
> > > > > + clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
> > > >
> > > > IMX8MM_CLK_SAI3_ROOT is the internal clock that drives the SAI3
> > > > interface, not an external clock that feeds the codec.
> > > >
> > > > It seems you should remove this 'clocks' entry.
> > >
> > > Just checked the schematics and the SAI3_MCLK pin clocks the codec, so
> > > the representation is correct:
> > >
> > > Reviewed-by: Fabio Estevam <[email protected]>
> >
> > Shawn,
> >
> > Can you have a look?
>
> I cannot apply this one, because there are '=20' in the patch content.
Talk to NXP colleague Anson Huang <[email protected]> to find out how
to fix it.
https://patchwork.kernel.org/patch/10944169/#22656941
Shawn