Hi,all
We are trying to integrate Audio codec to TX1. TX1 is in I2S Mater mode and Audio codec is in I2S Slave mode. Card/Codec registration is successful and appears in the ALSA device list.
Below is the required kernel device tree information
//modfiy by liuchen
gpio: gpio@6000d000 {
gpio-init-names = "default";
gpio-init-0 = <&gpio_default>;
gpio_default: default {
gpio-output-high = <
/* Unrelated to the audio system. */
TEGRA_GPIO(I, 2)
TEGRA_GPIO(Z, 2)
TEGRA_GPIO(L, 1)
TEGRA_GPIO(X, 2)
TEGRA_GPIO(X, 3)
TEGRA_GPIO(X, 7)
TEGRA_GPIO(S, 7)
/* Power-on the audio amplifier. */
TEGRA_GPIO(C, 0) /* SPK_EN_L */
TEGRA_GPIO(C, 1) /* SPK_EN_R */
TEGRA_GPIO(C, 2) /* CODEC_PWR_EN */
TEGRA_GPIO(C, 3) /* SPK_GAIN_0 */
TEGRA_GPIO(C, 4) /* SPK_GAIN_1 */
/* Power-on the audio CODEC. */
TEGRA_GPIO(BB,3) /* CODEC_RST */
>;
gpio-input = <
TEGRA_GPIO(V, 6) /* Unrelated to CODEC */
>;
/* Transfer pins from GPIO to I2S for audio. */
gpio-to-sfio = < /* GPIO# TX1-PIN TX1-FUNC/ERA-FUNC CODEC-PIN */
TEGRA_GPIO(B, 0) /* 8 H1 I2S0_LRCLK/SFSYNC R335/3 */
TEGRA_GPIO(B, 1) /* 9 G1 I2S0_SDIN R339/5 */
TEGRA_GPIO(B, 2) /* 10 H2 I2S0_SDOUT R337/4 */
TEGRA_GPIO(B, 3) /* 11 G2 I2S0_CLK/SRCLK R334/2 */
TEGRA_GPIO(BB, 0) /* 216 F1 AUDIO_MCLK R1/R332/1 */
/* This is commented out; we leave the CODEC enabled. */
/*TEGRA_GPIO(BB, 3) /* 219 F2 CODEC_RST R331/31 */
>;
};
};
gpio@6000d000 {
gpio_default: default {
gpio-to-sfio = <8 9 10 11 216 219>;
};
};
i2c@7000c400 {
status = "okay";
clock-frequency = <100000>;
lp8557-backlight-a-wuxga-8-0@2c {
status = "disabled";
};
};
i2c@7000c000 {
status = "okay";
//wm8974: wm8974.1-001a@1a {
wm8974: wm8974.0-001a@1a {
status = "okay";
compatible = "wm8974";
reg = <0x1a>;
};
};
sound_bpeer {
compatible = "nvidia,tegra-audio-t210ref";
nvidia,model = "tegra-t210ref";
nvidia,num-codec-link = <1>;
nvidia,xbar = <&tegra_axbar>;
// nvidia,audio-routing =
// "Headphone-z", "z SPKOUTP",
// "Headphone-z", "z SPKOUTN",
// "z MICN", "LineIn-z",
// "z MICP", "LineIn-z",
// "z AUX", "LineIn-z";
// nvidia,audio-routing =
// "Audio Out1", "SPKOUTP",
// "Audio Out1", "SPKOUTN",
// "MICN", "Mic Bias",
// "MICP", "Mic Bias",
// "Mic Bias", "my Mic",
// "AUX", "my AUX";
nvidia,audio-routing =
"Audio Out1", "SPKOUTP",
"Audio Out1", "SPKOUTN",
"MICN", "my Mic",
"MICP", "my Mic",
"AUX", "my AUX";
nvidia,dai-link-1 {
//struct snd_soc_dai_link[i].name;
link-name = "WM8974";
//struct snd_soc_dai_link[i].cpu_of_node && struct snd_soc_dai_link[j].codec_of_node
cpu-dai = <&tegra_i2s1>;
//struct snd_soc_dai_link[i].codec_of_node
codec-dai = <&wm8974>;
//struct snd_soc_dai_link[j].cpu_dai_name
cpu-dai-name = "I2S1";
//struct snd_soc_dai_link[i].codec_dai_name
codec-dai-name = "wm8974-hifi";
tx-mask = <0xff>;
rx-mask = <0xff>;
//struct snd_soc_dai_link[i].dai_fmt
format = "i2s";
bitclock-slave;
frame-salve;
bitclock-noninversion;
frame-noninversion;
frame-noninversion;
bit-format = "s16_le";
bclk_ratio = <1>;
srate = <16000>;
num-channel = <2>;
//name-prefix = "z";
};
};
I play wav formatted documents being given, the following is dmesg
root@tegra-ubuntu:/home/ubuntu# dmesg
[ 3901.005310] ASoC: ADMAIF1 <-> ADMAIF1 info:
[ 3901.005322] ASoC: rate mask 0x1ffe
[ 3901.005330] ASoC: min ch 1 max ch 16
[ 3901.005338] ASoC: min rate 8000 max rate 192000
[ 3901.007290] Setting clk_rate = 11025Hz pll_a_out0 = 11289600Hz clk_out = 2822400Hz
[ 3901.007300] (tedc) tegra_alt_asoc_utils_set_rate ++++
[ 3901.007331] (tedc) tegra_alt_asoc_utils_set_rate clk_pll_a:282240000, clk_pll_a_out0:11289600, clk_cdev1:2822400
[ 3901.007338] (tedc) tegra_alt_asoc_utils_set_rate ----
[ 3901.007344] (tedc) tegra210_xbar_set_clock ++++
[ 3901.007365] (tedc) tegra210_xbar_set_clock clk_parent:11289600, clk:11289600
[ 3901.007371] (tedc) tegra210_xbar_set_clock ----
[ 3901.007383]
[ 3901.007389] wm8974reg = 0x6 = 6
[ 3901.007396] wm8974[0xc]=0x40
[ 3901.007718] wm8974 write successful!
[ 3901.007726]
[ 3901.007731] wm8974reg = 0x1 = 1
[ 3901.007737] wm8974[0x2]=0x1d
[ 3901.008040] wm8974 write successful!
[ 3901.008052] (tedc) snd_soc_dai_set_bclk_ratio ++++ ----
[ 3901.008060] (tedc) tegra210_i2s_set_dai_bclk_ratio ++++ bclk_ratio:1
[ 3901.008066] (tedc) tegra210_i2s_set_dai_bclk_ratio ----
[ 3901.008071]
[ 3901.008076] wm8974reg = 0x4 = 4
[ 3901.008082] wm8974[0x8]=0x10
[ 3901.008384] wm8974 write successful!
[ 3901.008391]
[ 3901.008397] wm8974reg = 0x6 = 6
[ 3901.008403] wm8974[0xc]=0x40
[ 3901.008665] wm8974 write successful!
[ 3901.008673] (tedc) tegra210_i2s_set_fmt ++++ DAP:1
[ 3901.008679] (tedc) tegra210_i2s_set_fmt val:400, data_offset:1, fsync_width:31
[ 3901.008720] (tedc) tegra210_i2s_set_fmt ----
[ 3901.009980] smmu_dump_pagetable(): No valid page table
[ 3901.015171] mc-err: (255) csr_aper: EMEM decode error on PDE or PTE entry
[ 3901.021958] mc-err: status = 0x6000007a; addr = 0xde508000
[ 3901.027634] mc-err: secure: no, access-type: read, SMMU fault: nr-nw-s
[ 3901.034563] smmu_dump_pagetable(): No valid page table
[ 3901.039708] mc-err: (255) csr_aper: EMEM decode error on PDE or PTE entry
[ 3901.046510] mc-err: status = 0x6000207a; addr = 0xde508680
[ 3901.052166] mc-err: secure: no, access-type: read, SMMU fault: nr-nw-s
Playing in addition to mclk signal, the other i2s signal line without any output, there is a very strange phenomenon, in addition to i2S mclk line outside the several signal lines sometimes remain high, and sometimes remain low, ask Should be maintained high or low。
Annex is my boot log!
Please help me, I have stuck in this issue for a month and I’m going to crash!
log.txt (288 KB)