aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorJorge Sanjuan <jorge.sanjuan@codethink.co.uk>2018-07-11 08:37:53 -0400
committerTakashi Iwai <tiwai@suse.de>2018-07-16 10:35:34 -0400
commit0f292f023ffcc67ec49d63dcb7fe388711cbb83a (patch)
tree38d6931dff87166a3a4e80335ddbd9f71b36b6ab /include/uapi
parent4e887af31cedec0d3b24521a5c3c14c3a190422b (diff)
ALSA: usb-audio: Add support for Processing Units in UAC3
This patch adds support for the Processig Units defined in the UAC3 spec. The main difference with the previous specs is the lack of on/off switches in the controls for these units and the addiction of the new Multi Function Processing Unit. The current version of the UAC3 spec doesn't define any useful controls for the new Multi Function Processing Unit so no control will get created once this unit is parsed. Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/usb/audio.h49
1 files changed, 40 insertions, 9 deletions
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
index 74e520fb944f..ddc5396800aa 100644
--- a/include/uapi/linux/usb/audio.h
+++ b/include/uapi/linux/usb/audio.h
@@ -390,33 +390,64 @@ static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_
390static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, 390static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
391 int protocol) 391 int protocol)
392{ 392{
393 return (protocol == UAC_VERSION_1) ? 393 switch (protocol) {
394 desc->baSourceID[desc->bNrInPins + 4] : 394 case UAC_VERSION_1:
395 2; /* in UAC2, this value is constant */ 395 return desc->baSourceID[desc->bNrInPins + 4];
396 case UAC_VERSION_2:
397 return 2; /* in UAC2, this value is constant */
398 case UAC_VERSION_3:
399 return 4; /* in UAC3, this value is constant */
400 default:
401 return 1;
402 }
396} 403}
397 404
398static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, 405static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
399 int protocol) 406 int protocol)
400{ 407{
401 return (protocol == UAC_VERSION_1) ? 408 switch (protocol) {
402 &desc->baSourceID[desc->bNrInPins + 5] : 409 case UAC_VERSION_1:
403 &desc->baSourceID[desc->bNrInPins + 6]; 410 return &desc->baSourceID[desc->bNrInPins + 5];
411 case UAC_VERSION_2:
412 return &desc->baSourceID[desc->bNrInPins + 6];
413 case UAC_VERSION_3:
414 return &desc->baSourceID[desc->bNrInPins + 2];
415 default:
416 return NULL;
417 }
404} 418}
405 419
406static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, 420static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
407 int protocol) 421 int protocol)
408{ 422{
409 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); 423 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
410 return *(uac_processing_unit_bmControls(desc, protocol) 424
411 + control_size); 425 switch (protocol) {
426 case UAC_VERSION_1:
427 case UAC_VERSION_2:
428 default:
429 return *(uac_processing_unit_bmControls(desc, protocol)
430 + control_size);
431 case UAC_VERSION_3:
432 return 0; /* UAC3 does not have this field */
433 }
412} 434}
413 435
414static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, 436static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
415 int protocol) 437 int protocol)
416{ 438{
417 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); 439 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
418 return uac_processing_unit_bmControls(desc, protocol) 440
441 switch (protocol) {
442 case UAC_VERSION_1:
443 case UAC_VERSION_2:
444 default:
445 return uac_processing_unit_bmControls(desc, protocol)
419 + control_size + 1; 446 + control_size + 1;
447 case UAC_VERSION_3:
448 return uac_processing_unit_bmControls(desc, protocol)
449 + control_size;
450 }
420} 451}
421 452
422/* 4.5.2 Class-Specific AS Interface Descriptor */ 453/* 4.5.2 Class-Specific AS Interface Descriptor */