SGTL5000 cannot output audio

,

Hello NVIDIA engineers.
I am having a problem with the SGTL5000 audio chip:
After configuring the device tree according to the documentation, the headphone output is only current sound, no audio output. Do you have any suggestions for modification?
log.txt (79.6 KB)
tegra234-p3767-common-audio.dtsi.txt (2.8 KB)

  1. root@nvidia:/sys/kernel/debug/regmap/0-000a# cat registers
    000: a011
    002: 0070
    004: 0008
    006: 0080
    00a: 0010
    00e: 0200
    010: 3c3c
    014: 015f
    020: 0000
    022: 1818
    024: 0133
    026: 0068
    028: 01f1
    02a: 0170
    02c: 0322
    02e: 0d0d
    030: 72fb
    032: 5000
    034: 0000
    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: 1473
    128: 0028
    12a: 0050
    12c: 0000
    12e: 0000
    130: 0000
    132: 0000
    134: 0000
    136: 0000
    138: 0000
    13a: 0000

Then I tried to configure the headphone output, but no effect:
root@nvidia:/sys/kernel/debug/regmap/0-000a# amixer controls | grep H40
numid=451,iface=MIXER,name=‘H40-SGTL AVC Hard Limiter Switch’
numid=453,iface=MIXER,name=‘H40-SGTL AVC Integrator Response’
numid=452,iface=MIXER,name=‘H40-SGTL AVC Max Gain Volume’
numid=450,iface=MIXER,name=‘H40-SGTL AVC Switch’
numid=454,iface=MIXER,name=‘H40-SGTL AVC Threshold Volume’
numid=455,iface=MIXER,name=‘H40-SGTL BASS 0’
numid=456,iface=MIXER,name=‘H40-SGTL BASS 1’
numid=457,iface=MIXER,name=‘H40-SGTL BASS 2’
numid=458,iface=MIXER,name=‘H40-SGTL BASS 3’
numid=459,iface=MIXER,name=‘H40-SGTL BASS 4’
numid=439,iface=MIXER,name=‘H40-SGTL Capture Attenuate Switch (-6dB)’
numid=1497,iface=MIXER,name=‘H40-SGTL Capture Mux’
numid=441,iface=MIXER,name=‘H40-SGTL Capture Switch’
numid=438,iface=MIXER,name=‘H40-SGTL Capture Volume’
numid=440,iface=MIXER,name=‘H40-SGTL Capture ZC Switch’
numid=1501,iface=MIXER,name=‘H40-SGTL DAP MIX Mux’
numid=448,iface=MIXER,name=‘H40-SGTL DAP Main channel’
numid=449,iface=MIXER,name=‘H40-SGTL DAP Mix channel’
numid=1500,iface=MIXER,name=‘H40-SGTL DAP Mux’
numid=1499,iface=MIXER,name=‘H40-SGTL Digital Input Mux’
numid=1498,iface=MIXER,name=‘H40-SGTL Headphone Mux’
numid=443,iface=MIXER,name=‘H40-SGTL Headphone Playback Switch’
numid=442,iface=MIXER,name=‘H40-SGTL Headphone Playback Volume’
numid=444,iface=MIXER,name=‘H40-SGTL Headphone Playback ZC Switch’
numid=447,iface=MIXER,name=‘H40-SGTL Lineout Playback Switch’
numid=446,iface=MIXER,name=‘H40-SGTL Lineout Playback Volume’
numid=445,iface=MIXER,name=‘H40-SGTL Mic Volume’
numid=437,iface=MIXER,name=‘H40-SGTL PCM Playback Volume’

root@nvidia:/sys/kernel/debug/regmap/0-000a#
root@nvidia:/sys/kernel/debug/regmap/0-000a#

root@nvidia:/sys/kernel/debug/regmap/0-000a# amixer cset numid=443 1
numid=443,iface=MIXER,name=‘H40-SGTL Headphone Playback Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
root@nvidia:/sys/kernel/debug/regmap/0-000a# amixer cset numid=442 30
numid=442,iface=MIXER,name=‘H40-SGTL Headphone Playback Volume’
; type=INTEGER,access=rw—R–,values=2,min=0,max=127,step=0
: values=30,30
| dBscale-min=-51.50dB,step=0.50dB,mute=0
root@nvidia:/sys/kernel/debug/regmap/0-000a# cat registers
000: a011
002: 0070
004: 0008
006: 0080
00a: 0010
00e: 0200
010: 3c3c
014: 015f
020: 0000
022: 6161
024: 0123

Hi hanyu,
I don’t see any errors for the codec in the log provided. I believe the current sound comes only during the playback on the codec?. If so, can you confirm if I2S signals are reaching the codec properly. If this is true, then issue could be related to the codec connection or configurations.

Here are couple of similar issue resolved for your reference.

Audio codec sgtl5000 is not working for R36.3.0 (JP6.0) - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums

AGX Orin with sgtl5000 has no sound - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums

Hi, I checked this link:

I have the same error as him, but I added the code following his last steps and it didn’t work:
hdr40_snd_link_i2s: &i2s1_to_codec {
link-name = “fe-pi-audio-z-v2”;
bitclock-master;
frame-master;
codec-dai-name = “sgtl5000”;
codec-dai = <&sgtl5000>;
name-prefix = “H40-SGTL”;
codec {
sound-dai = <&sgtl5000>;
prefix = “H40-SGTL”;
};
};

root@nvidia:/home/nvidia# amixer -c APE contents > contents.txt
amixer: Control hw:1 element TLV read error: No such device or address

root@nvidia:/home/nvidia# sudo cat /sys/kernel/debug/regmap/0-000a/registers
000: a011
002: 0071
004: 0007
006: 01b0
00a: 0010
00e: 0200
010: 3c3c
014: 015f
020: 0000
022: 6161
024: 0023

And now there are I2S errors reported.
[ 13.909487] tegra210-i2s 2901000.i2s: timeout: failed to reset I2S for playback
[ 13.909715] tegra210-i2s 2901000.i2s: ASoC: PRE_PMU: I2S1 RX event failed: -110
[ 13.937484] tegra210-i2s 2901000.i2s: timeout: failed to reset I2S for playback
[ 13.937710] tegra210-i2s 2901000.i2s: ASoC: PRE_PMU: I2S1 RX event failed: -110

This error could be related to Tegra I2S1 is operating as slave. Can you try setting the below controls to make Tegra I2S1 as master.

amixer -c APE cset name=“I2S1 codec master mode” “cbs-cfs”

Hello

nvidia@nvidia:~$ amixer -c APE cset name=“I2S1 codec master mode” “cbs-cfs”
numid=1553,iface=MIXER,name=‘I2S1 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@nvidia:~$
nvidia@nvidia:~$

nvidia@nvidia:~$ [ 6650.733210] sgtl5000 0-000a: PLL not supported in slave mode
[ 6650.733390] sgtl5000 0-000a: 278 ratio is not supported. SYS_MCLK needs to be 256, 384 or 512 * fs
[ 6650.733654] sgtl5000 0-000a: ASoC: error at snd_soc_dai_hw_params on sgtl5000: -22
[ 6650.733879] tegra-asoc: sound: ASoC: PRE_PMU: fe-pi-audio-z-v2-playback event failed: -22

Hi
May I know the audio sampling rate played at your end.

Please provide the below dump during the usecase

sudo cat /sys/kernel/debug/clk/clk_summary | grep mclk

nvidia@nvidia:~$ sudo cat /sys/kernel/debug/clk/clk_summary | grep mclk
[sudo] password for nvidia:
aud_mclk 39 39 0 45158398 49151953 0 0 50000

Hi,
I believe you are using 40 Pin header I2S for your testing on Orin Nx board.

If so, the correct Tegra I2S instance is I2S2

amixer -c APE cset name=“I2S2 codec master mode” “cbs-cfs”

Also update below dt to add mclk-fs entry

	port {
		sgtl5000_ep: endpoint {
			remote-endpoint = <&hdr40_snd_i2s_dap_ep>;
			link-name = "fe-pi-audio-z-v2";
			mclk-fs = <256>;
		};
	};

Used the circuitry from our custom board.
The I2S channel used is the same as the development board, which is what you call I2S2.

I modified it to IS2 configuration:
i2s@2901100 {
status = “okay”;
};
hdr40_snd_link_i2s: &i2s2_to_codec
hdr40_snd_i2s_dap_ep: &i2s2_dap_ep

Also added, but it doesn’t do anything, the error is still the same.
port {
sgtl5000_ep: endpoint {
remote-endpoint = <&hdr40_snd_i2s_dap_ep>;
link-name = “fe-pi-audio-z-v2”.
mclk-fs = <256>;
};
};

Is there something wrong with my circuit?


Hi,
The circuit looks good. I can see now, you are using I2S2 from Tegra. Also, one more question, how did you ensure I2S2 and AUD_MLCK pinmux are set properly. Whether Jetson-IO tool was used to enable the Pinmux of these pins?.

After modifying pinmux, then modify bootloader/t186ref/BCT/tegra234-mb1-bct-pinmux-p3767-hdmi-a03.dtsi using . /tools/kernel_flash/l4t_initrd_flash.sh to re-burn the


Hi Hanyu,

Please provide the output of below commands from target, to confirm pinmux and DT changes are reflected,

  • cat /sys/kernel/debug/pinctrl/<addr>.pinmux/pinconf-groups > ~/pinmux_<addr>, here addr is pinmux node address.
  • dtc -I fs -O dts /proc/device-tree >/tmp/dt.log

Additionally, could you please probe the I2S2 and AUD_MCLK signals as well from Tegra and share the details.

Hello

pinmux_2430000.txt (39.3 KB)
dt.log (434.2 KB)

nvidia@nvidia:~$ sudo grep “mclk” /sys/kernel/debug/clk/clk_summary
aud_mclk 35 35 0 45158398 49151953 0 0 50000

AUD_MCLK:

I2S_Clk:

  • Pinmux settings looks fine.
  • Minor updates required in DT,
  1. Add nvidia-audio-card,mclk-fs = <256>; in sound node property.
  2. Few unwanted properties are there in dai-link, can be updated like below,
    &i2s2_to_codec {
      	link-name = "fe-pi-audio-z-v2";
        bitclock-master;
        frame-master;
	    codec {
	     	sound-dai = <&sgtl5000>;
		    prefix = "H40-SGTL";
	};
}; 
  1. Remove below entry,
port {
		sgtl5000_ep: endpoint {
			remote-endpoint = <&hdr40_snd_i2s_dap_ep>;
			link-name = "fe-pi-audio-z-v2";
			mclk-fs = <256>;
		};
	};
  • Incase still facing issue, please provide below details:
  1. Mixer controls dump using commandamixer -c APE contents > ~/settings.txt
  2. Codec register dump while usecase is running.
  3. Kernel logs after usecase stopped.

Also, please check if I2S data line has signal.

  1. nvidia@nvidia:/home/nvidia# amixer -c APE contents > ~/settings.txt
    amixer: Control hw:1 element TLV read error: No such device or address
    settings.txt (788.3 KB)

  2. reg:

    nvidia@nvidia:~$ amixer -c APE cset name=“I2S2 codec master mode” “cbs-cfs”
    numid=1555,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@nvidia:~$ sudo su
    root@nvidia:/home/nvidia# cat /sys/kernel/debug/regmap/0-000a/registers
    000: a011
    002: 0070
    004: 0007
    006: 0000
    00a: 0010
    00e: 0200
    010: 3c3c
    014: 015f
    020: 0000
    022: 6161
    024: 0023
    026: 0068
    028: 01f1
    02a: 0170
    02c: 0322
    02e: 0101
    030: 77fb
    032: 7599
    034: 0000
    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
    root@nvidia:/home/nvidia# [ 530.333610] sgtl5000 0-000a: PLL not supported in slave mode
    [ 530.333791] sgtl5000 0-000a: 278 ratio is not supported. SYS_MCLK needs to be 256, 384 or 512 * fs
    [ 530.334063] sgtl5000 0-000a: ASoC: error at snd_soc_dai_hw_params on sgtl5000: -22
    [ 530.334327] tegra-asoc: sound: ASoC: PRE_PMU: fe-pi-audio-z-v2-playback event failed: -22
    [ 530.344792] tegra210-i2s 2901000.i2s: timeout: failed to reset I2S for playback
    [ 530.345009] tegra210-i2s 2901000.i2s: ASoC: PRE_PMU: I2S1 RX event failed: -110

  1. log:
    log.txt (82.2 KB)

  2. orin I2S_out:

Thanks for providing the details,

  • The below errors are observed because I2S1 is also connected to ADMAIF1. Please do below settings before running the usecase,
    amixer -c APE cset name="I2S1 Mux" 0
    amixer -c APE cset name="I2S2 Mux" ADMAIF1

Hope, pcm device 0 is used for playback.

This is useful, I2S1 won’t come back.

I was modifying tegra_machine_dai_init and realized that the default used kernel/kernel-5.10/sound/soc/tegra/tegra_machine_driver.c. instead of kernel/nvidia/
How do I switch to kernel/nvidia to change the code

No need to switch to kernel/nvidia, the tegra driver files are located at kernel/kernel-5.10/sound/soc/tegra/ location only. You can look for snd_soc_dai_set_sysclk API or link-name inside tegra_codecs.c.