Commit 55b8cb46 authored by Jorge Sanjuan's avatar Jorge Sanjuan Committed by Takashi Iwai

ALSA: usb-audio: Tidy up logic for Processing Unit min/max values

This patch refactors the processing units min/max calculation logic
for the mixer controls and fixes an issue where the Mode Select
checking of the Up/Down mixers doesn't differentiate between the
UAC1 and UAC2 Control Selector (0x02) and the UAC3 one which is
different (0x01).
Signed-off-by: default avatarJorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8b3a087f
...@@ -2376,25 +2376,49 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, ...@@ -2376,25 +2376,49 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
cval->master_readonly = 1; cval->master_readonly = 1;
/* get min/max values */ /* get min/max values */
if (type == UAC_PROCESS_UP_DOWNMIX && cval->control == UAC_UD_MODE_SELECT) { switch (type) {
__u8 *control_spec = uac_processing_unit_specific(desc, state->mixer->protocol); case UAC_PROCESS_UP_DOWNMIX: {
/* FIXME: hard-coded */ bool mode_sel = false;
cval->min = 1;
cval->max = control_spec[0]; switch (state->mixer->protocol) {
cval->res = 1; case UAC_VERSION_1:
cval->initialized = 1; case UAC_VERSION_2:
} else { default:
if (type == USB_XU_CLOCK_RATE) { if (cval->control == UAC_UD_MODE_SELECT)
/* mode_sel = true;
* E-Mu USB 0404/0202/TrackerPre/0204 break;
* samplerate control quirk case UAC_VERSION_3:
*/ if (cval->control == UAC3_UD_MODE_SELECT)
cval->min = 0; mode_sel = true;
cval->max = 5; break;
}
if (mode_sel) {
__u8 *control_spec = uac_processing_unit_specific(desc,
state->mixer->protocol);
cval->min = 1;
cval->max = control_spec[0];
cval->res = 1; cval->res = 1;
cval->initialized = 1; cval->initialized = 1;
} else break;
get_min_max(cval, valinfo->min_value); }
get_min_max(cval, valinfo->min_value);
break;
}
case USB_XU_CLOCK_RATE:
/*
* E-Mu USB 0404/0202/TrackerPre/0204
* samplerate control quirk
*/
cval->min = 0;
cval->max = 5;
cval->res = 1;
cval->initialized = 1;
break;
default:
get_min_max(cval, valinfo->min_value);
break;
} }
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment