I2S BCLK+FSYNC Continuous and uninterrupted signal

Hello, engineers from NVIDIA.
Thor + JetPack 7.1

Currently, I am using I2S to control ADI chip. This chip requires two pins, BCLK and FSYNC, to input a continuous signal.

By configuring /sys/devices/platform/bus@0/bus@0:aconnect@9000000/9630000.ahub/9290000.i2s/power/control, a signal can be output after the system starts.
Is there any way to make this configuration take effect in the device tree or the driver? Because I need the BCLK+FSYNC continuous signal to take effect before the chip driver is loaded.

Reference link:

Keep the I2S FSYNC active - Jetson Systems / Jetson AGX Orin - NVIDIA Developer Forums

Audio Setup and Development — NVIDIA Jetson Linux Developer Guide

Hi hanyu.du,

Do you mean BCLK+FSYNC should be present before the actual kernel boot happens(before I2S driver load)?. Note: unless we program the I2S configs and enable the I2S controller BCLK+FSYNC won’t be available. The only possible way to do this is through I2S driver for now after loading the driver.

Current driver doesn’t support enabling the I2S by default, it would be enabled only during active usecase. If you need BCLK+FSYNC during driver load, we could try something if this satisfy your requirement. Let us know your thoughts.

Just start the I2S continuous signal before loading the ADI chip driver.
This is my current timing diagram. I want the I2S continuous signal to occur before writing to the I2C register.

Got it, Is it acceptable to enable clocks after kernel boot, may be post init process as this is the time I2S driver gets loaded?. If so, we can provide a reference patch to enable I2S clock during loading.

Could you please send me the patch? I’ll give it a try.

Hi, mkumard:

Could you please send this patch?

Hi hanyu.du,

Sorry for some delay here, I will provide the patch in a day.

Thank you, looking forward to your reply.

Hi mkumard,

Is the patch package ready?

Hi hanyu.du,

We have the patch but we are doing some basic testing as this was a new support in the driver design. We will try to provide the final patch soon.

OK. I’m waiting for your reply.

Hi mkumard,

How is the progress of the patch package?
A new issue occurred. After I conducted the recording test, the FSYNC signal disappeared, and the dmesg command reported an error:

▒▒[ 53.595224] tegra210-i2s 9290000.i2s: timeout: previous I2S capture is still active
[ 53.595304] tegra210-i2s 9290000.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

Hi hanyu.du,

We are planning to provide the patch by today sometime.

the error looks like you are trying to open the same I2S which is already active. you can avoid this.

Hi mkumard,

arecord -D hw:1,1 -f S32_LE -c 2 -r 48000 -d 40 test.wav

Using the recording mode will result in an error.:

[ 53.595224] tegra210-i2s 9290000.i2s: timeout: previous I2S capture is still active
[ 53.595304] tegra210-i2s 9290000.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

aplay -D hw:1,1 test.wav
The playback mode will not generate an error.

How to avoid this problem?

Could you run the below commands and attach the log files to analyse. Make sure target is not opening the pcm device either from GUI usually happens when sound setting is opened.

  1. run “cat /sys/kernel/debug/regmap/.i2s/registers > ~/reg_dump.txt” replace addr with 9290000 before running the arecord to check if I2S is enabled or not
  2. amixer -c APE contents > log.xt

Hi mkumard,

This is the command I executed upon startup, without using any other GUI or command line.:

After rebooting:

sudo su

echo on > /sys/devices/platform/bus@0/bus@0:aconnect@9000000/9630000.ahub/9290000.i2s/power/control

exit

arecord -D hw:1,1 -f S32_LE -c 2 -r 48000 -d 2 test.wav

aplay -D hw:1,1 test.wav

sudo cat /sys/kernel/debug/regmap/9290000.i2s/registers > ~/reg_dump.txt

reg_dump.txt (1.1 KB)

amixer -c APE contents > log.txt

log.txt (464.2 KB)

From the log, I don’t see any issue in the connections.

could you try without executing echo on > /sys/devices/platform/bus@0/bus@0:aconnect@9000000/9630000.ahub/9290000.i2s/power/control

I2S2 is connected to ADMAIF2 and is in master mode.

Hi mkumard,

Do not execute the command:

echo on > /sys/devices/platform/bus@0/bus@0:aconnect@9000000/9630000.ahub/9290000.i2s/power/control

1:

nvidia@EATHA20:~$ amixer -c 1 cset name=‘I2S2 codec master mode’ 1
numid=2102,iface=MIXER,name=‘I2S2 codec master mode’
; type=ENUMERATED,access=rw------,values=1,items=3
; Item #0 ‘None’
; Item #1 ‘cbm-cfm’
; Item #2 ‘cbs-cfs’
: values=1

nvidia@EATHA20:~$ arecord -D hw:1,1 -f S32_LE -c 2 -r 48000 -d 2 test.wav
Recording WAVE ‘test.wav’ : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
arecord: pcm_read:2240: read error: Input/output error

dmesg:

[ 97.730094] tegra210-i2s 9290000.i2s: timeout: failed to reset I2S for capture
[ 97.730143] tegra210-i2s 9290000.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

2:

nvidia@EATHA20:~$ amixer -c 1 cset name=‘I2S2 codec master mode’ 2
numid=2102,iface=MIXER,name=‘I2S2 codec master mode’
; type=ENUMERATED,access=rw------,values=1,items=3
; Item #0 ‘None’
; Item #1 ‘cbm-cfm’
; Item #2 ‘cbs-cfs’
: values=2

nvidia@EATHA20:~$ arecord -D hw:1,1 -f S32_LE -c 2 -r 48000 -d 2 test.wav
Recording WAVE ‘test.wav’ : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
nvidia@EATHA20:~$

[ 129.407827] tegra210-i2s 9290000.i2s: timeout: previous I2S capture is still active
[ 129.407875] tegra210-i2s 9290000.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

Hi mkumard,

I’ve figured out the reason:

If I add this line: ‘regmap_write(i2s->regmap, TEGRA264_I2S_TX_ENABLE, 0x1);’, an error will occur.

However, if I remove this line, after executing ‘echo on > /sys/devices/platform/bus@0/bus@0:aconnect@9000000/9630000.ahub/9290000.i2s/power/control’, FSYNC does not output anything; only BCLK continues to output.

Keep the I2S FSYNC active - Jetson Systems / Jetson AGX Orin - NVIDIA Developer Forums

0001-ASoC-tegra-Add-always-on-I2S-support.patch (24.6 KB)

0001-tegra234-Enable-always-on-I2S2-on-P3701.patch (897 Bytes)

Hi hanyu.du,

Please find the reference patch for supporting always on I2S functionality, you can refer the patch and make change according to your needs on formats or i2s instances. This should enable the I2S FS, BCLK during i2s driver probe.

Let me know if you face any issue