The Sony Walkman NW-A45 has a USB DAC mode that used to work fine with the snd-usb-audio driver, but stopped working completely in 5.11, and still doesn't work with the latest 5.13.y. This has been reproduced by a variety of users on the Arch Linux forum , and I have myself reproduced it on at least 3 different laptops / desktops.
I finally settled to bisect this in a VirtualBox VM, and found the culprit:
bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
Unfortunately this is a fairly large and invasive commit, so reverting it doesn't seem to be an option, even for a quick sanity check.
As far as I can tell, everything is exactly the same from a userspace perspective before and after this commit (see alsa-info.sh outputs attached: they are identical). However, after this commit, nothing is played back on the DAC.
Happy to provide further debug info if needed.
Created attachment 298355 [details]
alsa-info.sh output with 61cc2d775e09
Created attachment 298357 [details]
alsa-info.sh output with bf6313a0ff76
Could you give the alsa-info.sh output from 5.13.x kernel?
Also, could you try the patch below?
Created attachment 298361 [details]
Created attachment 298365 [details]
Corrected test fix
The previous one had a bug, this is a revised fix.
Thank you so much for the super quick reply and tentative fix! Building mainline with your patch now, in the meantime I'm attaching the alsa-info.sh output with 5.13.10.
Created attachment 298367 [details]
alsa-info.sh output with 5.13.10
Created attachment 298369 [details]
alsa-info.sh output with mainline (5.14rc6) + patch attached #298365
Unfortunately it looks like the last patch does not fix the issue, still nothing on the DAC. Attached the output of alsa-info.sh with the patch.
Could you test both the working and non-working kernels again with the boot option "snd_usb_audio.dyndbg=+p", and attach the dmesg outputs?
As a non-working kernel, at best the result with the 5.14-rc + test patch.
Erm, scratch my previous comment and previous patch -- I guess the patch isn't good in anyway.
Below are two hackish patches for testing: the first one is to enforce the interface and endpoint setups without optimization and the second one is to use the old ordering of setup. Those are made for 5.14 but should be applicable to 5.13, too. Check the first one, and if it fails, switch to the second one.
Created attachment 298381 [details]
Test patch #1
Created attachment 298383 [details]
Test patch #2
Victory! You had the right intuition. Patch #1 didn't help, but patch #2 did the trick \o/
Could it be that the NW-A45 is a non-compliant UAC2 device that doesn't like the interface being enabled after the parameters are set up?
Good to hear. Yes, it sounds like a firmware problem that doesn't behave as expected for other UAC2 devices.
Or it might be a timing issue. Instead of the previous patch, could you try to apply the delay in snd_usb_set_interface_quirk() in quirks.c?
I've just tried adding a 50ms delay in snd_usb_set_interface_quirk(), I can see it gets applied as I've added a pr_warn() but that doesn't help.
OK, then let's take the simple workaround to change the interface setup order.
A fix patch is below. Once after confirming it working, I'll submit it to the upstream.
Created attachment 298415 [details]
I've confirmed the last patch does fix the issue on the latest mainline (-rc7 now). Just in time for 5.15 (hope it can still make it)!
Huge thanks for the help, I'm really glad we've got to the bottom of this :)
The fix is merged to sound.git tree now. Let's close.