How to enable I2S2(i2s5b) in TX1?

On carrier board P2597, I want to enable I2S2, also named i2s5b.
The I2S1, is enabled by dts:

gpios = <
TEGRA_GPIO(B, 0) 0
TEGRA_GPIO(B, 1) 0
TEGRA_GPIO(B, 2) 0
TEGRA_GPIO(B, 3) 0
TEGRA_GPIO(BB, 0) 0
TEGRA_GPIO(BB, 3) 0
>;
status = “okay”;

when use command:

amixer -c 0 sset ‘I2S1 Mux’ ‘ADMAIF1’
aplay -Dhw:0,0 piano2.wav

Signals can be found on Expansion Header Pin.

For enable I2S2, modify dts like this:

gpios = <
TEGRA_GPIO(B, 0) 0
TEGRA_GPIO(B, 1) 0
TEGRA_GPIO(B, 2) 0
TEGRA_GPIO(B, 3) 0
TEGRA_GPIO(K, 0) 0
TEGRA_GPIO(K, 1) 0
TEGRA_GPIO(K, 2) 0
TEGRA_GPIO(K, 3) 0
TEGRA_GPIO(BB, 0) 0
TEGRA_GPIO(BB, 3) 0
>;
status = “okay”;

amixer -c 0 sset ‘I2S2 Mux’ ‘ADMAIF1’
aplay -Dhw:0,0 piano2.wav

There is no signel on GPIO Expansion Header, where is the second I2S interface location.

When I set I2S2 Loopback:
amixer cset -c 0 name=“I2S2 Loopback” 1

amixer -c 0 sset ‘ADMAIF2 Mux’ ‘I2S2’
amixer -c 0 sset ‘I2S2 Mux’ ‘ADMAIF1’

aplay -Dhw:0,0 -f S16_LE -r 48000 c304-2.wav &

arecord -Dhw:0,1 -f S16_LE -r 48000 sample4.wav

I can record data in sample4.wav.

Both of I2S1 and I2S2 dai have the same setting.
So, the sound card setting is ok. Maybe just the pinmux of I2S2 has problem.

Anyone can help me?

1 Like

@zhili_liu
Would you please check the 0x70003254 by devmem2

0x70003254: PINMUX_AUX_GPIO_PK0_0                                   = 0x00006074 //
          DRV_TYPE                                                = 0x00000003 // [14:13] DRIVE_4X [DRIVE_1X=0,DRIVE_2X=1,DRIVE_3X=2,DRIVE_4X=3]
          E_SCHMT                                                 = 0x00000000 // [12:12] DISABLE [DISABLE=0,ENABLE=1]
          E_HSM                                                   = 0x00000000 // [09:09] DISABLE [DISABLE=0,ENABLE=1]
          LOCK                                                    = 0x00000000 // [07:07] DISABLE [DISABLE=0,ENABLE=1]
          E_INPUT                                                 = 0x00000001 // [06:06] ENABLE [DISABLE=0,ENABLE=1]
          PARK                                                    = 0x00000001 // [05:05] PARKED [NORMAL=0,PARKED=1]
          TRISTATE                                                = 0x00000001 // [04:04] TRISTATE [PASSTHROUGH=0,TRISTATE=1]
          PUPD                                                    = 0x00000001 // [03:02] PULL_DOWN [NONE=0,PULL_DOWN=1,PULL_UP=2,RSVD=3]
          PM                                                      = 0x00000000 // [01:00] IQC0 [I2S5B=1,IQC0=0,RSVD2=2,RSVD3=3]

Hi ShaneCCC,

sudo devmem2 0x70003254 h
/dev/mem opened.
Memory mapped at address 0x7f8dc3e000.
Value at address 0x70003254 (0x7f8dc3e254): 0x6041

@zhili
Check others pin too. Should be the 0x70003258, 0x7000325c, 0x70003260.
Also check the gpio by cat /sys/kernel/debug/tegra_gpio

HI ShaneCCC:

nvidia@tegra-ubuntu:~$ clear
nvidia@tegra-ubuntu:~$ sudo devmem2 0x70003254 h
/dev/mem opened.
Memory mapped at address 0x7fb6929000.
Value at address 0x70003254 (0x7fb6929254): 0x6041
nvidia@tegra-ubuntu:~$ sudo devmem2 0x70003258 h
/dev/mem opened.
Memory mapped at address 0x7f7d775000.
Value at address 0x70003258 (0x7f7d775258): 0x6041
nvidia@tegra-ubuntu:~$ sudo devmem2 0x7000325c h
/dev/mem opened.
Memory mapped at address 0x7fb4d07000.
Value at address 0x7000325C (0x7fb4d0725c): 0x6041
nvidia@tegra-ubuntu:~$ sudo devmem2 0x70003260 h
/dev/mem opened.
Memory mapped at address 0x7f97f2c000.
Value at address 0x70003260 (0x7f97f2c260): 0x6041

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 70 00 00 00 00 00 000000
1:1 00 00 00 00 00 00 000000
1:2 00 00 00 00 00 00 000000
1:3 ff 1b 03 40 00 00 002024
2:0 0f 0d 01 02 00 00 000000
2:1 00 00 00 00 00 00 000000
2:2 f0 20 00 d0 00 80 008000
2:3 02 00 00 02 00 02 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 f0 f0 00 00 00 00 000000
4:3 03 03 00 00 00 00 000000
5:0 0c 00 00 00 00 00 000000
5:1 6e 66 00 00 00 00 000000
5:2 00 00 00 00 00 00 000000
5:3 ff 00 00 fe 00 70 606000
6:0 03 00 00 03 00 01 010100
6:1 1f 08 00 17 00 07 030300
6:2 00 00 00 00 00 00 000000
6:3 04 04 00 00 00 00 000000
7:0 32 10 00 22 00 02 020200
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

HI ShaneCCC:
Set I2S loopback, and play&capture worked, Is that mean I2S worked? This situation is just not signal output?

@zhili_liu
The REG and tegra_gpio status is good. Yes, I2S should be working you can probe it to make sure of it.

@ShaneCCC,
Do you have worked experience with i2s5b? Can you share the dts file?

@zhili
Sorry didn’t have any experience with this case.

@ShaneCCC,
I solve the problem.
Share for other people.

I used I2S2 for i2s5b, modify to I2S5, and signal output.

ref: I2S1_LRCLK doesn't seem to work - Jetson TX1 - NVIDIA Developer Forums

nvidia,dai-link-1 {
cpu-dai = <&tegra_i2s5>;
cpu-dai-name = “I2S5”;
}

amixer -c 0 sset ‘I2S5 Mux’ ‘ADMAIF1’
aplay -Dhw:0,0 piano2.wav

Then, the pin PK0-3 have signal output.

Now I have another question. I need to set codec master.
So the dai-link like this:
nvidia,dai-link-1 {
//bitclock-slave;
bitclock-master;
//frame-slave;
frame-master;
}

When I play, print error and not real play audio.

[ 144.774903] tegra210-i2s tegra210-i2s.4: Failed at I2S4_TX sw reset
[ 144.781162] tegra210-i2s tegra210-i2s.4: ASoC: PRE_PMU: I2S5 DAP TX event failed: -22

When set codec slave, there is no error.

So when I2S slave(codec master), how to resolve this problem?

@Zhili
I would like to reproduce if I can get the same error with you. Could you please attached your all what you modified file.

@Zhili
I would like to reproduce if I can get the same error with you. Could you please attached your all what you modified file.

@ShaneCCC,

The modify is just this in dts file:

nvidia,dai-link-1 {
//bitclock-slave;
bitclock-master;
//frame-slave;
frame-master;
}

then "apaly ".

@ShaneCCC,

I’m using L4T R28.1. when bitclock-master and frame-master, It will report error:

[ 144.774903] tegra210-i2s tegra210-i2s.4: Failed at I2S4_TX sw reset
[ 144.781162] tegra210-i2s tegra210-i2s.4: ASoC: PRE_PMU: I2S5 DAP TX event failed: -22

I test L4T R24.2, there is not this error, and aplay seems work. Because other reasons, I didn’t test audio work.

@ShaneCCC,
Did you reproduce the error?

@zhili
Did you rework the codec to connect to i2s5?
Due to my codec is connected to i2s1 and I was verified there’s no problem to set codec as master.

@ShaneCCC

On my board, the codec connect TX1 through FPGA. But I can confirm codec is set correct.

Maybe when set I2S slave/codec master, I2S sw reset need some hardware condition.

Can you give me some direction to debug?

what’s the reason of i2s sw reset fail?

I will appreciate your help.

@zhili_liu
Could you wire jump to I2S1 to clarify the problem.