45 #include <linux/bitops.h>
47 #include <linux/list.h>
48 #include <linux/slab.h>
49 #include <linux/string.h>
51 #include <linux/usb/audio.h>
66 #define MAX_ID_ELEMS 256
120 for (p = state->
map; p->
id; p++) {
121 if (p->
id == unitid &&
143 if (!p || p->
name || p->
dB)
161 int index,
char *buf,
int buflen)
168 if (p->
id == unitid && index < p->
count)
177 static void *find_audio_control_unit(
struct mixer_build *state,
unsigned char unit)
197 static int snd_usb_copy_string_desc(
struct mixer_build *state,
int index,
char *buf,
int maxlen)
260 else if (val >= cval->
max)
261 return (cval->
max - cval->
min + cval->
res - 1) / cval->
res;
263 return (val - cval->
min) / cval->
res;
287 unsigned char buf[2];
292 err = snd_usb_autoresume(cval->
mixer->chip);
296 while (timeout-- > 0) {
299 idx = snd_usb_ctrl_intf(chip) | (cval->
id << 8);
302 validx, idx, buf, val_len) >= val_len) {
308 snd_printdd(
KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
309 request, validx, idx, cval->
val_type);
314 snd_usb_autosuspend(cval->
mixer->chip);
318 static int get_ctl_value_v2(
struct usb_mixer_elem_info *cval,
int request,
int validx,
int *value_ret)
321 unsigned char buf[2 + 3*
sizeof(
__u16)];
328 size =
sizeof(
__u16);
334 memset(buf, 0,
sizeof(buf));
336 ret = snd_usb_autoresume(chip) ? -
EIO : 0;
344 idx = snd_usb_ctrl_intf(chip) | (cval->
id << 8);
347 validx, idx, buf, size);
350 snd_usb_autosuspend(chip);
354 snd_printk(
KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
355 request, validx, idx, cval->
val_type);
366 val = buf +
sizeof(
__u16);
369 val = buf +
sizeof(
__u16) * 2;
372 val = buf +
sizeof(
__u16) * 3;
383 static int get_ctl_value(
struct usb_mixer_elem_info *cval,
int request,
int validx,
int *value_ret)
386 get_ctl_value_v1(cval, request, validx, value_ret) :
387 get_ctl_value_v2(cval, request, validx, value_ret);
392 return get_ctl_value(cval,
UAC_GET_CUR, validx, value);
403 int channel,
int index,
int *value)
407 if (cval->
cached & (1 << channel)) {
411 err = get_cur_mix_raw(cval, channel, value);
413 if (!cval->
mixer->ignore_ctl_error)
429 int request,
int validx,
int value_set)
432 unsigned char buf[2];
433 int idx = 0, val_len,
err, timeout = 10;
439 val_len =
sizeof(
__u16);
450 value_set = convert_bytes_value(cval, value_set);
451 buf[0] = value_set & 0xff;
452 buf[1] = (value_set >> 8) & 0xff;
453 err = snd_usb_autoresume(chip);
457 while (timeout-- > 0) {
460 idx = snd_usb_ctrl_intf(chip) | (cval->
id << 8);
462 usb_sndctrlpipe(chip->
dev, 0), request,
464 validx, idx, buf, val_len) >= 0) {
469 snd_printdd(
KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
470 request, validx, idx, cval->
val_type, buf[0], buf[1]);
475 snd_usb_autosuspend(chip);
485 int index,
int value)
488 unsigned int read_only = (channel == 0) ?
494 __func__, channel, cval->
control);
511 unsigned int size,
unsigned int __user *_tlv)
516 if (size <
sizeof(scale))
518 scale[2] = cval->
dBmin;
519 scale[3] = cval->
dBmax;
529 static int parse_audio_unit(
struct mixer_build *state,
int unitid);
536 static int check_matrix_bitmap(
unsigned char *
bmap,
int ich,
int och,
int num_outs)
538 int idx = ich * num_outs + och;
539 return bmap[idx >> 3] & (0x80 >> (idx & 7));
573 static struct iterm_name_combo {
577 { 0x0300,
"Output" },
578 { 0x0301,
"Speaker" },
579 { 0x0302,
"Headphone" },
580 { 0x0303,
"HMD Audio" },
581 { 0x0304,
"Desktop Speaker" },
582 { 0x0305,
"Room Speaker" },
583 { 0x0306,
"Com Speaker" },
585 { 0x0600,
"External In" },
586 { 0x0601,
"Analog In" },
587 { 0x0602,
"Digital In" },
589 { 0x0604,
"Legacy In" },
590 { 0x0605,
"IEC958 In" },
591 { 0x0606,
"1394 DA Stream" },
592 { 0x0607,
"1394 DV Stream" },
593 { 0x0700,
"Embedded" },
594 { 0x0701,
"Noise Source" },
595 { 0x0702,
"Equalization Noise" },
599 { 0x0706,
"MiniDisk" },
600 { 0x0707,
"Analog Tape" },
601 { 0x0708,
"Phonograph" },
602 { 0x0709,
"VCR Audio" },
603 { 0x070a,
"Video Disk Audio" },
604 { 0x070b,
"DVD Audio" },
605 { 0x070c,
"TV Tuner Audio" },
606 { 0x070d,
"Satellite Rec Audio" },
607 { 0x070e,
"Cable Tuner Audio" },
608 { 0x070f,
"DSS Audio" },
609 { 0x0710,
"Radio Receiver" },
610 { 0x0711,
"Radio Transmitter" },
611 { 0x0712,
"Multi-Track Recorder" },
612 { 0x0713,
"Synthesizer" },
617 unsigned char *
name,
int maxlen,
int term_only)
619 struct iterm_name_combo *names;
622 return snd_usb_copy_string_desc(state, iterm->
name, name, maxlen);
625 if (iterm->
type >> 16) {
628 switch (iterm->
type >> 16) {
630 strcpy(name,
"Selector");
return 8;
632 strcpy(name,
"Process Unit");
return 12;
634 strcpy(name,
"Ext Unit");
return 8;
636 strcpy(name,
"Mixer");
return 5;
638 return sprintf(name,
"Unit %d", iterm->
id);
642 switch (iterm->
type & 0xff00) {
644 strcpy(name,
"PCM");
return 3;
646 strcpy(name,
"Mic");
return 3;
648 strcpy(name,
"Headset");
return 7;
650 strcpy(name,
"Phone");
return 5;
653 for (names = iterm_names; names->type; names++)
654 if (names->type == iterm->
type) {
655 strcpy(name, names->name);
656 return strlen(names->name);
671 memset(term, 0,
sizeof(*term));
672 while ((p1 = find_audio_control_unit(state,
id)) !=
NULL) {
673 unsigned char *hdr =
p1;
691 err = check_input_term(state, d->
bCSourceID, term);
705 term->
channels = uac_mixer_unit_bNrChannels(d);
706 term->
chconfig = uac_mixer_unit_wChannelConfig(d, state->
mixer->protocol);
707 term->
name = uac_mixer_unit_iMixer(d);
714 if (check_input_term(state, d->
baSourceID[0], term) < 0)
718 term->
name = uac_selector_unit_iSelector(d);
729 term->
channels = uac_processing_unit_bNrChannels(d);
730 term->
chconfig = uac_processing_unit_wChannelConfig(d, state->
mixer->protocol);
731 term->
name = uac_processing_unit_iProcessing(d, state->
mixer->protocol);
778 static void usb_mixer_elem_free(
struct snd_kcontrol *kctl)
793 switch (cval->
mixer->chip->usb_id) {
794 case USB_ID(0x0763, 0x2081):
795 case
USB_ID(0x0763, 0x2080):
796 if (
strcmp(kctl->id.name,
"Effect Duration") == 0) {
798 "usb-audio: set quirk for FTU Effect Duration\n");
804 if (
strcmp(kctl->
id.name,
"Effect Volume") == 0 ||
805 strcmp(kctl->
id.name,
"Effect Feedback Volume") == 0) {
807 "usb-audio: set quirks for FTU Effect Feedback/Volume\n");
814 case USB_ID(0x0471, 0x0101):
815 case
USB_ID(0x0471, 0x0104):
816 case
USB_ID(0x0471, 0x0105):
817 case
USB_ID(0x0672, 0x1041):
823 if (!
strcmp(kctl->id.name,
"PCM Playback Volume") &&
824 cval->min == -15616) {
826 "set volume quirk for UDA1321/N101 chip\n");
831 case USB_ID(0x046d, 0x09a4):
832 if (!
strcmp(kctl->id.name,
"Mic Capture Volume")) {
834 "set volume quirk for QuickCam E3500\n");
841 case USB_ID(0x046d, 0x0808):
842 case
USB_ID(0x046d, 0x0809):
843 case
USB_ID(0x046d, 0x081d):
844 case
USB_ID(0x046d, 0x0991):
849 if (!
strcmp(kctl->id.name,
"Mic Capture Volume")) {
851 "set resolution quirk: cval->res = 384\n");
866 cval->
min = default_min;
867 cval->
max = cval->
min + 1;
879 if (cval->
cmask & (1 << i)) {
893 int last_valid_res = cval->
res;
895 while (cval->
res > 1) {
897 (cval->
control << 8) | minchn, cval->
res / 2) < 0)
902 cval->
res = last_valid_res;
914 int last_valid_res = cval->
res;
916 get_cur_mix_raw(cval, minchn, &saved);
919 if (test < cval->
max)
923 if (test < cval->min || test > cval->
max ||
924 set_cur_mix_value(cval, minchn, 0, test) ||
925 get_cur_mix_raw(cval, minchn, &check)) {
926 cval->
res = last_valid_res;
933 set_cur_mix_value(cval, minchn, 0, saved);
940 volume_control_quirks(cval, kctl);
945 cval->
dBmin = (convert_signed_value(cval, cval->
min) * 100) / 256;
946 cval->
dBmax = (convert_signed_value(cval, cval->
max) * 100) / 256;
951 else if (cval->
dBmin > 0)
962 #define get_min_max(cval, def) get_min_max_with_quirks(cval, def, NULL)
981 get_min_max_with_quirks(cval, 0, kcontrol);
983 kcontrol->
vd[0].access &=
1004 ucontrol->
value.integer.value[0] = cval->
min;
1008 if (!(cval->
cmask & (1 << c)))
1010 err = get_cur_mix_value(cval, c + 1, cnt, &val);
1012 return cval->
mixer->ignore_ctl_error ? 0 :
err;
1013 val = get_relative_value(cval, val);
1020 err = get_cur_mix_value(cval, 0, 0, &val);
1022 return cval->
mixer->ignore_ctl_error ? 0 :
err;
1023 val = get_relative_value(cval, val);
1024 ucontrol->
value.integer.value[0] =
val;
1039 if (!(cval->
cmask & (1 << c)))
1041 err = get_cur_mix_value(cval, c + 1, cnt, &oval);
1043 return cval->
mixer->ignore_ctl_error ? 0 :
err;
1044 val = ucontrol->
value.integer.value[
cnt];
1045 val = get_abs_value(cval, val);
1047 set_cur_mix_value(cval, c + 1, cnt, val);
1054 err = get_cur_mix_value(cval, 0, 0, &oval);
1056 return cval->
mixer->ignore_ctl_error ? 0 :
err;
1057 val = ucontrol->
value.integer.value[0];
1058 val = get_abs_value(cval, val);
1060 set_cur_mix_value(cval, 0, 0, val);
1070 .info = mixer_ctl_feature_info,
1071 .get = mixer_ctl_feature_get,
1072 .put = mixer_ctl_feature_put,
1079 .info = mixer_ctl_feature_info,
1080 .get = mixer_ctl_feature_get,
1092 static size_t append_ctl_name(
struct snd_kcontrol *kctl,
const char *
str)
1094 return strlcat(kctl->
id.name, str,
sizeof(kctl->
id.name));
1097 static void build_feature_ctl(
struct mixer_build *state,
void *raw_desc,
1098 unsigned int ctl_mask,
int control,
1103 unsigned int len = 0;
1104 int mapped_name = 0;
1105 int nameid = uac_feature_unit_iFeature(desc);
1118 map = find_map(state, unitid, control);
1119 if (check_ignored_ctl(map))
1130 cval->
cmask = ctl_mask;
1132 if (ctl_mask == 0) {
1137 for (i = 0; i < 16; i++)
1138 if (ctl_mask & (1 << i))
1147 if (cval->
channels == readonly_mask)
1159 len = check_mapped_name(map, kctl->
id.name,
sizeof(kctl->
id.name));
1160 mapped_name = len != 0;
1161 if (! len && nameid)
1162 len = snd_usb_copy_string_desc(state, nameid,
1163 kctl->
id.name,
sizeof(kctl->
id.name));
1176 len = get_term_name(state, iterm, kctl->
id.name,
sizeof(kctl->
id.name), 1);
1178 len = get_term_name(state, &state->
oterm, kctl->
id.name,
sizeof(kctl->
id.name), 1);
1181 "Feature %d", unitid);
1187 if (! mapped_name && ! (state->
oterm.type >> 16)) {
1188 if ((state->
oterm.type & 0xff00) == 0x0100) {
1189 len = append_ctl_name(kctl,
" Capture");
1191 len = append_ctl_name(kctl,
" Playback");
1195 " Switch" :
" Volume");
1200 sizeof(kctl->
id.name));
1205 get_min_max_with_quirks(cval, 0, kctl);
1208 check_mapped_dB(map, cval);
1211 kctl->
vd[0].access |=
1217 range = (cval->
max - cval->
min) / cval->
res;
1224 "volume range (=%u), cval->res is probably wrong.",
1227 "val = %d/%d/%d", cval->
id,
1244 static int parse_audio_feature_unit(
struct mixer_build *state,
int unitid,
void *_ftr)
1248 unsigned int master_bits, first_ch_bits;
1257 "invalid bControlSize == 0\n", unitid);
1260 channels = (hdr->
bLength - 7) / csize - 1;
1265 channels = (hdr->
bLength - 6) / 4 - 1;
1270 snd_printk(
KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid);
1275 if ((err = parse_audio_unit(state, hdr->
bSourceID)) < 0)
1279 if (check_input_term(state, hdr->
bSourceID, &iterm) < 0)
1284 switch (state->
chip->usb_id) {
1285 case USB_ID(0x08bb, 0x2702):
1287 "usbmixer: master volume quirk for PCM2702 chip\n");
1291 case USB_ID(0x1130, 0xf211):
1293 "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n");
1306 for (i = 0; i < 10; i++) {
1307 unsigned int ch_bits = 0;
1310 if (mask & (1 << i))
1311 ch_bits |= (1 <<
j);
1315 build_feature_ctl(state, _ftr, ch_bits, i, &iterm, unitid, 0);
1316 if (master_bits & (1 << i))
1317 build_feature_ctl(state, _ftr, 0, i, &iterm, unitid, 0);
1320 for (i = 0; i <
ARRAY_SIZE(audio_feature_info); i++) {
1321 unsigned int ch_bits = 0;
1322 unsigned int ch_read_only = 0;
1326 if (uac2_control_is_readable(mask, i)) {
1327 ch_bits |= (1 <<
j);
1328 if (!uac2_control_is_writeable(mask, i))
1329 ch_read_only |= (1 << j);
1338 build_feature_ctl(state, _ftr, ch_bits, i, &iterm, unitid, ch_read_only);
1339 if (uac2_control_is_readable(master_bits, i))
1340 build_feature_ctl(state, _ftr, 0, i, &iterm, unitid,
1341 !uac2_control_is_writeable(master_bits, i));
1360 static void build_mixer_unit_ctl(
struct mixer_build *state,
1362 int in_pin,
int in_ch,
int unitid,
1366 unsigned int num_outs = uac_mixer_unit_bNrChannels(desc);
1367 unsigned int i, len;
1371 map = find_map(state, unitid, 0);
1372 if (check_ignored_ctl(map))
1383 for (i = 0; i < num_outs; i++) {
1384 if (check_matrix_bitmap(uac_mixer_unit_bmControls(desc, state->
mixer->protocol), in_ch, i, num_outs)) {
1401 len = check_mapped_name(map, kctl->
id.name,
sizeof(kctl->
id.name));
1403 len = get_term_name(state, iterm, kctl->
id.name,
sizeof(kctl->
id.name), 0);
1405 len =
sprintf(kctl->
id.name,
"Mixer Source %d", in_ch + 1);
1406 append_ctl_name(kctl,
" Volume");
1417 static int parse_audio_mixer_unit(
struct mixer_build *state,
int unitid,
void *raw_desc)
1421 int input_pins, num_ins, num_outs;
1424 if (desc->
bLength < 11 || ! (input_pins = desc->
bNrInPins) || ! (num_outs = uac_mixer_unit_bNrChannels(desc))) {
1429 if (desc->
bLength <= 10 + input_pins) {
1436 for (pin = 0; pin < input_pins; pin++) {
1437 err = parse_audio_unit(state, desc->
baSourceID[pin]);
1440 err = check_input_term(state, desc->
baSourceID[pin], &iterm);
1444 for (; ich < num_ins; ++ich) {
1445 int och, ich_has_controls = 0;
1447 for (och = 0; och < num_outs; ++och) {
1448 if (check_matrix_bitmap(uac_mixer_unit_bmControls(desc, state->
mixer->protocol),
1449 ich, och, num_outs)) {
1450 ich_has_controls = 1;
1454 if (ich_has_controls)
1455 build_mixer_unit_ctl(state, desc, pin, ich,
1473 err = get_cur_ctl_value(cval, cval->
control << 8, &val);
1474 if (err < 0 && cval->
mixer->ignore_ctl_error) {
1475 ucontrol->
value.integer.value[0] = cval->
min;
1480 val = get_relative_value(cval, val);
1481 ucontrol->
value.integer.value[0] =
val;
1491 err = get_cur_ctl_value(cval, cval->
control << 8, &oval);
1493 if (cval->
mixer->ignore_ctl_error)
1497 val = ucontrol->
value.integer.value[0];
1498 val = get_abs_value(cval, val);
1500 set_cur_ctl_value(cval, cval->
control << 8, val);
1510 .info = mixer_ctl_feature_info,
1511 .get = mixer_ctl_procunit_get,
1512 .put = mixer_ctl_procunit_put,
1624 0,
NULL, default_value_info
1628 desc->
bLength < num_ins + uac_processing_unit_bControlSize(desc, state->
mixer->protocol)) {
1633 for (i = 0; i < num_ins; i++) {
1634 if ((err = parse_audio_unit(state, desc->
baSourceID[i])) < 0)
1639 for (info = list; info && info->
type; info++)
1640 if (info->
type == type)
1642 if (! info || ! info->
type)
1643 info = &default_info;
1648 if (! (controls[valinfo->
control / 8] & (1 << ((valinfo->
control % 8) - 1))))
1650 map = find_map(state, unitid, valinfo->
control);
1651 if (check_ignored_ctl(map))
1666 __u8 *control_spec = uac_processing_unit_specific(desc, state->
mixer->protocol);
1669 cval->
max = control_spec[0];
1693 if (check_mapped_name(map, kctl->
id.name,
1694 sizeof(kctl->
id.name)))
1696 else if (info->
name)
1699 nameid = uac_processing_unit_iProcessing(desc, state->
mixer->protocol);
1702 len = snd_usb_copy_string_desc(state, nameid, kctl->
id.name,
sizeof(kctl->
id.name));
1704 strlcpy(kctl->
id.name, name,
sizeof(kctl->
id.name));
1706 append_ctl_name(kctl,
" ");
1707 append_ctl_name(kctl, valinfo->
suffix);
1718 static int parse_audio_processing_unit(
struct mixer_build *state,
int unitid,
void *raw_desc)
1720 return build_audio_procunit(state, unitid, raw_desc, procunits,
"Processing Unit");
1723 static int parse_audio_extension_unit(
struct mixer_build *state,
int unitid,
void *raw_desc)
1727 return build_audio_procunit(state, unitid, raw_desc, extunits,
"Extension Unit");
1741 const char **itemlist = (
const char **)kcontrol->
private_value;
1754 err = get_cur_ctl_value(cval, cval->
control << 8, &val);
1756 if (cval->
mixer->ignore_ctl_error) {
1757 ucontrol->
value.enumerated.item[0] = 0;
1762 val = get_relative_value(cval, val);
1763 ucontrol->
value.enumerated.item[0] =
val;
1773 err = get_cur_ctl_value(cval, cval->
control << 8, &oval);
1775 if (cval->
mixer->ignore_ctl_error)
1779 val = ucontrol->
value.enumerated.item[0];
1780 val = get_abs_value(cval, val);
1782 set_cur_ctl_value(cval, cval->
control << 8, val);
1792 .info = mixer_ctl_selector_info,
1793 .get = mixer_ctl_selector_get,
1794 .put = mixer_ctl_selector_put,
1801 static void usb_mixer_selector_elem_free(
struct snd_kcontrol *kctl)
1807 num_ins = cval->
max;
1813 for (i = 0; i < num_ins; i++)
1823 static int parse_audio_selector_unit(
struct mixer_build *state,
int unitid,
void *raw_desc)
1826 unsigned int i, nameid, len;
1839 if ((err = parse_audio_unit(state, desc->
baSourceID[i])) < 0)
1846 map = find_map(state, unitid, 0);
1847 if (check_ignored_ctl(map))
1875 #define MAX_ITEM_NAME_LEN 64
1880 if (! namelist[i]) {
1888 len = check_mapped_selector_name(state, unitid, i, namelist[i],
1890 if (! len && check_input_term(state, desc->
baSourceID[i], &iterm) >= 0)
1891 len = get_term_name(state, &iterm, namelist[i], MAX_ITEM_NAME_LEN, 0);
1893 sprintf(namelist[i],
"Input %d", i);
1906 nameid = uac_selector_unit_iSelector(desc);
1907 len = check_mapped_name(map, kctl->
id.name,
sizeof(kctl->
id.name));
1911 snd_usb_copy_string_desc(state, nameid, kctl->
id.name,
sizeof(kctl->
id.name));
1913 len = get_term_name(state, &state->
oterm,
1914 kctl->
id.name,
sizeof(kctl->
id.name), 0);
1916 strlcpy(kctl->
id.name,
"USB",
sizeof(kctl->
id.name));
1919 append_ctl_name(kctl,
" Clock Source");
1920 else if ((state->
oterm.type & 0xff00) == 0x0100)
1921 append_ctl_name(kctl,
" Capture Source");
1923 append_ctl_name(kctl,
" Playback Source");
1939 static int parse_audio_unit(
struct mixer_build *state,
int unitid)
1946 p1 = find_audio_control_unit(state, unitid);
1957 return parse_audio_mixer_unit(state, unitid, p1);
1960 return parse_audio_selector_unit(state, unitid, p1);
1962 return parse_audio_feature_unit(state, unitid, p1);
1966 return parse_audio_processing_unit(state, unitid, p1);
1972 return parse_audio_extension_unit(state, unitid, p1);
1974 return parse_audio_processing_unit(state, unitid, p1);
1985 kfree(mixer->
urb->transfer_buffer);
1996 snd_usb_mixer_free(mixer);
2012 memset(&state, 0,
sizeof(state));
2014 state.
mixer = mixer;
2019 for (map = usbmix_ctl_maps; map->
id; map++) {
2020 if (map->
id == state.
chip->usb_id) {
2034 if (desc->
bLength <
sizeof(*desc))
2040 err = parse_audio_unit(&state, desc->
bSourceID);
2046 if (desc->
bLength <
sizeof(*desc))
2052 err = parse_audio_unit(&state, desc->
bSourceID);
2057 err = parse_audio_unit(&state, desc->
bCSourceID);
2079 static char *val_types[] = {
"BOOLEAN",
"INV_BOOLEAN",
2080 "S8",
"U8",
"S16",
"U16"};
2081 snd_iprintf(buffer,
" Unit: %i\n", unitid);
2083 snd_iprintf(buffer,
" Control: name=\"%s\", index=%i\n",
2085 snd_iprintf(buffer,
" Info: id=%i, control=%i, cmask=0x%x, "
2086 "channels=%i, type=\"%s\"\n", cval->
id,
2089 snd_iprintf(buffer,
" Volume: min=%i, max=%i, dBmin=%i, dBmax=%i\n",
2103 "USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n",
2104 chip->
usb_id, snd_usb_ctrl_intf(chip),
2106 snd_iprintf(buffer,
"Card: %s\n", chip->
card->longname);
2108 for (cval = mixer->
id_elems[unitid]; cval;
2110 snd_usb_mixer_dump_cval(buffer, unitid, cval);
2119 __u8 unitid = (index >> 8) & 0xff;
2120 __u8 control = (value >> 8) & 0xff;
2121 __u8 channel = value & 0xff;
2123 if (channel >= MAX_CHANNELS) {
2133 switch (attribute) {
2161 static void snd_usb_mixer_interrupt(
struct urb *
urb)
2164 int len = urb->actual_length;
2165 int ustatus = urb->status;
2173 for (status = urb->transfer_buffer;
2174 len >=
sizeof(*status);
2175 len -=
sizeof(*status), status++) {
2193 for (msg = urb->transfer_buffer;
2194 len >=
sizeof(*msg);
2195 len -=
sizeof(*msg), msg++) {
2201 snd_usb_mixer_interrupt_v2(mixer, msg->
bAttribute,
2209 urb->dev = mixer->
chip->dev;
2246 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
2249 epnum = usb_endpoint_num(ep);
2252 if (!transfer_buffer)
2256 kfree(transfer_buffer);
2259 usb_fill_int_urb(mixer->
urb, mixer->
chip->dev,
2260 usb_rcvintpipe(mixer->
chip->dev, epnum),
2261 transfer_buffer, buffer_length,
2262 snd_usb_mixer_interrupt, mixer, ep->
bInterval);
2302 if ((err = snd_usb_mixer_controls(mixer)) < 0 ||
2303 (err = snd_usb_mixer_status_create(mixer)) < 0)
2313 !snd_card_proc_new(chip->
card,
"usbmixer", &entry))
2314 snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read);
2320 snd_usb_mixer_free(mixer);