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 |
| 16 | */ |
| 17 | |
| 18 | #ifndef __LINUX_USB_AUDIO_H |
| 19 | #define __LINUX_USB_AUDIO_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | |
| 23 | /* A.2 Audio Interface Subclass Codes */ |
| 24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 |
| 25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 |
| 26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 |
| 27 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 28 | /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ |
| 29 | #define UAC_HEADER 0x01 |
| 30 | #define UAC_INPUT_TERMINAL 0x02 |
| 31 | #define UAC_OUTPUT_TERMINAL 0x03 |
| 32 | #define UAC_MIXER_UNIT 0x04 |
| 33 | #define UAC_SELECTOR_UNIT 0x05 |
| 34 | #define UAC_FEATURE_UNIT 0x06 |
| 35 | #define UAC_PROCESSING_UNIT 0x07 |
| 36 | #define UAC_EXTENSION_UNIT 0x08 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 37 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 38 | /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ |
| 39 | #define UAC_AS_GENERAL 0x01 |
| 40 | #define UAC_FORMAT_TYPE 0x02 |
| 41 | #define UAC_FORMAT_SPECIFIC 0x03 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 42 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 43 | /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ |
| 44 | #define UAC_EP_GENERAL 0x01 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 45 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 46 | /* A.9 Audio Class-Specific Request Codes */ |
| 47 | #define UAC_SET_ 0x00 |
| 48 | #define UAC_GET_ 0x80 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 49 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 50 | #define UAC__CUR 0x1 |
| 51 | #define UAC__MIN 0x2 |
| 52 | #define UAC__MAX 0x3 |
| 53 | #define UAC__RES 0x4 |
| 54 | #define UAC__MEM 0x5 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 55 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 56 | #define UAC_SET_CUR (UAC_SET_ | UAC__CUR) |
| 57 | #define UAC_GET_CUR (UAC_GET_ | UAC__CUR) |
| 58 | #define UAC_SET_MIN (UAC_SET_ | UAC__MIN) |
| 59 | #define UAC_GET_MIN (UAC_GET_ | UAC__MIN) |
| 60 | #define UAC_SET_MAX (UAC_SET_ | UAC__MAX) |
| 61 | #define UAC_GET_MAX (UAC_GET_ | UAC__MAX) |
| 62 | #define UAC_SET_RES (UAC_SET_ | UAC__RES) |
| 63 | #define UAC_GET_RES (UAC_GET_ | UAC__RES) |
| 64 | #define UAC_SET_MEM (UAC_SET_ | UAC__MEM) |
| 65 | #define UAC_GET_MEM (UAC_GET_ | UAC__MEM) |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 66 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 67 | #define UAC_GET_STAT 0xff |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 68 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 69 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ |
| 70 | #define UAC_MS_HEADER 0x01 |
| 71 | #define UAC_MIDI_IN_JACK 0x02 |
| 72 | #define UAC_MIDI_OUT_JACK 0x03 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 73 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 74 | /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ |
| 75 | #define UAC_MS_GENERAL 0x01 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 76 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 77 | /* Terminals - 2.1 USB Terminal Types */ |
| 78 | #define UAC_TERMINAL_UNDEFINED 0x100 |
| 79 | #define UAC_TERMINAL_STREAMING 0x101 |
| 80 | #define UAC_TERMINAL_VENDOR_SPEC 0x1FF |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 81 | |
| 82 | /* Terminal Control Selectors */ |
Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 83 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 84 | struct uac_ac_header_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 85 | __u8 bLength; /* 8 + n */ |
Greg Kroah-Hartman | 41dceed | 2008-01-30 15:21:33 -0800 | [diff] [blame] | 86 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 87 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ |
Greg Kroah-Hartman | 41dceed | 2008-01-30 15:21:33 -0800 | [diff] [blame] | 88 | __le16 bcdADC; /* 0x0100 */ |
| 89 | __le16 wTotalLength; /* includes Unit and Terminal desc. */ |
| 90 | __u8 bInCollection; /* n */ |
| 91 | __u8 baInterfaceNr[]; /* [n] */ |
Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 92 | } __attribute__ ((packed)); |
| 93 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 94 | #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) |
Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 95 | |
| 96 | /* As above, but more useful for defining your own descriptors: */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 97 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ |
| 98 | struct uac_ac_header_descriptor_##n { \ |
Ben Williamson | f2ebf92c | 2006-08-01 11:28:16 +1000 | [diff] [blame] | 99 | __u8 bLength; \ |
| 100 | __u8 bDescriptorType; \ |
| 101 | __u8 bDescriptorSubtype; \ |
| 102 | __le16 bcdADC; \ |
| 103 | __le16 wTotalLength; \ |
| 104 | __u8 bInCollection; \ |
| 105 | __u8 baInterfaceNr[n]; \ |
| 106 | } __attribute__ ((packed)) |
| 107 | |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 108 | /* 4.3.2.1 Input Terminal Descriptor */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 109 | struct uac_input_terminal_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 110 | __u8 bLength; /* in bytes: 12 */ |
| 111 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ |
| 112 | __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ |
| 113 | __u8 bTerminalID; /* Constant uniquely terminal ID */ |
| 114 | __le16 wTerminalType; /* USB Audio Terminal Types */ |
| 115 | __u8 bAssocTerminal; /* ID of the Output Terminal associated */ |
| 116 | __u8 bNrChannels; /* Number of logical output channels */ |
| 117 | __le16 wChannelConfig; |
| 118 | __u8 iChannelNames; |
| 119 | __u8 iTerminal; |
| 120 | } __attribute__ ((packed)); |
| 121 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 122 | #define UAC_DT_INPUT_TERMINAL_SIZE 12 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 123 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 124 | /* Terminals - 2.2 Input Terminal Types */ |
| 125 | #define UAC_INPUT_TERMINAL_UNDEFINED 0x200 |
| 126 | #define UAC_INPUT_TERMINAL_MICROPHONE 0x201 |
| 127 | #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 |
| 128 | #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 |
| 129 | #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 |
| 130 | #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 |
| 131 | #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 132 | |
| 133 | /* 4.3.2.2 Output Terminal Descriptor */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 134 | struct uac_output_terminal_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 135 | __u8 bLength; /* in bytes: 9 */ |
| 136 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ |
| 137 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ |
| 138 | __u8 bTerminalID; /* Constant uniquely terminal ID */ |
| 139 | __le16 wTerminalType; /* USB Audio Terminal Types */ |
| 140 | __u8 bAssocTerminal; /* ID of the Input Terminal associated */ |
| 141 | __u8 bSourceID; /* ID of the connected Unit or Terminal*/ |
| 142 | __u8 iTerminal; |
| 143 | } __attribute__ ((packed)); |
| 144 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 145 | #define UAC_DT_OUTPUT_TERMINAL_SIZE 9 |
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.3 Output Terminal Types */ |
| 148 | #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300 |
| 149 | #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301 |
| 150 | #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302 |
| 151 | #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 |
| 152 | #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 |
| 153 | #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 |
| 154 | #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 |
| 155 | #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 156 | |
| 157 | /* Set bControlSize = 2 as default setting */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 158 | #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 159 | |
| 160 | /* As above, but more useful for defining your own descriptors: */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 161 | #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ |
| 162 | struct uac_feature_unit_descriptor_##ch { \ |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 163 | __u8 bLength; \ |
| 164 | __u8 bDescriptorType; \ |
| 165 | __u8 bDescriptorSubtype; \ |
| 166 | __u8 bUnitID; \ |
| 167 | __u8 bSourceID; \ |
| 168 | __u8 bControlSize; \ |
| 169 | __le16 bmaControls[ch + 1]; \ |
| 170 | __u8 iFeature; \ |
| 171 | } __attribute__ ((packed)) |
| 172 | |
| 173 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 174 | struct uac_as_header_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 175 | __u8 bLength; /* in bytes: 7 */ |
| 176 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 177 | __u8 bDescriptorSubtype; /* AS_GENERAL */ |
| 178 | __u8 bTerminalLink; /* Terminal ID of connected Terminal */ |
| 179 | __u8 bDelay; /* Delay introduced by the data path */ |
| 180 | __le16 wFormatTag; /* The Audio Data Format */ |
| 181 | } __attribute__ ((packed)); |
| 182 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 183 | #define UAC_DT_AS_HEADER_SIZE 7 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 184 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 185 | /* Formats - A.1.1 Audio Data Format Type I Codes */ |
| 186 | #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0 |
| 187 | #define UAC_FORMAT_TYPE_I_PCM 0x1 |
| 188 | #define UAC_FORMAT_TYPE_I_PCM8 0x2 |
| 189 | #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3 |
| 190 | #define UAC_FORMAT_TYPE_I_ALAW 0x4 |
| 191 | #define UAC_FORMAT_TYPE_I_MULAW 0x5 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 192 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 193 | struct uac_format_type_i_continuous_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 194 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ |
| 195 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 196 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ |
| 197 | __u8 bFormatType; /* FORMAT_TYPE_1 */ |
| 198 | __u8 bNrChannels; /* physical channels in the stream */ |
| 199 | __u8 bSubframeSize; /* */ |
| 200 | __u8 bBitResolution; |
| 201 | __u8 bSamFreqType; |
| 202 | __u8 tLowerSamFreq[3]; |
| 203 | __u8 tUpperSamFreq[3]; |
| 204 | } __attribute__ ((packed)); |
| 205 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 206 | #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 207 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 208 | struct uac_format_type_i_discrete_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 209 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ |
| 210 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 211 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ |
| 212 | __u8 bFormatType; /* FORMAT_TYPE_1 */ |
| 213 | __u8 bNrChannels; /* physical channels in the stream */ |
| 214 | __u8 bSubframeSize; /* */ |
| 215 | __u8 bBitResolution; |
| 216 | __u8 bSamFreqType; |
| 217 | __u8 tSamFreq[][3]; |
| 218 | } __attribute__ ((packed)); |
| 219 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 220 | #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ |
| 221 | struct uac_format_type_i_discrete_descriptor_##n { \ |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 222 | __u8 bLength; \ |
| 223 | __u8 bDescriptorType; \ |
| 224 | __u8 bDescriptorSubtype; \ |
| 225 | __u8 bFormatType; \ |
| 226 | __u8 bNrChannels; \ |
| 227 | __u8 bSubframeSize; \ |
| 228 | __u8 bBitResolution; \ |
| 229 | __u8 bSamFreqType; \ |
| 230 | __u8 tSamFreq[n][3]; \ |
| 231 | } __attribute__ ((packed)) |
| 232 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 233 | #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 234 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 235 | /* Formats - A.2 Format Type Codes */ |
| 236 | #define UAC_FORMAT_TYPE_UNDEFINED 0x0 |
| 237 | #define UAC_FORMAT_TYPE_I 0x1 |
| 238 | #define UAC_FORMAT_TYPE_II 0x2 |
| 239 | #define UAC_FORMAT_TYPE_III 0x3 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 240 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 241 | struct uac_iso_endpoint_descriptor { |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 242 | __u8 bLength; /* in bytes: 7 */ |
| 243 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ |
| 244 | __u8 bDescriptorSubtype; /* EP_GENERAL */ |
| 245 | __u8 bmAttributes; |
| 246 | __u8 bLockDelayUnits; |
| 247 | __le16 wLockDelay; |
| 248 | }; |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 249 | #define UAC_ISO_ENDPOINT_DESC_SIZE 7 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 250 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 251 | #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 |
| 252 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 |
| 253 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 254 | |
Laurent Pinchart | 512ad27 | 2009-06-21 23:23:05 +0200 | [diff] [blame^] | 255 | /* A.10.2 Feature Unit Control Selectors */ |
| 256 | #define UAC_FU_CONTROL_UNDEFINED 0x00 |
| 257 | #define UAC_MUTE_CONTROL 0x01 |
| 258 | #define UAC_VOLUME_CONTROL 0x02 |
| 259 | #define UAC_BASS_CONTROL 0x03 |
| 260 | #define UAC_MID_CONTROL 0x04 |
| 261 | #define UAC_TREBLE_CONTROL 0x05 |
| 262 | #define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06 |
| 263 | #define UAC_AUTOMATIC_GAIN_CONTROL 0x07 |
| 264 | #define UAC_DELAY_CONTROL 0x08 |
| 265 | #define UAC_BASS_BOOST_CONTROL 0x09 |
| 266 | #define UAC_LOUDNESS_CONTROL 0x0a |
| 267 | |
| 268 | #define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1)) |
| 269 | #define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1)) |
| 270 | #define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1)) |
| 271 | #define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1)) |
| 272 | #define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1)) |
| 273 | #define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1)) |
| 274 | #define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1)) |
| 275 | #define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1)) |
| 276 | #define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) |
| 277 | #define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) |
Bryan Wu | c47d7b0 | 2009-06-03 09:17:57 -0400 | [diff] [blame] | 278 | |
| 279 | struct usb_audio_control { |
| 280 | struct list_head list; |
| 281 | const char *name; |
| 282 | u8 type; |
| 283 | int data[5]; |
| 284 | int (*set)(struct usb_audio_control *con, u8 cmd, int value); |
| 285 | int (*get)(struct usb_audio_control *con, u8 cmd); |
| 286 | }; |
| 287 | |
| 288 | static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) |
| 289 | { |
| 290 | con->data[cmd] = value; |
| 291 | |
| 292 | return 0; |
| 293 | } |
| 294 | |
| 295 | static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd) |
| 296 | { |
| 297 | return con->data[cmd]; |
| 298 | } |
| 299 | |
| 300 | struct usb_audio_control_selector { |
| 301 | struct list_head list; |
| 302 | struct list_head control; |
| 303 | u8 id; |
| 304 | const char *name; |
| 305 | u8 type; |
| 306 | struct usb_descriptor_header *desc; |
| 307 | }; |
| 308 | |
Robert P. J. Day | dda43a0 | 2008-03-07 13:45:32 -0500 | [diff] [blame] | 309 | #endif /* __LINUX_USB_AUDIO_H */ |