diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-02-22 17:49:13 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-02-23 02:51:56 -0500 |
commit | de48c7bc6f93c6c8e0be8612c9d72a2dc92eaa01 (patch) | |
tree | f27b2849a4f78959f7c448eaaafd7bca8cb8f8ac /sound/usb/usbmixer.c | |
parent | 7b8a043f2686af9f41e313a78ed5e98233e5fded (diff) |
ALSA: usbaudio: consolidate header files
Use the definitions from linux/usb/audio.h all over the ALSA USB audio
driver and add some missing definitions there as well.
Use the endpoint attribute macros from linux/usb/ch9 and remove the own
things from sound/usb/usbaudio.h.
Now things are also nicely prefixed which makes understanding the code
easier.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbmixer.c')
-rw-r--r-- | sound/usb/usbmixer.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 42bb95c739a8..8e8f871b74ca 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -286,7 +286,7 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char un | |||
286 | p = NULL; | 286 | p = NULL; |
287 | while ((p = snd_usb_find_desc(state->buffer, state->buflen, p, | 287 | while ((p = snd_usb_find_desc(state->buffer, state->buflen, p, |
288 | USB_DT_CS_INTERFACE)) != NULL) { | 288 | USB_DT_CS_INTERFACE)) != NULL) { |
289 | if (p[0] >= 4 && p[2] >= INPUT_TERMINAL && p[2] <= EXTENSION_UNIT_V1 && p[3] == unit) | 289 | if (p[0] >= 4 && p[2] >= UAC_INPUT_TERMINAL && p[2] <= UAC_EXTENSION_UNIT_V1 && p[3] == unit) |
290 | return p; | 290 | return p; |
291 | } | 291 | } |
292 | return NULL; | 292 | return NULL; |
@@ -407,14 +407,14 @@ static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali | |||
407 | 407 | ||
408 | static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value) | 408 | static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value) |
409 | { | 409 | { |
410 | return get_ctl_value(cval, GET_CUR, validx, value); | 410 | return get_ctl_value(cval, UAC_GET_CUR, validx, value); |
411 | } | 411 | } |
412 | 412 | ||
413 | /* channel = 0: master, 1 = first channel */ | 413 | /* channel = 0: master, 1 = first channel */ |
414 | static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval, | 414 | static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval, |
415 | int channel, int *value) | 415 | int channel, int *value) |
416 | { | 416 | { |
417 | return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); | 417 | return get_ctl_value(cval, UAC_GET_CUR, (cval->control << 8) | channel, value); |
418 | } | 418 | } |
419 | 419 | ||
420 | static int get_cur_mix_value(struct usb_mixer_elem_info *cval, | 420 | static int get_cur_mix_value(struct usb_mixer_elem_info *cval, |
@@ -468,14 +468,14 @@ static int set_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali | |||
468 | 468 | ||
469 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) | 469 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) |
470 | { | 470 | { |
471 | return set_ctl_value(cval, SET_CUR, validx, value); | 471 | return set_ctl_value(cval, UAC_SET_CUR, validx, value); |
472 | } | 472 | } |
473 | 473 | ||
474 | static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, | 474 | static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, |
475 | int index, int value) | 475 | int index, int value) |
476 | { | 476 | { |
477 | int err; | 477 | int err; |
478 | err = set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, | 478 | err = set_ctl_value(cval, UAC_SET_CUR, (cval->control << 8) | channel, |
479 | value); | 479 | value); |
480 | if (err < 0) | 480 | if (err < 0) |
481 | return err; | 481 | return err; |
@@ -605,13 +605,13 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm | |||
605 | if (term_only) | 605 | if (term_only) |
606 | return 0; | 606 | return 0; |
607 | switch (iterm->type >> 16) { | 607 | switch (iterm->type >> 16) { |
608 | case SELECTOR_UNIT: | 608 | case UAC_SELECTOR_UNIT: |
609 | strcpy(name, "Selector"); return 8; | 609 | strcpy(name, "Selector"); return 8; |
610 | case PROCESSING_UNIT_V1: | 610 | case UAC_PROCESSING_UNIT_V1: |
611 | strcpy(name, "Process Unit"); return 12; | 611 | strcpy(name, "Process Unit"); return 12; |
612 | case EXTENSION_UNIT_V1: | 612 | case UAC_EXTENSION_UNIT_V1: |
613 | strcpy(name, "Ext Unit"); return 8; | 613 | strcpy(name, "Ext Unit"); return 8; |
614 | case MIXER_UNIT: | 614 | case UAC_MIXER_UNIT: |
615 | strcpy(name, "Mixer"); return 5; | 615 | strcpy(name, "Mixer"); return 5; |
616 | default: | 616 | default: |
617 | return sprintf(name, "Unit %d", iterm->id); | 617 | return sprintf(name, "Unit %d", iterm->id); |
@@ -650,22 +650,22 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
650 | while ((p1 = find_audio_control_unit(state, id)) != NULL) { | 650 | while ((p1 = find_audio_control_unit(state, id)) != NULL) { |
651 | term->id = id; | 651 | term->id = id; |
652 | switch (p1[2]) { | 652 | switch (p1[2]) { |
653 | case INPUT_TERMINAL: | 653 | case UAC_INPUT_TERMINAL: |
654 | term->type = combine_word(p1 + 4); | 654 | term->type = combine_word(p1 + 4); |
655 | term->channels = p1[7]; | 655 | term->channels = p1[7]; |
656 | term->chconfig = combine_word(p1 + 8); | 656 | term->chconfig = combine_word(p1 + 8); |
657 | term->name = p1[11]; | 657 | term->name = p1[11]; |
658 | return 0; | 658 | return 0; |
659 | case FEATURE_UNIT: | 659 | case UAC_FEATURE_UNIT: |
660 | id = p1[4]; | 660 | id = p1[4]; |
661 | break; /* continue to parse */ | 661 | break; /* continue to parse */ |
662 | case MIXER_UNIT: | 662 | case UAC_MIXER_UNIT: |
663 | term->type = p1[2] << 16; /* virtual type */ | 663 | term->type = p1[2] << 16; /* virtual type */ |
664 | term->channels = p1[5 + p1[4]]; | 664 | term->channels = p1[5 + p1[4]]; |
665 | term->chconfig = combine_word(p1 + 6 + p1[4]); | 665 | term->chconfig = combine_word(p1 + 6 + p1[4]); |
666 | term->name = p1[p1[0] - 1]; | 666 | term->name = p1[p1[0] - 1]; |
667 | return 0; | 667 | return 0; |
668 | case SELECTOR_UNIT: | 668 | case UAC_SELECTOR_UNIT: |
669 | /* call recursively to retrieve the channel info */ | 669 | /* call recursively to retrieve the channel info */ |
670 | if (check_input_term(state, p1[5], term) < 0) | 670 | if (check_input_term(state, p1[5], term) < 0) |
671 | return -ENODEV; | 671 | return -ENODEV; |
@@ -673,8 +673,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
673 | term->id = id; | 673 | term->id = id; |
674 | term->name = p1[9 + p1[0] - 1]; | 674 | term->name = p1[9 + p1[0] - 1]; |
675 | return 0; | 675 | return 0; |
676 | case PROCESSING_UNIT_V1: | 676 | case UAC_PROCESSING_UNIT_V1: |
677 | case EXTENSION_UNIT_V1: | 677 | case UAC_EXTENSION_UNIT_V1: |
678 | if (p1[6] == 1) { | 678 | if (p1[6] == 1) { |
679 | id = p1[7]; | 679 | id = p1[7]; |
680 | break; /* continue to parse */ | 680 | break; /* continue to parse */ |
@@ -752,23 +752,23 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) | |||
752 | break; | 752 | break; |
753 | } | 753 | } |
754 | } | 754 | } |
755 | if (get_ctl_value(cval, GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || | 755 | if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || |
756 | get_ctl_value(cval, GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { | 756 | get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { |
757 | snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n", | 757 | snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n", |
758 | cval->id, cval->mixer->ctrlif, cval->control, cval->id); | 758 | cval->id, cval->mixer->ctrlif, cval->control, cval->id); |
759 | return -EINVAL; | 759 | return -EINVAL; |
760 | } | 760 | } |
761 | if (get_ctl_value(cval, GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) { | 761 | if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) { |
762 | cval->res = 1; | 762 | cval->res = 1; |
763 | } else { | 763 | } else { |
764 | int last_valid_res = cval->res; | 764 | int last_valid_res = cval->res; |
765 | 765 | ||
766 | while (cval->res > 1) { | 766 | while (cval->res > 1) { |
767 | if (set_ctl_value(cval, SET_RES, (cval->control << 8) | minchn, cval->res / 2) < 0) | 767 | if (set_ctl_value(cval, UAC_SET_RES, (cval->control << 8) | minchn, cval->res / 2) < 0) |
768 | break; | 768 | break; |
769 | cval->res /= 2; | 769 | cval->res /= 2; |
770 | } | 770 | } |
771 | if (get_ctl_value(cval, GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) | 771 | if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) |
772 | cval->res = last_valid_res; | 772 | cval->res = last_valid_res; |
773 | } | 773 | } |
774 | if (cval->res == 0) | 774 | if (cval->res == 0) |
@@ -1097,7 +1097,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1097 | struct uac_feature_unit_descriptor *ftr = _ftr; | 1097 | struct uac_feature_unit_descriptor *ftr = _ftr; |
1098 | 1098 | ||
1099 | if (ftr->bLength < 7 || ! (csize = ftr->bControlSize) || ftr->bLength < 7 + csize) { | 1099 | if (ftr->bLength < 7 || ! (csize = ftr->bControlSize) || ftr->bLength < 7 + csize) { |
1100 | snd_printk(KERN_ERR "usbaudio: unit %u: invalid FEATURE_UNIT descriptor\n", unitid); | 1100 | snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid); |
1101 | return -EINVAL; | 1101 | return -EINVAL; |
1102 | } | 1102 | } |
1103 | 1103 | ||
@@ -1739,17 +1739,17 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) | |||
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | switch (p1[2]) { | 1741 | switch (p1[2]) { |
1742 | case INPUT_TERMINAL: | 1742 | case UAC_INPUT_TERMINAL: |
1743 | return 0; /* NOP */ | 1743 | return 0; /* NOP */ |
1744 | case MIXER_UNIT: | 1744 | case UAC_MIXER_UNIT: |
1745 | return parse_audio_mixer_unit(state, unitid, p1); | 1745 | return parse_audio_mixer_unit(state, unitid, p1); |
1746 | case SELECTOR_UNIT: | 1746 | case UAC_SELECTOR_UNIT: |
1747 | return parse_audio_selector_unit(state, unitid, p1); | 1747 | return parse_audio_selector_unit(state, unitid, p1); |
1748 | case FEATURE_UNIT: | 1748 | case UAC_FEATURE_UNIT: |
1749 | return parse_audio_feature_unit(state, unitid, p1); | 1749 | return parse_audio_feature_unit(state, unitid, p1); |
1750 | case PROCESSING_UNIT_V1: | 1750 | case UAC_PROCESSING_UNIT_V1: |
1751 | return parse_audio_processing_unit(state, unitid, p1); | 1751 | return parse_audio_processing_unit(state, unitid, p1); |
1752 | case EXTENSION_UNIT_V1: | 1752 | case UAC_EXTENSION_UNIT_V1: |
1753 | return parse_audio_extension_unit(state, unitid, p1); | 1753 | return parse_audio_extension_unit(state, unitid, p1); |
1754 | default: | 1754 | default: |
1755 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); | 1755 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); |
@@ -1779,7 +1779,7 @@ static int snd_usb_mixer_dev_free(struct snd_device *device) | |||
1779 | /* | 1779 | /* |
1780 | * create mixer controls | 1780 | * create mixer controls |
1781 | * | 1781 | * |
1782 | * walk through all OUTPUT_TERMINAL descriptors to search for mixers | 1782 | * walk through all UAC_OUTPUT_TERMINAL descriptors to search for mixers |
1783 | */ | 1783 | */ |
1784 | static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | 1784 | static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) |
1785 | { | 1785 | { |
@@ -1807,7 +1807,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | desc = NULL; | 1809 | desc = NULL; |
1810 | while ((desc = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, desc, OUTPUT_TERMINAL)) != NULL) { | 1810 | while ((desc = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, desc, UAC_OUTPUT_TERMINAL)) != NULL) { |
1811 | if (desc->bLength < 9) | 1811 | if (desc->bLength < 9) |
1812 | continue; /* invalid descriptor? */ | 1812 | continue; /* invalid descriptor? */ |
1813 | set_bit(desc->bTerminalID, state.unitbitmap); /* mark terminal ID as visited */ | 1813 | set_bit(desc->bTerminalID, state.unitbitmap); /* mark terminal ID as visited */ |
@@ -2047,7 +2047,7 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | |||
2047 | } | 2047 | } |
2048 | mixer->rc_setup_packet->bRequestType = | 2048 | mixer->rc_setup_packet->bRequestType = |
2049 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; | 2049 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; |
2050 | mixer->rc_setup_packet->bRequest = GET_MEM; | 2050 | mixer->rc_setup_packet->bRequest = UAC_GET_MEM; |
2051 | mixer->rc_setup_packet->wValue = cpu_to_le16(0); | 2051 | mixer->rc_setup_packet->wValue = cpu_to_le16(0); |
2052 | mixer->rc_setup_packet->wIndex = cpu_to_le16(0); | 2052 | mixer->rc_setup_packet->wIndex = cpu_to_le16(0); |
2053 | mixer->rc_setup_packet->wLength = cpu_to_le16(len); | 2053 | mixer->rc_setup_packet->wLength = cpu_to_le16(len); |
@@ -2170,7 +2170,7 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, | |||
2170 | snd_iprintf(buffer, "%s: ", jacks[i].name); | 2170 | snd_iprintf(buffer, "%s: ", jacks[i].name); |
2171 | err = snd_usb_ctl_msg(mixer->chip->dev, | 2171 | err = snd_usb_ctl_msg(mixer->chip->dev, |
2172 | usb_rcvctrlpipe(mixer->chip->dev, 0), | 2172 | usb_rcvctrlpipe(mixer->chip->dev, 0), |
2173 | GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | | 2173 | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | |
2174 | USB_RECIP_INTERFACE, 0, | 2174 | USB_RECIP_INTERFACE, 0, |
2175 | jacks[i].unitid << 8, buf, 3, 100); | 2175 | jacks[i].unitid << 8, buf, 3, 100); |
2176 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) | 2176 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) |