Issues with SGTL5000 Codec

I was able to get the SGTL5000 codec to load correctly with the corrections in my previous topic but now I am having issues playing sound. I do not have any errors appearing on dmesg but trying to play any sound gives an error.

I have already run:

$ alsactl init tegrasndt210ref
$ amixer -c tegrasndt210ref sset "ADMAIF1 Mux" "I2S4"

but when I try running:

$ speaker-test -D hw:tegrasndt210ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

I get the error:

Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error

Additionally, I am unable to see any output on the physical DOUT line on my oscilloscope. I can verify that the LRCLK and the SCLK lines are working as expected since the codec is the master.

I’ve tried various debugging tips from other threads:

$ sudo cat /sys/kernel/debug/tegra_gpio
...
B: 0:1 00 00 00 00 00 00 000000
J: 2:1 00 00 00 00 00 00 000000
...
$ sudo cat /sudo cat /sys/kernel/debug/gpio
...
gpio-76  (I2S0_FS)
gpio-77  (I2S0_DIN)
gpio-78  (I2S0_DOUT)
gpio-79  (I2S0_SCLK)
...
$ cat /proc/device-tree/sound/nvidia,dai-link-1/link-name
fe-pi-audio-z-v2
$ sudo cat /sys/kernel/debug/asoc/codecs
...
sgtl5000.2-000a
$ sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
Bank: 1 Reg: 0x70003144 Val: 0x00000040 -> dap4_fs_pj4
Bank: 1 Reg: 0x70003147 Val: 0x00000040 -> dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000040 -> dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000040 -> dap4_sclk_pj7

Please let me know any further debugging steps I can take to help resolve this. Thanks!!

After some further digging, it looks as if it may have been a hardware issue. I’ll have confirmation tomorrow.

Thanks for the update. Jon

Jon-

I fixed the hardware issue and am no longer receiving the error but the audio is extremely quiet despite having all volume controls set to 100%. This is verified with probing the output of the codec. Does the Fe-Pi driver also assume that the codec is on the i2c2 line? I have it on the i2c3 line and am wondering if it’s not receiving configuration data on startup.

Thanks!

Further digging shows that the SGTL5000 registers are set mostly correctly but the headphone output may be muted?

$ sudo cat /sys/kernel/debug/regmap/2-000a/registers

000: a011
002: 0060
004: 0007
006: 01b0
00a: 0010
00e: 020c
010: 3c3c (DAC L/R volume 0dB)
014: 015f
020: 0000
022: 1818 (Headphone L/R volume 0dB)
024: 0132 (Headphones are muted? Bit 4 set)
026: 0008
028: 01f1
02a: 0070
02c: 0304
02e: 0d0d
030: 7760
032: 7599
034: 0000
036: 0017
03a: 0000
03c: 0000
100: 0000
102: 0000
104: 0040
106: 051f
108: 0000
10a: 0040
10c: 0000
10e: 0000
110: 0000
116: 002f
118: 002f
11a: 002f
11c: 002f
11e: 002f
120: 8000
122: 0000
124: 0510
126: 1473
128: 0028
12a: 0050
12c: 0000
12e: 0000
130: 0000
132: 0000
134: 0000
136: 0000
138: 0000
13a: 0000

Hello!

The pinout for the fe-pi module can be found here. So yes this should be using i2c2 on the Jetson Nano.

Regards
Jon

Jon-

I moved the module to i2c2 (aka hdr40_i2c1) and updated the device tree as well. The audio is still extremely faint and the register settings are the same as before. Any suggestions?

Thanks,
Eva

Hello!

I have tried the sgtl5000 on Nano and the headphone output and line output (using headphones) sounds fine. Here is what I see from the codec mixer controls …

Simple mixer control 'x Capture Attenuate Switch (-6dB)',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'x Capture Mux',0
  Capabilities: enum
  Items: 'MIC_IN' 'LINE_IN'
  Item0: 'MIC_IN'
Simple mixer control 'x Capture ZC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'x Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 103 [81%] [0.00dB] [on]
  Front Right: Playback 103 [81%] [0.00dB] [on]
Simple mixer control 'x Headphone Mux',0
  Capabilities: enum
  Items: 'DAC' 'LINE_IN'
  Item0: 'DAC'
Simple mixer control 'x Headphone Playback ZC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'x Lineout',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 18 [58%] [-6.50dB] [on]
  Front Right: Playback 18 [58%] [-6.50dB] [on]
Simple mixer control 'x Mic',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 0 [0%] [0.00dB]
Simple mixer control 'x PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 192 [100%]
  Front Right: Playback 192 [100%]

And here is what I see from the register settings while speaker-test is running …

000: a011
002: 0061
004: 0008
006: 01b0
00a: 0010
00e: 0200
010: 3c3c
014: 015f
020: 0000
022: 1818
024: 0022
026: 0068
028: 01f1
02a: 0070
02c: 0322
02e: 0d0d
030: 72f9
032: 7599
034: 0000
036: 0017
03a: 0000
03c: 0000
100: 0000
102: 0000
104: 0040
106: 051f
108: 0000
10a: 0040
10c: 0000
10e: 0000
110: 0000
116: 002f
118: 002f
11a: 002f
11c: 002f
11e: 002f
120: 8000
122: 0000
124: 0510
126: 1473
128: 0028
12a: 0050
12c: 0000
12e: 0000
130: 0000
132: 0000
134: 0000
136: 0000
138: 0000
13a: 0000

Regards,
Jon