Hi Jonathan,
Sorry to revisit this question, but we’ve made a custom TX2i carrier board with both an SGTL5000 codec and TLV320ADC5140 ADC. The first is connected to I2C1 and I2S1 and is used for mono output only. The second is connected to I2C2 and I2S2 and is used for four-channel recording.
The sound node for the SGTL5000 looks like this:
tegra_sound: sound {
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
nvidia,num-codec-link = <1>;
nvidia,num-clk = <8>;
nvidia,clk-rates = < 270950400 /* PLLA_x11025_RATE */
11289600 /* AUD_MCLK_x11025_RATE */
45158400 /* PLLA_OUT0_x11025_RATE */
45158400 /* AHUB_x11025_RATE */
245760000 /* PLLA_x8000_RATE */
12288000 /* AUD_MCLK_x8000_RATE */
49152000 /* PLLA_OUT0_x8000_RATE */
49152000 >;/* AHUB_x8000_RATE */
clocks = <&tegra_car TEGRA186_CLK_PLLP_OUT0>,
<&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_CLK_M>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub",
"clk_m", "extern1";
assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
reset-names = "extern1_rst";
status = "okay";
nvidia,audio-routing =
"x MIC_IN", "x Mic",
"x ADC", "x Mic Bias",
"x Headphone", "x HP_OUT",
"x Lineout", "x LINE_OUT",
"x LINE_IN", "x Linein";
nvidia,xbar = <&tegra_axbar>;
mclk-fs = <256>;
rt565x_dai_link: nvidia,dai-link-1 {
link-name = "sgtl5000-codec";
cpu-dai = <&tegra_i2s1>;
codec-dai = <&sgtl5000>;
cpu-dai-name = "I2S1";
codec-dai-name = "sgtl5000";
format = "i2s";
fsync-width = <15>;
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = "s16_le";
bclk_ratio = <1>;
srate = <48000>;
num-channel = <2>;
ignore_suspend;
name-prefix = "x";
status = "okay";
};
The sound node for the TLV320ADC5140 looks like this:
tegra_sound: sound {
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
nvidia,num-codec-link = <1>;
nvidia,num-clk = <8>;
nvidia,clk-rates = < 270950400 /* PLLA_x11025_RATE */
11289600 /* AUD_MCLK_x11025_RATE */
45158400 /* PLLA_OUT0_x11025_RATE */
45158400 /* AHUB_x11025_RATE */
245760000 /* PLLA_x8000_RATE */
12288000 /* AUD_MCLK_x8000_RATE */
49152000 /* PLLA_OUT0_x8000_RATE */
49152000 >;/* AHUB_x8000_RATE */
clocks = <&tegra_car TEGRA186_CLK_PLLP_OUT0>,
<&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_CLK_M>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub",
"clk_m", "extern1";
assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
reset-names = "extern1_rst";
status = "okay";
nvidia,audio-routing =
"x MIC1P", "x Mic",
"x MIC2P", "x Mic",
"x MIC3P", "x Mic",
"x MIC4P", "x Mic",
"x Capture", "x CH1_ADC",
"x Capture", "x CH2_ADC",
"x Capture", "x CH3_ADC",
"x Capture", "x CH4_ADC";
nvidia,xbar = <&tegra_axbar>;
mclk-fs = <256>;
rt565x_dai_link: nvidia,dai-link-1 {
link-name = "tlv320adcx140-codec";
cpu-dai = <&tegra_i2s1>;
codec-dai = <&tlv320adcx140>;
cpu-dai-name = "I2S1";
codec-dai-name = "tlv320adcx140-codec";
format = "dsp_a";
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = "s32_le";
bclk_ratio = <0>;
srate = <48000>;
num-channel = <4>;
ignore_suspend;
name-prefix = "x";
status = "okay";
};
So, putting them together on one board, should we have:
tegra_sound: sound {
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
nvidia,num-codec-link = <2>;
nvidia,num-clk = <8>;
nvidia,clk-rates = < 270950400 /* PLLA_x11025_RATE */
11289600 /* AUD_MCLK_x11025_RATE */
45158400 /* PLLA_OUT0_x11025_RATE */
45158400 /* AHUB_x11025_RATE */
245760000 /* PLLA_x8000_RATE */
12288000 /* AUD_MCLK_x8000_RATE */
49152000 /* PLLA_OUT0_x8000_RATE */
49152000 >;/* AHUB_x8000_RATE */
clocks = <&tegra_car TEGRA186_CLK_PLLP_OUT0>,
<&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_CLK_M>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub",
"clk_m", "extern1";
assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_AHUB>,
<&tegra_car TEGRA186_CLK_AUD_MCLK>;
assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
reset-names = "extern1_rst";
status = "okay";
nvidia,audio-routing =
"x MIC_IN", "x Mic",
"x ADC", "x Mic Bias",
"x Headphone", "x HP_OUT",
"x Lineout", "x LINE_OUT",
"x LINE_IN", "x Linein",
"y MIC1P", "y Mic",
"y MIC2P", "y Mic",
"y MIC3P", "y Mic",
"y MIC4P", "y Mic",
"y Capture", "y CH1_ADC",
"y Capture", "y CH2_ADC",
"y Capture", "y CH3_ADC",
"y Capture", "y CH4_ADC";
nvidia,xbar = <&tegra_axbar>;
mclk-fs = <256>;
rt565x_dai_link: nvidia,dai-link-1 {
link-name = "sgtl5000-codec";
cpu-dai = <&tegra_i2s1>;
codec-dai = <&sgtl5000>;
cpu-dai-name = "I2S1";
codec-dai-name = "sgtl5000";
format = "i2s";
fsync-width = <15>;
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = "s16_le";
bclk_ratio = <1>;
srate = <48000>;
num-channel = <2>;
ignore_suspend;
name-prefix = "x";
status = "okay";
};
nvidia,dai-link-2 {
link-name = "tlv320adcx140-codec";
cpu-dai = <&tegra_i2s2>;
codec-dai = <&tlv320adcx140>;
cpu-dai-name = "I2S2";
codec-dai-name = "tlv320adcx140-codec";
format = "dsp_a";
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = "s32_le";
bclk_ratio = <0>;
srate = <48000>;
num-channel = <4>;
ignore_suspend;
name-prefix = "y";
status = "okay";
};
I’m a bit unclear on the role of the prefixes x and y (do they need to be different?) and the naming of rt565x_dai_link: nvidia,dai-link-1 vs nvidia,dai-link-2 . Ideally, I want aplay to default to the SGTL5000 and arecord to default to the TLV320ADC5140. Independently, the devices work correctly (thanks to your previous help), but I’m just after some guidance on how to properly combine the sound nodes. Both devices are slaves, but only the SGTL5000 uses MCLK.
Thanks in advance,
David.