Linking HDMI audio capture to I2S controller

I am working on a driver and device tree for the ADV7481 for JetPack 5.1.4 for a carrier board. I have successfully had this working with JetPack 4 and am now trying to get it working on JetPack 5.

The video capture is working but I cannot immediately see how to set up the device tree to link to the I2S endpoint. It looks as if I should add an extra port to the video receiver device but when I do this, the video capture fails to link.

This is the section of the device tree relating to the ADV chip. I have used port@2 for the audio because port@1 is used for composite input in the driver.
> adv7481_1:video-receiver@70 {

  	compatible = "adi,adv7481";
  	reg = <0x70>;

  	sensor_model ="adv7482";

  	clocks = <&CLK_SRC TEGRA_AUD_MCLK>;
  	clock-names = "mclk";
  	
  	#sound-dai-cells = <1>;
  	
  	sound-name-prefix = "x";

  	ports {
  		#address-cells = <1>;
  		#size-cells = <0>;
  		port@0 {
  			reg = <0>;
  			adv7481_out0: endpoint {
  				port-index = <0>;
  				bus-width = <4>;
  				clock-lanes = <0>;
  				data-lanes = <1 2 3 4>;
  				remote-endpoint = <&adv_csi_in2>;
  			};
  		};	

#if 1
port@2 {
reg = <2>;
adv7481_1_ep: endpoint {
remote-endpoint = <&i2s3_dap_ep>;
mclk-fs = <256>;
link-name = “adv7481-1”;
};
};
endif
};
};
I have added the following for to link the ADV to the audio:
&i2s3_dap_ep {
remote-endpoint = <&adv7481_1_ep>;
};

Hi,

The port and I2S link configuration appear to be correct. Could you please share the device tree include file (sound node) and the driver source? also please capture the dmesg logs.

Regards,
Ramesh

I have attached the log and zips of the driver and device tree source.
boot-241115-1456.log (92.5 KB)
adv748x.zip (19.0 KB)
jetstream-xavier.zip (4.5 KB)

Note that the carrier board has two ADV7481 chips fitted: one is connected to I2S5 and the other to I2S3.

Hi
Thank you for sharing the debug and device tree files.

The Audio Graph Card DAI link (endpoints) is not applicable to JetPack 5.1.4 releases. Please refer to the link below for instructions on adding the I2S DAI link (e.g., &i2s1_to_codec in the example provided).

https://docs.nvidia.com/jetson/archives/r35.2.1/DeveloperGuide/text/SD/Communications/AudioSetupAndDevelopment.html?highlight=sound#codec-driver-instantiation-using-device-tree

Thank you. I have removed the i2s_dai_linkX sections and added the following to the device tree:

&i2s5_to_codec {
link-name = “adv7481-1”;
bitclock-master;
frame-master;
bitclock-noninversion;
frame-noninversion;
bit-format = “s16_le”;
srate = <48000>;
num-channel = <2>;
ignore_suspend;
name-prefix = “x”;
codec {
sound-dai = <&adv7481_1 0>;
prefix = “x”;
};
};

&i2s3_to_codec {
link-name = “adv7481-2”;
bitclock-master;
frame-master;
bitclock-noninversion;
frame-noninversion;
bit-format = “s16_le”;
srate = <48000>;
num-channel = <2>;
ignore_suspend;
name-prefix = “y”;
codec {
sound-dai = <&adv7481_2 0>;
prefix = “y”;
};
};

The driver now seems to be registering but I am still unable to capture. I have the following trace when running arecord:

tracer: nop

entries-in-buffer/entries-written: 463/463 #P:4

_-----=> irqs-off

/ _----=> need-resched

| / _—=> hardirq/softirq

|| / _–=> preempt-depth

||| / delay

TASK-PID CPU# |||| TIMESTAMP FUNCTION

| | | |||| | |

     arecord-3645    [000] ....  1209.603772: snd_soc_dapm_start: card=JetStream Xavier APE
     arecord-3645    [000] ....  1209.604164: snd_soc_dapm_walk_done: JetStream Xavier APE: checks 2 power, 2 path, 0 neighbour
     arecord-3645    [000] ....  1209.604187: snd_soc_dapm_done: card=JetStream Xavier APE
     arecord-3645    [000] ....  1219.806010: snd_soc_dapm_start: card=JetStream Xavier APE
     arecord-3645    [000] ....  1219.806257: snd_soc_dapm_path: *ADMAIF1 XBAR-Capture -> (direct) -> tegra-dlink-44-capture
     arecord-3645    [000] ....  1219.806259: snd_soc_dapm_path: *ADMAIF1 XBAR-Capture -> (direct) -> ADMAIF1 Capture
     arecord-3645    [000] ....  1219.806363: snd_soc_dapm_walk_done: JetStream Xavier APE: checks 2 power, 2 path, 2 neighbour
     arecord-3645    [000] ....  1219.806378: snd_soc_dapm_done: card=JetStream Xavier APE

tegra-audio-debug.zip (40.7 KB)
In addition, I have attached a zip file containing a script and a text file; the text file is the result of running the script.

Hi
Could you please check the pinctrl registers and also share the complete trace log?

$sudo grep “aud_mclk|i2s5|dap5” /sys/kernel/debug/tegra_pinctrl_reg

If it I2S5 not congiured, Please set via Jetson Linux Expansion Header,
https://docs.nvidia.com/jetson/archives/r35.2.1/DeveloperGuide/text/HR/ConfiguringTheJetsonExpansionHeaders.html?highlight=gpio%20expansion%20header

$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
$ arecord
$ sudo cat /sys/kernel/debug/tracing/trace

I don’t seem to have /sys/kernel/debug/tegra_pinctrl_reg on my Jetson. I have tried the trace that you suggested and run:

arecord -D hw:CARD=APE,DEV=0 -c 2 -r 48000 -f S16_LE -d 10 cap.wav

but the trace is empty.

Hi
Please use the command below to capture pinctrl. The earlier command is for an older release.

cat /sys/kernel/debug/pinctrl/“addr”.pinmux/pinconf-groups > ~/pinmux_“addr”
Please change “addr” to in pinctrl address shown in the system

Could you please confirm if the I2S5 pinctrl is configured via the Jetson Linux Expansion Header?

Regarding the trace showing empty output, I believe you have set up the mixer controls and started capture, as you were previously able to capture DAPM routes.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.