You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG][ADL]: maxim 98373 speaker pop sound when switching audio output device #6379
@macchian we need to experiment with simpler setups at the hw: device level, i.e. without CRAS in the picture
Suggestions:
a) play on headset, stop 10s, play on amp, and check if there is any pop.
b) play on the amp while playing on the headset
c) try to play on the headset, wait 500ms and play on the amp with a script to simulate a switch.
@macchian we need to experiment with simpler setups at the hw: device level, i.e. without CRAS in the picture
Suggestions: a) play on headset, stop 10s, play on amp, and check if there is any pop. b) play on the amp while playing on the headset c) try to play on the headset, wait 500ms and play on the amp with a script to simulate a switch.
@plbossart Thanks for your advices! As you mentioned, I write a script spk_switch_on_off.sh and gen a 1k_sine_48k_16bits_60s.wav 1k_sine_48k_16bits_60s.zip
@macchian It's not likely to be SOF FW or driver issue, as the firmware and driver are not really involved in switching endpoints. It's more likely to be a codec or machine driver or UCM issue.
BTW, If someone can probe the I2S pins physically with a logic analyzer to get the audio data from I2S pins directly, it would be
a better way to clarify where is the pop from.
I can hear pop noise when speaker playback starts AND stops. And I also hear obvious pop noise when headphone playback stops.
The test wav is 1K_0dB.zip
@bardliao, can you isolate the pop with dapm_pop_time of 2 seconds?
Does the codec have Mute switch on headset, speaker? Does toggling it produces pop noise as well?
@ujfalusi@lgirdwood@macchian I am pretty sure the pop is from the codec itself after doing some experiment.
There are two speaker codecs (left and right) in the device.
And a pop is generated when a speaker is started and stopped. That's why we can hear two pops when speaker playback starts and two pops when speaker playback stops.
If I set dapm_pop_time = 2sec, there are some "da" "da" sound in the transition stage.
Below is the dmesg tested with dapm_pop_time = 2000, I added some empty line when I hear pop.
[Apr22 14:02] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +2.028752] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +2.050928] max98373 i2c-MX98373:00: pop test : Queue Right HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000046] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue Smart Amplifier Playback 0: reg=0xffffffff, 0x0/0x0
[ +0.000023] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue PCM0P: reg=0xffffffff, 0x1/0x0
[ +0.000020] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SSP1.OUT: reg=0xffffffff, 0x1/0x0
[ +0.000022] max98373 i2c-MX98373:00: pop test : Queue Right BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000022] max98373 i2c-MX98373:00: pop test : Queue Right DAI Sel Mux: reg=0xffffffff, 0x1/0x1
[ +0.000020] max98373 i2c-MX98373:00: pop test : Queue Right Amp Enable: reg=0x202b, 0x1/0x1
[ +0.000021] max98373 i2c-MX98373:00: pop test : Applying 0x1/0x1 to 202b in 2000ms
[ +2.057783] max98373 i2c-MX98373:00: pop test : Right Amp Enable POST_PMU
[ +0.032544] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.0: reg=0xffffffff, 0x1/0x0
[ +0.000025] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SMART_AMP1.0: reg=0xffffffff, 0x1/0x0
[ +0.000010] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.1: reg=0xffffffff, 0x1/0x0
[ +0.000015] sof_nau8825 adl_max98373_nau8825: pop test : Queue Right Spk: reg=0xffffffff, 0x0/0x0
[ +0.000203] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +2.002763] max98373 i2c-MX98373:01: pop test : Queue Left HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000027] max98373 i2c-MX98373:01: pop test : Queue Left BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000011] max98373 i2c-MX98373:01: pop test : Queue Left DAI Sel Mux: reg=0xffffffff, 0x1/0x1
[ +0.000012] max98373 i2c-MX98373:01: pop test : Queue Left Amp Enable: reg=0x202b, 0x1/0x1
[ +0.000012] max98373 i2c-MX98373:01: pop test : Applying 0x1/0x1 to 202b in 2000ms
[ +2.060351] max98373 i2c-MX98373:01: pop test : Left Amp Enable POST_PMU
[ +0.032063] sof_nau8825 adl_max98373_nau8825: pop test : Queue Left Spk: reg=0xffffffff, 0x0/0x0
[ +0.000335] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +5.758428] sof_nau8825 adl_max98373_nau8825: pop test : Queue Right Spk: reg=0xffffffff, 0x0/0x0
[ +0.000030] max98373 i2c-MX98373:00: pop test : Queue Right Amp Enable: reg=0x202b, 0x0/0x1
[ +0.000012] max98373 i2c-MX98373:00: pop test : Applying 0x0/0x1 to 202b in 2000ms
[ +2.017122] max98373 i2c-MX98373:00: pop test : Right Amp Enable POST_PMD
[ +0.032060] max98373 i2c-MX98373:00: pop test : Queue Right BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000027] max98373 i2c-MX98373:00: pop test : Queue Right DAI Sel Mux: reg=0xffffffff, 0x0/0x1
[ +0.000010] max98373 i2c-MX98373:00: pop test : Queue Right HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000280] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +2.004029] sof_nau8825 adl_max98373_nau8825: pop test : Queue Left Spk: reg=0xffffffff, 0x0/0x0
[ +0.000028] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.0: reg=0xffffffff, 0x0/0x0
[ +0.000009] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SMART_AMP1.0: reg=0xffffffff, 0x0/0x0
[ +0.000009] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.1: reg=0xffffffff, 0x0/0x0
[ +0.000014] max98373 i2c-MX98373:01: pop test : Queue Left Amp Enable: reg=0x202b, 0x0/0x1
[ +0.000010] max98373 i2c-MX98373:01: pop test : Applying 0x0/0x1 to 202b in 2000ms
[ +2.059528] max98373 i2c-MX98373:01: pop test : Left Amp Enable POST_PMD
[ +0.032118] max98373 i2c-MX98373:01: pop test : Queue Left BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000025] max98373 i2c-MX98373:01: pop test : Queue Left DAI Sel Mux: reg=0xffffffff, 0x0/0x1
[ +0.000010] max98373 i2c-MX98373:01: pop test : Queue Left HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000012] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue Smart Amplifier Playback 0: reg=0xffffffff, 0x0/0x0
[ +0.000008] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue PCM0P: reg=0xffffffff, 0x0/0x0
[ +0.000008] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SSP1.OUT: reg=0xffffffff, 0x0/0x0
[ +0.000267] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
[ +2.006744] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 2000ms
There is no single mute switch for speaker, but we have "Spk Switch" that can enable/disable Speakers. controls.txt
And I can hear the pop when I set amixer -c0 cset name='Left Spk Switch' 0 and amixer -c0 cset name='Left Spk Switch' 1 during playback is running.
However, there is no "da" "da" noise when I switch "Spk Switch" on or off.
Below is the dmesg when I switch 'Left Spk Switch'.
[ +9.274429] max98373 i2c-MX98373:01: pop test : Queue Left HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000028] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue Smart Amplifier Playback 0: reg=0xffffffff, 0x0/0x0
[ +0.000009] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue PCM0P: reg=0xffffffff, 0x1/0x0
[ +0.000007] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SSP1.OUT: reg=0xffffffff, 0x1/0x0
[ +0.000009] max98373 i2c-MX98373:01: pop test : Queue Left BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000008] max98373 i2c-MX98373:01: pop test : Queue Left DAI Sel Mux: reg=0xffffffff, 0x1/0x1
[ +0.000008] max98373 i2c-MX98373:01: pop test : Queue Left Amp Enable: reg=0x202b, 0x1/0x1
[ +0.000008] max98373 i2c-MX98373:01: pop test : Applying 0x1/0x1 to 202b in 1000ms
[ +1.060734] max98373 i2c-MX98373:01: pop test : Left Amp Enable POST_PMU
[ +0.032465] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.0: reg=0xffffffff, 0x1/0x0
[ +0.000026] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SMART_AMP1.0: reg=0xffffffff, 0x1/0x0
[ +0.000009] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.1: reg=0xffffffff, 0x1/0x0
[ +0.000014] sof_nau8825 adl_max98373_nau8825: pop test : Queue Left Spk: reg=0xffffffff, 0x0/0x0
[ +0.000278] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 1000ms
[ +9.379184] sof_nau8825 adl_max98373_nau8825: pop test : Queue Left Spk: reg=0xffffffff, 0x0/0x0
[ +0.000012] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.0: reg=0xffffffff, 0x0/0x0
[ +0.000001] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SMART_AMP1.0: reg=0xffffffff, 0x0/0x0
[ +0.000002] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue BUF1.1: reg=0xffffffff, 0x0/0x0
[ +0.000002] max98373 i2c-MX98373:01: pop test : Queue Left Amp Enable: reg=0x202b, 0x0/0x1
[ +0.000002] max98373 i2c-MX98373:01: pop test : Applying 0x0/0x1 to 202b in 1000ms
[ +1.020111] max98373 i2c-MX98373:01: pop test : Left Amp Enable POST_PMD
[ +0.032485] max98373 i2c-MX98373:01: pop test : Queue Left BE_OUT: reg=0xffffffff, 0x0/0x0
[ +0.000043] max98373 i2c-MX98373:01: pop test : Queue Left DAI Sel Mux: reg=0xffffffff, 0x0/0x1
[ +0.000022] max98373 i2c-MX98373:01: pop test : Queue Left HiFi Playback: reg=0xffffffff, 0x0/0x0
[ +0.000027] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue Smart Amplifier Playback 0: reg=0xffffffff, 0x0/0x0
[ +0.000017] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue PCM0P: reg=0xffffffff, 0x0/0x0
[ +0.000017] sof-audio-pci-intel-tgl 0000:00:1f.3: pop test : Queue SSP1.OUT: reg=0xffffffff, 0x0/0x0
[ +0.000267] sof_nau8825 adl_max98373_nau8825: DAPM sequencing finished, waiting 1000ms
Intel Audio DSP doesn't know user is switching the "Spk Switch", so, the audio data is consistent.
It implies that the pop is generated when the codec is doing the enabling/disabling process.
Like
Queue Left Amp Enable: reg=0x202b, 0x1/0x1
Queue Left Amp Enable: reg=0x202b, 0x0/0x1
Hi @mengdonglin , From Maxim's debugging results, it looks like not relevant to codec or DSM issue. Because the experiments below still hear the pop sound. There is 300Hz signal producing. (see attachment file pop picture) Is it a possible way by eq-iir reducing it?
Currently it reproduces on TGL and ADL/RPL, I believe MTL should as well. Could you suggest further method to fix it?
Maxim's test:
bypass DSM algo, the pop still occurs.
Keep the codec amp pin power always On , the pop exists.
@macchian Do you know if they do anything to prevent the codec driver from accessing the codec registers?
For example, let regcache_cache_only be always true, or use the dummy codec driver instead of max98373 codec driver.
If they didn't do that, the codec driver will still act as usual, and it didn't prove the pop is not from the enabling/disabling process.
I also modified the FE SSP stop sequence before BE amp shutdown.
The sequence ensures the i2s data stop before codec amp shutdown. In this case, pop can hear.
Hi all,
As per working with @bardliao and @ryans-lee from Maxim, I summarize the pop test results below:
Make ‘Digital Volume’ mute and test if it generates the same amount of noise.
Pop sound level is following by ‘Digital Volume’ boost/attenuate [Confirmed]
I2S signal scope need ODM rework I2S. Jonathan. [TBD]
Manually turn on/off 0x20FF(Global en) register while playing silent music and check the noise level. This amount of noise is how much we can expect from the amp.
During playing by aplay -D hw:0,0 -f dat 1k.wav,
a. turn off left Spk global_en first
#echo 0 0x20FF > /sys/kernel/debug/regmap/i2c-MX98373:01 (One pop sound)
b. then turn off right Spk global_en
#echo 0 0x20ff > /sys/kernel/debug/regmap/i2c-MX98373:00 (One pop sound)
c. turn on right spk global_en again
#echo 1 0x20ff > /sys/kernel/debug/regmap/i2c-MX98373:00 (speaker sound not resume sound when set global_en on)
So in this case, I only observe pop when running right spk global_en off.
Make the 0x202B always ON and do the same test in 2).
Applied the codes from Bard.
Pop occurs:
1 pop occurs when aplay starting, 2 pop occur when aplay stopped. [Confirmed]
During aplay -D hw:0,0 -f dat 1k.wav, switch Speaker Digital Volume from 0 to 100 repeatedly. No pop. Confirmed by Bard and Mac.
Switch ‘Spk Switch’ during playing 1k sine
During aplay -D hw:0,0 -f dat 1k.wav, switch ‘Left/Right Spk Switch’ repeatedly, 1 pop occurs from aplay starting and 2 pops from aplay stopped. Confirmed by Bard and Mac.
Play silence.wav and stop
No pop from aplay starting and stopped. [Confirmed]
FYI, the production build for ADL-P devices have been migrated from adl-004 to rpl-001, which means the fix commit should be merged back to rpl-001-drop-stable instead.
Activity
macchian commentedon Oct 7, 2022
dmesg_pop.txt

sof_trace_trace.log
macchian commentedon Oct 7, 2022
Noise_without_DSM.zip
macchian commentedon Oct 7, 2022
RanderWang, need your advices.
macchian commentedon Oct 11, 2022
@lgirdwood, @mwasko, pop also be reproduced on main branch, any comments?
plbossart commentedon Oct 12, 2022
@macchian your dmesg log seems wrong, it contains major errors:
plbossart commentedon Oct 12, 2022
@macchian we need to experiment with simpler setups at the hw: device level, i.e. without CRAS in the picture
Suggestions:
a) play on headset, stop 10s, play on amp, and check if there is any pop.
b) play on the amp while playing on the headset
c) try to play on the headset, wait 500ms and play on the amp with a script to simulate a switch.
macchian commentedon Oct 13, 2022
my bad... wrong file. reattached the correct one.
dmesg_pop.txt
macchian commentedon Oct 13, 2022
@plbossart Thanks for your advices! As you mentioned, I write a script spk_switch_on_off.sh and gen a 1k_sine_48k_16bits_60s.wav
1k_sine_48k_16bits_60s.zip
spk_switch_on_off.zip
The script is playing 1k sine wav in background and every 500ms switching speaker(-D hw:0,0) to headphone (-D hw:0,1) repeatedly.
Summarize test result below:
a) play on headset, stop 10s, play on amp, and check if there is any pop.
b) play on the amp while playing on the headset
c) try to play on the headset, wait 500ms and play on the amp with a script to simulate a switch.
mengdonglin commentedon Oct 14, 2022
@macchian It's not likely to be SOF FW or driver issue, as the firmware and driver are not really involved in switching endpoints. It's more likely to be a codec or machine driver or UCM issue.
16 remaining items
bardliao commentedon Oct 27, 2022
BTW, If someone can probe the I2S pins physically with a logic analyzer to get the audio data from I2S pins directly, it would be
a better way to clarify where is the pop from.
bardliao commentedon Oct 27, 2022
I can hear pop noise when speaker playback starts AND stops. And I also hear obvious pop noise when headphone playback stops.
The test wav is 1K_0dB.zip
ujfalusi commentedon Oct 27, 2022
@bardliao, can you isolate the pop with dapm_pop_time of 2 seconds?
Does the codec have Mute switch on headset, speaker? Does toggling it produces pop noise as well?
bardliao commentedon Oct 28, 2022
@ujfalusi @lgirdwood @macchian I am pretty sure the pop is from the codec itself after doing some experiment.
There are two speaker codecs (left and right) in the device.
And a pop is generated when a speaker is started and stopped. That's why we can hear two pops when speaker playback starts and two pops when speaker playback stops.
If I set dapm_pop_time = 2sec, there are some "da" "da" sound in the transition stage.
Below is the dmesg tested with dapm_pop_time = 2000, I added some empty line when I hear pop.
There is no single mute switch for speaker, but we have "Spk Switch" that can enable/disable Speakers.
controls.txt
And I can hear the pop when I set
amixer -c0 cset name='Left Spk Switch' 0andamixer -c0 cset name='Left Spk Switch' 1during playback is running.However, there is no "da" "da" noise when I switch "Spk Switch" on or off.
Below is the dmesg when I switch 'Left Spk Switch'.
Intel Audio DSP doesn't know user is switching the "Spk Switch", so, the audio data is consistent.
It implies that the pop is generated when the codec is doing the enabling/disabling process.
Like
Queue Left Amp Enable: reg=0x202b, 0x1/0x1
Queue Left Amp Enable: reg=0x202b, 0x0/0x1
bardliao commentedon Oct 28, 2022
@macchian Do you know if they do anything to prevent the codec driver from accessing the codec registers?
For example, let regcache_cache_only be always true, or use the dummy codec driver instead of max98373 codec driver.
If they didn't do that, the codec driver will still act as usual, and it didn't prove the pop is not from the enabling/disabling process.
macchian commentedon Nov 2, 2022
Hi all,
As per working with @bardliao and @ryans-lee from Maxim, I summarize the pop test results below:
a. turn off left Spk global_en first
#echo 0 0x20FF > /sys/kernel/debug/regmap/i2c-MX98373:01 (One pop sound)
b. then turn off right Spk global_en
#echo 0 0x20ff > /sys/kernel/debug/regmap/i2c-MX98373:00 (One pop sound)
c. turn on right spk global_en again
#echo 1 0x20ff > /sys/kernel/debug/regmap/i2c-MX98373:00 (speaker sound not resume sound when set global_en on)
So in this case, I only observe pop when running right spk global_en off.
Pop occurs:
1 pop occurs when aplay starting, 2 pop occur when aplay stopped. [Confirmed]
static const struct snd_soc_dapm_widget max98373_dapm_widgets[] = {
SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback",
─ MAX98373_R202B_PCM_RX_EN, 0, 0, max98373_dac_event,
┼ SND_SOC_NOPM, 0, 0, max98373_dac_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD |
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
static int max98373_probe(struct snd_soc_component *component)
MAX98373_R2043_AMP_EN,
MAX98373_SPK_EN_MASK, 1);
─
┼ regmap_write(max98373->regmap, MAX98373_R202B_PCM_RX_EN, 0x1);
plbossart commentedon Dec 13, 2022
@bardliao can you provide a summary? My understanding is that the issue is at the codec driver level?
bardliao commentedon Dec 13, 2022
@plbossart There are 2 issues.
a. When we run aplay with a 1k tone and stop during playback, we will hear a noise due to the discontinuous audio.
b.
We measured the I2S signal from I2S pins with a logic analyzer and the captured signal looks good. So, I don't think it is a SOF issue.
macchian commentedon Feb 8, 2023
refer to #7048 and #4179
johnylin76 commentedon Feb 8, 2023
FYI, the production build for ADL-P devices have been migrated from adl-004 to rpl-001, which means the fix commit should be merged back to rpl-001-drop-stable instead.
lgirdwood commentedon Feb 21, 2023
@macchian can we close ?
macchian commentedon Feb 22, 2023
@lgirdwood Yes, the remaining fix PR #4179 has approved and to be merged. We can close it. Thanks!