All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Volkov <voilthuman@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lee Volkov <voilthuman@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] ALSA: usb-audio: Filter invalid capture rates on Solid State Logic SSL 12
Date: Wed,  2 Dec 2026 21:10:12 +0300	[thread overview]
Message-ID: <20261202181013.145045-2-voilthuman@gmail.com> (raw)
In-Reply-To: <20261202181013.145045-1-voilthuman@gmail.com>

The Solid State Logic SSL 12 (USB ID 31e9:0005) exposes three capture
altsettings on interface 2 (EP 0x81 IN, bInterval 1, 32-bit PCM), all
sharing the same UAC2 clock source that advertises sample rates up to
192 kHz:

  Altset 1: 16 channels, wMaxPacketSize 0x0400 (1x 1024 bytes)
  Altset 2: 12 channels, wMaxPacketSize 0x0400 (1x 1024 bytes)
  Altset 3: 10 channels, wMaxPacketSize 0x03e8 (1x 1000 bytes)

On a 125 us high-speed microframe, 176.4/192 kHz requires 22-25 frames
per microframe. At 4 bytes per sample, 16 channels need 1408-1600 bytes
and 12 channels need 1056-1200 bytes, exceeding wMaxPacketSize (1024 B)
and causing xHCI buffer overruns and stream failures when Altset 1 or 2
is opened above 96 kHz. Only Altset 3 (10 channels, up to 1000 bytes at
25 frames) fits 176.4/192 kHz. Playback (interface 1, Altset 1, EP 0x01
OUT, 8 channels, wMaxPacketSize 800 bytes) supports all rates up to
192 kHz.

Filter out sample rates above 96 kHz for capture Altsets 1 and 2 on SSL 12
using the existing skip_rate path, leaving Altset 3 and playback able to
use the full rate range up to 192 kHz.

Cc: stable@vger.kernel.org
Signed-off-by: Lee Volkov <voilthuman@gmail.com>
---
 sound/usb/format.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/sound/usb/format.c b/sound/usb/format.c
index e2219aeb9..51e60928f 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -309,6 +309,31 @@ static bool s1810c_valid_sample_rate(struct audioformat *fp,
 	return false;
 }
 
+/*
+ * Solid State Logic SSL 12 reports all sample rates (up to 192 kHz) for every
+ * capture altsetting, even though Altset 1 (16 ch, wMaxPacketSize 1024) and
+ * Altset 2 (12 ch, wMaxPacketSize 1024) exceed their 125 us microframe packet
+ * limit above 96 kHz. Only Altset 3 (10 ch, wMaxPacketSize 1000) fits
+ * 176.4/192 kHz. Playback (EP 0x01, 8 ch, wMaxPacketSize 800) supports all
+ * rates up to 192 kHz.
+ */
+static bool ssl12_valid_sample_rate(const struct audioformat *fp,
+				    unsigned int rate)
+{
+	if (fp->endpoint != (USB_DIR_IN | 1))
+		return true;
+
+	switch (fp->altsetting) {
+	case 1:
+	case 2:
+		return rate <= 96000;
+	case 3:
+		return true;
+	default:
+		return false;
+	}
+}
+
 /*
  * Focusrite devices use rate pairs: 44100/48000, 88200/96000, and
  * 176400/192000. Return true if rate is in the pair for max_rate.
@@ -470,6 +495,11 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,
 			    !focusrite_valid_sample_rate(chip, fp, rate))
 				goto skip_rate;
 
+			/* Filter out invalid rates on Solid State Logic SSL 12 */
+			if (chip->usb_id == USB_ID(0x31e9, 0x0005) &&
+			    !ssl12_valid_sample_rate(fp, rate))
+				goto skip_rate;
+
 			if (fp->rate_table)
 				fp->rate_table[nr_rates] = rate;
 			nr_rates++;
-- 
2.55.0


  reply	other threads:[~2026-12-02 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:10 [PATCH 0/2] ALSA: usb-audio: Fix Solid State Logic SSL 12 192 kHz duplex Lee Volkov
2026-12-02 18:10 ` Lee Volkov [this message]
2026-12-02 18:10 ` [PATCH 2/2] ALSA: usb-audio: Reuse active sync endpoint format for implicit feedback Lee Volkov

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=20261202181013.145045-2-voilthuman@gmail.com \
    --to=voilthuman@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.