mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-18 00:24:58 +08:00
ALSA: scarlett2: Allow passing any output to line_out_remap()
Line outputs 3 & 4 on the Gen 3 18i8 are internally the analogue 7 and 8 outputs, and this renumbering is hidden from the user by line_out_remap(). By allowing higher values (representing non-analogue outputs) to be passed to line_out_remap(), repeated code from scarlett2_mux_src_enum_ctl_get() and scarlett2_mux_src_enum_ctl_put() can be removed. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/3b70267931f5994628ab27306c73cddd17b93c8f.1698342632.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
701949cc01
commit
2190b9aea4
@ -2026,9 +2026,16 @@ static int scarlett2_master_volume_ctl_get(struct snd_kcontrol *kctl,
|
||||
static int line_out_remap(struct scarlett2_data *private, int index)
|
||||
{
|
||||
const struct scarlett2_device_info *info = private->info;
|
||||
const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
|
||||
int line_out_count =
|
||||
port_count[SCARLETT2_PORT_TYPE_ANALOGUE][SCARLETT2_PORT_OUT];
|
||||
|
||||
if (!info->line_out_remap_enable)
|
||||
return index;
|
||||
|
||||
if (index >= line_out_count)
|
||||
return index;
|
||||
|
||||
return info->line_out_remap[index];
|
||||
}
|
||||
|
||||
@ -3513,14 +3520,7 @@ static int scarlett2_mux_src_enum_ctl_get(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;
|
||||
const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
|
||||
int line_out_count =
|
||||
port_count[SCARLETT2_PORT_TYPE_ANALOGUE][SCARLETT2_PORT_OUT];
|
||||
int index = elem->control;
|
||||
|
||||
if (index < line_out_count)
|
||||
index = line_out_remap(private, index);
|
||||
int index = line_out_remap(private, elem->control);
|
||||
|
||||
mutex_lock(&private->data_mutex);
|
||||
if (private->mux_updated)
|
||||
@ -3537,16 +3537,9 @@ static int scarlett2_mux_src_enum_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;
|
||||
const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
|
||||
int line_out_count =
|
||||
port_count[SCARLETT2_PORT_TYPE_ANALOGUE][SCARLETT2_PORT_OUT];
|
||||
int index = elem->control;
|
||||
int index = line_out_remap(private, elem->control);
|
||||
int oval, val, err = 0;
|
||||
|
||||
if (index < line_out_count)
|
||||
index = line_out_remap(private, index);
|
||||
|
||||
mutex_lock(&private->data_mutex);
|
||||
|
||||
oval = private->mux[index];
|
||||
|
Loading…
Reference in New Issue
Block a user