Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: M-Audio C600 disable Output Gain Knob
@ 2026-05-11 21:24 Simon Wood
  2026-05-15  6:55 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Wood @ 2026-05-11 21:24 UTC (permalink / raw)
  To: perex, tiwai; +Cc: alsa-devel, linux-kernel, linux-sound, Simon Wood

The C400/C600 interfaces have a large output gain knob which attenuates
the outputs as stereo pairs (1/2, 3/4 and 5/6). The Windows driver/app
provides a control to disable this knob/behaviour on any/all outputs,
forcing maximum gain on each.

The 'disable behaviour' is desirable if any outputs are being used for
aux/effects sends, or if interface is being used as a live/matrix mixer.

This patch adds a control to select which output pairs are affected by
the Output Gain Knob. Default behaviour is to select all outputs.

Tested on the C600, likely also works for the C400.

Signed-off-by: Simon Wood <simon@mungewell.org>
---
 sound/usb/mixer_quirks.c | 46 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 11e205da7964..16d8eb111d01 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1282,7 +1282,7 @@ static int snd_ftu_eff_switch_init(struct usb_mixer_interface *mixer,
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR,
 			      USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-			      pval & 0xff00,
+			      (pval & 0xff00) | ((pval & 0xff0000) >> 16),
 			      snd_usb_ctrl_intf(mixer->hostif) | ((pval & 0xff) << 8),
 			      value, 2);
 	if (err < 0)
@@ -1315,7 +1315,7 @@ static int snd_ftu_eff_switch_update(struct usb_mixer_elem_list *list)
 			       usb_sndctrlpipe(chip->dev, 0),
 			       UAC_SET_CUR,
 			       USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-			       pval & 0xff00,
+			       (pval & 0xff00) | ((pval & 0xff0000) >> 16),
 			       snd_usb_ctrl_intf(list->mixer->hostif) | ((pval & 0xff) << 8),
 			       value, 2);
 }
@@ -1728,6 +1728,44 @@ static int snd_c400_create_effect_ret_vol_ctls(struct usb_mixer_interface *mixer
 	return 0;
 }
 
+/* output gain knob selectively adjusts outputs as stereo pairs */
+/* reuses functions from FTU effect switch */
+static int snd_c400_knob_switch_info(struct snd_kcontrol *kcontrol,
+					struct snd_ctl_elem_info *uinfo)
+{
+	static const char *const texts[8] = {
+		"None", "1/2", "3/4", "1/2 3/4",
+		"5/6", "1/2 5/6", "3/4 5/6", "1/2 3/4 5/6"
+	};
+
+	return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
+}
+
+static int snd_c400_create_knob_switch(struct usb_mixer_interface *mixer,
+	int validx, int bUnitID)
+{
+	static struct snd_kcontrol_new template = {
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Output Gain Knob",
+		.index = 0,
+		.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+		.info = snd_c400_knob_switch_info,
+		.get = snd_ftu_eff_switch_get,
+		.put = snd_ftu_eff_switch_put
+	};
+	struct usb_mixer_elem_list *list;
+	int err;
+
+	err = add_single_ctl_with_resume(mixer, bUnitID,
+					 snd_ftu_eff_switch_update,
+					 &template, &list);
+	if (err < 0)
+		return err;
+	list->kctl->private_value = (validx << 8) | bUnitID;
+	snd_ftu_eff_switch_init(mixer, list->kctl);
+	return 0;
+}
+
 static int snd_c400_create_mixer(struct usb_mixer_interface *mixer)
 {
 	int err;
@@ -1760,6 +1798,10 @@ static int snd_c400_create_mixer(struct usb_mixer_interface *mixer)
 	if (err < 0)
 		return err;
 
+	err = snd_c400_create_knob_switch(mixer, 0x0900, 0x20);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: M-Audio C600 disable Output Gain Knob
  2026-05-11 21:24 [PATCH] ALSA: M-Audio C600 disable Output Gain Knob Simon Wood
@ 2026-05-15  6:55 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-05-15  6:55 UTC (permalink / raw)
  To: Simon Wood; +Cc: perex, tiwai, alsa-devel, linux-kernel, linux-sound

On Mon, 11 May 2026 23:24:58 +0200,
Simon Wood wrote:
> 
> The C400/C600 interfaces have a large output gain knob which attenuates
> the outputs as stereo pairs (1/2, 3/4 and 5/6). The Windows driver/app
> provides a control to disable this knob/behaviour on any/all outputs,
> forcing maximum gain on each.
> 
> The 'disable behaviour' is desirable if any outputs are being used for
> aux/effects sends, or if interface is being used as a live/matrix mixer.
> 
> This patch adds a control to select which output pairs are affected by
> the Output Gain Knob. Default behaviour is to select all outputs.
> 
> Tested on the C600, likely also works for the C400.
> 
> Signed-off-by: Simon Wood <simon@mungewell.org>

Applied to for-next branch.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-15  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 21:24 [PATCH] ALSA: M-Audio C600 disable Output Gain Knob Simon Wood
2026-05-15  6:55 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox