Getting SGTL5000 to work with L4T 35.1.0 on Jetson Xavier

Hello,
I was looking for some help in setting up SGTL5000 audio codec with Jetson Xavier with L4T 35.1.0. It would be really helpful if you could let me know which files and nodes I am supposed to change . If you could provide the detailed steps it would help me out here. Thank you.

You can refer to L4T doc to get more understanding of Audio codec setting: Audio Setup and Development — Jetson Linux
Developer Guide 34.1 documentation (nvidia.com)

Also can check below thread to see if can help:
Setting up SGTL5000 - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums
Audio Codec for sgtl5000 is not working for L4T 32.6.1 and L4T32.7.2 - Jetson & Embedded Systems / Jetson AGX Xavier - NVIDIA Developer Forums

Hi kayccc,

Thanks for the reply and sorry I couldn’t get back to you earlier. I went through the documentation and what you sent. These are the changes I made.

  1. I added the SGTL5000 node in the i2c@c250000 node in the tegra194-audio-p2822-0000.dtsi file since I am working with Xavier AGX.
  2. I made these changes in nvidia-audio-card-routing

nvidia-audio-card,routing =
“H40-SGTL Headphone”, “H40-SGTL HP_OUT”,
“H40-SGTL MIC_IN”, “H40-SGTL Mic”,
“H40-SGTL ADC”, “H40-SGTL Mic Bias”,
“H40-SGTL LINE_IN”, “H40-SGTL Line In”,
“H40-SGTL Line Out”, “H40-SGTL LINE_OUT”;

  1. I2S1 interface is used with the audio codec so I made the following change

&i2s1_to_codec {
link-name = “fe-pi-audio-z-v2”;
codec {
sound-dai = <&sgtl5000 0>;
prefix = “H40-SGTL”;
};
};
I had made these changes, compiled and flashed Jetson but it didn’t work. Are these changes correct? Am I missing out on anything?

I don’t see line out or input devices in list of audio devices in the settings menu when I make these changes.

Hi anims,

Can you please share more info on what works and what does not work?
Please see trouble shooting guide Audio Setup and Development — Jetson Linux<br/>Developer Guide 34.1 documentation

Are you able to register a sound card with SGTL5000 audio codec?
Are you using any specific audio card that has SGTL5000?
Does headphone playback work?

Thanks,
Sameer.

Hi Sameer,
Thanks for your response.
When I run cat /sys/kernel/debug/asoc/components I do see “sgtl5000.7-000a” listed.
In the dmesg logs it says “no soundcard found”.
In the settings menu the “Line Out” and “Mic” devices are not listed in sound devices for output and input devices. It used to work with previous versions of L4T but I am facing this with L4T 35.1.

Hi anims

Please refer to previous reply and provide details for each query.

Along with this can you dump info for following commands?

cat /proc/asound/cards
pacmd list-sinks
pacmd list-sources

Hi @spujar

  1. No, I am unable to register a sound card with sgtl5000
  2. I am using the Xavier AGX APE card.
  3. No, in the settings page no other audio device other than the HDMI monitor is showing up so I am unable to get headphone playback.

I have attached the output dump for the commands you had asked.

Thanks.
output_dump.txt (4.4 KB)

This needs to be resolved first. I am suspecting it is related to the DT change.
Please share your DT source files you modified.
Can you share kernel log to see if there is any obvious error?

Hi @spujar

Here are the sources that I had modified, and the logs.
kernel_logs.txt (102.2 KB)
tegra194-audio-p2822-0000.dtsi (8.9 KB)
tegra194-fixed-regulator-p2888-0001.dtsi (1.3 KB)

Thanks.

From the kernel_logs.txt following can be seen:

[   16.758906] OF: /sound/nvidia-audio-card,dai-link@76/codec: could not get #sound-dai-cells for /i2c@c250000/sgtl5000@0a
[   16.763869] tegra-asoc:: probe of sound failed with error -22

With above error, sound card registration failure is expected.
Looked at your DT file tegra194-audio-p2822-0000.dtsi, the “#sound-dai-cells” property is actually there. But this does not match with the error seen during probe().

This needs to be resolved first. Not sure why kernel complains even though DT has it.
Can you try below for experimenting?

i2c@c250000 {
		sgtl5000: sgtl5000@0a {
        ...
        #sound-dai-cells = <1>;
        ...
    };
};

...

/* Override with Codec entries */
&i2s1_to_codec {
	link-name = "fe-pi-audio-z-v2";
    bitclock-master;
    frame-master;
	codec {
		sound-dai = <&sgtl5000 0>;
		prefix = "H40-SGTL";
	};
};

I made the changes you suggested and the #sound-dai-cells error is gone now, but I’m still unable to register the soundcard.
kernel_logs.txt (84.0 KB)

You have different errors now.

[   18.917067] nvadsp 2993000.adsp: ADSP OS loading timed out
[   18.919061] nvadsp 2993000.adsp: Unable to start ADSP OS
[   18.921059] nvadsp 2993000.adsp: adsp failed to boot with ret = -62

Can you try to disable the ADSP audio driver and see if sound card registration works for you? Add following to your tegra194-audio-p2822-0000.dtsi file.

aconnect@2a41000 {
		status = "okay";

		agic-controller@2a41000 {
			status = "okay";
		};

		adsp@2993000 {
			status = "okay";
		};

+		adsp_audio {
+			status = "disabled";
+		}
+
	};

Hi @spujar,
With the change you suggested I was able to register the APE sound card. The Analog output and input devices are now showing in the settings menu but I am not getting audio playback on my headphones.

I tried with these changes in the “static inline u16 mute_output” function of the

sgtl5000.c file to see if that would help but still did not get any audio output:

- snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL,
- mute_mask, mute_mask);
+ /* snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL,
+ mute_mask, mute_mask); */ for testing
return mute_reg;
}
kernel_logs.txt (70.3 KB)
I’ve attached the kernel log messages.
Thanks.

Can you please check if below post helps?

I don’t see errors in the kernel log. Hence I am assuming when you run playback, it is just silent.

Given above, check if you are setting required mixer controls for SGTL5000 codec.

It does seem like the output is muted
root@nvidia-desktop:/home/nvidia# cat /sys/kernel/debug/regmap/7-000a/registers
000: a011
002: 0073
004: 0007
006: 01b0
00a: 0010
00e: 0200
010: 3c3c
014: 015f
020: 0000
022: 1818
024: 0133
026: 0000
028: 0041
02a: 0170
02c: 0304
02e: 0f0f
030: 4dfb
032: 7599
034: 0800
036: 0017
03a: 0000
03c: 0000
100: 0011
102: 0000
104: 0040
106: 051f
108: 0003
10a: 0040
10c: 0000
10e: 0000
110: 0000
116: 002f
118: 002f
11a: 002f
11c: 002f
11e: 002f
120: 8000
122: 0000
124: 5100
126: 1472
128: 0028
12a: 0050
12c: 0000
12e: 0000
130: 0000
132: 0000
134: 0000
136: 0000
138: 0000
13a: 0000

How do I unmute lineout using amixer?

@spujar
I unmuted lineout with amixer and audio is working now. Thank you very much.

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