mbox series

[v5,0/6] arm64: ti: Enable audio on AM62 and AM62A

Message ID 20230313-mcasp_upstream-v5-0-d6844707aa8a@ti.com
Headers show
Series arm64: ti: Enable audio on AM62 and AM62A | expand

Message

Jai Luthra March 13, 2023, 2:49 p.m. UTC
This patch series adds support for audio output via headphone jack on
SK-AM62 and SK-AM62A boards. The jack is wired to TLV320AIC3106 (codec),
which is connected to McASP1 (serializer) on the SoC.

The TRRS 3.5mm jack can be used for simultaneous playback and recording.

v5:
- Ported codec bindings to dtschema
- Add audio drivers in arm64 defconfig
- Keep McASP nodes disabled in SoC dtsi
- Enable audio-input for AM62
- Enable same feature-set for AM62A

v4: https://lore.kernel.org/all/20220620102750.32718-1-j-luthra@ti.com/

Signed-off-by: Jai Luthra <j-luthra@ti.com>
---
Jai Luthra (5):
      arm64: defconfig: Enable audio drivers for TI K3 SoCs
      arm64: dts: ti: k3-am625-sk: Enable audio on AM62 SK
      arm64: dts: ti: k3-am62a-main: Add nodes for McASP
      arm64: dts: ti: k3-am62a7-sk: Split vcc_3v3 regulators
      arm64: dts: ti: k3-am62a7-sk: Enable audio on AM62A

Jayesh Choudhary (1):
      arm64: dts: ti: k3-am62-main: Add McASP nodes

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi  | 60 ++++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am625-sk.dts    | 88 +++++++++++++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 60 ++++++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts   | 92 ++++++++++++++++++++++++++++++-
 arch/arm64/configs/defconfig              |  2 +
 5 files changed, 300 insertions(+), 2 deletions(-)
---
base-commit: 24469a0e5052ba01a35a15f104717a82b7a4798b
change-id: 20230313-mcasp_upstream-0e137013059b

Best regards,

Comments

Jayesh Choudhary March 15, 2023, 4:23 a.m. UTC | #1
On 13/03/23 20:19, Jai Luthra wrote:
> Add nodes for audio codec and sound card, enable the audio serializer
> (McASP1) under use and update pinmux.
> 
> Signed-off-by: Jai Luthra <j-luthra@ti.com>
> ---
>   arch/arm64/boot/dts/ti/k3-am625-sk.dts | 88 ++++++++++++++++++++++++++++++++++
>   1 file changed, 88 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/ti/k3-am625-sk.dts b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
> index 6bc7d63cf52f..3199042f3687 100644
> --- a/arch/arm64/boot/dts/ti/k3-am625-sk.dts
> +++ b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
> @@ -141,6 +141,52 @@ vdd_sd_dv: regulator-4 {
>   			 <3300000 0x1>;
>   	};
>   
> +	vcc_1v8: regulator-5 {
> +		/* output of TPS6282518DMQ */
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc_1v8";
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +		vin-supply = <&vcc_3v3_sys>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +	};
> +
> +	tlv320_mclk: clk-0 {
> +		#clock-cells = <0>;
> +		compatible = "fixed-clock";
> +		clock-frequency = <12288000>;
> +	};
> +
> +	sound {

Should we put label 'codec_audio' here similar to am62a7-sk???

> +		compatible = "simple-audio-card";
> +		simple-audio-card,name = "AM62x-SKEVM";
> +		simple-audio-card,widgets =
> +			"Headphone",	"Headphone Jack",
> +			"Line",	"Line In",
> +			"Microphone", "Microphone Jack";

Space/tab inconsistency after "Microphone",

> +		simple-audio-card,routing =
> +			"Headphone Jack",	"HPLOUT",
> +			"Headphone Jack",	"HPROUT",
> +			"LINE1L",		"Line In",
> +			"LINE1R",		"Line In",
> +			"MIC3R",		"Microphone Jack",
> +			"Microphone Jack",	"Mic Bias";
> +		simple-audio-card,format = "dsp_b";
> +		simple-audio-card,bitclock-master = <&sound_master>;
> +		simple-audio-card,frame-master = <&sound_master>;
> +		simple-audio-card,bitclock-inversion;
> +
> +		simple-audio-card,cpu {
> +			sound-dai = <&mcasp1>;
> +		};
> +
> +		sound_master: simple-audio-card,codec {
> +			sound-dai = <&tlv320aic3106>;
> +			clocks = <&tlv320_mclk>;
> +		};
> +	};
> +
>   	leds {
>   		compatible = "gpio-leds";
>   		pinctrl-names = "default";
> @@ -292,6 +338,15 @@ main_usb1_pins_default: main-usb1-pins-default {
>   			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18) USB1_DRVVBUS */
>   		>;
>   	};
> +
> +	main_mcasp1_pins_default: main-mcasp1-pins-default {
> +		pinctrl-single,pins = <
> +			AM62X_IOPAD(0x0090, PIN_INPUT, 2) /* (M24) GPMC0_BE0N_CLE.MCASP1_ACLKX */
> +			AM62X_IOPAD(0x0098, PIN_INPUT, 2) /* (U23) GPMC0_WAIT0.MCASP1_AFSX */
> +			AM62X_IOPAD(0x008c, PIN_OUTPUT, 2) /* (L25) GPMC0_WEN.MCASP1_AXR0 */
> +			AM62X_IOPAD(0x0084, PIN_INPUT, 2) /* (L23) GPMC0_ADVN_ALE.MCASP1_AXR2 */

Better to have padding for the offsets here consistent across dt.

Reviewed-by: Jayesh Choudhary <j-choudhary@ti.com>

> +		>;
> +	};
>   };
>   
>   &wkup_uart0 {
> @@ -349,6 +404,19 @@ exp1: gpio@22 {
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&main_gpio1_ioexp_intr_pins_default>;
>   	};
> +
> +	tlv320aic3106: audio-codec@1b {
> +		#sound-dai-cells = <0>;
> +		compatible = "ti,tlv320aic3106";
> +		reg = <0x1b>;
> +		ai3x-micbias-vg = <1>;	/* 2.0V */
> +
> +		/* Regulators */
> +		AVDD-supply = <&vcc_3v3_sys>;
> +		IOVDD-supply = <&vcc_3v3_sys>;
> +		DRVDD-supply = <&vcc_3v3_sys>;
> +		DVDD-supply = <&vcc_1v8>;
> +	};
>   };
>   
>   &sdhci0 {
> @@ -406,6 +474,26 @@ cpsw3g_phy1: ethernet-phy@1 {
>   	};
>   };
>   
> +&mcasp1 {
> +	status = "okay";
> +	#sound-dai-cells = <0>;
> +
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&main_mcasp1_pins_default>;
> +
> +	op-mode = <0>;          /* MCASP_IIS_MODE */
> +	tdm-slots = <2>;
> +
> +	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
> +	       1 0 2 0
> +	       0 0 0 0
> +	       0 0 0 0
> +	       0 0 0 0
> +	>;
> +	tx-num-evt = <32>;
> +	rx-num-evt = <32>;
> +};
> +
>   &mailbox0_cluster0 {
>   	mbox_m4_0: mbox-m4-0 {
>   		ti,mbox-rx = <0 0 0>;
>
Jayesh Choudhary March 15, 2023, 4:32 a.m. UTC | #2
On 13/03/23 20:19, Jai Luthra wrote:
> Add nodes for audio codec and sound card, enable the audio serializer
> (McASP1) under use and update pinmux.
> 
> Signed-off-by: Jai Luthra <j-luthra@ti.com>
> ---
>   arch/arm64/boot/dts/ti/k3-am62a7-sk.dts | 77 +++++++++++++++++++++++++++++++++
>   1 file changed, 77 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> index 063e69e45163..1775ed154aff 100644
> --- a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> +++ b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> @@ -122,6 +122,41 @@ led-0 {
>   			default-state = "off";
>   		};
>   	};
> +
> +	tlv320_mclk: clk-0 {
> +		#clock-cells = <0>;
> +		compatible = "fixed-clock";
> +		clock-frequency = <12288000>;
> +	};
> +
> +	codec_audio: sound {
> +		compatible = "simple-audio-card";
> +		simple-audio-card,name = "AM62Ax-SKEVM";
> +		simple-audio-card,widgets =
> +			"Headphone",	"Headphone Jack",
> +			"Line",	"Line In",
> +			"Microphone",	"Microphone Jack";
> +		simple-audio-card,routing =
> +			"Headphone Jack",	"HPLOUT",
> +			"Headphone Jack",	"HPROUT",
> +			"LINE1L",		"Line In",
> +			"LINE1R",		"Line In",
> +			"MIC3R",		"Microphone Jack",
> +			"Microphone Jack",	"Mic Bias";
> +		simple-audio-card,format = "dsp_b";
> +		simple-audio-card,bitclock-master = <&sound_master>;
> +		simple-audio-card,frame-master = <&sound_master>;
> +		simple-audio-card,bitclock-inversion;
> +
> +		simple-audio-card,cpu {
> +			sound-dai = <&mcasp1>;
> +		};
> +
> +		sound_master: simple-audio-card,codec {
> +			sound-dai = <&tlv320aic3106>;
> +			clocks = <&tlv320_mclk>;
> +		};
> +	};
>   };
>   
>   &main_pmx0 {
> @@ -200,6 +235,15 @@ AM62AX_IOPAD(0x130, PIN_INPUT, 0) /* (AB17) RGMII1_TXC */
>   			AM62AX_IOPAD(0x12c, PIN_INPUT, 0) /* (W16) RGMII1_TX_CTL */
>   		>;
>   	};
> +
> +	main_mcasp1_pins_default: main-mcasp1-pins-default {
> +		pinctrl-single,pins = <
> +			AM62AX_IOPAD(0x090, PIN_INPUT, 2) /* (L19) GPMC0_BE0n_CLE.MCASP1_ACLKX */
> +			AM62AX_IOPAD(0x098, PIN_INPUT, 2) /* (R18) GPMC0_WAIT0.MCASP1_AFSX */
> +			AM62AX_IOPAD(0x08c, PIN_OUTPUT, 2) /* (K19) GPMC0_WEn.MCASP1_AXR0 */
> +			AM62AX_IOPAD(0x084, PIN_INPUT, 2) /* (L18) GPMC0_ADVn_ALE.MCASP1_AXR2 */
> +		>;
> +	};
>   };
>   
>   &main_i2c0 {
> @@ -234,6 +278,19 @@ exp1: gpio@22 {
>   				   "MCASP1_FET_SEL", "UART1_FET_SEL",
>   				   "PD_I2C_IRQ", "IO_EXP_TEST_LED";
>   	};
> +
> +	tlv320aic3106: audio-codec@1b {
> +		#sound-dai-cells = <0>;
> +		compatible = "ti,tlv320aic3106";
> +		reg = <0x1b>;
> +		ai3x-micbias-vg = <1>;		/* 2.0V */
> +		status = "okay";

No need for status property here I guess????

> +
> +		/* Regulators */
> +		AVDD-supply = <&vcc_3v3_sys>;
> +		IOVDD-supply = <&vcc_3v3_sys>;
> +		DRVDD-supply = <&vcc_3v3_sys>;

DVDD 1.8V supply here looks missing???

Reviewed-by: Jayesh Choudhary <j-choudhary@ti.com>

> +	};
>   };
>   
>   &sdhci1 {
> @@ -302,3 +359,23 @@ cpsw3g_phy0: ethernet-phy@0 {
>   		ti,min-output-impedance;
>   	};
>   };
> +
> +&mcasp1 {
> +	status = "okay";
> +	#sound-dai-cells = <0>;
> +
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&main_mcasp1_pins_default>;
> +
> +	op-mode = <0>;          /* MCASP_IIS_MODE */
> +	tdm-slots = <2>;
> +
> +	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
> +	       1 0 2 0
> +	       0 0 0 0
> +	       0 0 0 0
> +	       0 0 0 0
> +	>;
> +	tx-num-evt = <32>;
> +	rx-num-evt = <32>;
> +};
>
Jai Luthra March 15, 2023, 6:29 a.m. UTC | #3
Hi Jayesh,

Thanks for the comments on the series.

On Mar 15, 2023 at 10:02:24 +0530, Jayesh Choudhary wrote:
> 
> 
> On 13/03/23 20:19, Jai Luthra wrote:
> > Add nodes for audio codec and sound card, enable the audio serializer
> > (McASP1) under use and update pinmux.
> > 
> > Signed-off-by: Jai Luthra <j-luthra@ti.com>
> > ---
> >   arch/arm64/boot/dts/ti/k3-am62a7-sk.dts | 77 +++++++++++++++++++++++++++++++++
> >   1 file changed, 77 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> > index 063e69e45163..1775ed154aff 100644
> > --- a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> > +++ b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
> > @@ -122,6 +122,41 @@ led-0 {
> >   			default-state = "off";
> >   		};
> >   	};
> > +
> > +	tlv320_mclk: clk-0 {
> > +		#clock-cells = <0>;
> > +		compatible = "fixed-clock";
> > +		clock-frequency = <12288000>;
> > +	};
> > +
> > +	codec_audio: sound {
> > +		compatible = "simple-audio-card";
> > +		simple-audio-card,name = "AM62Ax-SKEVM";
> > +		simple-audio-card,widgets =
> > +			"Headphone",	"Headphone Jack",
> > +			"Line",	"Line In",
> > +			"Microphone",	"Microphone Jack";
> > +		simple-audio-card,routing =
> > +			"Headphone Jack",	"HPLOUT",
> > +			"Headphone Jack",	"HPROUT",
> > +			"LINE1L",		"Line In",
> > +			"LINE1R",		"Line In",
> > +			"MIC3R",		"Microphone Jack",
> > +			"Microphone Jack",	"Mic Bias";
> > +		simple-audio-card,format = "dsp_b";
> > +		simple-audio-card,bitclock-master = <&sound_master>;
> > +		simple-audio-card,frame-master = <&sound_master>;
> > +		simple-audio-card,bitclock-inversion;
> > +
> > +		simple-audio-card,cpu {
> > +			sound-dai = <&mcasp1>;
> > +		};
> > +
> > +		sound_master: simple-audio-card,codec {
> > +			sound-dai = <&tlv320aic3106>;
> > +			clocks = <&tlv320_mclk>;
> > +		};
> > +	};
> >   };
> >   &main_pmx0 {
> > @@ -200,6 +235,15 @@ AM62AX_IOPAD(0x130, PIN_INPUT, 0) /* (AB17) RGMII1_TXC */
> >   			AM62AX_IOPAD(0x12c, PIN_INPUT, 0) /* (W16) RGMII1_TX_CTL */
> >   		>;
> >   	};
> > +
> > +	main_mcasp1_pins_default: main-mcasp1-pins-default {
> > +		pinctrl-single,pins = <
> > +			AM62AX_IOPAD(0x090, PIN_INPUT, 2) /* (L19) GPMC0_BE0n_CLE.MCASP1_ACLKX */
> > +			AM62AX_IOPAD(0x098, PIN_INPUT, 2) /* (R18) GPMC0_WAIT0.MCASP1_AFSX */
> > +			AM62AX_IOPAD(0x08c, PIN_OUTPUT, 2) /* (K19) GPMC0_WEn.MCASP1_AXR0 */
> > +			AM62AX_IOPAD(0x084, PIN_INPUT, 2) /* (L18) GPMC0_ADVn_ALE.MCASP1_AXR2 */
> > +		>;
> > +	};
> >   };
> >   &main_i2c0 {
> > @@ -234,6 +278,19 @@ exp1: gpio@22 {
> >   				   "MCASP1_FET_SEL", "UART1_FET_SEL",
> >   				   "PD_I2C_IRQ", "IO_EXP_TEST_LED";
> >   	};
> > +
> > +	tlv320aic3106: audio-codec@1b {
> > +		#sound-dai-cells = <0>;
> > +		compatible = "ti,tlv320aic3106";
> > +		reg = <0x1b>;
> > +		ai3x-micbias-vg = <1>;		/* 2.0V */
> > +		status = "okay";
> 
> No need for status property here I guess????

Will fix.

> 
> > +
> > +		/* Regulators */
> > +		AVDD-supply = <&vcc_3v3_sys>;
> > +		IOVDD-supply = <&vcc_3v3_sys>;
> > +		DRVDD-supply = <&vcc_3v3_sys>;
> 
> DVDD 1.8V supply here looks missing???

Sorry I missed to add a note in the commit message, will add in v6.

DVDD 1.8V is supplied by the PMIC (TPS6593x-Q1) on the SK, the driver 
and dt-bindings for it are still being worked on:
https://lore.kernel.org/all/20230216114410.183489-1-jpanis@baylibre.com/

The codec can be enabled without it for now, as it only uses the 
regulators to calculate the OCMV, which I will supply manually to the 
codec through DT in v6.

> 
> Reviewed-by: Jayesh Choudhary <j-choudhary@ti.com>
> 
> > +	};
> >   };
> >   &sdhci1 {
> > @@ -302,3 +359,23 @@ cpsw3g_phy0: ethernet-phy@0 {
> >   		ti,min-output-impedance;
> >   	};
> >   };
> > +
> > +&mcasp1 {
> > +	status = "okay";
> > +	#sound-dai-cells = <0>;
> > +
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&main_mcasp1_pins_default>;
> > +
> > +	op-mode = <0>;          /* MCASP_IIS_MODE */
> > +	tdm-slots = <2>;
> > +
> > +	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
> > +	       1 0 2 0
> > +	       0 0 0 0
> > +	       0 0 0 0
> > +	       0 0 0 0
> > +	>;
> > +	tx-num-evt = <32>;
> > +	rx-num-evt = <32>;
> > +};
> >