diff mbox

Focusrite Scarlett 6i6 gen1 - input handling fix

Message ID 5a1a63fe-10dd-3022-5932-dc933130125e@jensverwiebe.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jens Verwiebe Nov. 23, 2017, 3:04 p.m. UTC
Dammit, sorry, i better add the patch as textfile (?) Formatting looks 
good here, but ml shows spaces where i expect tabs.

New try:



The Scarlett 6i6 has no padding on rear inputs 3/4 but a gainstage 
(Low/Hi). Adding this functionality

Signed-off-by: Jens Verwiebe <info at jensverwiebe.de>

1 file changed, 21 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 7438e7c..2c86d595 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -152,6 +152,7 @@  enum {
 	SCARLETT_OUTPUTS,
 	SCARLETT_SWITCH_IMPEDANCE,
 	SCARLETT_SWITCH_PAD,
+	SCARLETT_SWITCH_GAIN,
 };
 
 enum {
@@ -202,6 +203,15 @@  struct scarlett_device_info {
 	}
 };
 
+static const struct scarlett_mixer_elem_enum_info opt_gain = {
+	.start = 0,
+	.len = 2,
+	.offsets = {},
+	.names = (char const * const []){
+		"Lo", "Hi"
+	}
+};
+
 static const struct scarlett_mixer_elem_enum_info opt_impedance = {
 	.start = 0,
 	.len = 2,
@@ -664,8 +674,8 @@  static int add_output_ctls(struct usb_mixer_interface *mixer,
 		{ .num = 1, .type = SCARLETT_SWITCH_PAD, .name = NULL},
 		{ .num = 2, .type = SCARLETT_SWITCH_IMPEDANCE, .name = NULL},
 		{ .num = 2, .type = SCARLETT_SWITCH_PAD, .name = NULL},
-		{ .num = 3, .type = SCARLETT_SWITCH_PAD, .name = NULL},
-		{ .num = 4, .type = SCARLETT_SWITCH_PAD, .name = NULL},
+		{ .num = 3, .type = SCARLETT_SWITCH_GAIN, .name = NULL},
+		{ .num = 4, .type = SCARLETT_SWITCH_GAIN, .name = NULL},
 	},
 
 	.matrix_mux_init = {
@@ -895,6 +905,15 @@  static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer,
 			if (err < 0)
 				return err;
 			break;
+		case SCARLETT_SWITCH_GAIN:
+			sprintf(mx, "Input %d Gain Switch", ctl->num);
+			err = add_new_ctl(mixer, &usb_scarlett_ctl_enum,
+					  scarlett_ctl_enum_resume, 0x01,
+					  0x08, ctl->num, USB_MIXER_S16, 1, mx,
+					  &opt_gain, &elem);
+			if (err < 0)
+				return err;
+			break;
 		}
 	}