diff options
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/audio.h | 129 |
1 files changed, 119 insertions, 10 deletions
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index cdad728543ae..bc78a83d0f48 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -181,6 +181,125 @@ struct uac_feature_unit_descriptor_##ch { \ | |||
181 | __u8 iFeature; \ | 181 | __u8 iFeature; \ |
182 | } __attribute__ ((packed)) | 182 | } __attribute__ ((packed)) |
183 | 183 | ||
184 | /* 4.3.2.3 Mixer Unit Descriptor */ | ||
185 | struct uac_mixer_unit_descriptor { | ||
186 | __u8 bLength; | ||
187 | __u8 bDescriptorType; | ||
188 | __u8 bDescriptorSubtype; | ||
189 | __u8 bUnitID; | ||
190 | __u8 bNrInPins; | ||
191 | __u8 baSourceID[]; | ||
192 | } __attribute__ ((packed)); | ||
193 | |||
194 | static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) | ||
195 | { | ||
196 | return desc->baSourceID[desc->bNrInPins]; | ||
197 | } | ||
198 | |||
199 | static inline __u16 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc) | ||
200 | { | ||
201 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
202 | desc->baSourceID[desc->bNrInPins + 1]; | ||
203 | } | ||
204 | |||
205 | static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc) | ||
206 | { | ||
207 | return desc->baSourceID[desc->bNrInPins + 3]; | ||
208 | } | ||
209 | |||
210 | static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc) | ||
211 | { | ||
212 | return &desc->baSourceID[desc->bNrInPins + 4]; | ||
213 | } | ||
214 | |||
215 | static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) | ||
216 | { | ||
217 | __u8 *raw = (__u8 *) desc; | ||
218 | return raw[desc->bLength - 1]; | ||
219 | } | ||
220 | |||
221 | /* 4.3.2.4 Selector Unit Descriptor */ | ||
222 | struct uac_selector_unit_descriptor { | ||
223 | __u8 bLength; | ||
224 | __u8 bDescriptorType; | ||
225 | __u8 bDescriptorSubtype; | ||
226 | __u8 bUintID; | ||
227 | __u8 bNrInPins; | ||
228 | __u8 baSourceID[]; | ||
229 | } __attribute__ ((packed)); | ||
230 | |||
231 | static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) | ||
232 | { | ||
233 | __u8 *raw = (__u8 *) desc; | ||
234 | return raw[desc->bLength - 1]; | ||
235 | } | ||
236 | |||
237 | /* 4.3.2.5 Feature Unit Descriptor */ | ||
238 | struct uac_feature_unit_descriptor { | ||
239 | __u8 bLength; | ||
240 | __u8 bDescriptorType; | ||
241 | __u8 bDescriptorSubtype; | ||
242 | __u8 bUnitID; | ||
243 | __u8 bSourceID; | ||
244 | __u8 bControlSize; | ||
245 | __u8 bmaControls[0]; /* variable length */ | ||
246 | } __attribute__((packed)); | ||
247 | |||
248 | static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) | ||
249 | { | ||
250 | __u8 *raw = (__u8 *) desc; | ||
251 | return raw[desc->bLength - 1]; | ||
252 | } | ||
253 | |||
254 | /* 4.3.2.6 Processing Unit Descriptors */ | ||
255 | struct uac_processing_unit_descriptor { | ||
256 | __u8 bLength; | ||
257 | __u8 bDescriptorType; | ||
258 | __u8 bDescriptorSubtype; | ||
259 | __u8 bUnitID; | ||
260 | __u16 wProcessType; | ||
261 | __u8 bNrInPins; | ||
262 | __u8 baSourceID[]; | ||
263 | } __attribute__ ((packed)); | ||
264 | |||
265 | static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) | ||
266 | { | ||
267 | return desc->baSourceID[desc->bNrInPins]; | ||
268 | } | ||
269 | |||
270 | static inline __u16 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc) | ||
271 | { | ||
272 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
273 | desc->baSourceID[desc->bNrInPins + 1]; | ||
274 | } | ||
275 | |||
276 | static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc) | ||
277 | { | ||
278 | return desc->baSourceID[desc->bNrInPins + 3]; | ||
279 | } | ||
280 | |||
281 | static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc) | ||
282 | { | ||
283 | return desc->baSourceID[desc->bNrInPins + 4]; | ||
284 | } | ||
285 | |||
286 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc) | ||
287 | { | ||
288 | return &desc->baSourceID[desc->bNrInPins + 5]; | ||
289 | } | ||
290 | |||
291 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc) | ||
292 | { | ||
293 | __u8 control_size = uac_processing_unit_bControlSize(desc); | ||
294 | return desc->baSourceID[desc->bNrInPins + control_size]; | ||
295 | } | ||
296 | |||
297 | static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc) | ||
298 | { | ||
299 | __u8 control_size = uac_processing_unit_bControlSize(desc); | ||
300 | return &desc->baSourceID[desc->bNrInPins + control_size + 1]; | ||
301 | } | ||
302 | |||
184 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | 303 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
185 | struct uac_as_header_descriptor_v1 { | 304 | struct uac_as_header_descriptor_v1 { |
186 | __u8 bLength; /* in bytes: 7 */ | 305 | __u8 bLength; /* in bytes: 7 */ |
@@ -315,16 +434,6 @@ struct uac_iso_endpoint_descriptor { | |||
315 | 434 | ||
316 | /* A.10.2 Feature Unit Control Selectors */ | 435 | /* A.10.2 Feature Unit Control Selectors */ |
317 | 436 | ||
318 | struct uac_feature_unit_descriptor { | ||
319 | __u8 bLength; | ||
320 | __u8 bDescriptorType; | ||
321 | __u8 bDescriptorSubtype; | ||
322 | __u8 bUnitID; | ||
323 | __u8 bSourceID; | ||
324 | __u8 bControlSize; | ||
325 | __u8 controls[0]; /* variable length */ | ||
326 | } __attribute__((packed)); | ||
327 | |||
328 | #define UAC_FU_CONTROL_UNDEFINED 0x00 | 437 | #define UAC_FU_CONTROL_UNDEFINED 0x00 |
329 | #define UAC_MUTE_CONTROL 0x01 | 438 | #define UAC_MUTE_CONTROL 0x01 |
330 | #define UAC_VOLUME_CONTROL 0x02 | 439 | #define UAC_VOLUME_CONTROL 0x02 |