Scarlett 6i6 gain switches patch
diff mbox

Message ID f9bc23ea-64ea-a87b-8a9d-1891790d4a35@jensverwiebe.de
State New
Headers show

Commit Message

Jens Verwiebe Aug. 26, 2017, 2:56 p.m. UTC
Hi folks

As an owner of an Focusrite Scarlett 6i6 (gen 1)i was bothered that i 
could not

switch rear inputs 3/4 gain. After investigating the code i found the 
specs of

that interface not used right. I wrote a patch and tested this well so far.

Afaik the same could be used also for the 18i18 and 18i20, but i left 
those untouched

for i could not test myself. Pls review and take over in case its accepted.


Cheers ... Jens

The patch:

Comments

Takashi Iwai Aug. 28, 2017, 8:37 a.m. UTC | #1
On Sat, 26 Aug 2017 16:56:02 +0200,
Jens Verwiebe wrote:
> 
> Hi folks
> 
> As an owner of an Focusrite Scarlett 6i6 (gen 1)i was bothered that i
> could not
> 
> switch rear inputs 3/4 gain. After investigating the code i found the
> specs of
> 
> that interface not used right. I wrote a patch and tested this well so far.
> 
> Afaik the same could be used also for the 18i18 and 18i20, but i left
> those untouched
> 
> for i could not test myself. Pls review and take over in case its accepted.

FYI, we can't take over / accept patches unless they are properly
submitted with sign-off, simply because of legal reasons.
Please refer to Documentation/SubmittingPatches.


thanks,

Takashi

> 
> 
> Cheers ... Jens
> 
> The patch:
> 
> --- /sound/usb/mixer_scarlett_nv.c    2017-04-08 09:53:53.000000000 +0200
> +++ /sound/usb/mixer_scarlett.c    2017-08-26 03:15:15.734930629 +0200
> @@ -152,6 +152,7 @@
>      SCARLETT_OUTPUTS,
>      SCARLETT_SWITCH_IMPEDANCE,
>      SCARLETT_SWITCH_PAD,
> +    SCARLETT_SWITCH_GAIN,
>  };
> 
>  enum {
> @@ -202,6 +203,15 @@
>      }
>  };
> 
> +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 @@
>          { .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 @@
>              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;
>          }
>      }
> 
> 
> -- 
> 
> Jens Verwiebe
> Allerskehre 44 - 22309 Hamburg
> 
> Tel.: +49 40 68 78 50
> mobile: +49 172 400 49 07
> mailto: info@jensverwiebe.de
> web: http://www.jensverwiebe.de
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

Patch
diff mbox

--- /sound/usb/mixer_scarlett_nv.c    2017-04-08 09:53:53.000000000 +0200
+++ /sound/usb/mixer_scarlett.c    2017-08-26 03:15:15.734930629 +0200
@@ -152,6 +152,7 @@ 
      SCARLETT_OUTPUTS,
      SCARLETT_SWITCH_IMPEDANCE,
      SCARLETT_SWITCH_PAD,
+    SCARLETT_SWITCH_GAIN,
  };

  enum {
@@ -202,6 +203,15 @@ 
      }
  };

+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 @@ 
          { .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 @@ 
              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;
          }
      }