From b42663cecdf4403a230baafb31bae136e90fd142 Mon Sep 17 00:00:00 2001 From: Vadym Shevchuk <0xsheff@gmail.com> Date: Mon, 5 Oct 2026 15:59:53 +0300 Subject: [PATCH] ALSA: usb-audio: Add quirk for Shanling UP4 The Shanling UP4 (0a12:1244, CSR-based, UAC1, full speed) sets the MaxPacketsOnly bit in its AS isochronous endpoint descriptor. With UAC_EP_CS_ATTR_FILL_MAX set, the driver fills every 1 ms packet up to wMaxPacketSize, i.e. 48 frames, regardless of the sample rate. At 44.1 kHz the device expects 44/45 frames per packet and outputs only silence. 48 kHz works because both packet sizes are the same there. Measured with aplay on hw:UP4,0, 4 s of S16_LE stereo: before: 44.1 kHz consumed at ~48030 frames/s, done in 3.68 s, silent after: 44.1 kHz consumed at ~44220 frames/s, done in 4.00 s, audible 48 kHz plays fine both before and after the change. Regular music playback at 44.1 kHz through PipeWire sounds fine as well. Clear the attribute for this device, as is already done for the MOTU MicroBook IIc. Since the packet sizes are equal at 48 kHz, this does not change anything for other devices that may share this CSR USB ID and only use 48 kHz. Link: https://lore.kernel.org/all/CAPHAwzdUNRbZjBQuYKLf18EK_QGq0gR6Vx3YMZ=ffYKBogUtLA@mail.gmail.com/ Signed-off-by: Vadym Shevchuk <0xsheff@gmail.com> Link: https://patch.msgid.link/20261005125953.190316-1-0xsheff@gmail.com Signed-off-by: Takashi Iwai --- sound/usb/quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 3ef983e23a2c..170f68db74fa 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2381,6 +2381,14 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, */ fp->attributes &= ~UAC_EP_CS_ATTR_FILL_MAX; break; + case USB_ID(0x0a12, 0x1244): /* Shanling UP4 */ + /* + * MaxPacketsOnly is set, but the device expects nominal-size + * packets. Filling 48 frames per packet at 44.1 kHz results + * in silence. No effect at 48 kHz, where both sizes match. + */ + fp->attributes &= ~UAC_EP_CS_ATTR_FILL_MAX; + break; case USB_ID(0x1224, 0x2a25): /* Jieli Technology USB PHY 2.0 */ /* mic works only when ep packet size is set to wMaxPacketSize */ fp->attributes |= UAC_EP_CS_ATTR_FILL_MAX;