Apalis TK1 SGTL5000 audio codec produce popping sounds while playing a track

Hi,

we are experiencing an issue with Apalis TK1’s SGTL5000 audio codec. We are using the Ixora v1.1 carrier board and Toradex Linux BSP 2.8b5.

With headphones attached to Ixora X12 audio jack, when playing a sound with aplay, e.g.:

# aplay /usr/share/sounds/alsa/Front_Center.wav

a pop sound can be heard at the beginning and a couple of seconds after the end of the track.

We managed to reproduce the problem by manually modifying register CHIP_ANA_POWER 0x0030 (see SGTL5000 data sheet at page 42).
https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Either toggling 0x0030 bits 3 (DAC_POWERUP) and 4 (HEADPHONE_POWERUP) or 14 (DAC_MONO, which selects MONO or STEREO mode) popping sounds show up at each writing. They seem related to the abrupt powering-up/down of the codec’s DAC.

To power up and down DAC and headphone amplifier toggling DAC_POWERUP and HEADPHONE_POWERUP bits:

# cd '/sys/kernel/debug/asoc/Toradex Apalis TK1 SGTL5000/sgtl5000.4-000a/'
# echo 30 12f8 >codec_reg
# echo 30 12e0 >codec_reg

To switch between mono and stereo toggling DAC_MONO bit:

# cd '/sys/kernel/debug/asoc/Toradex Apalis TK1 SGTL5000/sgtl5000.4-000a/'
# echo 30 52f8 >codec_reg
# echo 30 12f8 >codec_reg

Is it possible to implement a software solution to the problem in the sgtl5000 driver that would avoid the powerups and the mono / stereo switch, so that the audio pops are avoided?

Thank you.

hi @jdallaglio

Thanks for reporting this Issue. We can reproduce it. We will check internally and come soon back to you.

In meantime, could you try using the mainline kernel and check if the issue is also present there?

Best regards, Jaski

Hi @jaski.tx

It looks like audio is not working on the mainline image:

root@apalis-tk1-mainline:~# grep Mainline /etc/issue
Apalis-TK1-Mainline_LXDE-Image 2.8b5.156 20181228
root@apalis-tk1-mainline:~# aplay /usr/share/sounds/alsa/Front_Center.wav 
aplay: main:807: audio open error: No such file or directory

Could you try the following command on mainline:

aplay --device hw:1,0 --rate 48000 --channels 2 --format S16_LE /usr/share/sounds/alsa/Front_Center.wav

Still no luck:

root@apalis-tk1-mainline:~# aplay --device hw:1,0 --rate 48000 --channels 2 --format S16_LE /usr/share/sounds/alsa/Front_Center.wav 
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1324: Channels count non available

Anyway using mainline kernel is not an option for us.

We reproduced this Issue, it is also present on Mainline kernel. We will do further analysis and come back to you.

Hi @jdallaglio

We added some patches to fix this issue and issue seems to be resolved.
Could you check on your side, if you still hear the popping sound?

Best regards,
Jaski

Hi @jaski.tx

we integrated the first three patches in our system (Ixora v1.1 carrier board and Toradex Linux BSP 2.8b5), those published on 2019-04-26, and the pop sound disappeared when playing any audio file.

Thank you for your support.

Perfect that it works. Thanks for the feedback.