Hi,
I have a custom board with a TX1 and a Maxim MAX98089 codec. I am trying to integrate the codec with the TX1 but I can’t get it to record audio. The board has only 1 differential audio input and no outputs. The codec connects to I2S1 as indicated in the manual.
I used the default max98088.c codec driver that can be found in the tegra kernel sources. I used tegra_t210ref_mobile_rt565x_alt.c as a reference for writting a bridge driver. I am using release 28.1.
As you will see from the logs that I include at the bottom of the post, the codec, responds to I2C commands and it seems it is registered correctly. The routing specified in the DT also seems to work, as there are not errors reported.
I used a scope to verify that the audio signal reaches the input ports of the codec. I can also see a clock signal at 25MHZ between the codec and the TX1. I cannot see any other signal between the codec and the TX1, neither when the loopback play/record test is executed, nor when I issue a simple recording command.
The loopback test works as expected, with both files sounding identical:
nvidia@tegra-ubuntu:~$ aplay -Dhw:1,0 c304-2.wav & arecord -Dhw:1,1 -c 2 -d 35 -r 48000 -f S16_LE loopback_recording_test.wav
[2] 2159
Recording WAVE 'loopback_recording_test.wav' : Signed 16 bit Little Endian, Playing WAVE 'c304-2.wav' : Rate 48000 Hz, Signed 16 bit Little Endian, Stereo
Rate 48000 Hz, Stereo
[1] Done aplay -Dhw:1,0 c304-2.wav
I tried several amixer routing commands along with the following command to record audio but it always returns after a few seconds with the same error:
arecord -Dhw:1,1 -c 2 -d 50 -r 48000 -f S16_LE test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
arecord: pcm_read:2032: read error: Input/output error
This is the part of the device tree related to audio :
sound_card: sound {
compatible = "nvidia,tegra-audio-t210ref-mobile-max98089";
nvidia,model = "tegra-snd-t210ref-mobile-max98089";
clocks = <&tegra_car TEGRA210_CLK_PLL_P_OUT1>,
<&tegra_car TEGRA210_CLK_PLL_A>,
<&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA210_CLK_D_AUDIO>,
<&tegra_car TEGRA210_CLK_CLK_M>,
<&tegra_car TEGRA210_CLK_EXTERN1>;
clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub",
"clk_m", "extern1";
assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
<&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA210_CLK_D_AUDIO>,
<&tegra_car TEGRA210_CLK_EXTERN1>;
assigned-clock-rates = <368640000>, <36864000>,
<36864000>, <12288000>;
nvidia,num-codec-link = <1>;
nvidia,audio-routing =
"x INA1", "x LineInA",
"x INA2", "x LineInA",
"x INB1", "x LineInB",
"x INB2", "x LineInB";
nvidia,xbar = <&tegra_axbar>;
/* The codec-dai here is initialized to dummy and will be */
/* replaced with rt565x codec-dai on detecting super-module */
nvidia,dai-link-1 {
link-name = "max98089-playback";
cpu-dai = <&tegra_i2s1>;
codec-dai = <&max98089_a00>;
cpu-dai-name = "I2S1";
codec-dai-name = "max98089-HiFi";
format = "i2s";
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = "s16_le";
bclk_ratio = <0>;
srate = <48000>;
num-channel = <2>;
name-prefix = "x";
};
};
This is my gpio i2s declaration in the DT.
gpio-to-sfio = <
TEGRA_GPIO(B, 0)
TEGRA_GPIO(B, 1)
TEGRA_GPIO(B, 2)
TEGRA_GPIO(B, 3)
TEGRA_GPIO(BB, 0)
>;
Pinctrl:
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/pinctrl/700008d4.pinmux/pinmux-pins | grep -i pb
pin 8 (DAP1_FS PB0): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function i2s1 group dap1_fs_pb0
pin 9 (DAP1_DIN PB1): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function i2s1 group dap1_din_pb1
pin 10 (DAP1_DOUT PB2): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function i2s1 group dap1_dout_pb2
pin 11 (DAP1_SCLK PB3): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function i2s1 group dap1_sclk_pb3
pin 12 (SPI2_MOSI PB4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 13 (SPI2_MISO PB5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 14 (SPI2_SCK PB6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 15 (SPI2_CS0 PB7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 216 (AUD_MCLK PBB0): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function aud group aud_mclk_pbb0
pin 217 (DVFS_PWM PBB1): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function cldvfs group dvfs_pwm_pbb1
pin 218 (DVFS_CLK PBB2): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function rsvd0 group dvfs_clk_pbb2
pin 219 (GPIO_X1_AUD PBB3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 220 (GPIO_X3_AUD PBB4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep i2s1
type: MUX_GROUP controller 700008d4.pinmux group: dap1_din_pb1 (71) function: i2s1 (22)
type: MUX_GROUP controller 700008d4.pinmux group: dap1_dout_pb2 (72) function: i2s1 (22)
type: MUX_GROUP controller 700008d4.pinmux group: dap1_fs_pb0 (70) function: i2s1 (22)
type: MUX_GROUP controller 700008d4.pinmux group: dap1_sclk_pb3 (73) function: i2s1 (22)
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/pinctrl/700008d4.pinmux/pinmux-functions | grep i2s
function: i2s1, groups = [ dap1_fs_pb0 dap1_din_pb1 dap1_dout_pb2 dap1_sclk_pb3 ]
function: i2s2, groups = [ dap2_fs_paa0 dap2_din_paa2 dap2_dout_paa3 dap2_sclk_paa1 ]
function: i2s3, groups = [ dmic1_clk_pe0 dmic1_dat_pe1 dmic2_clk_pe2 dmic2_dat_pe3 ]
function: i2s4a, groups = [ uart2_tx_pg0 uart2_rx_pg1 uart2_rts_pg2 uart2_cts_pg3 ]
function: i2s4b, groups = [ dap4_fs_pj4 dap4_din_pj5 dap4_dout_pj6 dap4_sclk_pj7 ]
function: i2s5a, groups = [ dmic3_clk_pe4 dmic3_dat_pe5 pe6 pe7 ]
function: i2s5b, groups = [ pk0 pk1 pk2 pk3 ]
Results for codecs, platform, devices, gpio:
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/asoc/codecs | column
[sudo] password for nvidia:
tegra210-ope.1 tegra210-afc.4 tegra210-sfc.2 tegra210-amx.1 tegra210-i2s.3 4.spdif-dit.4 snd-soc-dummy
tegra210-ope.0 tegra210-afc.3 tegra210-sfc.1 tegra210-amx.0 tegra210-i2s.2 3.spdif-dit.3
tegra210-spdif tegra210-afc.2 tegra210-sfc.0 tegra210-dmic.2 tegra210-i2s.1 2.spdif-dit.2
tegra210-mvc.1 tegra210-afc.1 tegra210-mixer tegra210-dmic.1 tegra210-i2s.0 1.spdif-dit.1
tegra210-mvc.0 tegra210-afc.0 tegra210-adx.1 tegra210-dmic.0 tegra210-admaif 0.spdif-dit.0
tegra210-afc.5 tegra210-sfc.3 tegra210-adx.0 tegra210-i2s.4 702d0800.ahub max98088.0-0010
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/asoc/dais | column
OPE OUT RX7 CIF ADX2-2 MIXER1-9
OPE IN RX6 DAP ADX2-1 MIXER1-8
OPE OUT RX5 CIF ADX1 MIXER1-7
OPE IN RX4 DAP ADX1-4 MIXER1-6
DAP RX3 CIF ADX1-3 MIXER1-5
CIF RX2 ADMAIF10 CIF ADX1-2 MIXER1-4
MVC OUT RX1 ADMAIF9 CIF ADX1-1 MIXER1-3
MVC IN IN ADMAIF8 CIF AMX2-4 MIXER1-2
MVC OUT OUT4 ADMAIF7 CIF AMX2-3 MIXER1-1
MVC IN OUT3 ADMAIF6 CIF AMX2-2 SFC4
AFC OUT OUT2 ADMAIF5 CIF AMX2-1 SFC3
AFC IN OUT1 ADMAIF4 CIF AMX2 SFC2
AFC OUT IN ADMAIF3 CIF AMX1-4 SFC1
AFC IN OUT4 ADMAIF2 CIF AMX1-3 I2S5
AFC OUT OUT3 ADMAIF1 CIF AMX1-2 I2S4
AFC IN OUT2 ADMAIF10 FIFO AMX1-1 I2S3
AFC OUT OUT1 ADMAIF9 FIFO AMX1 I2S2
AFC IN OUT ADMAIF8 FIFO DMIC3 I2S1
AFC OUT IN4 ADMAIF7 FIFO DMIC2 ADMAIF10
AFC IN IN3 ADMAIF6 FIFO DMIC1 ADMAIF9
AFC OUT IN2 ADMAIF5 FIFO IQC2-2 ADMAIF8
AFC IN IN1 ADMAIF4 FIFO IQC2-1 ADMAIF7
DAP OUT ADMAIF3 FIFO IQC1-2 ADMAIF6
CIF IN4 ADMAIF2 FIFO IQC1-1 ADMAIF5
DAP IN3 ADMAIF1 FIFO MVC2 ADMAIF4
CIF IN2 ADMAIF10 MVC1 ADMAIF3
DAP IN1 ADMAIF9 SPKPROT1 ADMAIF2
CIF DAP ADMAIF8 OPE2 ADMAIF1
DAP CIF ADMAIF7 OPE1 dit-hifi
CIF DAP ADMAIF6 AFC6 dit-hifi
TX5 CIF ADMAIF5 AFC5 dit-hifi
TX4 DAP ADMAIF4 AFC4 dit-hifi
TX3 CIF ADMAIF3 AFC3 dit-hifi
TX2 DAP ADMAIF2 AFC2 Aux
TX1 CIF ADMAIF1 AFC1 max98089-HiFi
RX10 DAP ADX2 SPDIF1-2 snd-soc-dummy-dai
RX9 CIF ADX2-4 SPDIF1-1
RX8 DAP ADX2-3 MIXER1-10
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/asoc/platforms | column
tegra210-admaif snd-soc-dummy
nvidia@tegra-ubuntu:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 0: ADMAIF1 CIF ADMAIF1-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 1: ADMAIF2 CIF ADMAIF2-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 2: ADMAIF3 CIF ADMAIF3-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 3: ADMAIF4 CIF ADMAIF4-3 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 4: ADMAIF5 CIF ADMAIF5-4 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 5: ADMAIF6 CIF ADMAIF6-5 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 6: ADMAIF7 CIF ADMAIF7-6 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 7: ADMAIF8 CIF ADMAIF8-7 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 8: ADMAIF9 CIF ADMAIF9-8 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-max980], device 9: ADMAIF10 CIF ADMAIF10-9 []
Subdevices: 1/1
Subdevice #0: subdevice #0
nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/tegra_gpio
0:0 24 00 00 24 00 00 000000
0:1 00 00 00 00 00 00 000000
0:2 00 00 00 00 00 00 000000
0:3 00 00 00 00 00 00 000000
1:0 10 10 10 00 00 00 000000
1:1 00 00 00 00 00 00 000000
1:2 00 00 00 00 00 00 000000
1:3 3f 1b 02 24 00 00 000000
2:0 08 08 00 00 00 00 000000
2:1 00 00 00 00 00 00 000000
2:2 00 00 00 00 00 00 000000
2:3 00 00 00 00 00 00 000000
3:0 00 00 00 00 00 00 000000
3:1 00 00 00 00 00 00 000000
3:2 00 00 00 00 00 00 000000
3:3 00 00 00 00 00 00 000000
4:0 00 00 00 00 00 00 000000
4:1 00 00 00 00 00 00 000000
4:2 10 10 00 00 00 00 000000
4:3 00 00 00 00 00 00 000000
5:0 00 00 00 00 00 00 000000
5:1 02 02 00 00 00 00 000000
5:2 00 00 00 00 00 00 000000
5:3 70 00 00 70 00 70 606000
6:0 03 00 00 02 00 01 010100
6:1 1b 08 00 01 00 01 010100
6:2 00 00 00 00 00 00 000000
6:3 04 04 00 00 00 00 000000
7:0 b0 90 00 20 00 00 000000
7:1 00 00 00 00 00 00 000000
7:2 00 00 00 00 00 00 000000
7:3 00 00 00 00 00 00 000000
My kernel log looks like this:
[ 3.368255] No Device Node present for smmu client: snd-soc-dummy !!
[ 3.374672] platform snd-soc-dummy: No iommus property found in DT node, got swgids from fixup(101004000)
[ 3.384302] No Device Node present for smmu client: snd-soc-dummy !!
[ 3.393171] platform snd-soc-dummy: No iommus property found in DT node, got swgids from fixup(101004000)
[ 3.403148] input: tegra-hda HDMI/DP,pcm=3 as /devices/70030000.hda/sound/card0/input0
[ 3.411363] No Device Node present for smmu client: snd-soc-dummy !!
[ 3.417873] snd-soc-dummy snd-soc-dummy: No iommus property found in DT node, got swgids from fixup(101004000)
[ 3.427964] No Device Node present for smmu client: snd-soc-dummy !!
[ 3.434350] snd-soc-dummy snd-soc-dummy: No iommus property found in DT node, got swgids from fixup(101004000)
[ 3.464317] tegra210-i2s tegra210-i2s.0: Missing prop fsync-width for I2S0
[ 3.472876] tegra210-i2s tegra210-i2s.2: Missing prop fsync-width for I2S2
[ 3.480384] tegra210-i2s tegra210-i2s.3: Missing prop fsync-width for I2S3
[ 3.487997] tegra210-i2s tegra210-i2s.4: Missing prop fsync-width for I2S4
[ 3.510486] OPE platform probe
[ 3.513775] OPE platform probe successful
[ 3.518177] OPE platform probe
[ 3.521415] OPE platform probe successful
[ 3.526270] tegra-snd-t210ref-mobile-max98089 sound: Failed to get HP Det GPIO, should be handled by codec
[ 3.564049] max98088 0-0010: revision A
[ 3.571395] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF1 <-> ADMAIF1 mapping ok
[ 3.579312] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF2 <-> ADMAIF2 mapping ok
[ 3.587255] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF3 <-> ADMAIF3 mapping ok
[ 3.595171] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF4 <-> ADMAIF4 mapping ok
[ 3.606824] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF5 <-> ADMAIF5 mapping ok
[ 3.614740] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF6 <-> ADMAIF6 mapping ok
[ 3.622668] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF7 <-> ADMAIF7 mapping ok
[ 3.630572] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF8 <-> ADMAIF8 mapping ok
[ 3.638495] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF9 <-> ADMAIF9 mapping ok
[ 3.646420] tegra-snd-t210ref-mobile-max98089 sound: ADMAIF10 <-> ADMAIF10 mapping ok
[ 3.670771] max98088 0-0010: ASoC: mux x External MIC has no paths
[ 3.687448] tegra-snd-t210ref-mobile-max98089 sound: codec-dai "max98089-HiFi" registered
I cannot check the clock activity in the clock_tree file, while playing, as this file does not seem to exist in the 28.1 release. Is there a similar file in r28.1?
Any suggestions what might be wrong with my setup? Thanks in advance.