-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] MTL: sound distortion for SDW devices on SOF topology2 #8846
Comments
We have to split variables here @mstrozek there are just too many sources of issues. a) please first use the SOF development kernel, to rule out any backport issues. b) avoid system suspend for now and please disable pm_runtime for the SOF PCI device and SoundWire links. This can be done with these options: options snd-sof-pci sof_pci_debug=0x01 |
@mstrozek could you also test the low-level parts with the options above disabled to see if we have any obvious kernel/firmware issues. First copy this file
If all the tests pass, then the issue is in an area not tested by the Intel CI, such as the PipeWire integration. |
Another check would be to see what happens on the dmesg log when you open the Sound settings UI. What I see on my side is that there are no sound events after the application starts. What this means is that userspace opens an audio stream and mixes all other sounds into that stream. So if we start getting bad sound, it's either a) the application is confused in where the ALSA read/write pointers are, which could be related to some delay issues we're investigated.
c) that could also be an application problem. We'd need to extract PipeWire logs to see if anything goes boink at that level. If you see any changes on the dmesg log, it might indicate that the app is lost or there was an xrun somehow. |
Hi @plbossart , thank you for your instructions! Also tried the sof-tests with the /etc/modprobe.d/alsa.conf options disabled - please see attached output of those tests here sof-tests-output-normal.log. Looks like the sound settings UI was open during these tests and was causing some "Device or resource busy" errors , so re-run the tests again with UI closed (output here sof-tests-output-normal-no-soundUI.log) and that has broken something resulting in no soundcard being available anymore: and after reboot started showing HDMI audio, even though no HDMI was connected? Not sure what the tests are doing that the soundcard dissapears? Including a dmesg captured during the tests without sound UI here: Also, should I also run these tests after I notice the audio distortion? |
Hi @plbossart, an update: following a suggestion from @charleskeepax I tried increasing pipewire's buffer size with: |
@mstrozek the sof-test uses the hw: level so you want all applications, included pipewire, to be idle. The tests do add/remove modules so it's possible that the card was removed. Just reboot and re-run the tests once you see that the PCI device is in pm_suspend mode. |
@plbossart Not sure if I checked it correctly: tried |
The tests look ok, you just have errors with the module load/unload because the cirrus codecs are not included in the list
I had a PR to try and fix this in thesofproject/sof-test#1110, if you could apply those patches and retest the problems should go away At any rates the problem does seem to come from PipeWire's use of the ALSA api in a way that's not tested by the Intel CI. @ujfalusi and I reproduced a similar issue on a different platform, looking into this. |
@mstrozek I am able to reproduce a sound distortion on TGL and MTL devices without Cirrus Logic codecs. This seems to happen after an xrun, since at the driver level we see the stream being closed and reconfigured. This happens with the speaker output (pcm2)
That's not really a tight latency , 21ms periods are classic and should just work. |
Definitively an issue with xruns and recovery, every time the sound goes boink I see this sort of PipeWire logs
Edit: in the same monkey testing with TGL/IPC3, I never see this sort of logs, so it's a double-whammy |
thesofproject/linux#4816 seems to improve the xrun recovery in my tests with the Gnome Sound Settings/Test speaker cases. The question on why we have an xrun remains open. |
@plbossart I can confirm it improves the recovery. I can still see |
Thanks for testing @mstrozek. we're still working on this xrun recovery, the initial PR breaks other test cases so it will need improvements/refinements. |
@mstrozek could you please try Linux PR thesofproject/linux#4829 to test the xrun recovery. We've fixed the breaking test cases. |
@ranj063 merged the branch ranj063:pr4816 and looks like the issue is fixed! Did not hear any distortion during playback, but also can't see any |
@mstrozek thanks for testing! |
@abonislawski ok for me |
Describe the bug
On MTL laptop running Fedora 40 (most recent rawhide as of 06.02.2024) ) with the following topology:
occasionally the audio becomes strongly distorted (see attached files audio_example.tar.gz).
There is a chance this distortion will occur after waking the laptop from suspend, though it was observed to sometimes happen after restarting gnome sound settings GUI. It is possible that the sound can return to normal after some time or another wake/suspend cycle, but no clear pattern was observed.
The same distortion effect can be heard through both CS42L43 (jack) and CS35L56 (speakers). Also routing audio to bypass CS35L56's firmware has been tried, resulting in no change to distortion. This seems to suggest that the corruption happens before the sound is processed by CS42L43/CS35L56
To Reproduce
Try any audio output (tested mainly with gnome sound settings GUI) after waking the laptop from suspend.
Reproduction Rate
Should encounter the distortion after 5-10 attempts.
Expected behavior
No distortion should be present
Impact
Major
Environment
checkout v6.8-rc2 from https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/
merge next-20240202
Apply two patches from attached archive
patches.tar.gz
Apply ASoC: Intel: sof_sdw: starts non sdw BE id with the largest sdw BE id linux#4777
cs35l56_fw.tar.gz
Screenshots or console output
sdw_reg_dump.tar.gz
The text was updated successfully, but these errors were encountered: