diff options
-rw-r--r-- | include/linux/usb/audio.h | 88 | ||||
-rw-r--r-- | sound/usb/mixer.c | 99 | ||||
-rw-r--r-- | sound/usb/mixer_maps.c | 4 |
3 files changed, 98 insertions, 93 deletions
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index ed5cf92a3c0f..c51200c715e5 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -47,6 +47,15 @@ | |||
47 | #define UAC_FORMAT_TYPE 0x02 | 47 | #define UAC_FORMAT_TYPE 0x02 |
48 | #define UAC_FORMAT_SPECIFIC 0x03 | 48 | #define UAC_FORMAT_SPECIFIC 0x03 |
49 | 49 | ||
50 | /* A.7 Processing Unit Process Types */ | ||
51 | #define UAC_PROCESS_UNDEFINED 0x00 | ||
52 | #define UAC_PROCESS_UP_DOWNMIX 0x01 | ||
53 | #define UAC_PROCESS_DOLBY_PROLOGIC 0x02 | ||
54 | #define UAC_PROCESS_STEREO_EXTENDER 0x03 | ||
55 | #define UAC_PROCESS_REVERB 0x04 | ||
56 | #define UAC_PROCESS_CHORUS 0x05 | ||
57 | #define UAC_PROCESS_DYN_RANGE_COMP 0x06 | ||
58 | |||
50 | /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ | 59 | /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ |
51 | #define UAC_EP_GENERAL 0x01 | 60 | #define UAC_EP_GENERAL 0x01 |
52 | 61 | ||
@@ -73,6 +82,60 @@ | |||
73 | 82 | ||
74 | #define UAC_GET_STAT 0xff | 83 | #define UAC_GET_STAT 0xff |
75 | 84 | ||
85 | /* A.10 Control Selector Codes */ | ||
86 | |||
87 | /* A.10.1 Terminal Control Selectors */ | ||
88 | #define UAC_TERM_COPY_PROTECT 0x01 | ||
89 | |||
90 | /* A.10.2 Feature Unit Control Selectors */ | ||
91 | #define UAC_FU_MUTE 0x01 | ||
92 | #define UAC_FU_VOLUME 0x02 | ||
93 | #define UAC_FU_BASS 0x03 | ||
94 | #define UAC_FU_MID 0x04 | ||
95 | #define UAC_FU_TREBLE 0x05 | ||
96 | #define UAC_FU_GRAPHIC_EQUALIZER 0x06 | ||
97 | #define UAC_FU_AUTOMATIC_GAIN 0x07 | ||
98 | #define UAC_FU_DELAY 0x08 | ||
99 | #define UAC_FU_BASS_BOOST 0x09 | ||
100 | #define UAC_FU_LOUDNESS 0x0a | ||
101 | |||
102 | #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1)) | ||
103 | |||
104 | /* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */ | ||
105 | #define UAC_UD_ENABLE 0x01 | ||
106 | #define UAC_UD_MODE_SELECT 0x02 | ||
107 | |||
108 | /* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */ | ||
109 | #define UAC_DP_ENABLE 0x01 | ||
110 | #define UAC_DP_MODE_SELECT 0x02 | ||
111 | |||
112 | /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */ | ||
113 | #define UAC_3D_ENABLE 0x01 | ||
114 | #define UAC_3D_SPACE 0x02 | ||
115 | |||
116 | /* A.10.3.4 Reverberation Processing Unit Control Selectors */ | ||
117 | #define UAC_REVERB_ENABLE 0x01 | ||
118 | #define UAC_REVERB_LEVEL 0x02 | ||
119 | #define UAC_REVERB_TIME 0x03 | ||
120 | #define UAC_REVERB_FEEDBACK 0x04 | ||
121 | |||
122 | /* A.10.3.5 Chorus Processing Unit Control Selectors */ | ||
123 | #define UAC_CHORUS_ENABLE 0x01 | ||
124 | #define UAC_CHORUS_LEVEL 0x02 | ||
125 | #define UAC_CHORUS_RATE 0x03 | ||
126 | #define UAC_CHORUS_DEPTH 0x04 | ||
127 | |||
128 | /* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */ | ||
129 | #define UAC_DCR_ENABLE 0x01 | ||
130 | #define UAC_DCR_RATE 0x02 | ||
131 | #define UAC_DCR_MAXAMPL 0x03 | ||
132 | #define UAC_DCR_THRESHOLD 0x04 | ||
133 | #define UAC_DCR_ATTACK_TIME 0x05 | ||
134 | #define UAC_DCR_RELEASE_TIME 0x06 | ||
135 | |||
136 | /* A.10.4 Extension Unit Control Selectors */ | ||
137 | #define UAC_XU_ENABLE 0x01 | ||
138 | |||
76 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ | 139 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ |
77 | #define UAC_MS_HEADER 0x01 | 140 | #define UAC_MS_HEADER 0x01 |
78 | #define UAC_MIDI_IN_JACK 0x02 | 141 | #define UAC_MIDI_IN_JACK 0x02 |
@@ -463,31 +526,6 @@ struct uac_iso_endpoint_descriptor { | |||
463 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 | 526 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 |
464 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 | 527 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 |
465 | 528 | ||
466 | /* A.10.2 Feature Unit Control Selectors */ | ||
467 | |||
468 | #define UAC_FU_CONTROL_UNDEFINED 0x00 | ||
469 | #define UAC_MUTE_CONTROL 0x01 | ||
470 | #define UAC_VOLUME_CONTROL 0x02 | ||
471 | #define UAC_BASS_CONTROL 0x03 | ||
472 | #define UAC_MID_CONTROL 0x04 | ||
473 | #define UAC_TREBLE_CONTROL 0x05 | ||
474 | #define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06 | ||
475 | #define UAC_AUTOMATIC_GAIN_CONTROL 0x07 | ||
476 | #define UAC_DELAY_CONTROL 0x08 | ||
477 | #define UAC_BASS_BOOST_CONTROL 0x09 | ||
478 | #define UAC_LOUDNESS_CONTROL 0x0a | ||
479 | |||
480 | #define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1)) | ||
481 | #define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1)) | ||
482 | #define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1)) | ||
483 | #define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1)) | ||
484 | #define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1)) | ||
485 | #define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1)) | ||
486 | #define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1)) | ||
487 | #define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1)) | ||
488 | #define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) | ||
489 | #define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) | ||
490 | |||
491 | /* status word format (3.7.1.1) */ | 529 | /* status word format (3.7.1.1) */ |
492 | 530 | ||
493 | #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f | 531 | #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 9149a84c716f..24428198ae1b 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -78,39 +78,6 @@ enum { | |||
78 | USB_MIXER_U16, | 78 | USB_MIXER_U16, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | enum { | ||
82 | USB_PROC_UPDOWN = 1, | ||
83 | USB_PROC_UPDOWN_SWITCH = 1, | ||
84 | USB_PROC_UPDOWN_MODE_SEL = 2, | ||
85 | |||
86 | USB_PROC_PROLOGIC = 2, | ||
87 | USB_PROC_PROLOGIC_SWITCH = 1, | ||
88 | USB_PROC_PROLOGIC_MODE_SEL = 2, | ||
89 | |||
90 | USB_PROC_3DENH = 3, | ||
91 | USB_PROC_3DENH_SWITCH = 1, | ||
92 | USB_PROC_3DENH_SPACE = 2, | ||
93 | |||
94 | USB_PROC_REVERB = 4, | ||
95 | USB_PROC_REVERB_SWITCH = 1, | ||
96 | USB_PROC_REVERB_LEVEL = 2, | ||
97 | USB_PROC_REVERB_TIME = 3, | ||
98 | USB_PROC_REVERB_DELAY = 4, | ||
99 | |||
100 | USB_PROC_CHORUS = 5, | ||
101 | USB_PROC_CHORUS_SWITCH = 1, | ||
102 | USB_PROC_CHORUS_LEVEL = 2, | ||
103 | USB_PROC_CHORUS_RATE = 3, | ||
104 | USB_PROC_CHORUS_DEPTH = 4, | ||
105 | |||
106 | USB_PROC_DCR = 6, | ||
107 | USB_PROC_DCR_SWITCH = 1, | ||
108 | USB_PROC_DCR_RATIO = 2, | ||
109 | USB_PROC_DCR_MAX_AMP = 3, | ||
110 | USB_PROC_DCR_THRESHOLD = 4, | ||
111 | USB_PROC_DCR_ATTACK = 5, | ||
112 | USB_PROC_DCR_RELEASE = 6, | ||
113 | }; | ||
114 | 81 | ||
115 | /*E-mu 0202(0404) eXtension Unit(XU) control*/ | 82 | /*E-mu 0202(0404) eXtension Unit(XU) control*/ |
116 | enum { | 83 | enum { |
@@ -980,7 +947,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
980 | 947 | ||
981 | control++; /* change from zero-based to 1-based value */ | 948 | control++; /* change from zero-based to 1-based value */ |
982 | 949 | ||
983 | if (control == UAC_GRAPHIC_EQUALIZER_CONTROL) { | 950 | if (control == UAC_FU_GRAPHIC_EQUALIZER) { |
984 | /* FIXME: not supported yet */ | 951 | /* FIXME: not supported yet */ |
985 | return; | 952 | return; |
986 | } | 953 | } |
@@ -1036,8 +1003,8 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1036 | kctl->id.name, sizeof(kctl->id.name)); | 1003 | kctl->id.name, sizeof(kctl->id.name)); |
1037 | 1004 | ||
1038 | switch (control) { | 1005 | switch (control) { |
1039 | case UAC_MUTE_CONTROL: | 1006 | case UAC_FU_MUTE: |
1040 | case UAC_VOLUME_CONTROL: | 1007 | case UAC_FU_VOLUME: |
1041 | /* determine the control name. the rule is: | 1008 | /* determine the control name. the rule is: |
1042 | * - if a name id is given in descriptor, use it. | 1009 | * - if a name id is given in descriptor, use it. |
1043 | * - if the connected input can be determined, then use the name | 1010 | * - if the connected input can be determined, then use the name |
@@ -1064,9 +1031,9 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1064 | len = append_ctl_name(kctl, " Playback"); | 1031 | len = append_ctl_name(kctl, " Playback"); |
1065 | } | 1032 | } |
1066 | } | 1033 | } |
1067 | append_ctl_name(kctl, control == UAC_MUTE_CONTROL ? | 1034 | append_ctl_name(kctl, control == UAC_FU_MUTE ? |
1068 | " Switch" : " Volume"); | 1035 | " Switch" : " Volume"); |
1069 | if (control == UAC_VOLUME_CONTROL) { | 1036 | if (control == UAC_FU_VOLUME) { |
1070 | kctl->tlv.c = mixer_vol_tlv; | 1037 | kctl->tlv.c = mixer_vol_tlv; |
1071 | kctl->vd[0].access |= | 1038 | kctl->vd[0].access |= |
1072 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | | 1039 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | |
@@ -1165,7 +1132,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1165 | snd_printk(KERN_INFO | 1132 | snd_printk(KERN_INFO |
1166 | "usbmixer: master volume quirk for PCM2702 chip\n"); | 1133 | "usbmixer: master volume quirk for PCM2702 chip\n"); |
1167 | /* disable non-functional volume control */ | 1134 | /* disable non-functional volume control */ |
1168 | master_bits &= ~UAC_FU_VOLUME; | 1135 | master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME); |
1169 | break; | 1136 | break; |
1170 | } | 1137 | } |
1171 | if (channels > 0) | 1138 | if (channels > 0) |
@@ -1410,51 +1377,51 @@ struct procunit_info { | |||
1410 | }; | 1377 | }; |
1411 | 1378 | ||
1412 | static struct procunit_value_info updown_proc_info[] = { | 1379 | static struct procunit_value_info updown_proc_info[] = { |
1413 | { USB_PROC_UPDOWN_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1380 | { UAC_UD_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1414 | { USB_PROC_UPDOWN_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 }, | 1381 | { UAC_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 }, |
1415 | { 0 } | 1382 | { 0 } |
1416 | }; | 1383 | }; |
1417 | static struct procunit_value_info prologic_proc_info[] = { | 1384 | static struct procunit_value_info prologic_proc_info[] = { |
1418 | { USB_PROC_PROLOGIC_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1385 | { UAC_DP_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1419 | { USB_PROC_PROLOGIC_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 }, | 1386 | { UAC_DP_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 }, |
1420 | { 0 } | 1387 | { 0 } |
1421 | }; | 1388 | }; |
1422 | static struct procunit_value_info threed_enh_proc_info[] = { | 1389 | static struct procunit_value_info threed_enh_proc_info[] = { |
1423 | { USB_PROC_3DENH_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1390 | { UAC_3D_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1424 | { USB_PROC_3DENH_SPACE, "Spaciousness", USB_MIXER_U8 }, | 1391 | { UAC_3D_SPACE, "Spaciousness", USB_MIXER_U8 }, |
1425 | { 0 } | 1392 | { 0 } |
1426 | }; | 1393 | }; |
1427 | static struct procunit_value_info reverb_proc_info[] = { | 1394 | static struct procunit_value_info reverb_proc_info[] = { |
1428 | { USB_PROC_REVERB_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1395 | { UAC_REVERB_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1429 | { USB_PROC_REVERB_LEVEL, "Level", USB_MIXER_U8 }, | 1396 | { UAC_REVERB_LEVEL, "Level", USB_MIXER_U8 }, |
1430 | { USB_PROC_REVERB_TIME, "Time", USB_MIXER_U16 }, | 1397 | { UAC_REVERB_TIME, "Time", USB_MIXER_U16 }, |
1431 | { USB_PROC_REVERB_DELAY, "Delay", USB_MIXER_U8 }, | 1398 | { UAC_REVERB_FEEDBACK, "Feedback", USB_MIXER_U8 }, |
1432 | { 0 } | 1399 | { 0 } |
1433 | }; | 1400 | }; |
1434 | static struct procunit_value_info chorus_proc_info[] = { | 1401 | static struct procunit_value_info chorus_proc_info[] = { |
1435 | { USB_PROC_CHORUS_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1402 | { UAC_CHORUS_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1436 | { USB_PROC_CHORUS_LEVEL, "Level", USB_MIXER_U8 }, | 1403 | { UAC_CHORUS_LEVEL, "Level", USB_MIXER_U8 }, |
1437 | { USB_PROC_CHORUS_RATE, "Rate", USB_MIXER_U16 }, | 1404 | { UAC_CHORUS_RATE, "Rate", USB_MIXER_U16 }, |
1438 | { USB_PROC_CHORUS_DEPTH, "Depth", USB_MIXER_U16 }, | 1405 | { UAC_CHORUS_DEPTH, "Depth", USB_MIXER_U16 }, |
1439 | { 0 } | 1406 | { 0 } |
1440 | }; | 1407 | }; |
1441 | static struct procunit_value_info dcr_proc_info[] = { | 1408 | static struct procunit_value_info dcr_proc_info[] = { |
1442 | { USB_PROC_DCR_SWITCH, "Switch", USB_MIXER_BOOLEAN }, | 1409 | { UAC_DCR_ENABLE, "Switch", USB_MIXER_BOOLEAN }, |
1443 | { USB_PROC_DCR_RATIO, "Ratio", USB_MIXER_U16 }, | 1410 | { UAC_DCR_RATE, "Ratio", USB_MIXER_U16 }, |
1444 | { USB_PROC_DCR_MAX_AMP, "Max Amp", USB_MIXER_S16 }, | 1411 | { UAC_DCR_MAXAMPL, "Max Amp", USB_MIXER_S16 }, |
1445 | { USB_PROC_DCR_THRESHOLD, "Threshold", USB_MIXER_S16 }, | 1412 | { UAC_DCR_THRESHOLD, "Threshold", USB_MIXER_S16 }, |
1446 | { USB_PROC_DCR_ATTACK, "Attack Time", USB_MIXER_U16 }, | 1413 | { UAC_DCR_ATTACK_TIME, "Attack Time", USB_MIXER_U16 }, |
1447 | { USB_PROC_DCR_RELEASE, "Release Time", USB_MIXER_U16 }, | 1414 | { UAC_DCR_RELEASE_TIME, "Release Time", USB_MIXER_U16 }, |
1448 | { 0 } | 1415 | { 0 } |
1449 | }; | 1416 | }; |
1450 | 1417 | ||
1451 | static struct procunit_info procunits[] = { | 1418 | static struct procunit_info procunits[] = { |
1452 | { USB_PROC_UPDOWN, "Up Down", updown_proc_info }, | 1419 | { UAC_PROCESS_UP_DOWNMIX, "Up Down", updown_proc_info }, |
1453 | { USB_PROC_PROLOGIC, "Dolby Prologic", prologic_proc_info }, | 1420 | { UAC_PROCESS_DOLBY_PROLOGIC, "Dolby Prologic", prologic_proc_info }, |
1454 | { USB_PROC_3DENH, "3D Stereo Extender", threed_enh_proc_info }, | 1421 | { UAC_PROCESS_STEREO_EXTENDER, "3D Stereo Extender", threed_enh_proc_info }, |
1455 | { USB_PROC_REVERB, "Reverb", reverb_proc_info }, | 1422 | { UAC_PROCESS_REVERB, "Reverb", reverb_proc_info }, |
1456 | { USB_PROC_CHORUS, "Chorus", chorus_proc_info }, | 1423 | { UAC_PROCESS_CHORUS, "Chorus", chorus_proc_info }, |
1457 | { USB_PROC_DCR, "DCR", dcr_proc_info }, | 1424 | { UAC_PROCESS_DYN_RANGE_COMP, "DCR", dcr_proc_info }, |
1458 | { 0 }, | 1425 | { 0 }, |
1459 | }; | 1426 | }; |
1460 | /* | 1427 | /* |
@@ -1542,7 +1509,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw | |||
1542 | cval->channels = 1; | 1509 | cval->channels = 1; |
1543 | 1510 | ||
1544 | /* get min/max values */ | 1511 | /* get min/max values */ |
1545 | if (type == USB_PROC_UPDOWN && cval->control == USB_PROC_UPDOWN_MODE_SEL) { | 1512 | if (type == UAC_PROCESS_UP_DOWNMIX && cval->control == UAC_UD_MODE_SELECT) { |
1546 | __u8 *control_spec = uac_processing_unit_specific(desc, state->mixer->protocol); | 1513 | __u8 *control_spec = uac_processing_unit_specific(desc, state->mixer->protocol); |
1547 | /* FIXME: hard-coded */ | 1514 | /* FIXME: hard-coded */ |
1548 | cval->min = 1; | 1515 | cval->min = 1; |
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index d93fc89beba8..f1324c423835 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c | |||
@@ -85,8 +85,8 @@ static struct usbmix_name_map extigy_map[] = { | |||
85 | /* 16: MU (w/o controls) */ | 85 | /* 16: MU (w/o controls) */ |
86 | { 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */ | 86 | { 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */ |
87 | { 17, "Channel Routing", 2 }, /* PU: mode select */ | 87 | { 17, "Channel Routing", 2 }, /* PU: mode select */ |
88 | { 18, "Tone Control - Bass", UAC_BASS_CONTROL }, /* FU */ | 88 | { 18, "Tone Control - Bass", UAC_FU_BASS }, /* FU */ |
89 | { 18, "Tone Control - Treble", UAC_TREBLE_CONTROL }, /* FU */ | 89 | { 18, "Tone Control - Treble", UAC_FU_TREBLE }, /* FU */ |
90 | { 18, "Master Playback" }, /* FU; others */ | 90 | { 18, "Master Playback" }, /* FU; others */ |
91 | /* 19: OT speaker */ | 91 | /* 19: OT speaker */ |
92 | /* 20: OT headphone */ | 92 | /* 20: OT headphone */ |