aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-02-22 17:49:10 -0500
committerTakashi Iwai <tiwai@suse.de>2010-02-23 02:40:20 -0500
commit8fee4aff8c89c229593b76a6ab172a9cad24b412 (patch)
treefa04320ed558000ee0e131808e14698ddd4fe3ce /sound/usb
parent28e1b773083d349d5223f586a39fa30f5d0f1c36 (diff)
ALSA: usbaudio: introduce new types for audio class v2
This patch adds some definitions for audio class v2. Unfortunately, the UNIT types PROCESSING_UNIT and EXTENSION_UNIT have different numerical representations in both standards, so there is need for a _V1 add-on now. usbmixer.c is changed accordingly. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/usbaudio.h19
-rw-r--r--sound/usb/usbmixer.c14
2 files changed, 23 insertions, 10 deletions
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 9d8cea48fc5f..4f482939e8e8 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -36,8 +36,17 @@
36#define MIXER_UNIT 0x04 36#define MIXER_UNIT 0x04
37#define SELECTOR_UNIT 0x05 37#define SELECTOR_UNIT 0x05
38#define FEATURE_UNIT 0x06 38#define FEATURE_UNIT 0x06
39#define PROCESSING_UNIT 0x07 39#define PROCESSING_UNIT_V1 0x07
40#define EXTENSION_UNIT 0x08 40#define EXTENSION_UNIT_V1 0x08
41
42/* audio class v2 */
43#define EFFECT_UNIT 0x07
44#define PROCESSING_UNIT_V2 0x08
45#define EXTENSION_UNIT_V2 0x09
46#define CLOCK_SOURCE 0x0a
47#define CLOCK_SELECTOR 0x0b
48#define CLOCK_MULTIPLIER 0x0c
49#define SAMPLE_RATE_CONVERTER 0x0d
41 50
42#define AS_GENERAL 0x01 51#define AS_GENERAL 0x01
43#define FORMAT_TYPE 0x02 52#define FORMAT_TYPE 0x02
@@ -60,7 +69,7 @@
60#define EP_CS_ATTR_PITCH_CONTROL 0x02 69#define EP_CS_ATTR_PITCH_CONTROL 0x02
61#define EP_CS_ATTR_FILL_MAX 0x80 70#define EP_CS_ATTR_FILL_MAX 0x80
62 71
63/* Audio Class specific Request Codes */ 72/* Audio Class specific Request Codes (v1) */
64 73
65#define SET_CUR 0x01 74#define SET_CUR 0x01
66#define GET_CUR 0x81 75#define GET_CUR 0x81
@@ -74,6 +83,10 @@
74#define GET_MEM 0x85 83#define GET_MEM 0x85
75#define GET_STAT 0xff 84#define GET_STAT 0xff
76 85
86/* Audio Class specific Request Codes (v2) */
87#define CS_CUR 0x01
88#define CS_RANGE 0x02
89
77/* Terminal Control Selectors */ 90/* Terminal Control Selectors */
78 91
79#define COPY_PROTECT_CONTROL 0x01 92#define COPY_PROTECT_CONTROL 0x01
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 11636a6112d5..ca7949598191 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 && p[3] == unit) 289 if (p[0] >= 4 && p[2] >= INPUT_TERMINAL && p[2] <= EXTENSION_UNIT_V1 && p[3] == unit)
290 return p; 290 return p;
291 } 291 }
292 return NULL; 292 return NULL;
@@ -607,9 +607,9 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm
607 switch (iterm->type >> 16) { 607 switch (iterm->type >> 16) {
608 case SELECTOR_UNIT: 608 case SELECTOR_UNIT:
609 strcpy(name, "Selector"); return 8; 609 strcpy(name, "Selector"); return 8;
610 case PROCESSING_UNIT: 610 case PROCESSING_UNIT_V1:
611 strcpy(name, "Process Unit"); return 12; 611 strcpy(name, "Process Unit"); return 12;
612 case EXTENSION_UNIT: 612 case EXTENSION_UNIT_V1:
613 strcpy(name, "Ext Unit"); return 8; 613 strcpy(name, "Ext Unit"); return 8;
614 case MIXER_UNIT: 614 case MIXER_UNIT:
615 strcpy(name, "Mixer"); return 5; 615 strcpy(name, "Mixer"); return 5;
@@ -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: 676 case PROCESSING_UNIT_V1:
677 case EXTENSION_UNIT: 677 case 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 */
@@ -1747,9 +1747,9 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
1747 return parse_audio_selector_unit(state, unitid, p1); 1747 return parse_audio_selector_unit(state, unitid, p1);
1748 case FEATURE_UNIT: 1748 case FEATURE_UNIT:
1749 return parse_audio_feature_unit(state, unitid, p1); 1749 return parse_audio_feature_unit(state, unitid, p1);
1750 case PROCESSING_UNIT: 1750 case 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: 1752 case 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]);