Bug 216500

Summary: Steinberg UR22C malfunctions after upgrading from 5.19.8 to 5.19.9
Product: Drivers Reporter: Zoé B (bugzilla.kernel.org)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: angelettif, craig, development, fjmartire, fonsecajoao, hikkideveloper, honza, kuon, lortegap, m.beniamino, nicolai, nikolas, nsgers, per.kristian.nordnes, sebastian, tiwai, tkna91
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.19.9 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Test fix patch
Test fix patch (corrected)
The fix patch to be submitted
v2 fix patch
Debug log from snd-usb-audio
debug patch
Debug log with additional debug patch
Debug log with additional debug patch, v2
Another fix patch
v2 patch for endpoint setup split

Description Zoé B 2022-09-17 19:31:54 UTC
Since upgrading to 5.19.9 my Steinberg UR22C audio interface only shows input or output audio profiles and setting it to "Pro Audio" results in this error message with pipewire and only output works:

```
Sep 17 21:00:26 tynan pipewire[21886]: spa.alsa: set_hw_params: Device or resource busy
Sep 17 21:00:26 tynan pipewire[21886]: pw.node: (alsa_input.usb-Yamaha_Corporation_Steinberg_UR22C-00.pro-input-0-95) suspended -> error (Start error: Device or resource busy)
```

With 5.19.9 only audio output profile or audio input profiles work as the combined ones are missing completely.

Downgrading to 5.19.8 results in the interface showing all the profiles again and it works like before. I also tried 6.0rc5 which exhibits the same regression. Downgrading any pipewire components also didn't help and only the kernel version made a difference.
Comment 1 J Fonseca 2022-09-18 02:38:52 UTC
I can confirm the same issue and behavior is present on the Behringer UMC404HD and Focusrite Scarlett 2i2 usb audio interfaces. Downgrading to 5.19.8 also restored normal functionality for me on both devices
Comment 2 Takashi Iwai 2022-09-18 06:32:13 UTC
There are a few different fixes between those two versions about USB-audio (sound/usb/audio/*).  Could you bisect which one broke?
Comment 3 Zoé B 2022-09-18 09:14:57 UTC
(In reply to Takashi Iwai from comment #2)
> There are a few different fixes between those two versions about USB-audio
> (sound/usb/audio/*).  Could you bisect which one broke?

yes, currently trying that. will update if/when i find the offending one.
Comment 4 Zoé B 2022-09-18 09:37:22 UTC
Looking through the commit log i suspected that most likely https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.19.y&id=271f862ebc60b3a7ff1563654eb33cd4571c66aa is the culprit and reverting this single commit worked.

also pretty sure that https://bugzilla.kernel.org/show_bug.cgi?id=216499 is the exact same issue.
Comment 5 Matteo Beniamino 2022-09-18 13:49:39 UTC
I can confirm reverting that commit also fixes https://bugzilla.kernel.org/show_bug.cgi?id=216499 .
Comment 6 Takashi Iwai 2022-09-19 07:27:11 UTC
Thanks.  Could you try the patch below?

If that doesn't work, I'll revert the commit instead.
Comment 7 Takashi Iwai 2022-09-19 07:27:38 UTC
Created attachment 301829 [details]
Test fix patch
Comment 8 Takashi Iwai 2022-09-19 07:28:21 UTC
*** Bug 216499 has been marked as a duplicate of this bug. ***
Comment 9 Takashi Iwai 2022-09-19 08:02:49 UTC
Created attachment 301830 [details]
Test fix patch (corrected)
Comment 10 Zoé B 2022-09-19 08:41:04 UTC
That seems to have worked, just trying a clean build with the patch too, just in case.
Comment 11 Takashi Iwai 2022-09-19 08:42:14 UTC
Great, thanks for quick testing!
Comment 12 Takashi Iwai 2022-09-19 09:03:35 UTC
Created attachment 301832 [details]
The fix patch to be submitted
Comment 13 Zoé B 2022-09-19 09:58:24 UTC
I just tried it with a clean build, and either something went wrong with applying the patch or it's still not working. I'll try one more time with the non-distribution tree (i had dirty mainline first, then clean arch latest which failed).
Comment 14 Zoé B 2022-09-19 11:01:34 UTC
Tried a clean 5.19.9 with only this patch applied and unfortunately it's still broken.
Comment 15 Matteo Beniamino 2022-09-19 17:25:15 UTC
Same, unfortunately applying attachment 301832 [details] on top of 5.19.9 doesn't fix the issue for me.
Comment 16 Takashi Iwai 2022-09-20 05:52:28 UTC
Just to be sure, check with the patch in comment 9?
Comment 17 Zoé B 2022-09-20 08:38:58 UTC
(In reply to Takashi Iwai from comment #16)
> Just to be sure, check with the patch in comment 9?

Yes, it was.
Comment 18 Takashi Iwai 2022-09-20 09:12:06 UTC
Hrm, so both the patches in comment 9 and comment 12 didn't work on top of 6.0-rc[56]?

Could you try to load snd-usb-audio module with dyndbg=+p option, and attach the dmesg output?  It should show the debug print "Mismatched sample rate X vs Y...", if I understand correctly.
Comment 19 Nicolas Goy 2022-09-20 09:12:28 UTC
I have which appears to be the same issue with a MOTU M2 and kernel 5.15.68

Did this bug make it to the 5.15 branch?


```
sep 20 11:05:49 yoda pipewire[1026110]: spa.alsa: set_hw_params: Device or resource busy
sep 20 11:05:49 yoda pipewire[1026110]: pw.node: (alsa_input.usb-MOTU_M2_M2MT08FB8F-00.pro-input-0-96) suspended -> error (Start error: Device or resource bus>
sep 20 11:05:49 yoda pipewire[1026110]: spa.alsa: set_hw_params: Device or resource b
```
Comment 20 Zoé B 2022-09-20 09:30:08 UTC
(In reply to Takashi Iwai from comment #18)
> Hrm, so both the patches in comment 9 and comment 12 didn't work on top of
> 6.0-rc[56]?
> 
> Could you try to load snd-usb-audio module with dyndbg=+p option, and attach
> the dmesg output?  It should show the debug print "Mismatched sample rate X
> vs Y...", if I understand correctly.

Did something substantial change between patches in comment 9 and 12? I only tried the one in 9 with both 5.19.9 and 6.0rc5 where it didn't work for either kernel.
Comment 21 Takashi Iwai 2022-09-20 09:45:31 UTC
(In reply to Zoé B from comment #20)
> (In reply to Takashi Iwai from comment #18)
> > Hrm, so both the patches in comment 9 and comment 12 didn't work on top of
> > 6.0-rc[56]?
> > 
> > Could you try to load snd-usb-audio module with dyndbg=+p option, and
> attach
> > the dmesg output?  It should show the debug print "Mismatched sample rate X
> > vs Y...", if I understand correctly.
> 
> Did something substantial change between patches in comment 9 and 12? I only
> tried the one in 9 with both 5.19.9 and 6.0rc5 where it didn't work for
> either kernel.

No substantial, but only small difference.  I asked it just to be sure whether there was any thinko at refactoring.

In anyway, below is another pitch.  Hopefully this works better...

If it still doesn't work, I'm going to simply revert the commit mentioned in comment 4.
Comment 22 Takashi Iwai 2022-09-20 09:48:39 UTC
Created attachment 301833 [details]
v2 fix patch

Should be applicable to 5.19.y and 6.0-rc
Comment 23 Takashi Iwai 2022-09-20 09:49:32 UTC
(In reply to Nicolas Goy from comment #19)
> I have which appears to be the same issue with a MOTU M2 and kernel 5.15.68
> 
> Did this bug make it to the 5.15 branch?

Yes, likely.  Try to revert the stable commit df5ec554e9e35110971381e7c658ef945ace9905 (upstream ff878b408a03bef5d610b7e2302702e16a53636e).
Comment 24 Zoé B 2022-09-20 09:52:59 UTC
(In reply to Takashi Iwai from comment #22)
> Created attachment 301833 [details]
> v2 fix patch
> 
> Should be applicable to 5.19.y and 6.0-rc

Thank you! building with 6.0rc6 right now.
Comment 25 Zoé B 2022-09-20 10:40:02 UTC
Still doesn't work with the patch from comment 22 on 6.0-rc6 unfortunately...
Comment 26 Takashi Iwai 2022-09-20 11:33:16 UTC
OK, then it's something different from what I was looking at.

Could you give the kernel log taking after loading snd-usb-audio with dyndbg=+p option and reproducing the bug?
Comment 27 Takashi Iwai 2022-09-20 11:47:42 UTC
Meanwhile I submitted the revert now:
  https://lore.kernel.org/r/20220920113929.25162-1-tiwai@suse.de

It'll be likely included in 6.0-rc7 and backported to 5.15 and 5.19 stable eventually later.

But, let's keep debugging for a while with the buggy commit.  I need to understand what went south, above all.
Comment 28 Zoé B 2022-09-20 11:53:51 UTC
Created attachment 301834 [details]
Debug log from snd-usb-audio
Comment 29 Zoé B 2022-09-20 11:55:46 UTC
(In reply to Takashi Iwai from comment #26)
> OK, then it's something different from what I was looking at.
> 
> Could you give the kernel log taking after loading snd-usb-audio with
> dyndbg=+p option and reproducing the bug?

I attached the log output, it's a bit more than just the audio interface only because it's currently on a docking station. I can also do a attach with only the interface if necessary.
Comment 30 Takashi Iwai 2022-09-20 12:33:18 UTC
Thanks, that's fine, I can just grep "6-1.2.1" for the relevant messages.

Interestingly there was no error there in the log, so from the driver POV, it worked as expected.  Do I understand correctly that it's a broken state, right?
Comment 31 Zoé B 2022-09-20 12:38:07 UTC
It's broken in the sense of that it doesn't enumerate all the possible configurations. It works only as output or input but not both at the same time.
If I choose "Pro Audio" as the configuration it shows an input too, but that input then does not work at all.
Before the commit that broke this, it showed configurations for Output + Input and the Pro Audio configuration also worked as Output + Input simultaneously.
Comment 32 Takashi Iwai 2022-09-20 12:59:03 UTC
Could you apply the debug patch below on the top and give the log again with dyndbg=+p?
Comment 33 Takashi Iwai 2022-09-20 12:59:22 UTC
Created attachment 301835 [details]
debug patch
Comment 34 Zoé B 2022-09-20 13:46:09 UTC
Created attachment 301836 [details]
Debug log with additional debug patch

Debug log of attaching the audio interface directly.
Comment 35 Takashi Iwai 2022-09-20 13:53:13 UTC
I guess the patch wasn't applied or installed?  The patched kernel should show debug messages with "XXX ..."
Comment 36 Zoé B 2022-09-20 14:04:20 UTC
(In reply to Takashi Iwai from comment #35)
> I guess the patch wasn't applied or installed?  The patched kernel should
> show debug messages with "XXX ..."

right, i named it wrong so it didn't get applied in the build, trying again.
Comment 37 Zoé B 2022-09-20 14:35:56 UTC
Created attachment 301837 [details]
Debug log with additional debug patch, v2
Comment 38 Takashi Iwai 2022-09-20 15:06:01 UTC
Thanks!  Could you try the fix patch below?  (You can scratch the previous debug patch.)
Comment 39 Takashi Iwai 2022-09-20 15:06:33 UTC
Created attachment 301838 [details]
Another fix patch
Comment 40 Zoé B 2022-09-20 15:49:00 UTC
The combination of patches worked now, thanks a lot!
Comment 41 Takashi Iwai 2022-09-20 15:52:35 UTC
Thanks, finally nailed down.  So I scratched on another (potential) bug of the patch at first, then hit the right one now.

Below is the v2 patch for the buggy commit.  It'd be helpful if you can try this once after reverting the commit ff878b408a03 on top of the clean latest Linus tree (or 6.0-rc[56]) (i.e. without previous fix patches).
Comment 42 Takashi Iwai 2022-09-20 15:56:47 UTC
Created attachment 301839 [details]
v2 patch for endpoint setup split
Comment 43 Zoé B 2022-09-20 16:42:56 UTC
(In reply to Takashi Iwai from comment #41)
> Thanks, finally nailed down.  So I scratched on another (potential) bug of
> the patch at first, then hit the right one now.
> 
> Below is the v2 patch for the buggy commit.  It'd be helpful if you can try
> this once after reverting the commit ff878b408a03 on top of the clean latest
> Linus tree (or 6.0-rc[56]) (i.e. without previous fix patches).

This works with 6.0-rc6, ff878b408a03 reverted and only the patch in comment 42.
Comment 44 Matteo Beniamino 2022-09-20 16:53:06 UTC
And I can confirm 6.0-rc6 with ff878b408a03 reverted and the patch in attachment 301839 [details] works for MOTU M2 as well.
Comment 45 Takashi Iwai 2022-09-20 18:08:57 UTC
*** Bug 216508 has been marked as a duplicate of this bug. ***
Comment 46 Takashi Iwai 2022-09-20 18:10:35 UTC
Thanks for confirmation.  I'll submit the revised patch (but destined for 6.1).
6.0 and stable will receive the revert in a couple of days.
Comment 47 Nicolas Goy 2022-09-20 19:30:38 UTC
For reference, I confirm that the bug made it to the 5.15 branch:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/sound/usb/endpoint.c?id=v5.15.68&id2=v5.15.67
Comment 48 skogsmaskin 2022-09-23 07:28:39 UTC
Just want to add another report.

After upgrading to kernel 5.19.10 today (was previously on 5.19.8) my soundcard isn't detected by the kernel. Or rather it errors with:

[  939.487513] usb 1-2: USB disconnect, device number 3
[  942.497809] usb 1-2: new high-speed USB device number 4 using xhci_hcd
[  942.640650] usb 1-2: New USB device found, idVendor=2708, idProduct=0009, bcdDevice= 1.07
[  942.640656] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  942.640658] usb 1-2: Product: Audient iD4
[  942.640660] usb 1-2: Manufacturer: Audient
[  943.691605] usb 1-2: 60:0: cannot get min/max values for control 1 (id 60)
[  943.695600] usb 1-2: 60:0: cannot get min/max values for control 3 (id 60)
[  943.696225] usb 1-2: 60:0: cannot get min/max values for control 4 (id 60)
[  943.697225] usb 1-2: 11:0: cannot get min/max values for control 11 (id 11)
[  943.699983] input: Audient Audient iD4 as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:06:00.1/usb1/1-2/1-2:1.3/0003:2708:0009.0008/input/input28
[  943.700067] hid-generic 0003:2708:0009.0008: input,hidraw1: USB HID v1.10 Mouse [Audient Audient iD4] on usb-0000:06:00.1-2/input3
[  943.737731] usb 1-2: 60:0: cannot get min/max values for control 1 (id 60)
[  943.737979] usb 1-2: 60:0: cannot get min/max values for control 3 (id 60)
[  943.738219] usb 1-2: 60:0: cannot get min/max values for control 4 (id 60)
[  943.738465] usb 1-2: 11:0: cannot get min/max values for control 11 (id 11)
[  943.738716] usb 1-2: 60:0: cannot get min/max values for control 1 (id 60)
[  943.738965] usb 1-2: 60:0: cannot get min/max values for control 3 (id 60)
[  943.739216] usb 1-2: 60:0: cannot get min/max values for control 4 (id 60)
[  943.739464] usb 1-2: 11:0: cannot get min/max values for control 11 (id 11)
[  943.739715] usb 1-2: 60:0: cannot get min/max values for control 1 (id 60)
[  943.742217] usb 1-2: 60:0: cannot get min/max values for control 3 (id 60)
[  943.743965] usb 1-2: 60:0: cannot get min/max values for control 4 (id 60)
[  943.744966] usb 1-2: 11:0: cannot get min/max values for control 11 (id 11)
My soundcard is:

Bus 001 Device 003: ID 2708:0009 Audient Audient iD4
Comment 49 Takashi Iwai 2022-09-23 08:45:41 UTC
(In reply to skogsmaskin from comment #48)
> Just want to add another report.
> 
> After upgrading to kernel 5.19.10 today (was previously on 5.19.8) my
> soundcard isn't detected by the kernel. Or rather it errors with:

Looks like a different issue.  Please don't mix up, but open another report.
At best, try git bisection to hunt the regression cause.
Comment 50 angelettif 2022-09-25 02:51:15 UTC
I can confirm the same issue and behavior is present on the Behringer UMC404HD  usb audio interface. Downgrading to 5.19.8 also restored normal functionality for me.

I'v also tried with negative results: 
  linux 5.19.10.artix1-1
  linux-lts 5.15.70-1
  linux-zen 5.19.10.zen1-1
Comment 51 Luis O 2022-09-25 22:27:25 UTC
same as angelettif@gmail.com, but i have a behringer umc202hd.
Comment 52 Fernando M. 2022-09-26 15:14:24 UTC
Mismo problema endeavouros kernel 5.19.9/10-11 

Interface: audient id4
Comment 53 hikki 2022-09-27 11:10:49 UTC
The issue still exists.

Card: Audient iD4 (2708:0009)
Kernel: 5.19.11-zen1-1-zen
Comment 54 nikolas 2022-09-29 03:06:40 UTC
I've run into this issue on my Edirol UA-25 interface and kernel 5.19.11-200.fc36.x86_64. See: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2732
Comment 55 Fernando M. 2022-09-29 18:02:16 UTC
FIXED!

Working perfect with the new kernel 5.19.12
Thank you very much!
Comment 56 skogsmaskin 2022-09-29 20:16:54 UTC
Works for the Audient id4 again now also with v5.19.12. Great!
Comment 57 angelettif 2022-09-30 13:10:38 UTC
Works for Behringer UMC404HD agin with 5.19.12-zen1-1-zen