linux/include/linux/usb/audio-v2.h

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2010 Daniel Mack <[email protected]>
 *
 * This file holds USB constants and structures defined
 * by the USB Device Class Definition for Audio Devices in version 2.0.
 * Comments below reference relevant sections of the documents contained
 * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip
 */

#ifndef __LINUX_USB_AUDIO_V2_H
#define __LINUX_USB_AUDIO_V2_H

#include <linux/types.h>

/* v1.0 and v2.0 of this standard have many things in common. For the rest
 * of the definitions, please refer to audio.h */

/*
 * bmControl field decoders
 *
 * From the USB Audio spec v2.0:
 *
 *   bmaControls() is a (ch+1)-element array of 4-byte bitmaps,
 *   each containing a set of bit pairs. If a Control is present,
 *   it must be Host readable. If a certain Control is not
 *   present then the bit pair must be set to 0b00.
 *   If a Control is present but read-only, the bit pair must be
 *   set to 0b01. If a Control is also Host programmable, the bit
 *   pair must be set to 0b11. The value 0b10 is not allowed.
 *
 */

static inline bool uac_v2v3_control_is_readable(u32 bmControls, u8 control)
{}

static inline bool uac_v2v3_control_is_writeable(u32 bmControls, u8 control)
{}

/* 4.7.2 Class-Specific AC Interface Descriptor */
struct uac2_ac_header_descriptor {} __packed;

/* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/
struct uac2_format_type_i_descriptor {} __packed;

/* 4.7.2.1 Clock Source Descriptor */

struct uac_clock_source_descriptor {} __attribute__((packed));

/* bmAttribute fields */
#define UAC_CLOCK_SOURCE_TYPE_EXT
#define UAC_CLOCK_SOURCE_TYPE_INT_FIXED
#define UAC_CLOCK_SOURCE_TYPE_INT_VAR
#define UAC_CLOCK_SOURCE_TYPE_INT_PROG
#define UAC_CLOCK_SOURCE_SYNCED_TO_SOF

/* 4.7.2.2 Clock Selector Descriptor */

struct uac_clock_selector_descriptor {} __attribute__((packed));

/* 4.7.2.3 Clock Multiplier Descriptor */

struct uac_clock_multiplier_descriptor {} __attribute__((packed));

/* 4.7.2.4 Input terminal descriptor */

struct uac2_input_terminal_descriptor {} __attribute__((packed));

/* 4.7.2.5 Output terminal descriptor */

struct uac2_output_terminal_descriptor {} __attribute__((packed));



/* 4.7.2.8 Feature Unit Descriptor */

struct uac2_feature_unit_descriptor {} __attribute__((packed));

#define UAC2_DT_FEATURE_UNIT_SIZE(ch)

/* As above, but more useful for defining your own descriptors: */
#define DECLARE_UAC2_FEATURE_UNIT_DESCRIPTOR(ch)

/* 4.7.2.10 Effect Unit Descriptor */

struct uac2_effect_unit_descriptor {} __attribute__((packed));

/* 4.9.2 Class-Specific AS Interface Descriptor */

struct uac2_as_header_descriptor {} __attribute__((packed));

#define UAC2_FORMAT_TYPE_I_RAW_DATA

/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */

struct uac2_iso_endpoint_descriptor {} __attribute__((packed));

#define UAC2_CONTROL_PITCH
#define UAC2_CONTROL_DATA_OVERRUN
#define UAC2_CONTROL_DATA_UNDERRUN

/* 5.2.5.4.2 Connector Control Parameter Block */
struct uac2_connectors_ctl_blk {} __attribute__((packed));

/* 6.1 Interrupt Data Message */

#define UAC2_INTERRUPT_DATA_MSG_VENDOR
#define UAC2_INTERRUPT_DATA_MSG_EP

struct uac2_interrupt_data_msg {} __attribute__((packed));

/* A.7 Audio Function Category Codes */
#define UAC2_FUNCTION_SUBCLASS_UNDEFINED
#define UAC2_FUNCTION_DESKTOP_SPEAKER
#define UAC2_FUNCTION_HOME_THEATER
#define UAC2_FUNCTION_MICROPHONE
#define UAC2_FUNCTION_HEADSET
#define UAC2_FUNCTION_TELEPHONE
#define UAC2_FUNCTION_CONVERTER
#define UAC2_FUNCTION_SOUND_RECORDER
#define UAC2_FUNCTION_IO_BOX
#define UAC2_FUNCTION_MUSICAL_INSTRUMENT
#define UAC2_FUNCTION_PRO_AUDIO
#define UAC2_FUNCTION_AUDIO_VIDEO
#define UAC2_FUNCTION_CONTROL_PANEL
#define UAC2_FUNCTION_OTHER

/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */
/* see audio.h for the rest, which is identical to v1 */
#define UAC2_EFFECT_UNIT
#define UAC2_PROCESSING_UNIT_V2
#define UAC2_EXTENSION_UNIT_V2
#define UAC2_CLOCK_SOURCE
#define UAC2_CLOCK_SELECTOR
#define UAC2_CLOCK_MULTIPLIER
#define UAC2_SAMPLE_RATE_CONVERTER

/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */
/* see audio.h for the rest, which is identical to v1 */
#define UAC2_ENCODER
#define UAC2_DECODER

/* A.11 Effect Unit Effect Types */
#define UAC2_EFFECT_UNDEFINED
#define UAC2_EFFECT_PARAM_EQ
#define UAC2_EFFECT_REVERB
#define UAC2_EFFECT_MOD_DELAY
#define UAC2_EFFECT_DYN_RANGE_COMP

/* A.12 Processing Unit Process Types */
#define UAC2_PROCESS_UNDEFINED
#define UAC2_PROCESS_UP_DOWNMIX
#define UAC2_PROCESS_DOLBY_PROLOCIC
#define UAC2_PROCESS_STEREO_EXTENDER

/* A.14 Audio Class-Specific Request Codes */
#define UAC2_CS_CUR
#define UAC2_CS_RANGE
#define UAC2_CS_MEM

/* A.15 Encoder Type Codes */
#define UAC2_ENCODER_UNDEFINED
#define UAC2_ENCODER_OTHER
#define UAC2_ENCODER_MPEG
#define UAC2_ENCODER_AC3
#define UAC2_ENCODER_WMA
#define UAC2_ENCODER_DTS

/* A.16 Decoder Type Codes */
#define UAC2_DECODER_UNDEFINED
#define UAC2_DECODER_OTHER
#define UAC2_DECODER_MPEG
#define UAC2_DECODER_AC3
#define UAC2_DECODER_WMA
#define UAC2_DECODER_DTS

/* A.17.1 Clock Source Control Selectors */
#define UAC2_CS_UNDEFINED
#define UAC2_CS_CONTROL_SAM_FREQ
#define UAC2_CS_CONTROL_CLOCK_VALID

/* A.17.2 Clock Selector Control Selectors */
#define UAC2_CX_UNDEFINED
#define UAC2_CX_CLOCK_SELECTOR

/* A.17.3 Clock Multiplier Control Selectors */
#define UAC2_CM_UNDEFINED
#define UAC2_CM_NUMERATOR
#define UAC2_CM_DENOMINTATOR

/* A.17.4 Terminal Control Selectors */
#define UAC2_TE_UNDEFINED
#define UAC2_TE_COPY_PROTECT
#define UAC2_TE_CONNECTOR
#define UAC2_TE_OVERLOAD
#define UAC2_TE_CLUSTER
#define UAC2_TE_UNDERFLOW
#define UAC2_TE_OVERFLOW
#define UAC2_TE_LATENCY

/* A.17.5 Mixer Control Selectors */
#define UAC2_MU_UNDEFINED
#define UAC2_MU_MIXER
#define UAC2_MU_CLUSTER
#define UAC2_MU_UNDERFLOW
#define UAC2_MU_OVERFLOW
#define UAC2_MU_LATENCY

/* A.17.6 Selector Control Selectors */
#define UAC2_SU_UNDEFINED
#define UAC2_SU_SELECTOR
#define UAC2_SU_LATENCY

/* A.17.7 Feature Unit Control Selectors */
/* see audio.h for the rest, which is identical to v1 */
#define UAC2_FU_INPUT_GAIN
#define UAC2_FU_INPUT_GAIN_PAD
#define UAC2_FU_PHASE_INVERTER
#define UAC2_FU_UNDERFLOW
#define UAC2_FU_OVERFLOW
#define UAC2_FU_LATENCY

/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */
#define UAC2_PE_UNDEFINED
#define UAC2_PE_ENABLE
#define UAC2_PE_CENTERFREQ
#define UAC2_PE_QFACTOR
#define UAC2_PE_GAIN
#define UAC2_PE_UNDERFLOW
#define UAC2_PE_OVERFLOW
#define UAC2_PE_LATENCY

/* A.17.8.2 Reverberation Effect Unit Control Selectors */
#define UAC2_RV_UNDEFINED
#define UAC2_RV_ENABLE
#define UAC2_RV_TYPE
#define UAC2_RV_LEVEL
#define UAC2_RV_TIME
#define UAC2_RV_FEEDBACK
#define UAC2_RV_PREDELAY
#define UAC2_RV_DENSITY
#define UAC2_RV_HIFREQ_ROLLOFF
#define UAC2_RV_UNDERFLOW
#define UAC2_RV_OVERFLOW
#define UAC2_RV_LATENCY

/* A.17.8.3 Modulation Delay Effect Control Selectors */
#define UAC2_MD_UNDEFINED
#define UAC2_MD_ENABLE
#define UAC2_MD_BALANCE
#define UAC2_MD_RATE
#define UAC2_MD_DEPTH
#define UAC2_MD_TIME
#define UAC2_MD_FEEDBACK
#define UAC2_MD_UNDERFLOW
#define UAC2_MD_OVERFLOW
#define UAC2_MD_LATENCY

/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */
#define UAC2_DR_UNDEFINED
#define UAC2_DR_ENABLE
#define UAC2_DR_COMPRESSION_RATE
#define UAC2_DR_MAXAMPL
#define UAC2_DR_THRESHOLD
#define UAC2_DR_ATTACK_TIME
#define UAC2_DR_RELEASE_TIME
#define UAC2_DR_UNDEFLOW
#define UAC2_DR_OVERFLOW
#define UAC2_DR_LATENCY

/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */
#define UAC2_UD_UNDEFINED
#define UAC2_UD_ENABLE
#define UAC2_UD_MODE_SELECT
#define UAC2_UD_CLUSTER
#define UAC2_UD_UNDERFLOW
#define UAC2_UD_OVERFLOW
#define UAC2_UD_LATENCY

/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */
#define UAC2_DP_UNDEFINED
#define UAC2_DP_ENABLE
#define UAC2_DP_MODE_SELECT
#define UAC2_DP_CLUSTER
#define UAC2_DP_UNDERFFLOW
#define UAC2_DP_OVERFLOW
#define UAC2_DP_LATENCY

/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */
#define UAC2_ST_EXT_UNDEFINED
#define UAC2_ST_EXT_ENABLE
#define UAC2_ST_EXT_WIDTH
#define UAC2_ST_EXT_UNDEFLOW
#define UAC2_ST_EXT_OVERFLOW
#define UAC2_ST_EXT_LATENCY

/* A.17.10 Extension Unit Control Selectors */
#define UAC2_XU_UNDEFINED
#define UAC2_XU_ENABLE
#define UAC2_XU_CLUSTER
#define UAC2_XU_UNDERFLOW
#define UAC2_XU_OVERFLOW
#define UAC2_XU_LATENCY

/* A.17.11 AudioStreaming Interface Control Selectors */
#define UAC2_AS_UNDEFINED
#define UAC2_AS_ACT_ALT_SETTING
#define UAC2_AS_VAL_ALT_SETTINGS
#define UAC2_AS_AUDIO_DATA_FORMAT

/* A.17.12 Encoder Control Selectors */
#define UAC2_EN_UNDEFINED
#define UAC2_EN_BIT_RATE
#define UAC2_EN_QUALITY
#define UAC2_EN_VBR
#define UAC2_EN_TYPE
#define UAC2_EN_UNDERFLOW
#define UAC2_EN_OVERFLOW
#define UAC2_EN_ENCODER_ERROR
#define UAC2_EN_PARAM1
#define UAC2_EN_PARAM2
#define UAC2_EN_PARAM3
#define UAC2_EN_PARAM4
#define UAC2_EN_PARAM5
#define UAC2_EN_PARAM6
#define UAC2_EN_PARAM7
#define UAC2_EN_PARAM8

/* A.17.13.1 MPEG Decoder Control Selectors */
#define UAC2_MPEG_UNDEFINED
#define UAC2_MPEG_DUAL_CHANNEL
#define UAC2_MPEG_SECOND_STEREO
#define UAC2_MPEG_MULTILINGUAL
#define UAC2_MPEG_DYN_RANGE
#define UAC2_MPEG_SCALING
#define UAC2_MPEG_HILO_SCALING
#define UAC2_MPEG_UNDERFLOW
#define UAC2_MPEG_OVERFLOW
#define UAC2_MPEG_DECODER_ERROR

/* A17.13.2 AC3 Decoder Control Selectors */
#define UAC2_AC3_UNDEFINED
#define UAC2_AC3_MODE
#define UAC2_AC3_DYN_RANGE
#define UAC2_AC3_SCALING
#define UAC2_AC3_HILO_SCALING
#define UAC2_AC3_UNDERFLOW
#define UAC2_AC3_OVERFLOW
#define UAC2_AC3_DECODER_ERROR

/* A17.13.3 WMA Decoder Control Selectors */
#define UAC2_WMA_UNDEFINED
#define UAC2_WMA_UNDERFLOW
#define UAC2_WMA_OVERFLOW
#define UAC2_WMA_DECODER_ERROR

/* A17.13.4 DTS Decoder Control Selectors */
#define UAC2_DTS_UNDEFINED
#define UAC2_DTS_UNDERFLOW
#define UAC2_DTS_OVERFLOW
#define UAC2_DTS_DECODER_ERROR

/* A17.14 Endpoint Control Selectors */
#define UAC2_EP_CS_UNDEFINED
#define UAC2_EP_CS_PITCH
#define UAC2_EP_CS_DATA_OVERRUN
#define UAC2_EP_CS_DATA_UNDERRUN

#endif /* __LINUX_USB_AUDIO_V2_H */