Skip to contentSkip to conversation

ALSA: usb-audio: second configuration of the Steinberg UR22C

PATCH Applied Xinyu Wei 2 participants 4 messages Nov 8 – Nov 9 Sound

lore
Share & tools
lore

Xinyu Wei

author
#0 lore raw

cover ALSA: usb-audio: second configuration of the Steinberg UR22C

The Steinberg UR22C exposes two USB configurations: configuration 1 is class-compliant (2 playback / 4 capture channels), while configuration 2 is UAC2 behind bInterfaceClass 0xFF (6 playback / 8 capture channels and two MIDI interfaces). Selecting configuration 2 on a stock kernel leaves interfaces 0-2 unbound and registers no PCM.

Patch 1 adds a composite quirk entry for configuration 2's vendor-class interfaces. Patch 2 fixes a bogus bmFormats (0xffffffff) in configuration 2's capture descriptor so opening capture as FLOAT_LE does not lock out playback via implicit feedback sync.

Xinyu Wei (2):
ALSA: usb-audio: name the interfaces of the Steinberg UR22C
ALSA: usb-audio: fix the format bits of the Steinberg UR22C

 sound/usb/format.c       |  5 +++++
 sound/usb/quirks-table.h | 14 ++++++++++++++
 2 files changed, 19 insertions(+)
Signature · 1 line
2.56.0
author
#1 lore raw

PATCH 1/2 ALSA: usb-audio: name the interfaces of the Steinberg UR22C

Configuration 2 of the Steinberg UR22C (0499:172f) exposes 6 playback and 8 capture channels over standard UAC2 descriptors with bInterfaceClass set to 0xFF.

Because the interfaces are vendor-class, they fall into the Yamaha catch-all entry and QUIRK_AUTODETECT fails to set them up:
create_auto_pcm_quirk() rejects 6-byte UAC2 format descriptors, and interface 0 (audiocontrol, 1 altsetting, 0 endpoints) is rejected by both auto-PCM and auto-MIDI paths, leaving interfaces 0-2 unbound with no PCM registered.

Add a USB_DEVICE_VENDOR_SPEC composite entry before the Yamaha catch-all:
- interface 0: QUIRK_DATA_STANDARD_MIXER
- interfaces 1, 2: QUIRK_DATA_STANDARD_AUDIO (6-ch playback, 8-ch capture)
- interfaces 3, 4: QUIRK_DATA_MIDI_YAMAHA (DIN MIDI and DSP mixer control; both carry Yamaha-style CS_INTERFACE jack descriptors with no CS_ENDPOINT descriptor)

Configuration 1 uses bInterfaceClass 0x01 and is unaffected. The existing IMPLICIT_FB_FIXED_DEV(0x0499, 0x172f, 0x81, 2) entry in implicit.c applies to both configurations unchanged.

---
 sound/usb/quirks-table.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
sound/usb/quirks-table.h +14 -0
index e85eeb536..cc2c1317a 100644
@@ -455,6 +455,20 @@ YAMAHA_DEVICE(0x7000, "DTX"),
 YAMAHA_DEVICE(0x7010, "UB99"),
 #undef YAMAHA_DEVICE
 #undef YAMAHA_INTERFACE
+/* Steinberg UR22C (configuration 2) */
+{
+	USB_DEVICE_VENDOR_SPEC(0x0499, 0x172f),
+	QUIRK_DRIVER_INFO {
+		QUIRK_DATA_COMPOSITE {
+			{ QUIRK_DATA_STANDARD_MIXER(0) },
+			{ QUIRK_DATA_STANDARD_AUDIO(1) },
+			{ QUIRK_DATA_STANDARD_AUDIO(2) },
+			{ QUIRK_DATA_MIDI_YAMAHA(3) },
+			{ QUIRK_DATA_MIDI_YAMAHA(4) },
+			QUIRK_COMPOSITE_END
+		}
+	}
+},
 /* this catches most recent vendor-specific Yamaha devices */
 {
 	.match_flags = USB_DEVICE_ID_MATCH_VENDOR |
Signature · 1 line
2.56.0
author
#2 lore raw

PATCH 2/2 ALSA: usb-audio: fix the format bits of the Steinberg UR22C

In reply to Xinyu Wei

In configuration 2 of the Steinberg UR22C (0499:172f), the capture AS_GENERAL descriptor reports bmFormats = 0xffffffff, causing the driver to advertise U8, S32_LE, FLOAT_LE, MU_LAW, A_LAW and SPECIAL even though the hardware only supports 32-bit PCM (S32_LE).

Because playback is implicit-feedback synced to the capture endpoint (0x81 on interface 2), hw_rule_format() restricts playback to the active capture stream's format. If capture is opened first with a non-S32_LE format such as FLOAT_LE, the intersection with playback's S32_LE-only format mask is empty and playback fails to open with -EINVAL.

Clamp bmFormats to UAC2 PCM (1) in parse_audio_format_i_type() when chip->usb_id is 0499:172f and format == 0xffffffff, matching the existing DS4201 workaround below it.

---
 sound/usb/format.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/usb/format.c +5 -0
index 4830f9f93..7ca2b5d5c 100644
@@ -57,6 +57,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
 		sample_width = fmt->bBitResolution;
 		sample_bytes = fmt->bSubslotSize;
 
+		/* Steinberg UR22C workaround: config 2 capture sets 0xffffffff */
+		if (chip->usb_id == USB_ID(0x0499, 0x172f) &&
+		    format == 0xffffffff)
+			format = 1;
+
 		if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) {
 			pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
 			/* flag potentially raw DSD capable altsettings */
Signature · 1 line
2.56.0
Applied
#3 lore raw
In reply to Xinyu Wei
Quoted 7 lines · Xinyu Wei

The Steinberg UR22C exposes two USB configurations: configuration 1 is class-compliant (2 playback / 4 capture channels), while configuration 2 is UAC2 behind bInterfaceClass 0xFF (6 playback / 8 capture channels and two MIDI interfaces). Selecting configuration 2 on a stock kernel leaves interfaces 0-2 unbound and registers no PCM.

Quoted 8 lines

Patch 1 adds a composite quirk entry for configuration 2's vendor-class interfaces. Patch 2 fixes a bogus bmFormats (0xffffffff) in configuration 2's capture descriptor so opening capture as FLOAT_LE does not lock out playback via implicit feedback sync.

Xinyu Wei (2):
ALSA: usb-audio: name the interfaces of the Steinberg UR22C
ALSA: usb-audio: fix the format bits of the Steinberg UR22C

Applied both to for-next branch now. Thanks.

Takashi