Skip to content
Snippets Groups Projects
Commit 8ad5ea7e authored by Nicola Sparnacci's avatar Nicola Sparnacci
Browse files

[C57][DTS][C57-38][C57-61] Add audio support

Add audio support. Tested only the TRRS connector. The audio connector
should work properly configuring Alsa.

Test procedure:

```
 # Mixer configuration
amixer sset -q 'CM1_L to Left Mixer Negative Resistor' '10 kOhm'
amixer sset -q 'CM1_R to Right Mixer Negative Resistor' '10 kOhm'
amixer sset -q 'CM2_L to Left Mixer Negative Resistor' '10 kOhm'
amixer sset -q 'CM2_R to Right Mixer Negative Resistor' '10 kOhm'
amixer sset -q 'Mic PGA' on
amixer sset -q 'IN3_L to Left Mixer Positive Resistor' '10 kOhm'
amixer sset -q 'IN3_R to Right Mixer Positive Resistor' '10 kOhm'
amixer sset -q 'HP DAC' on
amixer sset -q 'HPL Output Mixer L_DAC' on
amixer sset -q 'HPR Output Mixer R_DAC' on
amixer sset -q 'LO DAC' on
amixer sset -q 'LOL Output Mixer L_DAC' on
amixer sset -q 'LOR Output Mixer R_DAC' on
amixer sset -q 'PCM' 50%
amixer sset -q 'Mixer Amp. Driver Gain' 40%
amixer sset -q 'HP Driver Gain' 30%
amixer sset -q 'LO Driver Gain' 30%
amixer sset -q 'ADC Level' 50%
amixer sset -q 'PGA Level' 50%

 # Record
arecord --format=dat test-mic.wav
 # Playback
aplay test-mic.wav
```
parent a767c743
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@
serial3 = &lpuart3;
mmc0 = &usdhc1;
mmc1 = &usdhc2;
i2c4 = &cm40_i2c;
i2c5 = &i2c0_mipi_lvds0;
i2c6 = &i2c0_mipi_lvds1;
gpio0 = &gpio0;
......@@ -153,6 +154,32 @@
enable-active-down;
regulator-always-on;
};
reg_audio: regulator-soc-audio {
compatible = "regulator-fixed";
regulator-name = "tlv320aic32x4_supply";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};
sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "seco-tlv320";
simple-audio-card,frame-master = <&cpudai>;
simple-audio-card,bitclock-master = <&cpudai>;
cpudai: simple-audio-card,cpu {
sound-dai = <&sai1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};
simple-audio-card,codec {
sound-dai = <&tlvcodec 0>;
};
};
/* Both Panels backlight + MP3385AGR */
......@@ -195,6 +222,14 @@
};
};
&acm {
status = "okay";
};
&asrc0 {
fsl,asrc-rate = <48000>;
status = "okay";
};
&iomuxc {
......@@ -219,9 +254,21 @@
IMX8QXP_CSI_MCLK_LSIO_GPIO3_IO01 0x00000021
/*EN_VCC_LCD_SW*/
IMX8QXP_SPDIF0_EXT_CLK_LSIO_GPIO0_IO12 0x00000021
/*TRRS_PLUG_DETECT*/
IMX8QXP_QSPI0A_SS1_B_LSIO_GPIO3_IO15 0x00000021
/*MUTE AUDIO#*/
IMX8QXP_MIPI_DSI0_GPIO0_01_LSIO_GPIO1_IO28 0x00000021
>;
};
pinctrl_codec: codecgrp {
fsl,pins = <
IMX8QXP_SPI0_SDO_LSIO_GPIO1_IO06 0x00000021
>;
};
pinctrl_lpuart0: lpuart0grp {
fsl,pins = <
IMX8QXP_UART0_RX_ADMA_UART0_RX 0x06000020
......@@ -285,6 +332,13 @@
>;
};
pinctrl_cm40_i2c: cm40i2cgrp {
fsl,pins = <
IMX8QXP_ADC_IN1_M40_I2C0_SDA 0x0600004c
IMX8QXP_ADC_IN0_M40_I2C0_SCL 0x0600004c
>;
};
pinctrl_lpi2c3: lpi2cgrp {
fsl,pins = <
IMX8QXP_SPI3_CS1_ADMA_I2C3_SCL 0x0600004c
......@@ -302,18 +356,28 @@
fsl,pins = <
IMX8QXP_MIPI_DSI1_GPIO0_00_MIPI_DSI1_PWM0_OUT 0x00000020
>;
};
pinctrl_sai0: sai0_grp {
fsl,pins = <
/*SAI BLUETOOTH*/
IMX8QXP_CSI_D00_ADMA_SAI0_RXC 0xc6000040
IMX8QXP_SAI0_TXC_ADMA_SAI0_TXC 0xc6000040
IMX8QXP_CSI_D01_ADMA_SAI0_RXD 0xc6000040
IMX8QXP_SAI0_TXD_ADMA_SAI0_TXD 0xc6000060
IMX8QXP_CSI_D02_ADMA_SAI0_RXFS 0xc6000040
IMX8QXP_SAI0_TXFS_ADMA_SAI0_TXFS 0xc6000040
>;
};
};
pinctrl_sai0: sai0_grp {
fsl,pins = <
/*SAI BLUETOOTH*/
IMX8QXP_CSI_D00_ADMA_SAI0_RXC 0xc6000040
IMX8QXP_SAI0_TXC_ADMA_SAI0_TXC 0xc6000040
IMX8QXP_CSI_D01_ADMA_SAI0_RXD 0xc6000040
IMX8QXP_SAI0_TXD_ADMA_SAI0_TXD 0xc6000060
IMX8QXP_CSI_D02_ADMA_SAI0_RXFS 0xc6000040
IMX8QXP_SAI0_TXFS_ADMA_SAI0_TXFS 0xc6000040
>;
};
pinctrl_sai1: sai1grp {
fsl,pins = <
IMX8QXP_SAI1_RXD_ADMA_SAI1_RXD 0x06000040
IMX8QXP_SAI1_RXC_ADMA_SAI1_TXC 0x06000040
IMX8QXP_SAI1_RXFS_ADMA_SAI1_TXFS 0x06000040
IMX8QXP_SPI0_CS1_ADMA_SAI1_TXD 0x06000040
IMX8QXP_MCLK_OUT0_ADMA_ACM_MCLK_OUT0 0x06000040
>;
};
pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
......@@ -453,7 +517,7 @@ gpio4: &lsio_gpio4 {
phy-reset-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
phy-reset-active-high;
phy-reset-duration = <2>;
mdio {
#address-cells = <1>;
......@@ -495,6 +559,36 @@ gpio4: &lsio_gpio4 {
phy-reset-duration = <2>;
};
&cm40_intmux {
status = "okay";
};
&cm40_i2c {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_cm40_i2c>;
status = "okay";
tlvcodec: tlv320aic32x4@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic32x4";
status = "okay";
reg = <0x18>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_codec>;
// MCLK Actually not used, but necessary for initialization
clocks = <&mclkout0_lpcg 0>;
ldoin-supply = <&reg_audio>;
iov-supply = <&reg_audio>;
reset-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
clock-names = "mclk";
route-on-lineout;
mic-bias;
};
};
&i2c3 {
#address-cells = <1>;
#size-cells = <0>;
......@@ -513,15 +607,28 @@ gpio4: &lsio_gpio4 {
// Bluetooth
&sai0 {
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&sai0_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai0>;
status = "okay";
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&sai0_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai0>;
status = "okay";
};
&sai1 {
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&sai1_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1>;
status = "okay";
};
&usdhc1 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment