* [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
@ 2026-05-23 21:04 Geoffrey D. Bennett
2026-05-25 7:28 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Geoffrey D. Bennett @ 2026-05-23 21:04 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Takashi Iwai, linux-sound
Firmware 2417 for the Scarlett 4th Gen 2i2 moved the direct monitor
gain parameter by 4 bytes, from offset 0x2a0 to 0x2a4, breaking the
"Direct Monitor X Mix Y" controls.
Special-case the offset in the get/set config helpers when the
running firmware is 2417 or later.
Fixes: 4e809a299677 ("ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4")
Cc: <stable@vger.kernel.org>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
Tested on a Scarlett 2i2 4th Gen by writing to "Direct Monitor 1
Mix A Input 01" and observing the USB traffic with usbmon:
- Firmware 2417, unpatched driver: write targets offset 0x2A0 (bug)
- Firmware 2417, patched driver: write targets offset 0x2A4
- Firmware 2128, patched driver: write targets offset 0x2A0
sound/usb/mixer_scarlett2.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 8e80a7165faf..a4fac4652201 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -2504,6 +2504,27 @@ static int scarlett2_has_config_item(
return !!private->config_set->items[config_item_num].offset;
}
+/* Return the configuration item's offset, applying any per-firmware
+ * overrides.
+ *
+ * Firmware 2417 for the 2i2 Gen 4 moved DIRECT_MONITOR_GAIN by 4
+ * bytes. Apply that shift here so that the rest of the driver can
+ * keep using the single config set. This override can be removed
+ * once the multi-config-set framework lands.
+ */
+static int scarlett2_config_item_offset(
+ struct scarlett2_data *private, int config_item_num)
+{
+ int offset = private->config_set->items[config_item_num].offset;
+
+ if (config_item_num == SCARLETT2_CONFIG_DIRECT_MONITOR_GAIN &&
+ private->info == &s2i2_gen4_info &&
+ private->firmware_version >= 2417)
+ offset = 0x2a4;
+
+ return offset;
+}
+
/* Send a USB message to get configuration parameters; result placed in *buf */
static int scarlett2_usb_get_config(
struct usb_mixer_interface *mixer,
@@ -2513,6 +2534,7 @@ static int scarlett2_usb_get_config(
const struct scarlett2_config *config_item =
&private->config_set->items[config_item_num];
int size, err, i;
+ int item_offset;
u8 *buf_8;
u8 value;
@@ -2522,13 +2544,15 @@ static int scarlett2_usb_get_config(
if (!config_item->offset)
return -EFAULT;
+ item_offset = scarlett2_config_item_offset(private, config_item_num);
+
/* Writes to the parameter buffer are always 1 byte */
size = config_item->size ? config_item->size : 8;
/* For byte-sized parameters, retrieve directly into buf */
if (size >= 8) {
size = size / 8 * count;
- err = scarlett2_usb_get(mixer, config_item->offset, buf, size);
+ err = scarlett2_usb_get(mixer, item_offset, buf, size);
if (err < 0)
return err;
if (config_item->size == 16) {
@@ -2546,7 +2570,7 @@ static int scarlett2_usb_get_config(
}
/* For bit-sized parameters, retrieve into value */
- err = scarlett2_usb_get(mixer, config_item->offset, &value, 1);
+ err = scarlett2_usb_get(mixer, item_offset, &value, 1);
if (err < 0)
return err;
@@ -2696,7 +2720,8 @@ static int scarlett2_usb_set_config(
*/
if (config_item->size >= 8) {
size = config_item->size / 8;
- offset = config_item->offset + index * size;
+ offset = scarlett2_config_item_offset(private, config_item_num) +
+ index * size;
/* If updating a bit, retrieve the old value, set/clear the
* bit as needed, and update value
@@ -2705,7 +2730,7 @@ static int scarlett2_usb_set_config(
u8 tmp;
size = 1;
- offset = config_item->offset;
+ offset = scarlett2_config_item_offset(private, config_item_num);
err = scarlett2_usb_get(mixer, offset, &tmp, 1);
if (err < 0)
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
2026-05-23 21:04 [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417 Geoffrey D. Bennett
@ 2026-05-25 7:28 ` Takashi Iwai
2026-05-26 5:42 ` Geoffrey D. Bennett
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-05-25 7:28 UTC (permalink / raw)
To: Geoffrey D. Bennett; +Cc: Takashi Iwai, Takashi Iwai, linux-sound
On Sat, 23 May 2026 23:04:14 +0200,
Geoffrey D. Bennett wrote:
>
> Firmware 2417 for the Scarlett 4th Gen 2i2 moved the direct monitor
> gain parameter by 4 bytes, from offset 0x2a0 to 0x2a4, breaking the
> "Direct Monitor X Mix Y" controls.
>
> Special-case the offset in the get/set config helpers when the
> running firmware is 2417 or later.
>
> Fixes: 4e809a299677 ("ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
> ---
> Tested on a Scarlett 2i2 4th Gen by writing to "Direct Monitor 1
> Mix A Input 01" and observing the USB traffic with usbmon:
>
> - Firmware 2417, unpatched driver: write targets offset 0x2A0 (bug)
> - Firmware 2417, patched driver: write targets offset 0x2A4
> - Firmware 2128, patched driver: write targets offset 0x2A0
Applied now to for-linus branch.
It seems that this can be merged without conflict to for-next that
contains already your previous series. Let me know if any adjustment
is needed at merging this with the previous one.
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
2026-05-25 7:28 ` Takashi Iwai
@ 2026-05-26 5:42 ` Geoffrey D. Bennett
2026-05-26 5:45 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Geoffrey D. Bennett @ 2026-05-26 5:42 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Takashi Iwai, linux-sound
On Mon, May 25, 2026 at 09:28:38AM +0200, Takashi Iwai wrote:
> On Sat, 23 May 2026 23:04:14 +0200,
> Geoffrey D. Bennett wrote:
> >
> > Firmware 2417 for the Scarlett 4th Gen 2i2 moved the direct monitor
> > gain parameter by 4 bytes, from offset 0x2a0 to 0x2a4, breaking the
> > "Direct Monitor X Mix Y" controls.
> >
> > Special-case the offset in the get/set config helpers when the
> > running firmware is 2417 or later.
> >
> > Fixes: 4e809a299677 ("ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
> > ---
> > Tested on a Scarlett 2i2 4th Gen by writing to "Direct Monitor 1
> > Mix A Input 01" and observing the USB traffic with usbmon:
> >
> > - Firmware 2417, unpatched driver: write targets offset 0x2A0 (bug)
> > - Firmware 2417, patched driver: write targets offset 0x2A4
> > - Firmware 2128, patched driver: write targets offset 0x2A0
>
> Applied now to for-linus branch.
>
> It seems that this can be merged without conflict to for-next that
> contains already your previous series. Let me know if any adjustment
> is needed at merging this with the previous one.
Thanks. Although they don't conflict, they are equivalent, so no need
for both. I think my previous series is the better way long term, so
can you drop the new patch when you merge to for-next? Or should I
send a revert? Or do you have a different preference?
Regards,
Geoffrey.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
2026-05-26 5:42 ` Geoffrey D. Bennett
@ 2026-05-26 5:45 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-05-26 5:45 UTC (permalink / raw)
To: Geoffrey D. Bennett; +Cc: Takashi Iwai, Takashi Iwai, linux-sound
On Tue, 26 May 2026 07:42:12 +0200,
Geoffrey D. Bennett wrote:
>
> On Mon, May 25, 2026 at 09:28:38AM +0200, Takashi Iwai wrote:
> > On Sat, 23 May 2026 23:04:14 +0200,
> > Geoffrey D. Bennett wrote:
> > >
> > > Firmware 2417 for the Scarlett 4th Gen 2i2 moved the direct monitor
> > > gain parameter by 4 bytes, from offset 0x2a0 to 0x2a4, breaking the
> > > "Direct Monitor X Mix Y" controls.
> > >
> > > Special-case the offset in the get/set config helpers when the
> > > running firmware is 2417 or later.
> > >
> > > Fixes: 4e809a299677 ("ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4")
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
> > > ---
> > > Tested on a Scarlett 2i2 4th Gen by writing to "Direct Monitor 1
> > > Mix A Input 01" and observing the USB traffic with usbmon:
> > >
> > > - Firmware 2417, unpatched driver: write targets offset 0x2A0 (bug)
> > > - Firmware 2417, patched driver: write targets offset 0x2A4
> > > - Firmware 2128, patched driver: write targets offset 0x2A0
> >
> > Applied now to for-linus branch.
> >
> > It seems that this can be merged without conflict to for-next that
> > contains already your previous series. Let me know if any adjustment
> > is needed at merging this with the previous one.
>
> Thanks. Although they don't conflict, they are equivalent, so no need
> for both. I think my previous series is the better way long term, so
> can you drop the new patch when you merge to for-next? Or should I
> send a revert? Or do you have a different preference?
It was already merged, so I'll revert it on for-next.
Thanks for confirmation.
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-26 5:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23 21:04 [PATCH] ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417 Geoffrey D. Bennett
2026-05-25 7:28 ` Takashi Iwai
2026-05-26 5:42 ` Geoffrey D. Bennett
2026-05-26 5:45 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox