L4T R32.1 cannot enable i2s4 slave mode.

We are still developing under L4T R32.1. We changed the I2S4 pins on device tree file “tegra210-porg-gpio-p3448-0002-a02.dtsi” from GPIO to SFIO, and it works. We also tried to change the “tegra210-porg-p3448-common.dtsi”, to enable the slave mode. But it doesn’t work. Any idea? Thanks

i2s_dai_link1: nvidia,dai-link-1 {
                        link-name = "spdif-dit-0";
                        cpu-dai = <&tegra_i2s4>;
                        codec-dai = <&spdif_dit0>;
                        cpu-dai-name = "I2S4";
                        codec-dai-name = "dit-hifi";
                        format = "i2s";
                        bitclock-master;
                        /* bitclock-slave; */
                        frame-master;
                        /* 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";
                };

Did you check the gpio status by sudo cat /sys/kernel/debug/tegra_gpio ?

Below topic may help for the configure.

https://devtalk.nvidia.com/default/topic/1066239

The master mode of I2S4 works fine. We do not have any trouble to change the pins from gpio to sfio. We can get word, bit and master clock without any trouble. But we have no idea where to control the slave/master mode for this I2S channel.

Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 A: 0:0 64 40 40 24 00 00 000000
 B: 0:1 f0 00 00 00 00 00 000000
 C: 0:2 00 00 00 00 00 00 000000
 D: 0:3 00 00 00 00 00 00 000000
 E: 1:0 40 00 00 00 00 00 000000
 F: 1:1 00 00 00 00 00 00 000000
 G: 1:2 0c 00 00 04 00 00 000000
 H: 1:3 fd 99 00 60 00 00 000000
 I: 2:0 07 05 00 02 00 00 000000
 J: 2:1 00 00 00 00 00 00 000000
 K: 2:2 00 00 00 00 00 00 000000
 L: 2:3 00 00 00 00 00 00 000000
 M: 3:0 00 00 00 00 00 00 000000
 N: 3:1 00 00 00 00 00 00 000000
 O: 3:2 00 00 00 00 00 00 000000
 P: 3:3 00 00 00 00 00 00 000000
 Q: 4:0 00 00 00 00 00 00 000000
 R: 4:1 00 00 00 00 00 00 000000
 S: 4:2 a0 80 00 00 00 00 000000
 T: 4:3 01 01 00 00 00 00 000000
 U: 5:0 00 00 00 00 00 00 000000
 V: 5:1 03 00 00 02 00 00 000000
 W: 5:2 00 00 00 00 00 00 000000
 X: 5:3 78 08 08 70 00 60 606000
 Y: 6:0 06 00 00 02 00 00 000000
 Z: 6:1 0f 08 08 04 00 06 020600
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 00 00 00 00 00 00 000000
CC: 7:0 12 00 00 12 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000

You need to modify dt for slave mode. Have a reference to below link.

https://devtalk.nvidia.com/default/topic/1046818/jetson-tx2/how-to-use-the-same-clock-for-two-i2s-slave-in-tegra-tx2-/

For me, this worked… (in my use case I need BOTH I2S3 and I2S4 as slaves). I didn’t alter the i2s sections of the DTB, although I did set-up/verify the pin mux function DTB section for both ports.

Connect the ports to a DMA Mux:
amixer -c tegrasndt210ref cset name=“ADMAIF1 Mux” I2S3
amixer -c tegrasndt210ref cset name=“ADMAIF2 Mux” I2S4

Set the codec up for bit and frame master: (this seems counter-intuitive, but nonetheless)
amixer -c tegrasndt210ref cset name=“I2S3 codec master mode” “cbm-cfm”
amixer -c tegrasndt210ref cset name=“I2S4 codec master mode” “cbm-cfm”

As a result, bit 10 of 0Xa0 of the I2S regs are now clear: (0=slave, 1=master)

tate@tate-nano-pd:~$ sudo cat /sys/kernel/debug/regmap/tegra210-i2s.2/registers | grep “a0:”
a0: 2a000003
tate@tate-nano-pd:~$ sudo cat /sys/kernel/debug/regmap/tegra210-i2s.3/registers | grep “a0:”
a0: 0f000003

I was then able to record and produce proper audio files from their commensurate sources:
arecord -D hw:tegrasndt210ref,0 -r 48000 -f S16_LE -c 2 -d 30 arecchan000.wav
arecord -D hw:tegrasndt210ref,1 -r 48000 -f S16_LE -c 2 -d 30 arecchan001.wav

===============================

Alternately… for I2S to be bit/frame master:

amixer -c tegrasndt210ref cset name=“I2S3 codec master mode” “cbs-cfs”
amixer -c tegrasndt210ref cset name=“I2S4 codec master mode” “cbs-cfs”

tate@tate-nano-pd:~$ sudo cat /sys/kernel/debug/regmap/tegra210-i2s.2/registers | grep “a0:”
a0: 2a000403
tate@tate-nano-pd:~$ sudo cat /sys/kernel/debug/regmap/tegra210-i2s.3/registers | grep “a0:”
a0: 0f000403

Hope it helps! (There’s a lot more to keep in mind with I2S, like a frame size, clock polarities, sample rate, maintaining a synchronous master clock, but hopefully this will sort some of it out).