| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 1 | /* | 
|  | 2 | * <linux/usb/audio.h> -- USB Audio definitions. | 
|  | 3 | * | 
|  | 4 | * Copyright (C) 2006 Thumtronics Pty Ltd. | 
|  | 5 | * Developed for Thumtronics by Grey Innovation | 
|  | 6 | * Ben Williamson <ben.williamson@greyinnovation.com> | 
|  | 7 | * | 
|  | 8 | * This software is distributed under the terms of the GNU General Public | 
|  | 9 | * License ("GPL") version 2, as published by the Free Software Foundation. | 
|  | 10 | * | 
|  | 11 | * This file holds USB constants and structures defined | 
|  | 12 | * by the USB Device Class Definition for Audio Devices. | 
|  | 13 | * Comments below reference relevant sections of that document: | 
|  | 14 | * | 
|  | 15 | * http://www.usb.org/developers/devclass_docs/audio10.pdf | 
| Daniel Mack | 7e84789 | 2010-03-11 21:13:20 +0100 | [diff] [blame] | 16 | * | 
|  | 17 | * Types and defines in this file are either specific to version 1.0 of | 
|  | 18 | * this standard or common for newer versions. | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 19 | */ | 
|  | 20 |  | 
|  | 21 | #ifndef __LINUX_USB_AUDIO_H | 
|  | 22 | #define __LINUX_USB_AUDIO_H | 
|  | 23 |  | 
|  | 24 | #include <linux/types.h> | 
|  | 25 |  | 
| Daniel Mack | 7e84789 | 2010-03-11 21:13:20 +0100 | [diff] [blame] | 26 | /* bInterfaceProtocol values to denote the version of the standard used */ | 
|  | 27 | #define UAC_VERSION_1			0x00 | 
|  | 28 | #define UAC_VERSION_2			0x20 | 
|  | 29 |  | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 30 | /* A.2 Audio Interface Subclass Codes */ | 
|  | 31 | #define USB_SUBCLASS_AUDIOCONTROL	0x01 | 
|  | 32 | #define USB_SUBCLASS_AUDIOSTREAMING	0x02 | 
|  | 33 | #define USB_SUBCLASS_MIDISTREAMING	0x03 | 
|  | 34 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 35 | /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ | 
|  | 36 | #define UAC_HEADER			0x01 | 
|  | 37 | #define UAC_INPUT_TERMINAL		0x02 | 
|  | 38 | #define UAC_OUTPUT_TERMINAL		0x03 | 
|  | 39 | #define UAC_MIXER_UNIT			0x04 | 
|  | 40 | #define UAC_SELECTOR_UNIT		0x05 | 
|  | 41 | #define UAC_FEATURE_UNIT		0x06 | 
| Daniel Mack | 69da9bc | 2010-06-16 17:57:28 +0200 | [diff] [blame] | 42 | #define UAC1_PROCESSING_UNIT		0x07 | 
|  | 43 | #define UAC1_EXTENSION_UNIT		0x08 | 
| Daniel Mack | de48c7b | 2010-02-22 23:49:13 +0100 | [diff] [blame] | 44 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 45 | /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ | 
|  | 46 | #define UAC_AS_GENERAL			0x01 | 
|  | 47 | #define UAC_FORMAT_TYPE			0x02 | 
|  | 48 | #define UAC_FORMAT_SPECIFIC		0x03 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 49 |  | 
| Daniel Mack | 65f25da | 2010-05-31 13:35:41 +0200 | [diff] [blame] | 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 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 59 | /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ | 
|  | 60 | #define UAC_EP_GENERAL			0x01 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 61 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 62 | /* A.9 Audio Class-Specific Request Codes */ | 
|  | 63 | #define UAC_SET_			0x00 | 
|  | 64 | #define UAC_GET_			0x80 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 65 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 66 | #define UAC__CUR			0x1 | 
|  | 67 | #define UAC__MIN			0x2 | 
|  | 68 | #define UAC__MAX			0x3 | 
|  | 69 | #define UAC__RES			0x4 | 
|  | 70 | #define UAC__MEM			0x5 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 71 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 72 | #define UAC_SET_CUR			(UAC_SET_ | UAC__CUR) | 
|  | 73 | #define UAC_GET_CUR			(UAC_GET_ | UAC__CUR) | 
|  | 74 | #define UAC_SET_MIN			(UAC_SET_ | UAC__MIN) | 
|  | 75 | #define UAC_GET_MIN			(UAC_GET_ | UAC__MIN) | 
|  | 76 | #define UAC_SET_MAX			(UAC_SET_ | UAC__MAX) | 
|  | 77 | #define UAC_GET_MAX			(UAC_GET_ | UAC__MAX) | 
|  | 78 | #define UAC_SET_RES			(UAC_SET_ | UAC__RES) | 
|  | 79 | #define UAC_GET_RES			(UAC_GET_ | UAC__RES) | 
|  | 80 | #define UAC_SET_MEM			(UAC_SET_ | UAC__MEM) | 
|  | 81 | #define UAC_GET_MEM			(UAC_GET_ | UAC__MEM) | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 82 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 83 | #define UAC_GET_STAT			0xff | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 84 |  | 
| Daniel Mack | 65f25da | 2010-05-31 13:35:41 +0200 | [diff] [blame] | 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 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 139 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ | 
|  | 140 | #define UAC_MS_HEADER			0x01 | 
|  | 141 | #define UAC_MIDI_IN_JACK		0x02 | 
|  | 142 | #define UAC_MIDI_OUT_JACK		0x03 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 143 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 144 | /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ | 
|  | 145 | #define UAC_MS_GENERAL			0x01 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 146 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 147 | /* Terminals - 2.1 USB Terminal Types */ | 
|  | 148 | #define UAC_TERMINAL_UNDEFINED		0x100 | 
|  | 149 | #define UAC_TERMINAL_STREAMING		0x101 | 
|  | 150 | #define UAC_TERMINAL_VENDOR_SPEC	0x1FF | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 151 |  | 
|  | 152 | /* Terminal Control Selectors */ | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 153 | /* 4.3.2  Class-Specific AC Interface Descriptor */ | 
| Daniel Mack | 69da9bc | 2010-06-16 17:57:28 +0200 | [diff] [blame] | 154 | struct uac1_ac_header_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 155 | __u8  bLength;			/* 8 + n */ | 
| Greg Kroah-Hartman | 41dceed | 2008-01-30 15:21:33 -0800 | [diff] [blame] | 156 | __u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */ | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 157 | __u8  bDescriptorSubtype;	/* UAC_MS_HEADER */ | 
| Greg Kroah-Hartman | 41dceed | 2008-01-30 15:21:33 -0800 | [diff] [blame] | 158 | __le16 bcdADC;			/* 0x0100 */ | 
|  | 159 | __le16 wTotalLength;		/* includes Unit and Terminal desc. */ | 
|  | 160 | __u8  bInCollection;		/* n */ | 
|  | 161 | __u8  baInterfaceNr[];		/* [n] */ | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 162 | } __attribute__ ((packed)); | 
|  | 163 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 164 | #define UAC_DT_AC_HEADER_SIZE(n)	(8 + (n)) | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 165 |  | 
|  | 166 | /* As above, but more useful for defining your own descriptors: */ | 
| Greg Kroah-Hartman | 0858a3a | 2010-05-17 10:58:12 -0700 | [diff] [blame] | 167 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n)			\ | 
| Daniel Mack | 69da9bc | 2010-06-16 17:57:28 +0200 | [diff] [blame] | 168 | struct uac1_ac_header_descriptor_##n {			\ | 
| Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 169 | __u8  bLength;						\ | 
|  | 170 | __u8  bDescriptorType;					\ | 
|  | 171 | __u8  bDescriptorSubtype;				\ | 
|  | 172 | __le16 bcdADC;						\ | 
|  | 173 | __le16 wTotalLength;					\ | 
|  | 174 | __u8  bInCollection;					\ | 
|  | 175 | __u8  baInterfaceNr[n];					\ | 
|  | 176 | } __attribute__ ((packed)) | 
|  | 177 |  | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 178 | /* 4.3.2.1 Input Terminal Descriptor */ | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 179 | struct uac_input_terminal_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 180 | __u8  bLength;			/* in bytes: 12 */ | 
|  | 181 | __u8  bDescriptorType;		/* CS_INTERFACE descriptor type */ | 
|  | 182 | __u8  bDescriptorSubtype;	/* INPUT_TERMINAL descriptor subtype */ | 
|  | 183 | __u8  bTerminalID;		/* Constant uniquely terminal ID */ | 
|  | 184 | __le16 wTerminalType;		/* USB Audio Terminal Types */ | 
|  | 185 | __u8  bAssocTerminal;		/* ID of the Output Terminal associated */ | 
|  | 186 | __u8  bNrChannels;		/* Number of logical output channels */ | 
|  | 187 | __le16 wChannelConfig; | 
|  | 188 | __u8  iChannelNames; | 
|  | 189 | __u8  iTerminal; | 
|  | 190 | } __attribute__ ((packed)); | 
|  | 191 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 192 | #define UAC_DT_INPUT_TERMINAL_SIZE			12 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 193 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 194 | /* Terminals - 2.2 Input Terminal Types */ | 
|  | 195 | #define UAC_INPUT_TERMINAL_UNDEFINED			0x200 | 
|  | 196 | #define UAC_INPUT_TERMINAL_MICROPHONE			0x201 | 
|  | 197 | #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE		0x202 | 
|  | 198 | #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE		0x203 | 
|  | 199 | #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE		0x204 | 
|  | 200 | #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY		0x205 | 
|  | 201 | #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY	0x206 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 202 |  | 
| Daniel Mack | de48c7b | 2010-02-22 23:49:13 +0100 | [diff] [blame] | 203 | /* Terminals - control selectors */ | 
|  | 204 |  | 
|  | 205 | #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL		0x01 | 
|  | 206 |  | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 207 | /* 4.3.2.2 Output Terminal Descriptor */ | 
| Daniel Mack | 69da9bc | 2010-06-16 17:57:28 +0200 | [diff] [blame] | 208 | struct uac1_output_terminal_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 209 | __u8  bLength;			/* in bytes: 9 */ | 
|  | 210 | __u8  bDescriptorType;		/* CS_INTERFACE descriptor type */ | 
|  | 211 | __u8  bDescriptorSubtype;	/* OUTPUT_TERMINAL descriptor subtype */ | 
|  | 212 | __u8  bTerminalID;		/* Constant uniquely terminal ID */ | 
|  | 213 | __le16 wTerminalType;		/* USB Audio Terminal Types */ | 
|  | 214 | __u8  bAssocTerminal;		/* ID of the Input Terminal associated */ | 
|  | 215 | __u8  bSourceID;		/* ID of the connected Unit or Terminal*/ | 
|  | 216 | __u8  iTerminal; | 
|  | 217 | } __attribute__ ((packed)); | 
|  | 218 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 219 | #define UAC_DT_OUTPUT_TERMINAL_SIZE			9 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 220 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 221 | /* Terminals - 2.3 Output Terminal Types */ | 
|  | 222 | #define UAC_OUTPUT_TERMINAL_UNDEFINED			0x300 | 
|  | 223 | #define UAC_OUTPUT_TERMINAL_SPEAKER			0x301 | 
|  | 224 | #define UAC_OUTPUT_TERMINAL_HEADPHONES			0x302 | 
|  | 225 | #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO	0x303 | 
|  | 226 | #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER		0x304 | 
|  | 227 | #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER		0x305 | 
|  | 228 | #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER	0x306 | 
|  | 229 | #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER	0x307 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 230 |  | 
|  | 231 | /* Set bControlSize = 2 as default setting */ | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 232 | #define UAC_DT_FEATURE_UNIT_SIZE(ch)		(7 + ((ch) + 1) * 2) | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 233 |  | 
|  | 234 | /* As above, but more useful for defining your own descriptors: */ | 
| Greg Kroah-Hartman | 0858a3a | 2010-05-17 10:58:12 -0700 | [diff] [blame] | 235 | #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch)			\ | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 236 | struct uac_feature_unit_descriptor_##ch {			\ | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 237 | __u8  bLength;						\ | 
|  | 238 | __u8  bDescriptorType;					\ | 
|  | 239 | __u8  bDescriptorSubtype;				\ | 
|  | 240 | __u8  bUnitID;						\ | 
|  | 241 | __u8  bSourceID;					\ | 
|  | 242 | __u8  bControlSize;					\ | 
|  | 243 | __le16 bmaControls[ch + 1];				\ | 
|  | 244 | __u8  iFeature;						\ | 
|  | 245 | } __attribute__ ((packed)) | 
|  | 246 |  | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 247 | /* 4.3.2.3 Mixer Unit Descriptor */ | 
|  | 248 | struct uac_mixer_unit_descriptor { | 
|  | 249 | __u8 bLength; | 
|  | 250 | __u8 bDescriptorType; | 
|  | 251 | __u8 bDescriptorSubtype; | 
|  | 252 | __u8 bUnitID; | 
|  | 253 | __u8 bNrInPins; | 
|  | 254 | __u8 baSourceID[]; | 
|  | 255 | } __attribute__ ((packed)); | 
|  | 256 |  | 
|  | 257 | static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) | 
|  | 258 | { | 
|  | 259 | return desc->baSourceID[desc->bNrInPins]; | 
|  | 260 | } | 
|  | 261 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 262 | static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc, | 
|  | 263 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 264 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 265 | if (protocol == UAC_VERSION_1) | 
|  | 266 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | 
|  | 267 | desc->baSourceID[desc->bNrInPins + 1]; | 
|  | 268 | else | 
|  | 269 | return  (desc->baSourceID[desc->bNrInPins + 4] << 24) | | 
|  | 270 | (desc->baSourceID[desc->bNrInPins + 3] << 16) | | 
|  | 271 | (desc->baSourceID[desc->bNrInPins + 2] << 8)  | | 
|  | 272 | (desc->baSourceID[desc->bNrInPins + 1]); | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 273 | } | 
|  | 274 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 275 | static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc, | 
|  | 276 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 277 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 278 | return (protocol == UAC_VERSION_1) ? | 
|  | 279 | desc->baSourceID[desc->bNrInPins + 3] : | 
|  | 280 | desc->baSourceID[desc->bNrInPins + 5]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 281 | } | 
|  | 282 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 283 | static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc, | 
|  | 284 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 285 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 286 | return (protocol == UAC_VERSION_1) ? | 
|  | 287 | &desc->baSourceID[desc->bNrInPins + 4] : | 
|  | 288 | &desc->baSourceID[desc->bNrInPins + 6]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 289 | } | 
|  | 290 |  | 
|  | 291 | static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) | 
|  | 292 | { | 
|  | 293 | __u8 *raw = (__u8 *) desc; | 
|  | 294 | return raw[desc->bLength - 1]; | 
|  | 295 | } | 
|  | 296 |  | 
|  | 297 | /* 4.3.2.4 Selector Unit Descriptor */ | 
|  | 298 | struct uac_selector_unit_descriptor { | 
|  | 299 | __u8 bLength; | 
|  | 300 | __u8 bDescriptorType; | 
|  | 301 | __u8 bDescriptorSubtype; | 
|  | 302 | __u8 bUintID; | 
|  | 303 | __u8 bNrInPins; | 
|  | 304 | __u8 baSourceID[]; | 
|  | 305 | } __attribute__ ((packed)); | 
|  | 306 |  | 
|  | 307 | static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) | 
|  | 308 | { | 
|  | 309 | __u8 *raw = (__u8 *) desc; | 
| Daniel Mack | 7176d37 | 2010-05-31 13:35:39 +0200 | [diff] [blame] | 310 | return raw[desc->bLength - 1]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 311 | } | 
|  | 312 |  | 
|  | 313 | /* 4.3.2.5 Feature Unit Descriptor */ | 
|  | 314 | struct uac_feature_unit_descriptor { | 
|  | 315 | __u8 bLength; | 
|  | 316 | __u8 bDescriptorType; | 
|  | 317 | __u8 bDescriptorSubtype; | 
|  | 318 | __u8 bUnitID; | 
|  | 319 | __u8 bSourceID; | 
|  | 320 | __u8 bControlSize; | 
|  | 321 | __u8 bmaControls[0]; /* variable length */ | 
|  | 322 | } __attribute__((packed)); | 
|  | 323 |  | 
|  | 324 | static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) | 
|  | 325 | { | 
|  | 326 | __u8 *raw = (__u8 *) desc; | 
|  | 327 | return raw[desc->bLength - 1]; | 
|  | 328 | } | 
|  | 329 |  | 
|  | 330 | /* 4.3.2.6 Processing Unit Descriptors */ | 
|  | 331 | struct uac_processing_unit_descriptor { | 
|  | 332 | __u8 bLength; | 
|  | 333 | __u8 bDescriptorType; | 
|  | 334 | __u8 bDescriptorSubtype; | 
|  | 335 | __u8 bUnitID; | 
|  | 336 | __u16 wProcessType; | 
|  | 337 | __u8 bNrInPins; | 
|  | 338 | __u8 baSourceID[]; | 
|  | 339 | } __attribute__ ((packed)); | 
|  | 340 |  | 
|  | 341 | static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) | 
|  | 342 | { | 
|  | 343 | return desc->baSourceID[desc->bNrInPins]; | 
|  | 344 | } | 
|  | 345 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 346 | static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc, | 
|  | 347 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 348 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 349 | if (protocol == UAC_VERSION_1) | 
|  | 350 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | 
|  | 351 | desc->baSourceID[desc->bNrInPins + 1]; | 
|  | 352 | else | 
|  | 353 | return  (desc->baSourceID[desc->bNrInPins + 4] << 24) | | 
|  | 354 | (desc->baSourceID[desc->bNrInPins + 3] << 16) | | 
|  | 355 | (desc->baSourceID[desc->bNrInPins + 2] << 8)  | | 
|  | 356 | (desc->baSourceID[desc->bNrInPins + 1]); | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 357 | } | 
|  | 358 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 359 | static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc, | 
|  | 360 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 361 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 362 | return (protocol == UAC_VERSION_1) ? | 
|  | 363 | desc->baSourceID[desc->bNrInPins + 3] : | 
|  | 364 | desc->baSourceID[desc->bNrInPins + 5]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 365 | } | 
|  | 366 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 367 | static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, | 
|  | 368 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 369 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 370 | return (protocol == UAC_VERSION_1) ? | 
|  | 371 | desc->baSourceID[desc->bNrInPins + 4] : | 
|  | 372 | desc->baSourceID[desc->bNrInPins + 6]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 373 | } | 
|  | 374 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 375 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, | 
|  | 376 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 377 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 378 | return (protocol == UAC_VERSION_1) ? | 
|  | 379 | &desc->baSourceID[desc->bNrInPins + 5] : | 
|  | 380 | &desc->baSourceID[desc->bNrInPins + 7]; | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 381 | } | 
|  | 382 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 383 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, | 
|  | 384 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 385 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 386 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 387 | return desc->baSourceID[desc->bNrInPins + control_size]; | 
|  | 388 | } | 
|  | 389 |  | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 390 | static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, | 
|  | 391 | int protocol) | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 392 | { | 
| Daniel Mack | 23caaf1 | 2010-03-11 21:13:25 +0100 | [diff] [blame] | 393 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); | 
| Daniel Mack | 99fc864 | 2010-03-11 21:13:24 +0100 | [diff] [blame] | 394 | return &desc->baSourceID[desc->bNrInPins + control_size + 1]; | 
|  | 395 | } | 
|  | 396 |  | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 397 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | 
| Daniel Mack | 69da9bc | 2010-06-16 17:57:28 +0200 | [diff] [blame] | 398 | struct uac1_as_header_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 399 | __u8  bLength;			/* in bytes: 7 */ | 
|  | 400 | __u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */ | 
|  | 401 | __u8  bDescriptorSubtype;	/* AS_GENERAL */ | 
|  | 402 | __u8  bTerminalLink;		/* Terminal ID of connected Terminal */ | 
|  | 403 | __u8  bDelay;			/* Delay introduced by the data path */ | 
|  | 404 | __le16 wFormatTag;		/* The Audio Data Format */ | 
|  | 405 | } __attribute__ ((packed)); | 
|  | 406 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 407 | #define UAC_DT_AS_HEADER_SIZE		7 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 408 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 409 | /* Formats - A.1.1 Audio Data Format Type I Codes */ | 
|  | 410 | #define UAC_FORMAT_TYPE_I_UNDEFINED	0x0 | 
|  | 411 | #define UAC_FORMAT_TYPE_I_PCM		0x1 | 
|  | 412 | #define UAC_FORMAT_TYPE_I_PCM8		0x2 | 
|  | 413 | #define UAC_FORMAT_TYPE_I_IEEE_FLOAT	0x3 | 
|  | 414 | #define UAC_FORMAT_TYPE_I_ALAW		0x4 | 
|  | 415 | #define UAC_FORMAT_TYPE_I_MULAW		0x5 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 416 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 417 | struct uac_format_type_i_continuous_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 418 | __u8  bLength;			/* in bytes: 8 + (ns * 3) */ | 
|  | 419 | __u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */ | 
|  | 420 | __u8  bDescriptorSubtype;	/* FORMAT_TYPE */ | 
|  | 421 | __u8  bFormatType;		/* FORMAT_TYPE_1 */ | 
|  | 422 | __u8  bNrChannels;		/* physical channels in the stream */ | 
|  | 423 | __u8  bSubframeSize;		/* */ | 
|  | 424 | __u8  bBitResolution; | 
|  | 425 | __u8  bSamFreqType; | 
|  | 426 | __u8  tLowerSamFreq[3]; | 
|  | 427 | __u8  tUpperSamFreq[3]; | 
|  | 428 | } __attribute__ ((packed)); | 
|  | 429 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 430 | #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE	14 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 431 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 432 | struct uac_format_type_i_discrete_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 433 | __u8  bLength;			/* in bytes: 8 + (ns * 3) */ | 
|  | 434 | __u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */ | 
|  | 435 | __u8  bDescriptorSubtype;	/* FORMAT_TYPE */ | 
|  | 436 | __u8  bFormatType;		/* FORMAT_TYPE_1 */ | 
|  | 437 | __u8  bNrChannels;		/* physical channels in the stream */ | 
|  | 438 | __u8  bSubframeSize;		/* */ | 
|  | 439 | __u8  bBitResolution; | 
|  | 440 | __u8  bSamFreqType; | 
|  | 441 | __u8  tSamFreq[][3]; | 
|  | 442 | } __attribute__ ((packed)); | 
|  | 443 |  | 
| Greg Kroah-Hartman | 0858a3a | 2010-05-17 10:58:12 -0700 | [diff] [blame] | 444 | #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n)		\ | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 445 | struct uac_format_type_i_discrete_descriptor_##n {		\ | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 446 | __u8  bLength;						\ | 
|  | 447 | __u8  bDescriptorType;					\ | 
|  | 448 | __u8  bDescriptorSubtype;				\ | 
|  | 449 | __u8  bFormatType;					\ | 
|  | 450 | __u8  bNrChannels;					\ | 
|  | 451 | __u8  bSubframeSize;					\ | 
|  | 452 | __u8  bBitResolution;					\ | 
|  | 453 | __u8  bSamFreqType;					\ | 
|  | 454 | __u8  tSamFreq[n][3];					\ | 
|  | 455 | } __attribute__ ((packed)) | 
|  | 456 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 457 | #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n)	(8 + (n * 3)) | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 458 |  | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 459 | struct uac_format_type_i_ext_descriptor { | 
|  | 460 | __u8 bLength; | 
|  | 461 | __u8 bDescriptorType; | 
|  | 462 | __u8 bDescriptorSubtype; | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 463 | __u8 bFormatType; | 
| Daniel Mack | 2b9ddcb | 2010-03-04 19:46:18 +0100 | [diff] [blame] | 464 | __u8 bSubslotSize; | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 465 | __u8 bBitResolution; | 
|  | 466 | __u8 bHeaderLength; | 
|  | 467 | __u8 bControlSize; | 
|  | 468 | __u8 bSideBandProtocol; | 
|  | 469 | } __attribute__((packed)); | 
|  | 470 |  | 
| Daniel Mack | 28e1b77 | 2010-02-22 23:49:09 +0100 | [diff] [blame] | 471 | /* Formats - Audio Data Format Type I Codes */ | 
|  | 472 |  | 
| Daniel Mack | de48c7b | 2010-02-22 23:49:13 +0100 | [diff] [blame] | 473 | #define UAC_FORMAT_TYPE_II_MPEG	0x1001 | 
|  | 474 | #define UAC_FORMAT_TYPE_II_AC3	0x1002 | 
|  | 475 |  | 
| Daniel Mack | 28e1b77 | 2010-02-22 23:49:09 +0100 | [diff] [blame] | 476 | struct uac_format_type_ii_discrete_descriptor { | 
|  | 477 | __u8 bLength; | 
|  | 478 | __u8 bDescriptorType; | 
|  | 479 | __u8 bDescriptorSubtype; | 
|  | 480 | __u8 bFormatType; | 
|  | 481 | __le16 wMaxBitRate; | 
|  | 482 | __le16 wSamplesPerFrame; | 
|  | 483 | __u8 bSamFreqType; | 
|  | 484 | __u8 tSamFreq[][3]; | 
|  | 485 | } __attribute__((packed)); | 
|  | 486 |  | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 487 | struct uac_format_type_ii_ext_descriptor { | 
|  | 488 | __u8 bLength; | 
|  | 489 | __u8 bDescriptorType; | 
|  | 490 | __u8 bDescriptorSubtype; | 
|  | 491 | __u8 bFormatType; | 
|  | 492 | __u16 wMaxBitRate; | 
|  | 493 | __u16 wSamplesPerFrame; | 
|  | 494 | __u8 bHeaderLength; | 
|  | 495 | __u8 bSideBandProtocol; | 
|  | 496 | } __attribute__((packed)); | 
|  | 497 |  | 
| Daniel Mack | de48c7b | 2010-02-22 23:49:13 +0100 | [diff] [blame] | 498 | /* type III */ | 
|  | 499 | #define UAC_FORMAT_TYPE_III_IEC1937_AC3	0x2001 | 
|  | 500 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1	0x2002 | 
|  | 501 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT	0x2003 | 
|  | 502 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT	0x2004 | 
|  | 503 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS	0x2005 | 
|  | 504 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS	0x2006 | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 505 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 506 | /* Formats - A.2 Format Type Codes */ | 
|  | 507 | #define UAC_FORMAT_TYPE_UNDEFINED	0x0 | 
|  | 508 | #define UAC_FORMAT_TYPE_I		0x1 | 
|  | 509 | #define UAC_FORMAT_TYPE_II		0x2 | 
|  | 510 | #define UAC_FORMAT_TYPE_III		0x3 | 
| Daniel Mack | 8fee4af | 2010-02-22 23:49:10 +0100 | [diff] [blame] | 511 | #define UAC_EXT_FORMAT_TYPE_I		0x81 | 
|  | 512 | #define UAC_EXT_FORMAT_TYPE_II		0x82 | 
|  | 513 | #define UAC_EXT_FORMAT_TYPE_III		0x83 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 514 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 515 | struct uac_iso_endpoint_descriptor { | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 516 | __u8  bLength;			/* in bytes: 7 */ | 
|  | 517 | __u8  bDescriptorType;		/* USB_DT_CS_ENDPOINT */ | 
|  | 518 | __u8  bDescriptorSubtype;	/* EP_GENERAL */ | 
|  | 519 | __u8  bmAttributes; | 
|  | 520 | __u8  bLockDelayUnits; | 
|  | 521 | __le16 wLockDelay; | 
| Daniel Mack | 0350b6a | 2010-05-11 18:13:49 +0200 | [diff] [blame] | 522 | } __attribute__((packed)); | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 523 | #define UAC_ISO_ENDPOINT_DESC_SIZE	7 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 524 |  | 
| Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame] | 525 | #define UAC_EP_CS_ATTR_SAMPLE_RATE	0x01 | 
|  | 526 | #define UAC_EP_CS_ATTR_PITCH_CONTROL	0x02 | 
|  | 527 | #define UAC_EP_CS_ATTR_FILL_MAX		0x80 | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 528 |  | 
| Daniel Mack | e213e9c | 2010-05-11 18:13:50 +0200 | [diff] [blame] | 529 | /* status word format (3.7.1.1) */ | 
|  | 530 |  | 
|  | 531 | #define UAC1_STATUS_TYPE_ORIG_MASK		0x0f | 
|  | 532 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF	0x0 | 
|  | 533 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF	0x1 | 
|  | 534 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP	0x2 | 
|  | 535 |  | 
|  | 536 | #define UAC1_STATUS_TYPE_IRQ_PENDING		(1 << 7) | 
|  | 537 | #define UAC1_STATUS_TYPE_MEM_CHANGED		(1 << 6) | 
|  | 538 |  | 
|  | 539 | struct uac1_status_word { | 
|  | 540 | __u8 bStatusType; | 
|  | 541 | __u8 bOriginator; | 
|  | 542 | } __attribute__((packed)); | 
|  | 543 |  | 
| Michael S. Tsirkin | c350130 | 2009-07-29 14:23:25 +0300 | [diff] [blame] | 544 | #ifdef __KERNEL__ | 
|  | 545 |  | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 546 | struct usb_audio_control { | 
|  | 547 | struct list_head list; | 
|  | 548 | const char *name; | 
|  | 549 | u8 type; | 
|  | 550 | int data[5]; | 
|  | 551 | int (*set)(struct usb_audio_control *con, u8 cmd, int value); | 
|  | 552 | int (*get)(struct usb_audio_control *con, u8 cmd); | 
|  | 553 | }; | 
|  | 554 |  | 
| Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 555 | struct usb_audio_control_selector { | 
|  | 556 | struct list_head list; | 
|  | 557 | struct list_head control; | 
|  | 558 | u8 id; | 
|  | 559 | const char *name; | 
|  | 560 | u8 type; | 
|  | 561 | struct usb_descriptor_header *desc; | 
|  | 562 | }; | 
|  | 563 |  | 
| Michael S. Tsirkin | c350130 | 2009-07-29 14:23:25 +0300 | [diff] [blame] | 564 | #endif /* __KERNEL__ */ | 
|  | 565 |  | 
| Robert P. J. Day | dda43a0 | 2008-03-07 13:45:32 -0500 | [diff] [blame] | 566 | #endif /* __LINUX_USB_AUDIO_H */ |