diff mbox series

[v2,2/2] arm64: dts: imx8mm-evk: Enable audio codec wm8524

Message ID 20190422193542.2853-3-daniel.baluta@nxp.com (mailing list archive)
State New, archived
Headers show
Series Enable wm8524 codec on i.MX8MM EVK | expand

Commit Message

Daniel Baluta April 22, 2019, 7:36 p.m. UTC
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
	* clock hierarchy
	* codec node
	* simple-card configuration

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comments

Marco Felsch April 23, 2019, 5:17 a.m. UTC | #1
Hi Daniel,

On 19-04-22 19:36, Daniel Baluta wrote:
> 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
> 	* clock hierarchy
> 	* codec node
> 	* simple-card configuration
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 48 ++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> index 2d5d89475b76..207b13266a96 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> @@ -37,6 +37,35 @@
>  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
>  		enable-active-high;
>  	};
> +
> +	wm8524: audio-codec {
> +		#sound-dai-cells = <0>;
> +		compatible = "wlf,wm8524";
> +		wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;

I would mux the gpio where I use them.

> +	};
> +
> +	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>;
> +		};
> +
> +		link_codec: simple-audio-card,codec {

Can you drop that phandle?

Regards,
  Marco

> +			sound-dai = <&wm8524>;
> +			clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
> +		};
> +	};
>  };
>  
>  &fec1 {
> @@ -61,6 +90,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>;
> @@ -130,6 +168,16 @@
>  		>;
>  	};
>  
> +	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
> +			MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21        0xd6
> +		>;
> +	};
> +
>  	pinctrl_uart2: uart2grp {
>  		fsl,pins = <
>  			MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX	0x140
> -- 
> 2.17.1
>
Daniel Baluta April 23, 2019, 6:22 a.m. UTC | #2
Hi Marco,

On Tue, Apr 23, 2019 at 8:19 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
>
> Hi Daniel,
>
> On 19-04-22 19:36, Daniel Baluta wrote:
> > 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
> >       * clock hierarchy
> >       * codec node
> >       * simple-card configuration
> >
> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > ---
> >  arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 48 ++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > index 2d5d89475b76..207b13266a96 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > @@ -37,6 +37,35 @@
> >               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
> >               enable-active-high;
> >       };
> > +
> > +     wm8524: audio-codec {
> > +             #sound-dai-cells = <0>;
> > +             compatible = "wlf,wm8524";
> > +             wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
>
> I would mux the gpio where I use them.

I'm not sure I understand this. Can you provide an example.
>
> > +     };
> > +
> > +     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>;
> > +             };
> > +
> > +             link_codec: simple-audio-card,codec {
>
> Can you drop that phandle?

I see your point here. But for symmetry and consistency with
imx8mm-evk I would prefer
to keep it like that.

https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/tree/arch/arm64/boot/dts/freescale/imx8mq-evk.dts?h=for-next#n59
Marco Felsch April 23, 2019, 7:31 a.m. UTC | #3
Hi Daniel,

On 19-04-23 09:22, Daniel Baluta wrote:
> Hi Marco,
> 
> On Tue, Apr 23, 2019 at 8:19 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
> >
> > Hi Daniel,
> >
> > On 19-04-22 19:36, Daniel Baluta wrote:
> > > 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
> > >       * clock hierarchy
> > >       * codec node
> > >       * simple-card configuration
> > >
> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > ---
> > >  arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 48 ++++++++++++++++++++
> > >  1 file changed, 48 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > > index 2d5d89475b76..207b13266a96 100644
> > > --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > > +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
> > > @@ -37,6 +37,35 @@
> > >               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
> > >               enable-active-high;
> > >       };
> > > +
> > > +     wm8524: audio-codec {
> > > +             #sound-dai-cells = <0>;
> > > +             compatible = "wlf,wm8524";
> > > +             wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
> >
> > I would mux the gpio where I use them.
> 
> I'm not sure I understand this. Can you provide an example.

Just adding a princtrl-0 and pinctrl-names entry to mux the gpio here
rather than within the sai node.

> >
> > > +     };
> > > +
> > > +     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>;
> > > +             };
> > > +
> > > +             link_codec: simple-audio-card,codec {
> >
> > Can you drop that phandle?
> 
> I see your point here. But for symmetry and consistency with
> imx8mm-evk I would prefer
> to keep it like that.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/tree/arch/arm64/boot/dts/freescale/imx8mq-evk.dts?h=for-next#n59
> 

Got your point but I think that the evk dts will be used as base for
future dts. Instead of keep them here I would send a patch to drop the
phandle in the imx8mq-evk.dts since it isn't necessary.

Regards,
  Marco
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
index 2d5d89475b76..207b13266a96 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
@@ -37,6 +37,35 @@ 
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+	wm8524: audio-codec {
+		#sound-dai-cells = <0>;
+		compatible = "wlf,wm8524";
+		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>;
+		};
+
+		link_codec: simple-audio-card,codec {
+			sound-dai = <&wm8524>;
+			clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
+		};
+	};
 };
 
 &fec1 {
@@ -61,6 +90,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>;
@@ -130,6 +168,16 @@ 
 		>;
 	};
 
+	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
+			MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21        0xd6
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX8MM_IOMUXC_UART2_RXD_UART2_DCE_RX	0x140