summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorGeoffrey D. Bennett <g@b4.vu>2023-12-25 05:52:24 +1030
committerTakashi Iwai <tiwai@suse.de>2023-12-29 15:41:22 +0100
commitc13d43a8582aa9b003b40fc6eecb66bd4ee8b5d6 (patch)
tree8d2643c3c40543525585a81764f63f749215be40 /sound/usb
parent2edc76dddee8a2e785f6566d2baddb49ad62fb5b (diff)
ALSA: scarlett2: Check presence of mixer using mux_assignment
Currently the presence of a mixer is determined by checking if the device uses the GEN_3A config set. Add scarlett2_has_mixer() function which checks for the presence of mux_assignment entries instead. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/ef6f4d360c2fe682ab65f83cccbe5be66ccc6296.1703444932.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_scarlett2.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 84dd9c43afde..26bdd1beae2e 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -1680,6 +1680,12 @@ static int scarlett2_usb_get_volume_status(
buf, sizeof(*buf));
}
+/* Return true if the device has a mixer that we can control */
+static int scarlett2_has_mixer(struct scarlett2_data *private)
+{
+ return !!private->info->mux_assignment[0][0].count;
+}
+
/* Send a USB message to get the volumes for all inputs of one mix
* and put the values into private->mix[]
*/
@@ -2175,7 +2181,7 @@ static int scarlett2_add_sync_ctl(struct usb_mixer_interface *mixer)
struct scarlett2_data *private = mixer->private_data;
/* devices without a mixer also don't support reporting sync status */
- if (private->info->config_set == SCARLETT2_CONFIG_SET_GEN_3A)
+ if (!scarlett2_has_mixer(private))
return 0;
return scarlett2_add_new_ctl(mixer, &scarlett2_sync_ctl,
@@ -4111,7 +4117,7 @@ static int scarlett2_add_meter_ctl(struct usb_mixer_interface *mixer)
struct scarlett2_data *private = mixer->private_data;
/* devices without a mixer also don't support reporting levels */
- if (private->info->config_set == SCARLETT2_CONFIG_SET_GEN_3A)
+ if (!scarlett2_has_mixer(private))
return 0;
return scarlett2_add_new_ctl(mixer, &scarlett2_meter_ctl,
@@ -4516,7 +4522,7 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer)
return err;
/* the rest of the configuration is for devices with a mixer */
- if (info->config_set == SCARLETT2_CONFIG_SET_GEN_3A)
+ if (!scarlett2_has_mixer(private))
return 0;
if (scarlett2_has_config_item(private,