Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0-or-later
17 * - support for UAC2 effect units
18 * - support for graphical equalizers
19 * - RANGE and MEM set commands (UAC2)
20 * - RANGE and MEM interrupt dispatchers (UAC2)
21 * - audio channel clustering (UAC2)
22 * - audio sample rate converter units (UAC2)
23 * - proper handling of clock multipliers (UAC2)
24 * - dispatch clock change notifications (UAC2)
25 * - stop PCM streams which use a clock that became invalid
26 * - stop PCM streams which use a clock selector that has changed
27 * - parse available sample rates again when clock sources changed
38 #include <linux/usb/audio-v2.h>
39 #include <linux/usb/audio-v3.h>
77 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
106 for (; p->id; p++) { in find_map()
107 if (p->id == unitid && in find_map()
108 (!control || !p->control || control == p->control)) in find_map()
120 if (!p || !p->name) in check_mapped_name()
123 buflen--; in check_mapped_name()
124 len = strscpy(buf, p->name, buflen); in check_mapped_name()
130 ((cval)->head.mixer->ignore_ctl_error ? 0 : (err))
136 if (!p || p->name || p->dB) in check_ignored_ctl()
145 if (p && p->dB) { in check_mapped_dB()
146 cval->dBmin = p->dB->min; in check_mapped_dB()
147 cval->dBmax = p->dB->max; in check_mapped_dB()
148 cval->min_mute = p->dB->min_mute; in check_mapped_dB()
149 cval->initialized = 1; in check_mapped_dB()
160 if (!state->selector_map) in check_mapped_selector_name()
162 for (p = state->selector_map; p->id; p++) { in check_mapped_selector_name()
163 if (p->id == unitid && index < p->count) { in check_mapped_selector_name()
164 len = strscpy(buf, p->names[index], buflen); in check_mapped_selector_name()
180 while ((hdr = snd_usb_find_desc(state->buffer, state->buflen, hdr, in find_audio_control_unit()
182 if (hdr->bLength >= 4 && in find_audio_control_unit()
183 hdr->bDescriptorSubtype >= UAC_INPUT_TERMINAL && in find_audio_control_unit()
184 hdr->bDescriptorSubtype <= UAC3_SAMPLE_RATE_CONVERTER && in find_audio_control_unit()
185 hdr->bUnitID == unit) in find_audio_control_unit()
198 int len = usb_string(chip->dev, index, buf, maxlen - 1); in snd_usb_copy_string_desc()
208 * convert from the byte/word on usb descriptor to the zero-based integer
212 switch (cval->val_type) { in convert_signed_value()
223 val -= 0x100; in convert_signed_value()
231 val -= 0x10000; in convert_signed_value()
238 * convert from the zero-based int to the byte/word for usb descriptor
242 switch (cval->val_type) { in convert_bytes_value()
259 if (!cval->res) in get_relative_value()
260 cval->res = 1; in get_relative_value()
261 if (val < cval->min) in get_relative_value()
263 else if (val >= cval->max) in get_relative_value()
264 return DIV_ROUND_UP(cval->max - cval->min, cval->res); in get_relative_value()
266 return (val - cval->min) / cval->res; in get_relative_value()
272 return cval->min; in get_abs_value()
273 if (!cval->res) in get_abs_value()
274 cval->res = 1; in get_abs_value()
275 val *= cval->res; in get_abs_value()
276 val += cval->min; in get_abs_value()
277 if (val > cval->max) in get_abs_value()
278 return cval->max; in get_abs_value()
304 return get_iface_desc(mixer->hostif)->bInterfaceNumber; in mixer_ctrl_intf()
310 struct snd_usb_audio *chip = cval->head.mixer->chip; in get_ctl_value_v1()
312 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; in get_ctl_value_v1()
318 return -EIO; in get_ctl_value_v1()
320 while (timeout-- > 0) { in get_ctl_value_v1()
321 idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8); in get_ctl_value_v1()
322 err = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, in get_ctl_value_v1()
329 } else if (err == -ETIMEDOUT) { in get_ctl_value_v1()
335 request, validx, idx, cval->val_type); in get_ctl_value_v1()
336 err = -EINVAL; in get_ctl_value_v1()
346 struct snd_usb_audio *chip = cval->head.mixer->chip; in get_ctl_value_v2()
353 val_size = uac2_ctl_value_size(cval->val_type); in get_ctl_value_v2()
366 return -EIO; in get_ctl_value_v2()
368 idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8); in get_ctl_value_v2()
369 ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, in get_ctl_value_v2()
377 request, validx, idx, cval->val_type); in get_ctl_value_v2()
397 return -EINVAL; in get_ctl_value_v2()
409 validx += cval->idx_off; in get_ctl_value()
411 return (cval->head.mixer->protocol == UAC_VERSION_1) ? in get_ctl_value()
427 (cval->control << 8) | channel, in get_cur_mix_raw()
436 if (cval->cached & (1 << channel)) { in snd_usb_get_cur_mix_value()
437 *value = cval->cache_val[index]; in snd_usb_get_cur_mix_value()
442 if (!cval->head.mixer->ignore_ctl_error) in snd_usb_get_cur_mix_value()
443 usb_audio_dbg(cval->head.mixer->chip, in snd_usb_get_cur_mix_value()
445 cval->control, channel, err); in snd_usb_get_cur_mix_value()
448 cval->cached |= 1 << channel; in snd_usb_get_cur_mix_value()
449 cval->cache_val[index] = *value; in snd_usb_get_cur_mix_value()
460 struct snd_usb_audio *chip = cval->head.mixer->chip; in snd_usb_mixer_set_ctl_value()
464 validx += cval->idx_off; in snd_usb_mixer_set_ctl_value()
467 if (cval->head.mixer->protocol == UAC_VERSION_1) { in snd_usb_mixer_set_ctl_value()
468 val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; in snd_usb_mixer_set_ctl_value()
470 val_len = uac2_ctl_value_size(cval->val_type); in snd_usb_mixer_set_ctl_value()
475 return -EINVAL; in snd_usb_mixer_set_ctl_value()
489 return -EIO; in snd_usb_mixer_set_ctl_value()
491 while (timeout-- > 0) { in snd_usb_mixer_set_ctl_value()
492 idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8); in snd_usb_mixer_set_ctl_value()
493 err = snd_usb_ctl_msg(chip->dev, in snd_usb_mixer_set_ctl_value()
494 usb_sndctrlpipe(chip->dev, 0), request, in snd_usb_mixer_set_ctl_value()
500 } else if (err == -ETIMEDOUT) { in snd_usb_mixer_set_ctl_value()
505 request, validx, idx, cval->val_type, buf[0], buf[1]); in snd_usb_mixer_set_ctl_value()
506 err = -EINVAL; in snd_usb_mixer_set_ctl_value()
524 cval->master_readonly : in snd_usb_set_cur_mix_value()
525 cval->ch_readonly & (1 << (channel - 1)); in snd_usb_set_cur_mix_value()
528 usb_audio_dbg(cval->head.mixer->chip, in snd_usb_set_cur_mix_value()
530 __func__, channel, cval->control); in snd_usb_set_cur_mix_value()
535 UAC_SET_CUR, (cval->control << 8) | channel, in snd_usb_set_cur_mix_value()
539 cval->cached |= 1 << channel; in snd_usb_set_cur_mix_value()
540 cval->cache_val[index] = value; in snd_usb_set_cur_mix_value()
550 struct usb_mixer_elem_info *cval = kcontrol->private_data; in snd_usb_mixer_vol_tlv()
554 return -ENOMEM; in snd_usb_mixer_vol_tlv()
555 if (cval->min_mute) in snd_usb_mixer_vol_tlv()
557 scale[2] = cval->dBmin; in snd_usb_mixer_vol_tlv()
558 scale[3] = cval->dBmax; in snd_usb_mixer_vol_tlv()
560 return -EFAULT; in snd_usb_mixer_vol_tlv()
593 struct usb_mixer_interface *mixer = list->mixer; in snd_usb_mixer_add_list()
596 while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) in snd_usb_mixer_add_list()
597 kctl->id.index++; in snd_usb_mixer_add_list()
598 err = snd_ctl_add(mixer->chip->card, kctl); in snd_usb_mixer_add_list()
600 usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n", in snd_usb_mixer_add_list()
604 list->kctl = kctl; in snd_usb_mixer_add_list()
605 list->is_std_info = is_std_info; in snd_usb_mixer_add_list()
606 list->next_id_elem = mixer->id_elems[list->id]; in snd_usb_mixer_add_list()
607 mixer->id_elems[list->id] = list; in snd_usb_mixer_add_list()
653 { 0x0712, "Multi-Track Recorder" },
664 if (iterm->name) { in get_term_name()
665 len = snd_usb_copy_string_desc(chip, iterm->name, in get_term_name()
671 /* virtual type - not a real terminal */ in get_term_name()
672 if (iterm->type >> 16) { in get_term_name()
675 switch (iterm->type >> 16) { in get_term_name()
689 return sprintf(name, "Unit %d", iterm->id); in get_term_name()
693 switch (iterm->type & 0xff00) { in get_term_name()
708 for (names = iterm_names; names->type; names++) { in get_term_name()
709 if (names->type == iterm->type) { in get_term_name()
710 strcpy(name, names->name); in get_term_name()
711 return strlen(names->name); in get_term_name()
726 err = snd_usb_ctl_msg(state->chip->dev, in get_cluster_channels_v3()
727 usb_rcvctrlpipe(state->chip->dev, 0), in get_cluster_channels_v3()
731 snd_usb_ctrl_intf(state->chip), in get_cluster_channels_v3()
736 err = -EIO; in get_cluster_channels_v3()
743 usb_audio_err(state->chip, "cannot request logical cluster ID: %d (err: %d)\n", cluster_id, err); in get_cluster_channels_v3()
755 switch (state->mixer->protocol) { in uac_mixer_unit_get_channels()
759 if (desc->bLength < sizeof(*desc) + desc->bNrInPins + 1) in uac_mixer_unit_get_channels()
760 return 0; /* no bmControls -> skip */ in uac_mixer_unit_get_channels()
784 term->type = le16_to_cpu(d->wTerminalType); in parse_term_uac1_iterm_unit()
785 term->channels = d->bNrChannels; in parse_term_uac1_iterm_unit()
786 term->chconfig = le16_to_cpu(d->wChannelConfig); in parse_term_uac1_iterm_unit()
787 term->name = d->iTerminal; in parse_term_uac1_iterm_unit()
799 err = __check_input_term(state, d->bCSourceID, term); in parse_term_uac2_iterm_unit()
806 term->id = id; in parse_term_uac2_iterm_unit()
807 term->type = le16_to_cpu(d->wTerminalType); in parse_term_uac2_iterm_unit()
808 term->channels = d->bNrChannels; in parse_term_uac2_iterm_unit()
809 term->chconfig = le32_to_cpu(d->bmChannelConfig); in parse_term_uac2_iterm_unit()
810 term->name = d->iTerminal; in parse_term_uac2_iterm_unit()
822 err = __check_input_term(state, d->bCSourceID, term); in parse_term_uac3_iterm_unit()
829 term->id = id; in parse_term_uac3_iterm_unit()
830 term->type = le16_to_cpu(d->wTerminalType); in parse_term_uac3_iterm_unit()
832 err = get_cluster_channels_v3(state, le16_to_cpu(d->wClusterDescrID)); in parse_term_uac3_iterm_unit()
835 term->channels = err; in parse_term_uac3_iterm_unit()
838 term->chconfig = 0; in parse_term_uac3_iterm_unit()
840 term->name = le16_to_cpu(d->wTerminalDescrStr); in parse_term_uac3_iterm_unit()
849 int protocol = state->mixer->protocol; in parse_term_mixer_unit()
856 term->type = UAC3_MIXER_UNIT << 16; /* virtual type */ in parse_term_mixer_unit()
857 term->channels = err; in parse_term_mixer_unit()
859 term->chconfig = uac_mixer_unit_wChannelConfig(d, protocol); in parse_term_mixer_unit()
860 term->name = uac_mixer_unit_iMixer(d); in parse_term_mixer_unit()
873 err = __check_input_term(state, d->baSourceID[0], term); in parse_term_selector_unit()
876 term->type = UAC3_SELECTOR_UNIT << 16; /* virtual type */ in parse_term_selector_unit()
877 term->id = id; in parse_term_selector_unit()
878 if (state->mixer->protocol != UAC_VERSION_3) in parse_term_selector_unit()
879 term->name = uac_selector_unit_iSelector(d); in parse_term_selector_unit()
888 int protocol = state->mixer->protocol; in parse_term_proc_unit()
891 if (d->bNrInPins) { in parse_term_proc_unit()
893 err = __check_input_term(state, d->baSourceID[0], term); in parse_term_proc_unit()
898 term->type = vtype << 16; /* virtual type */ in parse_term_proc_unit()
899 term->id = id; in parse_term_proc_unit()
904 if (!term->channels) { in parse_term_proc_unit()
905 term->channels = uac_processing_unit_bNrChannels(d); in parse_term_proc_unit()
906 term->chconfig = uac_processing_unit_wChannelConfig(d, protocol); in parse_term_proc_unit()
908 term->name = uac_processing_unit_iProcessing(d, protocol); in parse_term_proc_unit()
919 err = __check_input_term(state, d->bSourceID, term); in parse_term_effect_unit()
922 term->type = UAC3_EFFECT_UNIT << 16; /* virtual type */ in parse_term_effect_unit()
923 term->id = id; in parse_term_effect_unit()
933 term->type = UAC3_CLOCK_SOURCE << 16; /* virtual type */ in parse_term_uac2_clock_source()
934 term->id = id; in parse_term_uac2_clock_source()
935 term->name = d->iClockSource; in parse_term_uac2_clock_source()
945 term->type = UAC3_CLOCK_SOURCE << 16; /* virtual type */ in parse_term_uac3_clock_source()
946 term->id = id; in parse_term_uac3_clock_source()
947 term->name = le16_to_cpu(d->wClockSourceStr); in parse_term_uac3_clock_source()
960 int protocol = state->mixer->protocol; in __check_input_term()
966 if (test_and_set_bit(id, state->termbitmap)) in __check_input_term()
967 return -EINVAL; in __check_input_term()
976 term->id = id; in __check_input_term()
985 id = d->bSourceID; in __check_input_term()
1022 return -ENODEV; in __check_input_term()
1025 return -ENODEV; in __check_input_term()
1033 memset(state->termbitmap, 0, sizeof(state->termbitmap)); in check_input_term()
1046 int type_uac2; /* data type for uac2 if different from uac1, else -1 */
1050 { UAC_FU_MUTE, "Mute", USB_MIXER_INV_BOOLEAN, -1 },
1051 { UAC_FU_VOLUME, "Volume", USB_MIXER_S16, -1 },
1052 { UAC_FU_BASS, "Tone Control - Bass", USB_MIXER_S8, -1 },
1053 { UAC_FU_MID, "Tone Control - Mid", USB_MIXER_S8, -1 },
1054 { UAC_FU_TREBLE, "Tone Control - Treble", USB_MIXER_S8, -1 },
1055 …{ UAC_FU_GRAPHIC_EQUALIZER, "Graphic Equalizer", USB_MIXER_S8, -1 }, /* FIXME: not implemented yet…
1056 { UAC_FU_AUTOMATIC_GAIN, "Auto Gain Control", USB_MIXER_BOOLEAN, -1 },
1058 { UAC_FU_BASS_BOOST, "Bass Boost", USB_MIXER_BOOLEAN, -1 },
1059 { UAC_FU_LOUDNESS, "Loudness", USB_MIXER_BOOLEAN, -1 },
1061 { UAC2_FU_INPUT_GAIN, "Input Gain Control", USB_MIXER_S16, -1 },
1062 { UAC2_FU_INPUT_GAIN_PAD, "Input Gain Pad Control", USB_MIXER_S16, -1 },
1063 { UAC2_FU_PHASE_INVERTER, "Phase Inverter Control", USB_MIXER_BOOLEAN, -1 },
1074 usb_mixer_elem_info_free(kctl->private_data); in snd_usb_mixer_elem_free()
1075 kctl->private_data = NULL; in snd_usb_mixer_elem_free()
1086 struct snd_usb_audio *chip = cval->head.mixer->chip; in volume_control_quirks()
1087 switch (chip->usb_id) { in volume_control_quirks()
1088 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ in volume_control_quirks()
1089 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ in volume_control_quirks()
1090 if (strcmp(kctl->id.name, "Effect Duration") == 0) { in volume_control_quirks()
1091 cval->min = 0x0000; in volume_control_quirks()
1092 cval->max = 0xffff; in volume_control_quirks()
1093 cval->res = 0x00e6; in volume_control_quirks()
1096 if (strcmp(kctl->id.name, "Effect Volume") == 0 || in volume_control_quirks()
1097 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) { in volume_control_quirks()
1098 cval->min = 0x00; in volume_control_quirks()
1099 cval->max = 0xff; in volume_control_quirks()
1102 if (strstr(kctl->id.name, "Effect Return") != NULL) { in volume_control_quirks()
1103 cval->min = 0xb706; in volume_control_quirks()
1104 cval->max = 0xff7b; in volume_control_quirks()
1105 cval->res = 0x0073; in volume_control_quirks()
1108 if ((strstr(kctl->id.name, "Playback Volume") != NULL) || in volume_control_quirks()
1109 (strstr(kctl->id.name, "Effect Send") != NULL)) { in volume_control_quirks()
1110 cval->min = 0xb5fb; /* -73 dB = 0xb6ff */ in volume_control_quirks()
1111 cval->max = 0xfcfe; in volume_control_quirks()
1112 cval->res = 0x0073; in volume_control_quirks()
1116 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ in volume_control_quirks()
1117 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ in volume_control_quirks()
1118 if (strcmp(kctl->id.name, "Effect Duration") == 0) { in volume_control_quirks()
1121 cval->min = 0x0000; in volume_control_quirks()
1122 cval->max = 0x7f00; in volume_control_quirks()
1123 cval->res = 0x0100; in volume_control_quirks()
1126 if (strcmp(kctl->id.name, "Effect Volume") == 0 || in volume_control_quirks()
1127 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) { in volume_control_quirks()
1130 cval->min = 0x00; in volume_control_quirks()
1131 cval->max = 0x7f; in volume_control_quirks()
1137 if (!strcmp(kctl->id.name, "PCM Playback Volume")) { in volume_control_quirks()
1139 "set volume quirk for CM102-A+/102S+\n"); in volume_control_quirks()
1140 cval->min = -256; in volume_control_quirks()
1151 * I hope that the min value is -15360 for newer firmware --jk in volume_control_quirks()
1153 if (!strcmp(kctl->id.name, "PCM Playback Volume") && in volume_control_quirks()
1154 cval->min == -15616) { in volume_control_quirks()
1157 cval->max = -256; in volume_control_quirks()
1162 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { in volume_control_quirks()
1165 cval->min = 6080; in volume_control_quirks()
1166 cval->max = 8768; in volume_control_quirks()
1167 cval->res = 192; in volume_control_quirks()
1184 * Probably there is some logitech magic behind this number --fishor in volume_control_quirks()
1186 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { in volume_control_quirks()
1188 "set resolution quirk: cval->res = 384\n"); in volume_control_quirks()
1189 cval->res = 384; in volume_control_quirks()
1193 if ((strstr(kctl->id.name, "Playback Volume") != NULL) || in volume_control_quirks()
1194 strstr(kctl->id.name, "Capture Volume") != NULL) { in volume_control_quirks()
1195 cval->min >>= 8; in volume_control_quirks()
1196 cval->max = 0; in volume_control_quirks()
1197 cval->res = 1; in volume_control_quirks()
1201 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { in volume_control_quirks()
1203 "set resolution quirk: cval->res = 16\n"); in volume_control_quirks()
1204 cval->res = 16; in volume_control_quirks()
1220 if (!cval->head.mixer->ignore_ctl_error) in init_cur_mix_raw()
1221 usb_audio_warn(cval->head.mixer->chip, in init_cur_mix_raw()
1223 cval->head.id, mixer_ctrl_intf(cval->head.mixer), in init_cur_mix_raw()
1225 snd_usb_set_cur_mix_value(cval, ch, idx, cval->min); in init_cur_mix_raw()
1237 cval->min = default_min; in get_min_max_with_quirks()
1238 cval->max = cval->min + 1; in get_min_max_with_quirks()
1239 cval->res = 1; in get_min_max_with_quirks()
1240 cval->dBmin = cval->dBmax = 0; in get_min_max_with_quirks()
1242 if (cval->val_type == USB_MIXER_BOOLEAN || in get_min_max_with_quirks()
1243 cval->val_type == USB_MIXER_INV_BOOLEAN) { in get_min_max_with_quirks()
1244 cval->initialized = 1; in get_min_max_with_quirks()
1247 if (cval->cmask) { in get_min_max_with_quirks()
1249 if (cval->cmask & (1 << i)) { in get_min_max_with_quirks()
1254 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || in get_min_max_with_quirks()
1255 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { in get_min_max_with_quirks()
1256 usb_audio_err(cval->head.mixer->chip, in get_min_max_with_quirks()
1258 cval->head.id, mixer_ctrl_intf(cval->head.mixer), in get_min_max_with_quirks()
1259 cval->control, cval->head.id); in get_min_max_with_quirks()
1260 return -EINVAL; in get_min_max_with_quirks()
1263 (cval->control << 8) | minchn, in get_min_max_with_quirks()
1264 &cval->res) < 0) { in get_min_max_with_quirks()
1265 cval->res = 1; in get_min_max_with_quirks()
1266 } else if (cval->head.mixer->protocol == UAC_VERSION_1) { in get_min_max_with_quirks()
1267 int last_valid_res = cval->res; in get_min_max_with_quirks()
1269 while (cval->res > 1) { in get_min_max_with_quirks()
1271 (cval->control << 8) | minchn, in get_min_max_with_quirks()
1272 cval->res / 2) < 0) in get_min_max_with_quirks()
1274 cval->res /= 2; in get_min_max_with_quirks()
1277 (cval->control << 8) | minchn, &cval->res) < 0) in get_min_max_with_quirks()
1278 cval->res = last_valid_res; in get_min_max_with_quirks()
1280 if (cval->res == 0) in get_min_max_with_quirks()
1281 cval->res = 1; in get_min_max_with_quirks()
1289 if (cval->min + cval->res < cval->max) { in get_min_max_with_quirks()
1290 int last_valid_res = cval->res; in get_min_max_with_quirks()
1296 if (test < cval->max) in get_min_max_with_quirks()
1297 test += cval->res; in get_min_max_with_quirks()
1299 test -= cval->res; in get_min_max_with_quirks()
1300 if (test < cval->min || test > cval->max || in get_min_max_with_quirks()
1303 cval->res = last_valid_res; in get_min_max_with_quirks()
1308 cval->res *= 2; in get_min_max_with_quirks()
1314 cval->initialized = 1; in get_min_max_with_quirks()
1323 cval->dBmin = (convert_signed_value(cval, cval->min) * 100) / 256; in get_min_max_with_quirks()
1324 cval->dBmax = (convert_signed_value(cval, cval->max) * 100) / 256; in get_min_max_with_quirks()
1325 if (cval->dBmin > cval->dBmax) { in get_min_max_with_quirks()
1327 if (cval->dBmin < 0) in get_min_max_with_quirks()
1328 cval->dBmax = 0; in get_min_max_with_quirks()
1329 else if (cval->dBmin > 0) in get_min_max_with_quirks()
1330 cval->dBmin = 0; in get_min_max_with_quirks()
1331 if (cval->dBmin > cval->dBmax) { in get_min_max_with_quirks()
1333 return -EINVAL; in get_min_max_with_quirks()
1337 * here we use -96dB as the threshold in get_min_max_with_quirks()
1339 if (cval->dBmax <= -9600) { in get_min_max_with_quirks()
1340 usb_audio_info(cval->head.mixer->chip, in get_min_max_with_quirks()
1342 cval->head.id, mixer_ctrl_intf(cval->head.mixer), in get_min_max_with_quirks()
1343 cval->dBmin, cval->dBmax); in get_min_max_with_quirks()
1344 cval->dBmin = cval->dBmax = 0; in get_min_max_with_quirks()
1349 if (!cval->cmask) { in get_min_max_with_quirks()
1354 if (cval->cmask & (1 << i)) { in get_min_max_with_quirks()
1370 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_feature_info()
1372 if (cval->val_type == USB_MIXER_BOOLEAN || in mixer_ctl_feature_info()
1373 cval->val_type == USB_MIXER_INV_BOOLEAN) in mixer_ctl_feature_info()
1374 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in mixer_ctl_feature_info()
1376 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in mixer_ctl_feature_info()
1377 uinfo->count = cval->channels; in mixer_ctl_feature_info()
1378 if (cval->val_type == USB_MIXER_BOOLEAN || in mixer_ctl_feature_info()
1379 cval->val_type == USB_MIXER_INV_BOOLEAN) { in mixer_ctl_feature_info()
1380 uinfo->value.integer.min = 0; in mixer_ctl_feature_info()
1381 uinfo->value.integer.max = 1; in mixer_ctl_feature_info()
1383 if (!cval->initialized) { in mixer_ctl_feature_info()
1385 if (cval->initialized && cval->dBmin >= cval->dBmax) { in mixer_ctl_feature_info()
1386 kcontrol->vd[0].access &= in mixer_ctl_feature_info()
1389 snd_ctl_notify(cval->head.mixer->chip->card, in mixer_ctl_feature_info()
1391 &kcontrol->id); in mixer_ctl_feature_info()
1394 uinfo->value.integer.min = 0; in mixer_ctl_feature_info()
1395 uinfo->value.integer.max = in mixer_ctl_feature_info()
1396 DIV_ROUND_UP(cval->max - cval->min, cval->res); in mixer_ctl_feature_info()
1405 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_feature_get()
1408 ucontrol->value.integer.value[0] = cval->min; in mixer_ctl_feature_get()
1409 if (cval->cmask) { in mixer_ctl_feature_get()
1412 if (!(cval->cmask & (1 << c))) in mixer_ctl_feature_get()
1418 ucontrol->value.integer.value[cnt] = val; in mixer_ctl_feature_get()
1428 ucontrol->value.integer.value[0] = val; in mixer_ctl_feature_get()
1437 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_feature_put()
1441 if (cval->cmask) { in mixer_ctl_feature_put()
1444 if (!(cval->cmask & (1 << c))) in mixer_ctl_feature_put()
1449 val = ucontrol->value.integer.value[cnt]; in mixer_ctl_feature_put()
1462 val = ucontrol->value.integer.value[0]; in mixer_ctl_feature_put()
1476 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_master_bool_get()
1483 ucontrol->value.integer.value[0] = val; in mixer_ctl_master_bool_get()
1490 struct snd_usb_audio *chip = cval->head.mixer->chip; in get_connector_value()
1493 validx = cval->control << 8 | 0; in get_connector_value()
1495 ret = snd_usb_lock_shutdown(chip) ? -EIO : 0; in get_connector_value()
1499 idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8); in get_connector_value()
1500 if (cval->head.mixer->protocol == UAC_VERSION_2) { in get_connector_value()
1503 ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), UAC2_CS_CUR, in get_connector_value()
1511 ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), UAC2_CS_CUR, in get_connector_value()
1529 UAC_GET_CUR, validx, idx, cval->val_type); in get_connector_value()
1544 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_connector_get()
1547 ret = get_connector_value(cval, kcontrol->id.name, &val); in mixer_ctl_connector_get()
1552 ucontrol->value.integer.value[0] = val; in mixer_ctl_connector_get()
1564 /* the read-only variant */
1606 return strlcat(kctl->id.name, str, sizeof(kctl->id.name)); in append_ctl_name()
1622 if (strcmp("Speaker", kctl->id.name)) in check_no_speaker_on_headset()
1626 if (strstr(card->shortname, *s)) { in check_no_speaker_on_headset()
1675 snd_usb_mixer_elem_init_std(&cval->head, mixer, unitid); in __build_feature_ctl()
1676 cval->control = control; in __build_feature_ctl()
1677 cval->cmask = ctl_mask; in __build_feature_ctl()
1684 if (mixer->protocol == UAC_VERSION_1) in __build_feature_ctl()
1685 cval->val_type = ctl_info->type; in __build_feature_ctl()
1687 cval->val_type = ctl_info->type_uac2 >= 0 ? in __build_feature_ctl()
1688 ctl_info->type_uac2 : ctl_info->type; in __build_feature_ctl()
1691 cval->channels = 1; /* master channel */ in __build_feature_ctl()
1692 cval->master_readonly = readonly_mask; in __build_feature_ctl()
1698 cval->channels = c; in __build_feature_ctl()
1699 cval->ch_readonly = readonly_mask; in __build_feature_ctl()
1703 * If all channels in the mask are marked read-only, make the control in __build_feature_ctl()
1704 * read-only. snd_usb_set_cur_mix_value() will check the mask again and won't in __build_feature_ctl()
1705 * issue write commands to read-only channels. in __build_feature_ctl()
1707 if (cval->channels == readonly_mask) in __build_feature_ctl()
1713 usb_audio_err(mixer->chip, "cannot malloc kcontrol\n"); in __build_feature_ctl()
1717 kctl->private_free = snd_usb_mixer_elem_free; in __build_feature_ctl()
1719 len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)); in __build_feature_ctl()
1722 len = snd_usb_copy_string_desc(mixer->chip, nameid, in __build_feature_ctl()
1723 kctl->id.name, sizeof(kctl->id.name)); in __build_feature_ctl()
1730 * - if a name id is given in descriptor, use it. in __build_feature_ctl()
1731 * - if the connected input can be determined, then use the name in __build_feature_ctl()
1733 * - if the connected output can be determined, use it. in __build_feature_ctl()
1734 * - otherwise, anonymous name. in __build_feature_ctl()
1738 len = get_term_name(mixer->chip, iterm, in __build_feature_ctl()
1739 kctl->id.name, in __build_feature_ctl()
1740 sizeof(kctl->id.name), 1); in __build_feature_ctl()
1742 len = get_term_name(mixer->chip, oterm, in __build_feature_ctl()
1743 kctl->id.name, in __build_feature_ctl()
1744 sizeof(kctl->id.name), 1); in __build_feature_ctl()
1746 snprintf(kctl->id.name, sizeof(kctl->id.name), in __build_feature_ctl()
1751 check_no_speaker_on_headset(kctl, mixer->chip->card); in __build_feature_ctl()
1758 if (!mapped_name && oterm && !(oterm->type >> 16)) { in __build_feature_ctl()
1759 if ((oterm->type & 0xff00) == 0x0100) in __build_feature_ctl()
1769 strscpy(kctl->id.name, audio_feature_info[control-1].name, in __build_feature_ctl()
1770 sizeof(kctl->id.name)); in __build_feature_ctl()
1778 if (cval->max <= cval->min) { in __build_feature_ctl()
1779 usb_audio_dbg(mixer->chip, in __build_feature_ctl()
1781 cval->head.id, kctl->id.name); in __build_feature_ctl()
1789 if (cval->dBmin < cval->dBmax || !cval->initialized) { in __build_feature_ctl()
1790 kctl->tlv.c = snd_usb_mixer_vol_tlv; in __build_feature_ctl()
1791 kctl->vd[0].access |= in __build_feature_ctl()
1799 range = (cval->max - cval->min) / cval->res; in __build_feature_ctl()
1806 usb_audio_warn(mixer->chip, in __build_feature_ctl()
1807 "Warning! Unlikely big volume range (=%u), cval->res is probably wrong.", in __build_feature_ctl()
1809 usb_audio_warn(mixer->chip, in __build_feature_ctl()
1811 cval->head.id, kctl->id.name, cval->channels, in __build_feature_ctl()
1812 cval->min, cval->max, cval->res); in __build_feature_ctl()
1815 usb_audio_dbg(mixer->chip, "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", in __build_feature_ctl()
1816 cval->head.id, kctl->id.name, cval->channels, in __build_feature_ctl()
1817 cval->min, cval->max, cval->res); in __build_feature_ctl()
1818 snd_usb_mixer_add_control(&cval->head, kctl); in __build_feature_ctl()
1829 __build_feature_ctl(state->mixer, state->map, ctl_mask, control, in build_feature_ctl()
1830 iterm, &state->oterm, unitid, nameid, readonly_mask); in build_feature_ctl()
1845 int name_len = get_term_name(mixer->chip, term, name, name_size, 0); in get_connector_control_name()
1856 strlcat(name, " - Input Jack", name_size); in get_connector_control_name()
1858 strlcat(name, " - Output Jack", name_size); in get_connector_control_name()
1870 /* Build a mixer control for a UAC connector control (jack-detect) */
1879 map = find_map(imap, term->id, 0); in build_connector_control()
1886 snd_usb_mixer_elem_init_std(&cval->head, mixer, term->id); in build_connector_control()
1889 cval->head.resume = connector_mixer_resume; in build_connector_control()
1901 if (mixer->protocol == UAC_VERSION_2) in build_connector_control()
1902 cval->control = UAC2_TE_CONNECTOR; in build_connector_control()
1904 cval->control = UAC3_TE_INSERTION; in build_connector_control()
1906 cval->val_type = USB_MIXER_BOOLEAN; in build_connector_control()
1907 cval->channels = 1; /* report true if any channel is connected */ in build_connector_control()
1908 cval->min = 0; in build_connector_control()
1909 cval->max = 1; in build_connector_control()
1912 usb_audio_err(mixer->chip, "cannot malloc kcontrol\n"); in build_connector_control()
1917 if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) in build_connector_control()
1918 strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name)); in build_connector_control()
1920 get_connector_control_name(mixer, term, is_input, kctl->id.name, in build_connector_control()
1921 sizeof(kctl->id.name)); in build_connector_control()
1922 kctl->private_free = snd_usb_mixer_elem_free; in build_connector_control()
1923 snd_usb_mixer_add_control(&cval->head, kctl); in build_connector_control()
1935 if (state->mixer->protocol != UAC_VERSION_2) in parse_clock_source_unit()
1936 return -EINVAL; in parse_clock_source_unit()
1942 if (!uac_v2v3_control_is_readable(hdr->bmControls, in parse_clock_source_unit()
1948 return -ENOMEM; in parse_clock_source_unit()
1950 snd_usb_mixer_elem_init_std(&cval->head, state->mixer, hdr->bClockID); in parse_clock_source_unit()
1952 cval->min = 0; in parse_clock_source_unit()
1953 cval->max = 1; in parse_clock_source_unit()
1954 cval->channels = 1; in parse_clock_source_unit()
1955 cval->val_type = USB_MIXER_BOOLEAN; in parse_clock_source_unit()
1956 cval->control = UAC2_CS_CONTROL_CLOCK_VALID; in parse_clock_source_unit()
1958 cval->master_readonly = 1; in parse_clock_source_unit()
1964 return -ENOMEM; in parse_clock_source_unit()
1967 kctl->private_free = snd_usb_mixer_elem_free; in parse_clock_source_unit()
1968 ret = snd_usb_copy_string_desc(state->chip, hdr->iClockSource, in parse_clock_source_unit()
1971 snprintf(kctl->id.name, sizeof(kctl->id.name), in parse_clock_source_unit()
1974 snprintf(kctl->id.name, sizeof(kctl->id.name), in parse_clock_source_unit()
1975 "Clock Source %d Validity", hdr->bClockID); in parse_clock_source_unit()
1977 return snd_usb_mixer_add_control(&cval->head, kctl); in parse_clock_source_unit()
1995 if (state->mixer->protocol == UAC_VERSION_1) { in parse_audio_feature_unit()
1996 csize = hdr->bControlSize; in parse_audio_feature_unit()
1997 channels = (hdr->bLength - 7) / csize - 1; in parse_audio_feature_unit()
1998 bmaControls = hdr->bmaControls; in parse_audio_feature_unit()
1999 } else if (state->mixer->protocol == UAC_VERSION_2) { in parse_audio_feature_unit()
2002 channels = (hdr->bLength - 6) / 4 - 1; in parse_audio_feature_unit()
2003 bmaControls = ftr->bmaControls; in parse_audio_feature_unit()
2008 channels = (ftr->bLength - 7) / 4 - 1; in parse_audio_feature_unit()
2009 bmaControls = ftr->bmaControls; in parse_audio_feature_unit()
2013 err = parse_audio_unit(state, hdr->bSourceID); in parse_audio_feature_unit()
2018 err = check_input_term(state, hdr->bSourceID, &iterm); in parse_audio_feature_unit()
2024 switch (state->chip->usb_id) { in parse_audio_feature_unit()
2026 usb_audio_info(state->chip, in parse_audio_feature_unit()
2028 /* disable non-functional volume control */ in parse_audio_feature_unit()
2032 usb_audio_info(state->chip, in parse_audio_feature_unit()
2034 /* disable non-functional volume control */ in parse_audio_feature_unit()
2040 if (state->mixer->protocol == UAC_VERSION_1) { in parse_audio_feature_unit()
2054 /* audio class v1 controls are never read-only */ in parse_audio_feature_unit()
2087 * read-only if all channels are marked read-only in in parse_audio_feature_unit()
2090 * actually issue a write command for read-only in parse_audio_feature_unit()
2157 map = find_map(state->map, unitid, 0); in build_mixer_unit_ctl()
2165 snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); in build_mixer_unit_ctl()
2166 cval->control = in_ch + 1; /* based on 1 */ in build_mixer_unit_ctl()
2167 cval->val_type = USB_MIXER_S16; in build_mixer_unit_ctl()
2169 __u8 *c = uac_mixer_unit_bmControls(desc, state->mixer->protocol); in build_mixer_unit_ctl()
2172 cval->cmask |= (1 << i); in build_mixer_unit_ctl()
2173 cval->channels++; in build_mixer_unit_ctl()
2182 usb_audio_err(state->chip, "cannot malloc kcontrol\n"); in build_mixer_unit_ctl()
2186 kctl->private_free = snd_usb_mixer_elem_free; in build_mixer_unit_ctl()
2188 len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)); in build_mixer_unit_ctl()
2190 len = get_term_name(state->chip, iterm, kctl->id.name, in build_mixer_unit_ctl()
2191 sizeof(kctl->id.name), 0); in build_mixer_unit_ctl()
2193 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); in build_mixer_unit_ctl()
2196 usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", in build_mixer_unit_ctl()
2197 cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max); in build_mixer_unit_ctl()
2198 snd_usb_mixer_add_control(&cval->head, kctl); in build_mixer_unit_ctl()
2207 if (state->mixer->protocol == UAC_VERSION_2) { in parse_audio_input_terminal()
2210 term_id = d_v2->bTerminalID; in parse_audio_input_terminal()
2211 bmctls = le16_to_cpu(d_v2->bmControls); in parse_audio_input_terminal()
2212 } else if (state->mixer->protocol == UAC_VERSION_3) { in parse_audio_input_terminal()
2215 term_id = d_v3->bTerminalID; in parse_audio_input_terminal()
2216 bmctls = le32_to_cpu(d_v3->bmControls); in parse_audio_input_terminal()
2226 build_connector_control(state->mixer, state->map, &iterm, true); in parse_audio_input_terminal()
2244 usb_audio_err(state->chip, in parse_audio_mixer_unit()
2251 input_pins = desc->bNrInPins; in parse_audio_mixer_unit()
2256 err = parse_audio_unit(state, desc->baSourceID[pin]); in parse_audio_mixer_unit()
2259 /* no bmControls field (e.g. Maya44) -> ignore */ in parse_audio_mixer_unit()
2262 err = check_input_term(state, desc->baSourceID[pin], &iterm); in parse_audio_mixer_unit()
2266 if (mixer_bitmap_overflow(desc, state->mixer->protocol, in parse_audio_mixer_unit()
2274 state->mixer->protocol); in parse_audio_mixer_unit()
2297 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_procunit_get()
2300 err = get_cur_ctl_value(cval, cval->control << 8, &val); in mixer_ctl_procunit_get()
2302 ucontrol->value.integer.value[0] = cval->min; in mixer_ctl_procunit_get()
2306 ucontrol->value.integer.value[0] = val; in mixer_ctl_procunit_get()
2314 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_procunit_put()
2317 err = get_cur_ctl_value(cval, cval->control << 8, &oval); in mixer_ctl_procunit_put()
2320 val = ucontrol->value.integer.value[0]; in mixer_ctl_procunit_put()
2323 set_cur_ctl_value(cval, cval->control << 8, val); in mixer_ctl_procunit_put()
2361 { UAC_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 },
2366 { UAC_DP_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 },
2409 { UAC3_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 },
2420 { UAC3_PROCESS_MULTI_FUNCTION, "Multi-Function", undefined_proc_info },
2476 num_ins = desc->bNrInPins; in build_audio_procunit()
2478 err = parse_audio_unit(state, desc->baSourceID[i]); in build_audio_procunit()
2483 type = le16_to_cpu(desc->wProcessType); in build_audio_procunit()
2484 for (info = list; info && info->type; info++) in build_audio_procunit()
2485 if (info->type == type) in build_audio_procunit()
2487 if (!info || !info->type) in build_audio_procunit()
2490 for (valinfo = info->values; valinfo->control; valinfo++) { in build_audio_procunit()
2491 __u8 *controls = uac_processing_unit_bmControls(desc, state->mixer->protocol); in build_audio_procunit()
2493 if (state->mixer->protocol == UAC_VERSION_1) { in build_audio_procunit()
2494 if (!(controls[valinfo->control / 8] & in build_audio_procunit()
2495 (1 << ((valinfo->control % 8) - 1)))) in build_audio_procunit()
2498 if (!uac_v2v3_control_is_readable(controls[valinfo->control / 8], in build_audio_procunit()
2499 valinfo->control)) in build_audio_procunit()
2503 map = find_map(state->map, unitid, valinfo->control); in build_audio_procunit()
2508 return -ENOMEM; in build_audio_procunit()
2509 snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); in build_audio_procunit()
2510 cval->control = valinfo->control; in build_audio_procunit()
2511 cval->val_type = valinfo->val_type; in build_audio_procunit()
2512 cval->channels = 1; in build_audio_procunit()
2514 if (state->mixer->protocol > UAC_VERSION_1 && in build_audio_procunit()
2515 !uac_v2v3_control_is_writeable(controls[valinfo->control / 8], in build_audio_procunit()
2516 valinfo->control)) in build_audio_procunit()
2517 cval->master_readonly = 1; in build_audio_procunit()
2524 switch (state->mixer->protocol) { in build_audio_procunit()
2528 if (cval->control == UAC_UD_MODE_SELECT) in build_audio_procunit()
2532 if (cval->control == UAC3_UD_MODE_SELECT) in build_audio_procunit()
2539 state->mixer->protocol); in build_audio_procunit()
2540 cval->min = 1; in build_audio_procunit()
2541 cval->max = control_spec[0]; in build_audio_procunit()
2542 cval->res = 1; in build_audio_procunit()
2543 cval->initialized = 1; in build_audio_procunit()
2547 get_min_max(cval, valinfo->min_value); in build_audio_procunit()
2552 * E-Mu USB 0404/0202/TrackerPre/0204 in build_audio_procunit()
2555 cval->min = 0; in build_audio_procunit()
2556 cval->max = 5; in build_audio_procunit()
2557 cval->res = 1; in build_audio_procunit()
2558 cval->initialized = 1; in build_audio_procunit()
2561 get_min_max(cval, valinfo->min_value); in build_audio_procunit()
2565 err = get_cur_ctl_value(cval, cval->control << 8, &val); in build_audio_procunit()
2568 return -EINVAL; in build_audio_procunit()
2574 return -ENOMEM; in build_audio_procunit()
2576 kctl->private_free = snd_usb_mixer_elem_free; in build_audio_procunit()
2578 if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) { in build_audio_procunit()
2580 } else if (info->name) { in build_audio_procunit()
2581 strscpy(kctl->id.name, info->name, sizeof(kctl->id.name)); in build_audio_procunit()
2584 nameid = uac_extension_unit_iExtension(desc, state->mixer->protocol); in build_audio_procunit()
2586 nameid = uac_processing_unit_iProcessing(desc, state->mixer->protocol); in build_audio_procunit()
2589 len = snd_usb_copy_string_desc(state->chip, in build_audio_procunit()
2591 kctl->id.name, in build_audio_procunit()
2592 sizeof(kctl->id.name)); in build_audio_procunit()
2594 strscpy(kctl->id.name, name, sizeof(kctl->id.name)); in build_audio_procunit()
2597 append_ctl_name(kctl, valinfo->suffix); in build_audio_procunit()
2599 usb_audio_dbg(state->chip, in build_audio_procunit()
2601 cval->head.id, kctl->id.name, cval->channels, in build_audio_procunit()
2602 cval->min, cval->max); in build_audio_procunit()
2604 err = snd_usb_mixer_add_control(&cval->head, kctl); in build_audio_procunit()
2614 switch (state->mixer->protocol) { in parse_audio_processing_unit()
2647 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_selector_info()
2648 const char **itemlist = (const char **)kcontrol->private_value; in mixer_ctl_selector_info()
2651 return -EINVAL; in mixer_ctl_selector_info()
2652 return snd_ctl_enum_info(uinfo, 1, cval->max, itemlist); in mixer_ctl_selector_info()
2659 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_selector_get()
2662 err = get_cur_ctl_value(cval, cval->control << 8, &val); in mixer_ctl_selector_get()
2664 ucontrol->value.enumerated.item[0] = 0; in mixer_ctl_selector_get()
2668 ucontrol->value.enumerated.item[0] = val; in mixer_ctl_selector_get()
2676 struct usb_mixer_elem_info *cval = kcontrol->private_data; in mixer_ctl_selector_put()
2679 err = get_cur_ctl_value(cval, cval->control << 8, &oval); in mixer_ctl_selector_put()
2682 val = ucontrol->value.enumerated.item[0]; in mixer_ctl_selector_put()
2685 set_cur_ctl_value(cval, cval->control << 8, val); in mixer_ctl_selector_put()
2708 if (kctl->private_data) { in usb_mixer_selector_elem_free()
2709 struct usb_mixer_elem_info *cval = kctl->private_data; in usb_mixer_selector_elem_free()
2710 num_ins = cval->max; in usb_mixer_selector_elem_free()
2712 kctl->private_data = NULL; in usb_mixer_selector_elem_free()
2714 if (kctl->private_value) { in usb_mixer_selector_elem_free()
2715 char **itemlist = (char **)kctl->private_value; in usb_mixer_selector_elem_free()
2719 kctl->private_value = 0; in usb_mixer_selector_elem_free()
2737 for (i = 0; i < desc->bNrInPins; i++) { in parse_audio_selector_unit()
2738 err = parse_audio_unit(state, desc->baSourceID[i]); in parse_audio_selector_unit()
2743 if (desc->bNrInPins == 1) /* only one ? nonsense! */ in parse_audio_selector_unit()
2746 map = find_map(state->map, unitid, 0); in parse_audio_selector_unit()
2752 return -ENOMEM; in parse_audio_selector_unit()
2753 snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); in parse_audio_selector_unit()
2754 cval->val_type = USB_MIXER_U8; in parse_audio_selector_unit()
2755 cval->channels = 1; in parse_audio_selector_unit()
2756 cval->min = 1; in parse_audio_selector_unit()
2757 cval->max = desc->bNrInPins; in parse_audio_selector_unit()
2758 cval->res = 1; in parse_audio_selector_unit()
2759 cval->initialized = 1; in parse_audio_selector_unit()
2761 switch (state->mixer->protocol) { in parse_audio_selector_unit()
2764 cval->control = 0; in parse_audio_selector_unit()
2768 if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR || in parse_audio_selector_unit()
2769 desc->bDescriptorSubtype == UAC3_CLOCK_SELECTOR) in parse_audio_selector_unit()
2770 cval->control = UAC2_CX_CLOCK_SELECTOR; in parse_audio_selector_unit()
2772 cval->control = UAC2_SU_SELECTOR; in parse_audio_selector_unit()
2776 namelist = kcalloc(desc->bNrInPins, sizeof(char *), GFP_KERNEL); in parse_audio_selector_unit()
2778 err = -ENOMEM; in parse_audio_selector_unit()
2782 for (i = 0; i < desc->bNrInPins; i++) { in parse_audio_selector_unit()
2786 err = -ENOMEM; in parse_audio_selector_unit()
2791 if (! len && check_input_term(state, desc->baSourceID[i], &iterm) >= 0) in parse_audio_selector_unit()
2792 len = get_term_name(state->chip, &iterm, namelist[i], in parse_audio_selector_unit()
2800 usb_audio_err(state->chip, "cannot malloc kcontrol\n"); in parse_audio_selector_unit()
2801 err = -ENOMEM; in parse_audio_selector_unit()
2804 kctl->private_value = (unsigned long)namelist; in parse_audio_selector_unit()
2805 kctl->private_free = usb_mixer_selector_elem_free; in parse_audio_selector_unit()
2808 len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)); in parse_audio_selector_unit()
2811 switch (state->mixer->protocol) { in parse_audio_selector_unit()
2818 len = snd_usb_copy_string_desc(state->chip, in parse_audio_selector_unit()
2819 nameid, kctl->id.name, in parse_audio_selector_unit()
2820 sizeof(kctl->id.name)); in parse_audio_selector_unit()
2823 /* TODO: Class-Specific strings not yet supported */ in parse_audio_selector_unit()
2829 len = get_term_name(state->chip, &state->oterm, in parse_audio_selector_unit()
2830 kctl->id.name, sizeof(kctl->id.name), 0); in parse_audio_selector_unit()
2833 strscpy(kctl->id.name, "USB", sizeof(kctl->id.name)); in parse_audio_selector_unit()
2836 if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR || in parse_audio_selector_unit()
2837 desc->bDescriptorSubtype == UAC3_CLOCK_SELECTOR) in parse_audio_selector_unit()
2839 else if ((state->oterm.type & 0xff00) == 0x0100) in parse_audio_selector_unit()
2845 usb_audio_dbg(state->chip, "[%d] SU [%s] items = %d\n", in parse_audio_selector_unit()
2846 cval->head.id, kctl->id.name, desc->bNrInPins); in parse_audio_selector_unit()
2847 return snd_usb_mixer_add_control(&cval->head, kctl); in parse_audio_selector_unit()
2850 for (i = 0; i < desc->bNrInPins; i++) in parse_audio_selector_unit()
2865 int protocol = state->mixer->protocol; in parse_audio_unit()
2867 if (test_and_set_bit(unitid, state->unitbitmap)) in parse_audio_unit()
2872 usb_audio_err(state->chip, "unit %d not found!\n", unitid); in parse_audio_unit()
2873 return -EINVAL; in parse_audio_unit()
2877 usb_audio_dbg(state->chip, "invalid unit %d\n", unitid); in parse_audio_unit()
2913 return 0; /* FIXME - effect units not implemented yet */ in parse_audio_unit()
2915 usb_audio_err(state->chip, in parse_audio_unit()
2918 return -EINVAL; in parse_audio_unit()
2927 kfree(mixer->id_elems); in snd_usb_mixer_free()
2928 if (mixer->urb) { in snd_usb_mixer_free()
2929 kfree(mixer->urb->transfer_buffer); in snd_usb_mixer_free()
2930 usb_free_urb(mixer->urb); in snd_usb_mixer_free()
2932 usb_free_urb(mixer->rc_urb); in snd_usb_mixer_free()
2933 kfree(mixer->rc_setup_packet); in snd_usb_mixer_free()
2939 struct usb_mixer_interface *mixer = device->device_data; in snd_usb_mixer_dev_free()
2962 .c_chmask = -1, /* dynamic channels */
2963 .p_chmask = -1, /* dynamic channels */
2975 .p_chmask = -1, /* dynamic channels */
2981 .c_chmask = -1, /* dynamic channels */
2992 .p_chmask = -1, /* dynamic channels */
3021 if (f->c_chmask < 0 && f->p_chmask < 0) { in uac3_badd_func_has_valid_channels()
3023 usb_audio_warn(mixer->chip, "BAAD %s: no channels?", in uac3_badd_func_has_valid_channels()
3024 f->name); in uac3_badd_func_has_valid_channels()
3030 if ((f->c_chmask < 0 && !c_chmask) || in uac3_badd_func_has_valid_channels()
3031 (f->c_chmask >= 0 && f->c_chmask != c_chmask)) { in uac3_badd_func_has_valid_channels()
3032 usb_audio_warn(mixer->chip, "BAAD %s c_chmask mismatch", in uac3_badd_func_has_valid_channels()
3033 f->name); in uac3_badd_func_has_valid_channels()
3036 if ((f->p_chmask < 0 && !p_chmask) || in uac3_badd_func_has_valid_channels()
3037 (f->p_chmask >= 0 && f->p_chmask != p_chmask)) { in uac3_badd_func_has_valid_channels()
3038 usb_audio_warn(mixer->chip, "BAAD %s p_chmask mismatch", in uac3_badd_func_has_valid_channels()
3039 f->name); in uac3_badd_func_has_valid_channels()
3055 struct usb_device *dev = mixer->chip->dev; in snd_usb_mixer_controls_badd()
3056 struct usb_interface_assoc_descriptor *assoc; in snd_usb_mixer_controls_badd() local
3057 int badd_profile = mixer->chip->badd_profile; in snd_usb_mixer_controls_badd()
3063 assoc = usb_ifnum_to_if(dev, ctrlif)->intf_assoc; in snd_usb_mixer_controls_badd()
3066 for (i = 0; i < assoc->bInterfaceCount; i++) { in snd_usb_mixer_controls_badd()
3067 int intf = assoc->bFirstInterface + i; in snd_usb_mixer_controls_badd()
3083 num = iface->num_altsetting; in snd_usb_mixer_controls_badd()
3086 return -EINVAL; in snd_usb_mixer_controls_badd()
3095 alts = &iface->altsetting[1]; in snd_usb_mixer_controls_badd()
3098 if (altsd->bNumEndpoints < 1) in snd_usb_mixer_controls_badd()
3099 return -EINVAL; in snd_usb_mixer_controls_badd()
3102 dir_in = (get_endpoint(alts, 0)->bEndpointAddress & USB_DIR_IN); in snd_usb_mixer_controls_badd()
3103 maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); in snd_usb_mixer_controls_badd()
3107 usb_audio_err(mixer->chip, in snd_usb_mixer_controls_badd()
3110 return -EINVAL; in snd_usb_mixer_controls_badd()
3131 usb_audio_dbg(mixer->chip, in snd_usb_mixer_controls_badd()
3136 for (map = uac3_badd_usbmix_ctl_maps; map->id; map++) { in snd_usb_mixer_controls_badd()
3137 if (map->id == badd_profile) in snd_usb_mixer_controls_badd()
3141 if (!map->id) in snd_usb_mixer_controls_badd()
3142 return -EINVAL; in snd_usb_mixer_controls_badd()
3144 for (f = uac3_badd_profiles; f->name; f++) { in snd_usb_mixer_controls_badd()
3145 if (badd_profile == f->subclass) in snd_usb_mixer_controls_badd()
3148 if (!f->name) in snd_usb_mixer_controls_badd()
3149 return -EINVAL; in snd_usb_mixer_controls_badd()
3151 return -EINVAL; in snd_usb_mixer_controls_badd()
3152 st_chmask = f->st_chmask; in snd_usb_mixer_controls_badd()
3158 UAC3_BADD_FU_ID2, map->map); in snd_usb_mixer_controls_badd()
3161 UAC3_BADD_FU_ID2, map->map); in snd_usb_mixer_controls_badd()
3168 UAC3_BADD_FU_ID5, map->map); in snd_usb_mixer_controls_badd()
3171 UAC3_BADD_FU_ID5, map->map); in snd_usb_mixer_controls_badd()
3174 /* Side tone-mixing */ in snd_usb_mixer_controls_badd()
3178 UAC3_BADD_FU_ID7, map->map); in snd_usb_mixer_controls_badd()
3181 UAC3_BADD_FU_ID7, map->map); in snd_usb_mixer_controls_badd()
3185 if (f->subclass == UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER) { in snd_usb_mixer_controls_badd()
3188 /* Input Term - Insertion control */ in snd_usb_mixer_controls_badd()
3192 build_connector_control(mixer, map->map, &iterm, true); in snd_usb_mixer_controls_badd()
3194 /* Output Term - Insertion control */ in snd_usb_mixer_controls_badd()
3198 build_connector_control(mixer, map->map, &oterm, false); in snd_usb_mixer_controls_badd()
3217 state.chip = mixer->chip; in snd_usb_mixer_controls()
3219 state.buffer = mixer->hostif->extra; in snd_usb_mixer_controls()
3220 state.buflen = mixer->hostif->extralen; in snd_usb_mixer_controls()
3223 for (map = usbmix_ctl_maps; map->id; map++) { in snd_usb_mixer_controls()
3224 if (map->id == state.chip->usb_id) { in snd_usb_mixer_controls()
3225 state.map = map->map; in snd_usb_mixer_controls()
3226 state.selector_map = map->selector_map; in snd_usb_mixer_controls()
3227 mixer->connector_map = map->connector_map; in snd_usb_mixer_controls()
3233 while ((p = snd_usb_find_csint_desc(mixer->hostif->extra, in snd_usb_mixer_controls()
3234 mixer->hostif->extralen, in snd_usb_mixer_controls()
3236 if (!snd_usb_validate_audio_desc(p, mixer->protocol)) in snd_usb_mixer_controls()
3239 if (mixer->protocol == UAC_VERSION_1) { in snd_usb_mixer_controls()
3243 set_bit(desc->bTerminalID, state.unitbitmap); in snd_usb_mixer_controls()
3244 state.oterm.id = desc->bTerminalID; in snd_usb_mixer_controls()
3245 state.oterm.type = le16_to_cpu(desc->wTerminalType); in snd_usb_mixer_controls()
3246 state.oterm.name = desc->iTerminal; in snd_usb_mixer_controls()
3247 err = parse_audio_unit(&state, desc->bSourceID); in snd_usb_mixer_controls()
3248 if (err < 0 && err != -EINVAL) in snd_usb_mixer_controls()
3250 } else if (mixer->protocol == UAC_VERSION_2) { in snd_usb_mixer_controls()
3254 set_bit(desc->bTerminalID, state.unitbitmap); in snd_usb_mixer_controls()
3255 state.oterm.id = desc->bTerminalID; in snd_usb_mixer_controls()
3256 state.oterm.type = le16_to_cpu(desc->wTerminalType); in snd_usb_mixer_controls()
3257 state.oterm.name = desc->iTerminal; in snd_usb_mixer_controls()
3258 err = parse_audio_unit(&state, desc->bSourceID); in snd_usb_mixer_controls()
3259 if (err < 0 && err != -EINVAL) in snd_usb_mixer_controls()
3266 err = parse_audio_unit(&state, desc->bCSourceID); in snd_usb_mixer_controls()
3267 if (err < 0 && err != -EINVAL) in snd_usb_mixer_controls()
3271 uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), in snd_usb_mixer_controls()
3280 set_bit(desc->bTerminalID, state.unitbitmap); in snd_usb_mixer_controls()
3281 state.oterm.id = desc->bTerminalID; in snd_usb_mixer_controls()
3282 state.oterm.type = le16_to_cpu(desc->wTerminalType); in snd_usb_mixer_controls()
3283 state.oterm.name = le16_to_cpu(desc->wTerminalDescrStr); in snd_usb_mixer_controls()
3284 err = parse_audio_unit(&state, desc->bSourceID); in snd_usb_mixer_controls()
3285 if (err < 0 && err != -EINVAL) in snd_usb_mixer_controls()
3292 err = parse_audio_unit(&state, desc->bCSourceID); in snd_usb_mixer_controls()
3293 if (err < 0 && err != -EINVAL) in snd_usb_mixer_controls()
3297 uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls), in snd_usb_mixer_controls()
3311 const struct usbmix_connector_map *map = mixer->connector_map; in delegate_notify()
3316 for (; map->id; map++) { in delegate_notify()
3317 if (map->id == unitid) { in delegate_notify()
3318 if (control && map->control) in delegate_notify()
3319 *control = map->control; in delegate_notify()
3320 if (channel && map->channel) in delegate_notify()
3321 *channel = map->channel; in delegate_notify()
3322 return map->delegated_id; in delegate_notify()
3337 if (!list->is_std_info) in snd_usb_mixer_notify_id()
3341 info->cached = 0; in snd_usb_mixer_notify_id()
3342 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_usb_mixer_notify_id()
3343 &list->kctl->id); in snd_usb_mixer_notify_id()
3363 "channels=%i, type=\"%s\"\n", cval->head.id, in snd_usb_mixer_dump_cval()
3364 cval->control, cval->cmask, cval->channels, in snd_usb_mixer_dump_cval()
3365 val_types[cval->val_type]); in snd_usb_mixer_dump_cval()
3367 cval->min, cval->max, cval->dBmin, cval->dBmax); in snd_usb_mixer_dump_cval()
3373 struct snd_usb_audio *chip = entry->private_data; in snd_usb_mixer_proc_read()
3378 list_for_each_entry(mixer, &chip->mixer_list, list) { in snd_usb_mixer_proc_read()
3381 chip->usb_id, mixer_ctrl_intf(mixer), in snd_usb_mixer_proc_read()
3382 mixer->ignore_ctl_error); in snd_usb_mixer_proc_read()
3383 snd_iprintf(buffer, "Card: %s\n", chip->card->longname); in snd_usb_mixer_proc_read()
3386 snd_iprintf(buffer, " Unit: %i\n", list->id); in snd_usb_mixer_proc_read()
3387 if (list->kctl) in snd_usb_mixer_proc_read()
3390 list->kctl->id.name, in snd_usb_mixer_proc_read()
3391 list->kctl->id.index); in snd_usb_mixer_proc_read()
3392 if (list->dump) in snd_usb_mixer_proc_read()
3393 list->dump(buffer, list); in snd_usb_mixer_proc_read()
3409 usb_audio_dbg(mixer->chip, in snd_usb_mixer_interrupt_v2()
3426 if (!list->kctl) in snd_usb_mixer_interrupt_v2()
3428 if (!list->is_std_info) in snd_usb_mixer_interrupt_v2()
3432 if (count > 1 && info->control != control) in snd_usb_mixer_interrupt_v2()
3439 info->cached &= ~(1 << channel); in snd_usb_mixer_interrupt_v2()
3441 info->cached = 0; in snd_usb_mixer_interrupt_v2()
3443 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_usb_mixer_interrupt_v2()
3444 &info->head.kctl->id); in snd_usb_mixer_interrupt_v2()
3456 usb_audio_dbg(mixer->chip, in snd_usb_mixer_interrupt_v2()
3466 struct usb_mixer_interface *mixer = urb->context; in snd_usb_mixer_interrupt()
3467 int len = urb->actual_length; in snd_usb_mixer_interrupt()
3468 int ustatus = urb->status; in snd_usb_mixer_interrupt()
3473 if (mixer->protocol == UAC_VERSION_1) { in snd_usb_mixer_interrupt()
3476 for (status = urb->transfer_buffer; in snd_usb_mixer_interrupt()
3478 len -= sizeof(*status), status++) { in snd_usb_mixer_interrupt()
3479 dev_dbg(&urb->dev->dev, "status interrupt: %02x %02x\n", in snd_usb_mixer_interrupt()
3480 status->bStatusType, in snd_usb_mixer_interrupt()
3481 status->bOriginator); in snd_usb_mixer_interrupt()
3484 if ((status->bStatusType & UAC1_STATUS_TYPE_ORIG_MASK) != in snd_usb_mixer_interrupt()
3488 if (status->bStatusType & UAC1_STATUS_TYPE_MEM_CHANGED) in snd_usb_mixer_interrupt()
3489 snd_usb_mixer_rc_memory_change(mixer, status->bOriginator); in snd_usb_mixer_interrupt()
3491 snd_usb_mixer_notify_id(mixer, status->bOriginator); in snd_usb_mixer_interrupt()
3496 for (msg = urb->transfer_buffer; in snd_usb_mixer_interrupt()
3498 len -= sizeof(*msg), msg++) { in snd_usb_mixer_interrupt()
3500 if ((msg->bInfo & UAC2_INTERRUPT_DATA_MSG_VENDOR) || in snd_usb_mixer_interrupt()
3501 (msg->bInfo & UAC2_INTERRUPT_DATA_MSG_EP)) in snd_usb_mixer_interrupt()
3504 snd_usb_mixer_interrupt_v2(mixer, msg->bAttribute, in snd_usb_mixer_interrupt()
3505 le16_to_cpu(msg->wValue), in snd_usb_mixer_interrupt()
3506 le16_to_cpu(msg->wIndex)); in snd_usb_mixer_interrupt()
3511 if (ustatus != -ENOENT && in snd_usb_mixer_interrupt()
3512 ustatus != -ECONNRESET && in snd_usb_mixer_interrupt()
3513 ustatus != -ESHUTDOWN) { in snd_usb_mixer_interrupt()
3514 urb->dev = mixer->chip->dev; in snd_usb_mixer_interrupt()
3528 if (get_iface_desc(mixer->hostif)->bNumEndpoints < 1) in snd_usb_mixer_status_create()
3530 ep = get_endpoint(mixer->hostif, 0); in snd_usb_mixer_status_create()
3535 buffer_length = le16_to_cpu(ep->wMaxPacketSize); in snd_usb_mixer_status_create()
3538 return -ENOMEM; in snd_usb_mixer_status_create()
3539 mixer->urb = usb_alloc_urb(0, GFP_KERNEL); in snd_usb_mixer_status_create()
3540 if (!mixer->urb) { in snd_usb_mixer_status_create()
3542 return -ENOMEM; in snd_usb_mixer_status_create()
3544 usb_fill_int_urb(mixer->urb, mixer->chip->dev, in snd_usb_mixer_status_create()
3545 usb_rcvintpipe(mixer->chip->dev, epnum), in snd_usb_mixer_status_create()
3547 snd_usb_mixer_interrupt, mixer, ep->bInterval); in snd_usb_mixer_status_create()
3548 usb_submit_urb(mixer->urb, GFP_KERNEL); in snd_usb_mixer_status_create()
3560 strcpy(chip->card->mixername, "USB Mixer"); in snd_usb_create_mixer()
3564 return -ENOMEM; in snd_usb_create_mixer()
3565 mixer->chip = chip; in snd_usb_create_mixer()
3566 mixer->ignore_ctl_error = !!(chip->quirk_flags & QUIRK_FLAG_IGNORE_CTL_ERROR); in snd_usb_create_mixer()
3567 mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems), in snd_usb_create_mixer()
3569 if (!mixer->id_elems) { in snd_usb_create_mixer()
3571 return -ENOMEM; in snd_usb_create_mixer()
3574 mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; in snd_usb_create_mixer()
3575 switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) { in snd_usb_create_mixer()
3578 mixer->protocol = UAC_VERSION_1; in snd_usb_create_mixer()
3581 mixer->protocol = UAC_VERSION_2; in snd_usb_create_mixer()
3584 mixer->protocol = UAC_VERSION_3; in snd_usb_create_mixer()
3588 if (mixer->protocol == UAC_VERSION_3 && in snd_usb_create_mixer()
3589 chip->badd_profile >= UAC3_FUNCTION_SUBCLASS_GENERIC_IO) { in snd_usb_create_mixer()
3607 err = snd_device_new(chip->card, SNDRV_DEV_CODEC, mixer, &dev_ops); in snd_usb_create_mixer()
3611 if (list_empty(&chip->mixer_list)) in snd_usb_create_mixer()
3612 snd_card_ro_proc_new(chip->card, "usbmixer", chip, in snd_usb_create_mixer()
3615 list_add(&mixer->list, &chip->mixer_list); in snd_usb_create_mixer()
3625 if (mixer->disconnected) in snd_usb_mixer_disconnect()
3627 if (mixer->urb) in snd_usb_mixer_disconnect()
3628 usb_kill_urb(mixer->urb); in snd_usb_mixer_disconnect()
3629 if (mixer->rc_urb) in snd_usb_mixer_disconnect()
3630 usb_kill_urb(mixer->rc_urb); in snd_usb_mixer_disconnect()
3631 if (mixer->private_free) in snd_usb_mixer_disconnect()
3632 mixer->private_free(mixer); in snd_usb_mixer_disconnect()
3633 mixer->disconnected = true; in snd_usb_mixer_disconnect()
3639 usb_kill_urb(mixer->urb); in snd_usb_mixer_inactivate()
3640 usb_kill_urb(mixer->rc_urb); in snd_usb_mixer_inactivate()
3647 if (mixer->urb) { in snd_usb_mixer_activate()
3648 err = usb_submit_urb(mixer->urb, GFP_NOIO); in snd_usb_mixer_activate()
3659 if (mixer->private_suspend) in snd_usb_mixer_suspend()
3660 mixer->private_suspend(mixer); in snd_usb_mixer_suspend()
3669 if (cval->val_type == USB_MIXER_BESPOKEN) in restore_mixer_value()
3672 if (cval->cmask) { in restore_mixer_value()
3675 if (!(cval->cmask & (1 << c))) in restore_mixer_value()
3677 if (cval->cached & (1 << (c + 1))) { in restore_mixer_value()
3679 cval->cache_val[idx]); in restore_mixer_value()
3687 if (cval->cached) in restore_mixer_value()
3688 snd_usb_set_cur_mix_value(cval, 0, 0, *cval->cache_val); in restore_mixer_value()
3702 if (list->resume) { in snd_usb_mixer_resume()
3703 err = list->resume(list); in snd_usb_mixer_resume()
3719 list->mixer = mixer; in snd_usb_mixer_elem_init_std()
3720 list->id = unitid; in snd_usb_mixer_elem_init_std()
3721 list->dump = snd_usb_mixer_dump_cval; in snd_usb_mixer_elem_init_std()
3722 list->resume = restore_mixer_value; in snd_usb_mixer_elem_init_std()