summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorGeoffrey D. Bennett <g@b4.vu>2023-12-27 04:36:21 +1030
committerTakashi Iwai <tiwai@suse.de>2023-12-29 15:52:12 +0100
commitdd57b1213ab60ec9ad603507bd25ed069f9a6b61 (patch)
tree2e5e3603ea0d83046c4894aadb1e9a5de9fb1441 /sound/usb
parent4dedf7ca929a3f29fbed973e85372056d69a1848 (diff)
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 #2 (the Gen 3 Solo had these controls on analogue input #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
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_scarlett2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 8f466ad82d5a..b881881124a6 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -632,9 +632,15 @@ struct scarlett2_device_info {
*/
u8 air_input_count;
+ /* the first input with an air control (0-based) */
+ u8 air_input_first;
+
/* the number of phantom (48V) software switchable controls */
u8 phantom_count;
+ /* the first input with phantom power control (0-based) */
+ u8 phantom_first;
+
/* the number of inputs each phantom switch controls */
u8 inputs_per_phantom;
@@ -3043,6 +3049,7 @@ static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,
struct usb_mixer_elem_info *elem = kctl->private_data;
struct usb_mixer_interface *mixer = elem->head.mixer;
struct scarlett2_data *private = mixer->private_data;
+ const struct scarlett2_device_info *info = private->info;
int index = elem->control;
int oval, val, err = 0;
@@ -3064,7 +3071,7 @@ static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,
/* Send switch change to the device */
err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH,
- index, val);
+ index + info->phantom_first, val);
if (err == 0)
err = 1;
@@ -3763,7 +3770,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
/* Add input air controls */
for (i = 0; i < info->air_input_count; i++) {
- snprintf(s, sizeof(s), fmt, i + 1, "Air", "Switch");
+ snprintf(s, sizeof(s), fmt, i + 1 + info->air_input_first,
+ "Air", "Switch");
err = scarlett2_add_new_ctl(mixer, &scarlett2_air_ctl,
i, 1, s, &private->air_ctls[i]);
if (err < 0)
@@ -3773,7 +3781,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
/* Add input phantom controls */
if (info->inputs_per_phantom == 1) {
for (i = 0; i < info->phantom_count; i++) {
- scnprintf(s, sizeof(s), fmt, i + 1,
+ scnprintf(s, sizeof(s), fmt,
+ i + 1 + info->phantom_first,
"Phantom Power", "Switch");
err = scarlett2_add_new_ctl(
mixer, &scarlett2_phantom_ctl,