diff mbox series

[v5,5/5] arm64: dts: imx8mp: Add analog audio output on i.MX8MP EVK

Message ID 20230227174308.87286-5-marex@denx.de (mailing list archive)
State Superseded, archived
Headers show
Series [v5,1/5] clk: Introduce devm_clk_hw_register_gate_parent_data() | expand

Commit Message

Marek Vasut Feb. 27, 2023, 5:43 p.m. UTC
Enable SAI3 on i.MX8MP EVK, add WM8960 codec binding and regulator.
This is all that is needed to get analog audio output operational
on i.MX8MP EVK.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Abel Vesa <abelvesa@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jacky Bai <ping.bai@nxp.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-clk@vger.kernel.org
---
V2: No change
V3: No change
V4: - Update codec node name and phandle label
    - Use just sound for the sound node name
    - Rebase on next 20230223
V5: - Drop regulator-always-on from codec regulator
    - Add RB from Fabio
    - TB by Alexander added and removed again, since the patch was reworked
    - Switch to simple-audio-card
    - Add sound-dai-cells to codec node
---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 74 ++++++++++++++++++++
 1 file changed, 74 insertions(+)

Comments

Marco Felsch Feb. 27, 2023, 6:59 p.m. UTC | #1
Hi Marek,

thanks for switching to simple-audio-card :)

On 23-02-27, Marek Vasut wrote:
> Enable SAI3 on i.MX8MP EVK, add WM8960 codec binding and regulator.
> This is all that is needed to get analog audio output operational
> on i.MX8MP EVK.
> 
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Abel Vesa <abelvesa@kernel.org>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Jacky Bai <ping.bai@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Marco Felsch <m.felsch@pengutronix.de>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-clk@vger.kernel.org
> ---
> V2: No change
> V3: No change
> V4: - Update codec node name and phandle label
>     - Use just sound for the sound node name
>     - Rebase on next 20230223
> V5: - Drop regulator-always-on from codec regulator
>     - Add RB from Fabio
>     - TB by Alexander added and removed again, since the patch was reworked
>     - Switch to simple-audio-card
>     - Add sound-dai-cells to codec node
> ---
>  arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 74 ++++++++++++++++++++
>  1 file changed, 74 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> index 7816853162b3f..f2285ed9f70b1 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> @@ -40,6 +40,15 @@ pcie0_refclk: pcie0-refclk {
>  		clock-frequency = <100000000>;
>  	};
>  
> +	reg_audio_pwr: regulator-audio-pwr {
> +		compatible = "regulator-fixed";
> +		regulator-name = "audio-pwr";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
> +		enable-active-high;

We should have a proper pinctrl setup for the regulator device.

> +	};
> +
>  	reg_can1_stby: regulator-can1-stby {
>  		compatible = "regulator-fixed";
>  		regulator-name = "can1-stby";
> @@ -83,6 +92,37 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
>  		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
>  		enable-active-high;
>  	};
> +
> +	sound {
> +		compatible = "simple-audio-card";
> +		simple-audio-card,name = "wm8960-audio";
> +		simple-audio-card,format = "i2s";
> +		simple-audio-card,frame-master = <&cpudai>;
> +		simple-audio-card,bitclock-master = <&cpudai>;
> +		simple-audio-card,widgets =
> +			"Headphone", "Headphone Jack",
> +			"Speaker", "External Speaker",
> +			"Microphone", "Mic Jack";
> +		simple-audio-card,routing =
> +			"Headphone Jack", "HP_L",
> +			"Headphone Jack", "HP_R",
> +			"External Speaker", "SPK_LP",
> +			"External Speaker", "SPK_LN",
> +			"External Speaker", "SPK_RP",
> +			"External Speaker", "SPK_RN",
> +			"LINPUT1", "Mic Jack",
> +			"LINPUT3", "Mic Jack",
> +			"Mic Jack", "MICB";
> +
> +		cpudai: simple-audio-card,cpu {
> +			sound-dai = <&sai3>;
> +		};
> +
> +		simple-audio-card,codec {
> +			sound-dai = <&wm8960>;
> +		};
> +
> +	};
>  };
>  
>  &flexspi {
> @@ -344,6 +384,18 @@ &i2c3 {
>  	pinctrl-0 = <&pinctrl_i2c3>;
>  	status = "okay";
>  
> +	wm8960: codec@1a {
> +		#sound-dai-cells = <0>;
> +		compatible = "wlf,wm8960";
> +		reg = <0x1a>;

The compatible should be the first property followed by the reg
property.

> +		clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
> +		clock-names = "mclk";
> +		wlf,shared-lrclk;
> +		wlf,hp-cfg = <3 2 3>;
> +		wlf,gpio-cfg = <1 3>;
> +		SPKVDD1-supply = <&reg_audio_pwr>;
> +	};
> +
>  	pca6416: gpio@20 {
>  		compatible = "ti,tca6416";
>  		reg = <0x20>;
> @@ -422,6 +474,16 @@ &pwm4 {
>  	status = "okay";
>  };
>  
> +&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>;
> +	fsl,sai-mclk-direction-output;
> +	status = "okay";
> +};
> +
>  &snvs_pwrkey {
>  	status = "okay";
>  };
> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS	0x140
>  		>;
>  	};
>  
> +	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_RXFS__GPIO4_IO28		0xd6

What is gpio04-io28 used for?

> +			MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29		0xd6
> +		>;
> +	};

Regards,
  Marco
Marek Vasut Feb. 27, 2023, 7:33 p.m. UTC | #2
On 2/27/23 19:59, Marco Felsch wrote:
[...]

>> @@ -344,6 +384,18 @@ &i2c3 {
>>   	pinctrl-0 = <&pinctrl_i2c3>;
>>   	status = "okay";
>>   
>> +	wm8960: codec@1a {
>> +		#sound-dai-cells = <0>;
>> +		compatible = "wlf,wm8960";
>> +		reg = <0x1a>;
> 
> The compatible should be the first property followed by the reg
> property.

See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
The rest is fixed in V6.

>> +		clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
>> +		clock-names = "mclk";
>> +		wlf,shared-lrclk;
>> +		wlf,hp-cfg = <3 2 3>;
>> +		wlf,gpio-cfg = <1 3>;
>> +		SPKVDD1-supply = <&reg_audio_pwr>;
>> +	};
>> +
>>   	pca6416: gpio@20 {
>>   		compatible = "ti,tca6416";
>>   		reg = <0x20>;

[...]

>> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS	0x140
>>   		>;
>>   	};
>>   
>> +	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_RXFS__GPIO4_IO28		0xd6
> 
> What is gpio04-io28 used for?

Apparently unused, dropped.
Adam Ford Feb. 28, 2023, 2:44 a.m. UTC | #3
On Mon, Feb 27, 2023 at 1:37 PM Marek Vasut <marex@denx.de> wrote:
>
> On 2/27/23 19:59, Marco Felsch wrote:
> [...]
>
> >> @@ -344,6 +384,18 @@ &i2c3 {
> >>      pinctrl-0 = <&pinctrl_i2c3>;
> >>      status = "okay";
> >>
> >> +    wm8960: codec@1a {
> >> +            #sound-dai-cells = <0>;
> >> +            compatible = "wlf,wm8960";
> >> +            reg = <0x1a>;
> >
> > The compatible should be the first property followed by the reg
> > property.
>
> See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
> The rest is fixed in V6.
>
> >> +            clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
> >> +            clock-names = "mclk";
> >> +            wlf,shared-lrclk;
> >> +            wlf,hp-cfg = <3 2 3>;
> >> +            wlf,gpio-cfg = <1 3>;
> >> +            SPKVDD1-supply = <&reg_audio_pwr>;
> >> +    };
> >> +
> >>      pca6416: gpio@20 {
> >>              compatible = "ti,tca6416";
> >>              reg = <0x20>;
>
> [...]
>
> >> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS   0x140
> >>              >;
> >>      };
> >>
> >> +    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_RXFS__GPIO4_IO28              0xd6
> >
> > What is gpio04-io28 used for?
>
> Apparently unused, dropped.

Isn't that the headphone detect GPIO?

I think simple-audio-card,hp-det-gpio can reference it.

adam
Marek Vasut Feb. 28, 2023, 6:43 a.m. UTC | #4
On 2/28/23 03:44, Adam Ford wrote:
> On Mon, Feb 27, 2023 at 1:37 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 2/27/23 19:59, Marco Felsch wrote:
>> [...]
>>
>>>> @@ -344,6 +384,18 @@ &i2c3 {
>>>>       pinctrl-0 = <&pinctrl_i2c3>;
>>>>       status = "okay";
>>>>
>>>> +    wm8960: codec@1a {
>>>> +            #sound-dai-cells = <0>;
>>>> +            compatible = "wlf,wm8960";
>>>> +            reg = <0x1a>;
>>>
>>> The compatible should be the first property followed by the reg
>>> property.
>>
>> See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
>> The rest is fixed in V6.
>>
>>>> +            clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
>>>> +            clock-names = "mclk";
>>>> +            wlf,shared-lrclk;
>>>> +            wlf,hp-cfg = <3 2 3>;
>>>> +            wlf,gpio-cfg = <1 3>;
>>>> +            SPKVDD1-supply = <&reg_audio_pwr>;
>>>> +    };
>>>> +
>>>>       pca6416: gpio@20 {
>>>>               compatible = "ti,tca6416";
>>>>               reg = <0x20>;
>>
>> [...]
>>
>>>> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS   0x140
>>>>               >;
>>>>       };
>>>>
>>>> +    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_RXFS__GPIO4_IO28              0xd6
>>>
>>> What is gpio04-io28 used for?
>>
>> Apparently unused, dropped.
> 
> Isn't that the headphone detect GPIO?
> 
> I think simple-audio-card,hp-det-gpio can reference it.

Per the schematics of the MX8MP EVK, the pin is not connected on the 
board-to-board connector EVK side, right ?
Marek Vasut Feb. 28, 2023, 6:48 a.m. UTC | #5
On 2/28/23 07:43, Marek Vasut wrote:
> On 2/28/23 03:44, Adam Ford wrote:
>> On Mon, Feb 27, 2023 at 1:37 PM Marek Vasut <marex@denx.de> wrote:
>>>
>>> On 2/27/23 19:59, Marco Felsch wrote:
>>> [...]
>>>
>>>>> @@ -344,6 +384,18 @@ &i2c3 {
>>>>>       pinctrl-0 = <&pinctrl_i2c3>;
>>>>>       status = "okay";
>>>>>
>>>>> +    wm8960: codec@1a {
>>>>> +            #sound-dai-cells = <0>;
>>>>> +            compatible = "wlf,wm8960";
>>>>> +            reg = <0x1a>;
>>>>
>>>> The compatible should be the first property followed by the reg
>>>> property.
>>>
>>> See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
>>> The rest is fixed in V6.
>>>
>>>>> +            clocks = <&audio_blk_ctrl 
>>>>> IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
>>>>> +            clock-names = "mclk";
>>>>> +            wlf,shared-lrclk;
>>>>> +            wlf,hp-cfg = <3 2 3>;
>>>>> +            wlf,gpio-cfg = <1 3>;
>>>>> +            SPKVDD1-supply = <&reg_audio_pwr>;
>>>>> +    };
>>>>> +
>>>>>       pca6416: gpio@20 {
>>>>>               compatible = "ti,tca6416";
>>>>>               reg = <0x20>;
>>>
>>> [...]
>>>
>>>>> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS   0x140
>>>>>               >;
>>>>>       };
>>>>>
>>>>> +    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_RXFS__GPIO4_IO28              0xd6
>>>>
>>>> What is gpio04-io28 used for?
>>>
>>> Apparently unused, dropped.
>>
>> Isn't that the headphone detect GPIO?
>>
>> I think simple-audio-card,hp-det-gpio can reference it.
> 
> Per the schematics of the MX8MP EVK, the pin is not connected on the 
> board-to-board connector EVK side, right ?

Er, correction, that's AUD_NINT, which is WM8960 GPIO1 .
Adam Ford Feb. 28, 2023, 11:29 a.m. UTC | #6
On Tue, Feb 28, 2023 at 12:48 AM Marek Vasut <marex@denx.de> wrote:
>
> On 2/28/23 07:43, Marek Vasut wrote:
> > On 2/28/23 03:44, Adam Ford wrote:
> >> On Mon, Feb 27, 2023 at 1:37 PM Marek Vasut <marex@denx.de> wrote:
> >>>
> >>> On 2/27/23 19:59, Marco Felsch wrote:
> >>> [...]
> >>>
> >>>>> @@ -344,6 +384,18 @@ &i2c3 {
> >>>>>       pinctrl-0 = <&pinctrl_i2c3>;
> >>>>>       status = "okay";
> >>>>>
> >>>>> +    wm8960: codec@1a {
> >>>>> +            #sound-dai-cells = <0>;
> >>>>> +            compatible = "wlf,wm8960";
> >>>>> +            reg = <0x1a>;
> >>>>
> >>>> The compatible should be the first property followed by the reg
> >>>> property.
> >>>
> >>> See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
> >>> The rest is fixed in V6.
> >>>
> >>>>> +            clocks = <&audio_blk_ctrl
> >>>>> IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
> >>>>> +            clock-names = "mclk";
> >>>>> +            wlf,shared-lrclk;
> >>>>> +            wlf,hp-cfg = <3 2 3>;
> >>>>> +            wlf,gpio-cfg = <1 3>;
> >>>>> +            SPKVDD1-supply = <&reg_audio_pwr>;
> >>>>> +    };
> >>>>> +
> >>>>>       pca6416: gpio@20 {
> >>>>>               compatible = "ti,tca6416";
> >>>>>               reg = <0x20>;
> >>>
> >>> [...]
> >>>
> >>>>> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS   0x140
> >>>>>               >;
> >>>>>       };
> >>>>>
> >>>>> +    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_RXFS__GPIO4_IO28              0xd6
> >>>>
> >>>> What is gpio04-io28 used for?
> >>>
> >>> Apparently unused, dropped.
> >>
> >> Isn't that the headphone detect GPIO?
> >>
> >> I think simple-audio-card,hp-det-gpio can reference it.
> >
> > Per the schematics of the MX8MP EVK, the pin is not connected on the
> > board-to-board connector EVK side, right ?
>
> Er, correction, that's AUD_NINT, which is WM8960 GPIO1 .

I only went by NXP's downstream device tree.  I didn't have the
schematics in front of me.  Sorry for the noise.

adam
Marek Vasut Feb. 28, 2023, 9:55 p.m. UTC | #7
On 2/28/23 12:29, Adam Ford wrote:
> On Tue, Feb 28, 2023 at 12:48 AM Marek Vasut <marex@denx.de> wrote:
>>
>> On 2/28/23 07:43, Marek Vasut wrote:
>>> On 2/28/23 03:44, Adam Ford wrote:
>>>> On Mon, Feb 27, 2023 at 1:37 PM Marek Vasut <marex@denx.de> wrote:
>>>>>
>>>>> On 2/27/23 19:59, Marco Felsch wrote:
>>>>> [...]
>>>>>
>>>>>>> @@ -344,6 +384,18 @@ &i2c3 {
>>>>>>>        pinctrl-0 = <&pinctrl_i2c3>;
>>>>>>>        status = "okay";
>>>>>>>
>>>>>>> +    wm8960: codec@1a {
>>>>>>> +            #sound-dai-cells = <0>;
>>>>>>> +            compatible = "wlf,wm8960";
>>>>>>> +            reg = <0x1a>;
>>>>>>
>>>>>> The compatible should be the first property followed by the reg
>>>>>> property.
>>>>>
>>>>> See my reply to the mx8mn sound-sai-cells patch , I am not sure here.
>>>>> The rest is fixed in V6.
>>>>>
>>>>>>> +            clocks = <&audio_blk_ctrl
>>>>>>> IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
>>>>>>> +            clock-names = "mclk";
>>>>>>> +            wlf,shared-lrclk;
>>>>>>> +            wlf,hp-cfg = <3 2 3>;
>>>>>>> +            wlf,gpio-cfg = <1 3>;
>>>>>>> +            SPKVDD1-supply = <&reg_audio_pwr>;
>>>>>>> +    };
>>>>>>> +
>>>>>>>        pca6416: gpio@20 {
>>>>>>>                compatible = "ti,tca6416";
>>>>>>>                reg = <0x20>;
>>>>>
>>>>> [...]
>>>>>
>>>>>>> @@ -668,6 +730,18 @@ MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS   0x140
>>>>>>>                >;
>>>>>>>        };
>>>>>>>
>>>>>>> +    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_RXFS__GPIO4_IO28              0xd6
>>>>>>
>>>>>> What is gpio04-io28 used for?
>>>>>
>>>>> Apparently unused, dropped.
>>>>
>>>> Isn't that the headphone detect GPIO?
>>>>
>>>> I think simple-audio-card,hp-det-gpio can reference it.
>>>
>>> Per the schematics of the MX8MP EVK, the pin is not connected on the
>>> board-to-board connector EVK side, right ?
>>
>> Er, correction, that's AUD_NINT, which is WM8960 GPIO1 .
> 
> I only went by NXP's downstream device tree.  I didn't have the
> schematics in front of me.  Sorry for the noise.

But you and Marco were right in that I had the regulator pinmux wrong 
(fixed in V6)
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
index 7816853162b3f..f2285ed9f70b1 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
@@ -40,6 +40,15 @@  pcie0_refclk: pcie0-refclk {
 		clock-frequency = <100000000>;
 	};
 
+	reg_audio_pwr: regulator-audio-pwr {
+		compatible = "regulator-fixed";
+		regulator-name = "audio-pwr";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
 	reg_can1_stby: regulator-can1-stby {
 		compatible = "regulator-fixed";
 		regulator-name = "can1-stby";
@@ -83,6 +92,37 @@  reg_usdhc2_vmmc: regulator-usdhc2 {
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "wm8960-audio";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,frame-master = <&cpudai>;
+		simple-audio-card,bitclock-master = <&cpudai>;
+		simple-audio-card,widgets =
+			"Headphone", "Headphone Jack",
+			"Speaker", "External Speaker",
+			"Microphone", "Mic Jack";
+		simple-audio-card,routing =
+			"Headphone Jack", "HP_L",
+			"Headphone Jack", "HP_R",
+			"External Speaker", "SPK_LP",
+			"External Speaker", "SPK_LN",
+			"External Speaker", "SPK_RP",
+			"External Speaker", "SPK_RN",
+			"LINPUT1", "Mic Jack",
+			"LINPUT3", "Mic Jack",
+			"Mic Jack", "MICB";
+
+		cpudai: simple-audio-card,cpu {
+			sound-dai = <&sai3>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&wm8960>;
+		};
+
+	};
 };
 
 &flexspi {
@@ -344,6 +384,18 @@  &i2c3 {
 	pinctrl-0 = <&pinctrl_i2c3>;
 	status = "okay";
 
+	wm8960: codec@1a {
+		#sound-dai-cells = <0>;
+		compatible = "wlf,wm8960";
+		reg = <0x1a>;
+		clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
+		clock-names = "mclk";
+		wlf,shared-lrclk;
+		wlf,hp-cfg = <3 2 3>;
+		wlf,gpio-cfg = <1 3>;
+		SPKVDD1-supply = <&reg_audio_pwr>;
+	};
+
 	pca6416: gpio@20 {
 		compatible = "ti,tca6416";
 		reg = <0x20>;
@@ -422,6 +474,16 @@  &pwm4 {
 	status = "okay";
 };
 
+&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>;
+	fsl,sai-mclk-direction-output;
+	status = "okay";
+};
+
 &snvs_pwrkey {
 	status = "okay";
 };
@@ -668,6 +730,18 @@  MX8MP_IOMUXC_UART3_TXD__UART1_DCE_RTS	0x140
 		>;
 	};
 
+	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_RXFS__GPIO4_IO28		0xd6
+			MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29		0xd6
+		>;
+	};
+
 	pinctrl_uart2: uart2grp {
 		fsl,pins = <
 			MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX	0x140