Bug 208353

Summary: Distorted Audio Output Through USB C Docking Station
Product: Drivers Reporter: Peter Bui (pbui)
Component: USBAssignee: Default virtual assignee for Drivers/USB (drivers_usb)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alexander, alxchk, bugzilla.kernel, c.e.perry, david, flo, jwrdegoede, mark.blakeney, me, miles, pnqkernelbugzilla, steffen.weber, subjectdenied, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.4.49 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Output of alsa-info.sh
Output of lsusb -v -d 0bda:402e
test.patch

Description Peter Bui 2020-06-28 15:19:06 UTC
Created attachment 289909 [details]
Output of alsa-info.sh

With kernel 5.4.49 the audio output through my Dell WD19 Docking station is now laggy and distorted (sounds like only bass frequencies are emitted).  Previously, audio output through the dock worked just fine with all versions of 4.19.x and 5.4.x.

After looking through the changelog for 5.4.49, I was able to locate the offending patch:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=aba41867dd66939d336fdf604e4d73b805d8039f

Reverting this patch allows audio to play normally through my docking station.
Comment 1 Alan Stern 2020-06-28 17:50:26 UTC
Bring this to the attention of the person who wrote the offending commit:

On Sun, Jun 28, 2020 at 03:19:06PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208353
> 
>             Bug ID: 208353
>            Summary: Distorted Audio Output Through USB C Docking Station
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 5.4.49
>           Hardware: All
>                 OS: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>           Assignee: drivers_usb@kernel-bugs.kernel.org
>           Reporter: pbui@kernel.bx612.space
>         Regression: No
> 
> Created attachment 289909 [details]
>   --> https://bugzilla.kernel.org/attachment.cgi?id=289909&action=edit
> Output of alsa-info.sh
> 
> With kernel 5.4.49 the audio output through my Dell WD19 Docking station is
> now
> laggy and distorted (sounds like only bass frequencies are emitted). 
> Previously, audio output through the dock worked just fine with all versions
> of
> 4.19.x and 5.4.x.
> 
> After looking through the changelog for 5.4.49, I was able to locate the
> offending patch:
> 
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=aba41867dd66939d336fdf604e4d73b805d8039f

This is upstream commit f0bd62b64016 ("ALSA: usb-audio: Improve frames 
size computation").

Alan Stern

> Reverting this patch allows audio to play normally through my docking
> station.
Comment 2 Alexander Tsoy 2020-06-28 18:15:22 UTC
Please attach the output of "lsusb -v -d 0bda:402e" command.
Comment 3 Peter Bui 2020-06-28 18:43:54 UTC
Created attachment 289915 [details]
Output of lsusb -v -d 0bda:402e

Attached is the output "lsusb -v -d 0bda:402e" command.
Comment 4 Alexander Tsoy 2020-06-28 19:09:42 UTC
Thanks! I think I've completely missed datainterval in my calculations. I'll prepare a patch for you to test.

(Also CCing Takashi)
Comment 5 Alexander Tsoy 2020-06-28 20:24:00 UTC
Created attachment 289917 [details]
test.patch

Here is a quick patch to test my theory. Please give it a try.
Comment 6 Peter Bui 2020-06-28 22:17:56 UTC
The patch works! After applying it to 5.4.49, I can play audio via my USB C docking station now.

Thanks for the quick response and fix!
Comment 7 Mark Blakeney 2020-06-29 22:06:48 UTC
Alex, this is also https://bugzilla.kernel.org/show_bug.cgi?id=208317 with kernel 5.7.6. I applied your single line patch to my Arch 5.7.6 kernel and it does fix the issue. Thanks for the quick response.
Comment 8 Steffen Weber 2020-06-30 06:32:35 UTC
I can confirm that the patch works for me on a ThinkPad X1 Carbon Gen 8 with a ThinkPad Ultra Docking Station running Linux 5.7.6 (as did reverting the original commit). Thank you!
Comment 9 Hans de Goede 2020-07-07 08:34:04 UTC
Fedora is shipping 5.7.z kernels in our updates repo and it is raining bug-reports because of this issue.

Can we please get a non test-patch fix for this ASAP?

Or get a revert of the commit causing this regression queued up for all the stable series where this got added and is causing regressions (also ASAP)?
Comment 11 Florian Engelhardt 2020-07-07 13:45:01 UTC
I too can confirm the patch works, applied it to the Fedora 32 5.7.7 kernel and the problem is solved. Thanks for the fix!
Comment 12 Petr Novak 2020-07-08 15:39:27 UTC
I have similar issue with audio output from Dell WD15 USB-C Dock. I decoded notorious song "Never Gonna Give You Up" to raw audio and ran it throug aplay. Before the commit it plays normally, since the commit it plays like this: https://central.szn.cz/s/tr9otisNwiFEE2A

The first official release with the issue is 5.7.6, it is still present in 5.8-rc4. Bisecting found the following commit d288dc74f8cf95cb7ae0aaf245b7128627a49bf3 (ALSA: usb-audio: Improve frames size computation), which is based on upstream commit f0bd62b64016508938df9babe47f65c2c727d25c.

Release 5.7.7 with the patch from comment #5 seems okay.
Comment 13 Takashi Iwai 2020-07-09 14:10:20 UTC
The fix patch landed in Linus tree yesterday.  Sorry that it took long, as I've been off.

FWIW, Greg already reverted the original commit that caused a problem on stable trees.
Comment 14 Takashi Iwai 2020-07-09 14:12:33 UTC
*** Bug 208403 has been marked as a duplicate of this bug. ***
Comment 15 Takashi Iwai 2020-07-09 14:15:41 UTC
*** Bug 208317 has been marked as a duplicate of this bug. ***
Comment 16 Takashi Iwai 2020-07-09 14:19:26 UTC
*** Bug 208501 has been marked as a duplicate of this bug. ***