Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Vadym Shevchuk <0xsheff@gmail.com>
To: Takashi Iwai <tiwai@suse.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, Vadym Shevchuk <0xsheff@gmail.com>
Subject: [PATCH v2] ALSA: usb-audio: Add quirk for Shanling UP4
Date: Mon,  5 Oct 2026 15:59:53 +0300	[thread overview]
Message-ID: <20261005125953.190316-1-0xsheff@gmail.com> (raw)
In-Reply-To: <20261005094433.32960-1-0xsheff@gmail.com>

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>
---
v2: use the full name in From and Signed-off-by
v1: https://lore.kernel.org/all/20261005094433.32960-1-0xsheff@gmail.com/

 sound/usb/quirks.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 38d78b834..3fdf03ce9 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2366,6 +2366,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;
-- 
2.53.0


  reply	other threads:[~2026-10-05 13:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAPHAwzdUNRbZjBQuYKLf18EK_QGq0gR6Vx3YMZ=ffYKBogUtLA@mail.gmail.com>
2026-10-03  9:13 ` [BUG] ALSA: usb-audio: Shanling UP4 (0a12:1244) silent at 44.1 kHz due to MaxPacketsOnly Takashi Iwai
2026-10-05  9:44 ` [PATCH] ALSA: usb-audio: Add quirk for Shanling UP4 Vadym S
2026-10-05 12:59   ` Vadym Shevchuk [this message]
2026-10-05 13:18     ` [PATCH v2] " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261005125953.190316-1-0xsheff@gmail.com \
    --to=0xsheff@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox