Skip to content

Commit d452cc4

Browse files
geoffreybennettNeroReflex
authored andcommitted
ALSA: scarlett2: Add support for air/phantom control on input 2
The Focusrite Scarlett Gen 4 Solo has Air and Phantom Power controls on analogue input ChimeraOS#2 (the Gen 3 Solo had these controls on analogue input ChimeraOS#1). Add air_input_first and phantom_first device info options to cater for this. These options are similar to the level_input_first option that was added for the Gen 3 Solo, but these new options do not require adjusting the index of the control. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/19511f18895b8c094985a4a5691fbc1dc028c108.1703612638.git.g@b4.vu
1 parent a2df00c commit d452cc4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sound/usb/mixer_scarlett2.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,15 @@ struct scarlett2_device_info {
632632
*/
633633
u8 air_input_count;
634634

635+
/* the first input with an air control (0-based) */
636+
u8 air_input_first;
637+
635638
/* the number of phantom (48V) software switchable controls */
636639
u8 phantom_count;
637640

641+
/* the first input with phantom power control (0-based) */
642+
u8 phantom_first;
643+
638644
/* the number of inputs each phantom switch controls */
639645
u8 inputs_per_phantom;
640646

@@ -3043,6 +3049,7 @@ static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,
30433049
struct usb_mixer_elem_info *elem = kctl->private_data;
30443050
struct usb_mixer_interface *mixer = elem->head.mixer;
30453051
struct scarlett2_data *private = mixer->private_data;
3052+
const struct scarlett2_device_info *info = private->info;
30463053

30473054
int index = elem->control;
30483055
int oval, val, err = 0;
@@ -3064,7 +3071,7 @@ static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,
30643071

30653072
/* Send switch change to the device */
30663073
err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH,
3067-
index, val);
3074+
index + info->phantom_first, val);
30683075
if (err == 0)
30693076
err = 1;
30703077

@@ -3763,7 +3770,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
37633770

37643771
/* Add input air controls */
37653772
for (i = 0; i < info->air_input_count; i++) {
3766-
snprintf(s, sizeof(s), fmt, i + 1, "Air", "Switch");
3773+
snprintf(s, sizeof(s), fmt, i + 1 + info->air_input_first,
3774+
"Air", "Switch");
37673775
err = scarlett2_add_new_ctl(mixer, &scarlett2_air_ctl,
37683776
i, 1, s, &private->air_ctls[i]);
37693777
if (err < 0)
@@ -3773,7 +3781,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
37733781
/* Add input phantom controls */
37743782
if (info->inputs_per_phantom == 1) {
37753783
for (i = 0; i < info->phantom_count; i++) {
3776-
scnprintf(s, sizeof(s), fmt, i + 1,
3784+
scnprintf(s, sizeof(s), fmt,
3785+
i + 1 + info->phantom_first,
37773786
"Phantom Power", "Switch");
37783787
err = scarlett2_add_new_ctl(
37793788
mixer, &scarlett2_phantom_ctl,

0 commit comments

Comments
 (0)