Bug 214105 - [Regression] snd-usb-audio - Sony Walkman NW-A45 DAC stopped working in 5.11
Summary: [Regression] snd-usb-audio - Sony Walkman NW-A45 DAC stopped working in 5.11
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-18 21:20 UTC by Kevin Brodsky
Modified: 2021-08-24 08:47 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.11+
Tree: Mainline
Regression: Yes


Attachments
alsa-info.sh output with 61cc2d775e09 (49.09 KB, text/plain)
2021-08-18 21:22 UTC, Kevin Brodsky
Details
alsa-info.sh output with bf6313a0ff76 (49.10 KB, text/plain)
2021-08-18 21:23 UTC, Kevin Brodsky
Details
Test patch (5.53 KB, patch)
2021-08-19 13:10 UTC, Takashi Iwai
Details | Diff
Corrected test fix (6.06 KB, patch)
2021-08-19 14:57 UTC, Takashi Iwai
Details | Diff
alsa-info.sh output with 5.13.10 (50.06 KB, text/plain)
2021-08-19 21:45 UTC, Kevin Brodsky
Details
alsa-info.sh output with mainline (5.14rc6) + patch attached #298365 (50.40 KB, text/plain)
2021-08-19 22:32 UTC, Kevin Brodsky
Details
Test patch #1 (421 bytes, patch)
2021-08-20 09:32 UTC, Takashi Iwai
Details | Diff
Test patch #2 (564 bytes, patch)
2021-08-20 09:32 UTC, Takashi Iwai
Details | Diff
Fix patch (1.98 KB, patch)
2021-08-22 13:06 UTC, Takashi Iwai
Details | Diff

Description Kevin Brodsky 2021-08-18 21:20:43 UTC
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 [1], 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.

[1] https://bbs.archlinux.org/viewtopic.php?id=264051
Comment 1 Kevin Brodsky 2021-08-18 21:22:39 UTC
Created attachment 298355 [details]
alsa-info.sh output with 61cc2d775e09
Comment 2 Kevin Brodsky 2021-08-18 21:23:34 UTC
Created attachment 298357 [details]
alsa-info.sh output with bf6313a0ff76
Comment 3 Takashi Iwai 2021-08-19 12:08:38 UTC
Could you give the alsa-info.sh output from 5.13.x kernel?
Comment 4 Takashi Iwai 2021-08-19 13:10:07 UTC
Also, could you try the patch below?
Comment 5 Takashi Iwai 2021-08-19 13:10:27 UTC
Created attachment 298361 [details]
Test patch
Comment 6 Takashi Iwai 2021-08-19 14:57:07 UTC
Created attachment 298365 [details]
Corrected test fix

The previous one had a bug, this is a revised fix.
Comment 7 Kevin Brodsky 2021-08-19 21:44:46 UTC
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.
Comment 8 Kevin Brodsky 2021-08-19 21:45:22 UTC
Created attachment 298367 [details]
alsa-info.sh output with 5.13.10
Comment 9 Kevin Brodsky 2021-08-19 22:32:29 UTC
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.
Comment 10 Takashi Iwai 2021-08-20 05:53:19 UTC
OK, thanks.

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?
Comment 11 Takashi Iwai 2021-08-20 05:53:59 UTC
As a non-working kernel, at best the result with the 5.14-rc + test patch.
Comment 12 Takashi Iwai 2021-08-20 09:31:52 UTC
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.
Comment 13 Takashi Iwai 2021-08-20 09:32:21 UTC
Created attachment 298381 [details]
Test patch #1
Comment 14 Takashi Iwai 2021-08-20 09:32:42 UTC
Created attachment 298383 [details]
Test patch #2
Comment 15 Kevin Brodsky 2021-08-20 21:29:07 UTC
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?
Comment 16 Takashi Iwai 2021-08-22 06:19:28 UTC
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?
Comment 17 Kevin Brodsky 2021-08-22 09:49:52 UTC
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.
Comment 18 Takashi Iwai 2021-08-22 13:05:19 UTC
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.
Comment 19 Takashi Iwai 2021-08-22 13:06:18 UTC
Created attachment 298415 [details]
Fix patch
Comment 20 Kevin Brodsky 2021-08-23 20:59:22 UTC
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 :)
Comment 21 Takashi Iwai 2021-08-24 08:47:35 UTC
The fix is merged to sound.git tree now.  Let's close.

Note You need to log in before you can comment on or make changes to this bug.