History

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.

Jorge Sanjuan committed 8 years ago

Commit 0f292f01 parent 4e887af3 files · +104 −11Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/usb/audio.h+40−9
@@ -390,33 +390,64 @@ static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_ · 389 unmodified lines
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 */