Commit de48c7bc authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

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: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7b8a043f
...@@ -35,8 +35,17 @@ ...@@ -35,8 +35,17 @@
#define UAC_MIXER_UNIT 0x04 #define UAC_MIXER_UNIT 0x04
#define UAC_SELECTOR_UNIT 0x05 #define UAC_SELECTOR_UNIT 0x05
#define UAC_FEATURE_UNIT 0x06 #define UAC_FEATURE_UNIT 0x06
#define UAC_PROCESSING_UNIT 0x07 #define UAC_PROCESSING_UNIT_V1 0x07
#define UAC_EXTENSION_UNIT 0x08 #define UAC_EXTENSION_UNIT_V1 0x08
/* UAC v2.0 types */
#define UAC_EFFECT_UNIT 0x07
#define UAC_PROCESSING_UNIT_V2 0x08
#define UAC_EXTENSION_UNIT_V2 0x09
#define UAC_CLOCK_SOURCE 0x0a
#define UAC_CLOCK_SELECTOR 0x0b
#define UAC_CLOCK_MULTIPLIER 0x0c
#define UAC_SAMPLE_RATE_CONVERTER 0x0d
/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
#define UAC_AS_GENERAL 0x01 #define UAC_AS_GENERAL 0x01
...@@ -69,6 +78,10 @@ ...@@ -69,6 +78,10 @@
#define UAC_GET_STAT 0xff #define UAC_GET_STAT 0xff
/* Audio class v2.0 handles all the parameter calls differently */
#define UAC2_CS_CUR 0x01
#define UAC2_CS_RANGE 0x02
/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
#define UAC_MS_HEADER 0x01 #define UAC_MS_HEADER 0x01
#define UAC_MIDI_IN_JACK 0x02 #define UAC_MIDI_IN_JACK 0x02
...@@ -133,6 +146,10 @@ struct uac_input_terminal_descriptor { ...@@ -133,6 +146,10 @@ struct uac_input_terminal_descriptor {
#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
/* Terminals - control selectors */
#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
/* 4.3.2.2 Output Terminal Descriptor */ /* 4.3.2.2 Output Terminal Descriptor */
struct uac_output_terminal_descriptor_v1 { struct uac_output_terminal_descriptor_v1 {
__u8 bLength; /* in bytes: 9 */ __u8 bLength; /* in bytes: 9 */
...@@ -263,6 +280,9 @@ struct uac_format_type_i_ext_descriptor { ...@@ -263,6 +280,9 @@ struct uac_format_type_i_ext_descriptor {
/* Formats - Audio Data Format Type I Codes */ /* Formats - Audio Data Format Type I Codes */
#define UAC_FORMAT_TYPE_II_MPEG 0x1001
#define UAC_FORMAT_TYPE_II_AC3 0x1002
struct uac_format_type_ii_discrete_descriptor { struct uac_format_type_ii_discrete_descriptor {
__u8 bLength; __u8 bLength;
__u8 bDescriptorType; __u8 bDescriptorType;
...@@ -285,6 +305,13 @@ struct uac_format_type_ii_ext_descriptor { ...@@ -285,6 +305,13 @@ struct uac_format_type_ii_ext_descriptor {
__u8 bSideBandProtocol; __u8 bSideBandProtocol;
} __attribute__((packed)); } __attribute__((packed));
/* type III */
#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
/* Formats - A.2 Format Type Codes */ /* Formats - A.2 Format Type Codes */
#define UAC_FORMAT_TYPE_UNDEFINED 0x0 #define UAC_FORMAT_TYPE_UNDEFINED 0x0
......
This diff is collapsed.
...@@ -21,106 +21,6 @@ ...@@ -21,106 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/*
*/
#define USB_SUBCLASS_AUDIO_CONTROL 0x01
#define USB_SUBCLASS_AUDIO_STREAMING 0x02
#define USB_SUBCLASS_MIDI_STREAMING 0x03
#define USB_SUBCLASS_VENDOR_SPEC 0xff
#define HEADER 0x01
#define INPUT_TERMINAL 0x02
#define OUTPUT_TERMINAL 0x03
#define MIXER_UNIT 0x04
#define SELECTOR_UNIT 0x05
#define FEATURE_UNIT 0x06
#define PROCESSING_UNIT_V1 0x07
#define EXTENSION_UNIT_V1 0x08
/* audio class v2 */
#define EFFECT_UNIT 0x07
#define PROCESSING_UNIT_V2 0x08
#define EXTENSION_UNIT_V2 0x09
#define CLOCK_SOURCE 0x0a
#define CLOCK_SELECTOR 0x0b
#define CLOCK_MULTIPLIER 0x0c
#define SAMPLE_RATE_CONVERTER 0x0d
#define AS_GENERAL 0x01
#define FORMAT_TYPE 0x02
#define FORMAT_SPECIFIC 0x03
#define EP_GENERAL 0x01
#define MS_GENERAL 0x01
#define MIDI_IN_JACK 0x02
#define MIDI_OUT_JACK 0x03
/* endpoint attributes */
#define EP_ATTR_MASK 0x0c
#define EP_ATTR_ASYNC 0x04
#define EP_ATTR_ADAPTIVE 0x08
#define EP_ATTR_SYNC 0x0c
/* cs endpoint attributes */
#define EP_CS_ATTR_SAMPLE_RATE 0x01
#define EP_CS_ATTR_PITCH_CONTROL 0x02
#define EP_CS_ATTR_FILL_MAX 0x80
/* Audio Class specific Request Codes (v1) */
#define SET_CUR 0x01
#define GET_CUR 0x81
#define SET_MIN 0x02
#define GET_MIN 0x82
#define SET_MAX 0x03
#define GET_MAX 0x83
#define SET_RES 0x04
#define GET_RES 0x84
#define SET_MEM 0x05
#define GET_MEM 0x85
#define GET_STAT 0xff
/* Audio Class specific Request Codes (v2) */
#define CS_CUR 0x01
#define CS_RANGE 0x02
/* Terminal Control Selectors */
#define COPY_PROTECT_CONTROL 0x01
/* Endpoint Control Selectors */
#define SAMPLING_FREQ_CONTROL 0x01
#define PITCH_CONTROL 0x02
/* Format Types */
#define USB_FORMAT_TYPE_I 0x01
#define USB_FORMAT_TYPE_II 0x02
#define USB_FORMAT_TYPE_III 0x03
/* type I */
#define USB_AUDIO_FORMAT_PCM 0x01
#define USB_AUDIO_FORMAT_PCM8 0x02
#define USB_AUDIO_FORMAT_IEEE_FLOAT 0x03
#define USB_AUDIO_FORMAT_ALAW 0x04
#define USB_AUDIO_FORMAT_MU_LAW 0x05
/* type II */
#define USB_AUDIO_FORMAT_MPEG 0x1001
#define USB_AUDIO_FORMAT_AC3 0x1002
/* type III */
#define USB_AUDIO_FORMAT_IEC1937_AC3 0x2001
#define USB_AUDIO_FORMAT_IEC1937_MPEG1_LAYER1 0x2002
#define USB_AUDIO_FORMAT_IEC1937_MPEG2_NOEXT 0x2003
#define USB_AUDIO_FORMAT_IEC1937_MPEG2_EXT 0x2004
#define USB_AUDIO_FORMAT_IEC1937_MPEG2_LAYER1_LS 0x2005
#define USB_AUDIO_FORMAT_IEC1937_MPEG2_LAYER23_LS 0x2006
/* maximum number of endpoints per interface */ /* maximum number of endpoints per interface */
#define MIDI_MAX_ENDPOINTS 2 #define MIDI_MAX_ENDPOINTS 2
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/usb/audio.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/control.h> #include <sound/control.h>
#include <sound/rawmidi.h> #include <sound/rawmidi.h>
...@@ -1540,7 +1542,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1540,7 +1542,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
if (hostif->extralen >= 7 && if (hostif->extralen >= 7 &&
ms_header->bLength >= 7 && ms_header->bLength >= 7 &&
ms_header->bDescriptorType == USB_DT_CS_INTERFACE && ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
ms_header->bDescriptorSubtype == HEADER) ms_header->bDescriptorSubtype == UAC_HEADER)
snd_printdd(KERN_INFO "MIDIStreaming version %02x.%02x\n", snd_printdd(KERN_INFO "MIDIStreaming version %02x.%02x\n",
ms_header->bcdMSC[1], ms_header->bcdMSC[0]); ms_header->bcdMSC[1], ms_header->bcdMSC[0]);
else else
...@@ -1556,7 +1558,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, ...@@ -1556,7 +1558,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
if (hostep->extralen < 4 || if (hostep->extralen < 4 ||
ms_ep->bLength < 4 || ms_ep->bLength < 4 ||
ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT ||
ms_ep->bDescriptorSubtype != MS_GENERAL) ms_ep->bDescriptorSubtype != UAC_MS_GENERAL)
continue; continue;
if (usb_endpoint_dir_out(ep)) { if (usb_endpoint_dir_out(ep)) {
if (endpoints[epidx].out_ep) { if (endpoints[epidx].out_ep) {
...@@ -1768,9 +1770,9 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, ...@@ -1768,9 +1770,9 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
cs_desc < hostif->extra + hostif->extralen && cs_desc[0] >= 2; cs_desc < hostif->extra + hostif->extralen && cs_desc[0] >= 2;
cs_desc += cs_desc[0]) { cs_desc += cs_desc[0]) {
if (cs_desc[1] == USB_DT_CS_INTERFACE) { if (cs_desc[1] == USB_DT_CS_INTERFACE) {
if (cs_desc[2] == MIDI_IN_JACK) if (cs_desc[2] == UAC_MIDI_IN_JACK)
endpoint->in_cables = (endpoint->in_cables << 1) | 1; endpoint->in_cables = (endpoint->in_cables << 1) | 1;
else if (cs_desc[2] == MIDI_OUT_JACK) else if (cs_desc[2] == UAC_MIDI_OUT_JACK)
endpoint->out_cables = (endpoint->out_cables << 1) | 1; endpoint->out_cables = (endpoint->out_cables << 1) | 1;
} }
} }
......
...@@ -286,7 +286,7 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char un ...@@ -286,7 +286,7 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char un
p = NULL; p = NULL;
while ((p = snd_usb_find_desc(state->buffer, state->buflen, p, while ((p = snd_usb_find_desc(state->buffer, state->buflen, p,
USB_DT_CS_INTERFACE)) != NULL) { USB_DT_CS_INTERFACE)) != NULL) {
if (p[0] >= 4 && p[2] >= INPUT_TERMINAL && p[2] <= EXTENSION_UNIT_V1 && p[3] == unit) if (p[0] >= 4 && p[2] >= UAC_INPUT_TERMINAL && p[2] <= UAC_EXTENSION_UNIT_V1 && p[3] == unit)
return p; return p;
} }
return NULL; return NULL;
...@@ -407,14 +407,14 @@ static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali ...@@ -407,14 +407,14 @@ static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali
static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value) static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value)
{ {
return get_ctl_value(cval, GET_CUR, validx, value); return get_ctl_value(cval, UAC_GET_CUR, validx, value);
} }
/* channel = 0: master, 1 = first channel */ /* channel = 0: master, 1 = first channel */
static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval, static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval,
int channel, int *value) int channel, int *value)
{ {
return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); return get_ctl_value(cval, UAC_GET_CUR, (cval->control << 8) | channel, value);
} }
static int get_cur_mix_value(struct usb_mixer_elem_info *cval, 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,14 +468,14 @@ static int set_ctl_value(struct usb_mixer_elem_info *cval, int request, int vali
static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
{ {
return set_ctl_value(cval, SET_CUR, validx, value); return set_ctl_value(cval, UAC_SET_CUR, validx, value);
} }
static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
int index, int value) int index, int value)
{ {
int err; int err;
err = set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, err = set_ctl_value(cval, UAC_SET_CUR, (cval->control << 8) | channel,
value); value);
if (err < 0) if (err < 0)
return err; return err;
...@@ -605,13 +605,13 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm ...@@ -605,13 +605,13 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm
if (term_only) if (term_only)
return 0; return 0;
switch (iterm->type >> 16) { switch (iterm->type >> 16) {
case SELECTOR_UNIT: case UAC_SELECTOR_UNIT:
strcpy(name, "Selector"); return 8; strcpy(name, "Selector"); return 8;
case PROCESSING_UNIT_V1: case UAC_PROCESSING_UNIT_V1:
strcpy(name, "Process Unit"); return 12; strcpy(name, "Process Unit"); return 12;
case EXTENSION_UNIT_V1: case UAC_EXTENSION_UNIT_V1:
strcpy(name, "Ext Unit"); return 8; strcpy(name, "Ext Unit"); return 8;
case MIXER_UNIT: case UAC_MIXER_UNIT:
strcpy(name, "Mixer"); return 5; strcpy(name, "Mixer"); return 5;
default: default:
return sprintf(name, "Unit %d", iterm->id); 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,22 +650,22 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
while ((p1 = find_audio_control_unit(state, id)) != NULL) { while ((p1 = find_audio_control_unit(state, id)) != NULL) {
term->id = id; term->id = id;
switch (p1[2]) { switch (p1[2]) {
case INPUT_TERMINAL: case UAC_INPUT_TERMINAL:
term->type = combine_word(p1 + 4); term->type = combine_word(p1 + 4);
term->channels = p1[7]; term->channels = p1[7];
term->chconfig = combine_word(p1 + 8); term->chconfig = combine_word(p1 + 8);
term->name = p1[11]; term->name = p1[11];
return 0; return 0;
case FEATURE_UNIT: case UAC_FEATURE_UNIT:
id = p1[4]; id = p1[4];
break; /* continue to parse */ break; /* continue to parse */
case MIXER_UNIT: case UAC_MIXER_UNIT:
term->type = p1[2] << 16; /* virtual type */ term->type = p1[2] << 16; /* virtual type */
term->channels = p1[5 + p1[4]]; term->channels = p1[5 + p1[4]];
term->chconfig = combine_word(p1 + 6 + p1[4]); term->chconfig = combine_word(p1 + 6 + p1[4]);
term->name = p1[p1[0] - 1]; term->name = p1[p1[0] - 1];
return 0; return 0;
case SELECTOR_UNIT: case UAC_SELECTOR_UNIT:
/* call recursively to retrieve the channel info */ /* call recursively to retrieve the channel info */
if (check_input_term(state, p1[5], term) < 0) if (check_input_term(state, p1[5], term) < 0)
return -ENODEV; return -ENODEV;
...@@ -673,8 +673,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ ...@@ -673,8 +673,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
term->id = id; term->id = id;
term->name = p1[9 + p1[0] - 1]; term->name = p1[9 + p1[0] - 1];
return 0; return 0;
case PROCESSING_UNIT_V1: case UAC_PROCESSING_UNIT_V1:
case EXTENSION_UNIT_V1: case UAC_EXTENSION_UNIT_V1:
if (p1[6] == 1) { if (p1[6] == 1) {
id = p1[7]; id = p1[7];
break; /* continue to parse */ break; /* continue to parse */
...@@ -752,23 +752,23 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) ...@@ -752,23 +752,23 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min)
break; break;
} }
} }
if (get_ctl_value(cval, GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 ||
get_ctl_value(cval, GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) {
snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n", snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n",
cval->id, cval->mixer->ctrlif, cval->control, cval->id); cval->id, cval->mixer->ctrlif, cval->control, cval->id);
return -EINVAL; return -EINVAL;
} }
if (get_ctl_value(cval, GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) { if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) {
cval->res = 1; cval->res = 1;
} else { } else {
int last_valid_res = cval->res; int last_valid_res = cval->res;
while (cval->res > 1) { while (cval->res > 1) {
if (set_ctl_value(cval, SET_RES, (cval->control << 8) | minchn, cval->res / 2) < 0) if (set_ctl_value(cval, UAC_SET_RES, (cval->control << 8) | minchn, cval->res / 2) < 0)
break; break;
cval->res /= 2; cval->res /= 2;
} }
if (get_ctl_value(cval, GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0)
cval->res = last_valid_res; cval->res = last_valid_res;
} }
if (cval->res == 0) if (cval->res == 0)
...@@ -1097,7 +1097,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void ...@@ -1097,7 +1097,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
struct uac_feature_unit_descriptor *ftr = _ftr; struct uac_feature_unit_descriptor *ftr = _ftr;
if (ftr->bLength < 7 || ! (csize = ftr->bControlSize) || ftr->bLength < 7 + csize) { if (ftr->bLength < 7 || ! (csize = ftr->bControlSize) || ftr->bLength < 7 + csize) {
snd_printk(KERN_ERR "usbaudio: unit %u: invalid FEATURE_UNIT descriptor\n", unitid); snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid);
return -EINVAL; return -EINVAL;
} }
...@@ -1739,17 +1739,17 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) ...@@ -1739,17 +1739,17 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
} }
switch (p1[2]) { switch (p1[2]) {
case INPUT_TERMINAL: case UAC_INPUT_TERMINAL:
return 0; /* NOP */ return 0; /* NOP */
case MIXER_UNIT: case UAC_MIXER_UNIT:
return parse_audio_mixer_unit(state, unitid, p1); return parse_audio_mixer_unit(state, unitid, p1);
case SELECTOR_UNIT: case UAC_SELECTOR_UNIT:
return parse_audio_selector_unit(state, unitid, p1); return parse_audio_selector_unit(state, unitid, p1);
case FEATURE_UNIT: case UAC_FEATURE_UNIT:
return parse_audio_feature_unit(state, unitid, p1); return parse_audio_feature_unit(state, unitid, p1);
case PROCESSING_UNIT_V1: case UAC_PROCESSING_UNIT_V1:
return parse_audio_processing_unit(state, unitid, p1); return parse_audio_processing_unit(state, unitid, p1);
case EXTENSION_UNIT_V1: case UAC_EXTENSION_UNIT_V1:
return parse_audio_extension_unit(state, unitid, p1); return parse_audio_extension_unit(state, unitid, p1);
default: default:
snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); 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,7 +1779,7 @@ static int snd_usb_mixer_dev_free(struct snd_device *device)
/* /*
* create mixer controls * create mixer controls
* *
* walk through all OUTPUT_TERMINAL descriptors to search for mixers * walk through all UAC_OUTPUT_TERMINAL descriptors to search for mixers
*/ */
static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
{ {
...@@ -1807,7 +1807,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) ...@@ -1807,7 +1807,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
} }
desc = NULL; desc = NULL;
while ((desc = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, desc, OUTPUT_TERMINAL)) != NULL) { while ((desc = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, desc, UAC_OUTPUT_TERMINAL)) != NULL) {
if (desc->bLength < 9) if (desc->bLength < 9)
continue; /* invalid descriptor? */ continue; /* invalid descriptor? */
set_bit(desc->bTerminalID, state.unitbitmap); /* mark terminal ID as visited */ 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,7 +2047,7 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
} }
mixer->rc_setup_packet->bRequestType = mixer->rc_setup_packet->bRequestType =
USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
mixer->rc_setup_packet->bRequest = GET_MEM; mixer->rc_setup_packet->bRequest = UAC_GET_MEM;
mixer->rc_setup_packet->wValue = cpu_to_le16(0); mixer->rc_setup_packet->wValue = cpu_to_le16(0);
mixer->rc_setup_packet->wIndex = cpu_to_le16(0); mixer->rc_setup_packet->wIndex = cpu_to_le16(0);
mixer->rc_setup_packet->wLength = cpu_to_le16(len); 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,7 +2170,7 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "%s: ", jacks[i].name); snd_iprintf(buffer, "%s: ", jacks[i].name);
err = snd_usb_ctl_msg(mixer->chip->dev, err = snd_usb_ctl_msg(mixer->chip->dev,
usb_rcvctrlpipe(mixer->chip->dev, 0), usb_rcvctrlpipe(mixer->chip->dev, 0),
GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
USB_RECIP_INTERFACE, 0, USB_RECIP_INTERFACE, 0,
jacks[i].unitid << 8, buf, 3, 100); jacks[i].unitid << 8, buf, 3, 100);
if (err == 3 && (buf[0] == 3 || buf[0] == 6)) if (err == 3 && (buf[0] == 3 || buf[0] == 6))
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x0850, .idProduct = 0x0850,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x08ae, .idProduct = 0x08ae,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x08c6, .idProduct = 0x08c6,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x08f0, .idProduct = 0x08f0,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x08f5, .idProduct = 0x08f5,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
.idVendor = 0x046d, .idVendor = 0x046d,
.idProduct = 0x08f6, .idProduct = 0x08f6,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
}, },
{ {
USB_DEVICE(0x046d, 0x0990), USB_DEVICE(0x046d, 0x0990),
...@@ -301,7 +301,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -301,7 +301,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.iface = 1, .iface = 1,
.altsetting = 1, .altsetting = 1,
.altset_idx = 1, .altset_idx = 1,
.attributes = EP_CS_ATTR_FILL_MAX, .attributes = UAC_EP_CS_ATTR_FILL_MAX,
.endpoint = 0x81, .endpoint = 0x81,
.ep_attr = 0x05, .ep_attr = 0x05,
.rates = SNDRV_PCM_RATE_CONTINUOUS, .rates = SNDRV_PCM_RATE_CONTINUOUS,
...@@ -2108,7 +2108,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2108,7 +2108,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2122,7 +2122,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2122,7 +2122,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2136,7 +2136,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2136,7 +2136,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2150,7 +2150,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2150,7 +2150,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2164,7 +2164,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2164,7 +2164,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2178,7 +2178,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2178,7 +2178,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2192,7 +2192,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2192,7 +2192,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-950Q", .product_name = "HVR-950Q",
...@@ -2206,7 +2206,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2206,7 +2206,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "Hauppauge", .vendor_name = "Hauppauge",
.product_name = "HVR-850", .product_name = "HVR-850",
...@@ -2238,7 +2238,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2238,7 +2238,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.iface = 1, .iface = 1,
.altsetting = 1, .altsetting = 1,
.altset_idx = 1, .altset_idx = 1,
.attributes = EP_CS_ATTR_SAMPLE_RATE, .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
.endpoint = 0x02, .endpoint = 0x02,
.ep_attr = 0x01, .ep_attr = 0x01,
.maxpacksize = 0x130, .maxpacksize = 0x130,
...@@ -2268,7 +2268,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2268,7 +2268,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
USB_DEVICE_ID_MATCH_INT_SUBCLASS, USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_AUDIO, .bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_MIDI_STREAMING, .bInterfaceSubClass = USB_SUBCLASS_MIDISTREAMING,
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
.ifnum = QUIRK_ANY_INTERFACE, .ifnum = QUIRK_ANY_INTERFACE,
.type = QUIRK_MIDI_STANDARD_INTERFACE .type = QUIRK_MIDI_STANDARD_INTERFACE
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/hwdep.h> #include <sound/hwdep.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -315,9 +317,9 @@ static int us122l_set_sample_rate(struct usb_device *dev, int rate) ...@@ -315,9 +317,9 @@ static int us122l_set_sample_rate(struct usb_device *dev, int rate)
data[0] = rate; data[0] = rate;
data[1] = rate >> 8; data[1] = rate >> 8;
data[2] = rate >> 16; data[2] = rate >> 16;
err = us122l_ctl_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, err = us122l_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000); UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3, 1000);
if (err < 0) if (err < 0)
snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n", snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n",
dev->devnum, rate, ep); dev->devnum, rate, ep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment