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

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (c) 2017 Ruslan Bilovol <[email protected]>
 *
 * This file holds USB constants and structures defined
 * by the USB DEVICE CLASS DEFINITION FOR AUDIO DEVICES Release 3.0.
 */

#ifndef __LINUX_USB_AUDIO_V3_H
#define __LINUX_USB_AUDIO_V3_H

#include <linux/types.h>

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

/* All High Capability descriptors have these 2 fields at the beginning */
struct uac3_hc_descriptor_header {} __attribute__ ((packed));

/* 4.3.1 CLUSTER DESCRIPTOR HEADER */
struct uac3_cluster_header_descriptor {} __attribute__ ((packed));

/* 4.3.2.1 SEGMENTS */
struct uac3_cluster_segment_descriptor {} __attribute__ ((packed));

/* 4.3.2.1.1 END SEGMENT */
struct uac3_cluster_end_segment_descriptor {} __attribute__ ((packed));

/* 4.3.2.1.3.1 INFORMATION SEGMENT */
struct uac3_cluster_information_segment_descriptor {} __attribute__ ((packed));

/* 4.5.2 CLASS-SPECIFIC AC INTERFACE DESCRIPTOR */
struct uac3_ac_header_descriptor {} __attribute__ ((packed));

/* 4.5.2.1 INPUT TERMINAL DESCRIPTOR */
struct uac3_input_terminal_descriptor {} __attribute__((packed));

/* 4.5.2.2 OUTPUT TERMINAL DESCRIPTOR */
struct uac3_output_terminal_descriptor {} __attribute__((packed));

/* 4.5.2.7 FEATURE UNIT DESCRIPTOR */
struct uac3_feature_unit_descriptor {} __attribute__((packed));

#define UAC3_DT_FEATURE_UNIT_SIZE(ch)

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

/* 4.5.2.12 CLOCK SOURCE DESCRIPTOR */
struct uac3_clock_source_descriptor {} __attribute__((packed));

/* bmAttribute fields */
#define UAC3_CLOCK_SOURCE_TYPE_EXT
#define UAC3_CLOCK_SOURCE_TYPE_INT
#define UAC3_CLOCK_SOURCE_ASYNC
#define UAC3_CLOCK_SOURCE_SYNCED_TO_SOF

/* 4.5.2.13 CLOCK SELECTOR DESCRIPTOR */
struct uac3_clock_selector_descriptor {} __attribute__((packed));

/* 4.5.2.14 CLOCK MULTIPLIER DESCRIPTOR */
struct uac3_clock_multiplier_descriptor {} __attribute__((packed));

/* 4.5.2.15 POWER DOMAIN DESCRIPTOR */
struct uac3_power_domain_descriptor {} __attribute__((packed));

/* As above, but more useful for defining your own descriptors */
#define DECLARE_UAC3_POWER_DOMAIN_DESCRIPTOR(n)

/* 4.7.2 CLASS-SPECIFIC AS INTERFACE DESCRIPTOR */
struct uac3_as_header_descriptor {} __attribute__((packed));

#define UAC3_FORMAT_TYPE_I_RAW_DATA

/* 4.8.1.2 CLASS-SPECIFIC AS ISOCHRONOUS AUDIO DATA ENDPOINT DESCRIPTOR */
struct uac3_iso_endpoint_descriptor {} __attribute__((packed));

/* 5.2.1.6.1 INSERTION CONTROL PARAMETER BLOCK */
struct uac3_insertion_ctl_blk {} __attribute__ ((packed));

/* 6.1 INTERRUPT DATA MESSAGE */
struct uac3_interrupt_data_msg {} __attribute__((packed));

/* A.2 AUDIO AUDIO FUNCTION SUBCLASS CODES */
#define UAC3_FUNCTION_SUBCLASS_UNDEFINED
#define UAC3_FUNCTION_SUBCLASS_FULL_ADC_3_0
/* BADD profiles */
#define UAC3_FUNCTION_SUBCLASS_GENERIC_IO
#define UAC3_FUNCTION_SUBCLASS_HEADPHONE
#define UAC3_FUNCTION_SUBCLASS_SPEAKER
#define UAC3_FUNCTION_SUBCLASS_MICROPHONE
#define UAC3_FUNCTION_SUBCLASS_HEADSET
#define UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER
#define UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE

/* A.7 AUDIO FUNCTION CATEGORY CODES */
#define UAC3_FUNCTION_SUBCLASS_UNDEFINED
#define UAC3_FUNCTION_DESKTOP_SPEAKER
#define UAC3_FUNCTION_HOME_THEATER
#define UAC3_FUNCTION_MICROPHONE
#define UAC3_FUNCTION_HEADSET
#define UAC3_FUNCTION_TELEPHONE
#define UAC3_FUNCTION_CONVERTER
#define UAC3_FUNCTION_SOUND_RECORDER
#define UAC3_FUNCTION_IO_BOX
#define UAC3_FUNCTION_MUSICAL_INSTRUMENT
#define UAC3_FUNCTION_PRO_AUDIO
#define UAC3_FUNCTION_AUDIO_VIDEO
#define UAC3_FUNCTION_CONTROL_PANEL
#define UAC3_FUNCTION_HEADPHONE
#define UAC3_FUNCTION_GENERIC_SPEAKER
#define UAC3_FUNCTION_HEADSET_ADAPTER
#define UAC3_FUNCTION_SPEAKERPHONE
#define UAC3_FUNCTION_OTHER

/* A.8 AUDIO CLASS-SPECIFIC DESCRIPTOR TYPES */
#define UAC3_CS_UNDEFINED
#define UAC3_CS_DEVICE
#define UAC3_CS_CONFIGURATION
#define UAC3_CS_STRING
#define UAC3_CS_INTERFACE
#define UAC3_CS_ENDPOINT
#define UAC3_CS_CLUSTER

/* A.10 CLUSTER DESCRIPTOR SEGMENT TYPES */
#define UAC3_SEGMENT_UNDEFINED
#define UAC3_CLUSTER_DESCRIPTION
#define UAC3_CLUSTER_VENDOR_DEFINED
#define UAC3_CHANNEL_INFORMATION
#define UAC3_CHANNEL_AMBISONIC
#define UAC3_CHANNEL_DESCRIPTION
#define UAC3_CHANNEL_VENDOR_DEFINED
#define UAC3_END_SEGMENT

/* A.11 CHANNEL PURPOSE DEFINITIONS */
#define UAC3_PURPOSE_UNDEFINED
#define UAC3_PURPOSE_GENERIC_AUDIO
#define UAC3_PURPOSE_VOICE
#define UAC3_PURPOSE_SPEECH
#define UAC3_PURPOSE_AMBIENT
#define UAC3_PURPOSE_REFERENCE
#define UAC3_PURPOSE_ULTRASONIC
#define UAC3_PURPOSE_VIBROKINETIC
#define UAC3_PURPOSE_NON_AUDIO

/* A.12 CHANNEL RELATIONSHIP DEFINITIONS */
#define UAC3_CH_RELATIONSHIP_UNDEFINED
#define UAC3_CH_MONO
#define UAC3_CH_LEFT
#define UAC3_CH_RIGHT
#define UAC3_CH_ARRAY
#define UAC3_CH_PATTERN_X
#define UAC3_CH_PATTERN_Y
#define UAC3_CH_PATTERN_A
#define UAC3_CH_PATTERN_B
#define UAC3_CH_PATTERN_M
#define UAC3_CH_PATTERN_S
#define UAC3_CH_FRONT_LEFT
#define UAC3_CH_FRONT_RIGHT
#define UAC3_CH_FRONT_CENTER
#define UAC3_CH_FRONT_LEFT_OF_CENTER
#define UAC3_CH_FRONT_RIGHT_OF_CENTER
#define UAC3_CH_FRONT_WIDE_LEFT
#define UAC3_CH_FRONT_WIDE_RIGHT
#define UAC3_CH_SIDE_LEFT
#define UAC3_CH_SIDE_RIGHT
#define UAC3_CH_SURROUND_ARRAY_LEFT
#define UAC3_CH_SURROUND_ARRAY_RIGHT
#define UAC3_CH_BACK_LEFT
#define UAC3_CH_BACK_RIGHT
#define UAC3_CH_BACK_CENTER
#define UAC3_CH_BACK_LEFT_OF_CENTER
#define UAC3_CH_BACK_RIGHT_OF_CENTER
#define UAC3_CH_BACK_WIDE_LEFT
#define UAC3_CH_BACK_WIDE_RIGHT
#define UAC3_CH_TOP_CENTER
#define UAC3_CH_TOP_FRONT_LEFT
#define UAC3_CH_TOP_FRONT_RIGHT
#define UAC3_CH_TOP_FRONT_CENTER
#define UAC3_CH_TOP_FRONT_LOC
#define UAC3_CH_TOP_FRONT_ROC
#define UAC3_CH_TOP_FRONT_WIDE_LEFT
#define UAC3_CH_TOP_FRONT_WIDE_RIGHT
#define UAC3_CH_TOP_SIDE_LEFT
#define UAC3_CH_TOP_SIDE_RIGHT
#define UAC3_CH_TOP_SURR_ARRAY_LEFT
#define UAC3_CH_TOP_SURR_ARRAY_RIGHT
#define UAC3_CH_TOP_BACK_LEFT
#define UAC3_CH_TOP_BACK_RIGHT
#define UAC3_CH_TOP_BACK_CENTER
#define UAC3_CH_TOP_BACK_LOC
#define UAC3_CH_TOP_BACK_ROC
#define UAC3_CH_TOP_BACK_WIDE_LEFT
#define UAC3_CH_TOP_BACK_WIDE_RIGHT
#define UAC3_CH_BOTTOM_CENTER
#define UAC3_CH_BOTTOM_FRONT_LEFT
#define UAC3_CH_BOTTOM_FRONT_RIGHT
#define UAC3_CH_BOTTOM_FRONT_CENTER
#define UAC3_CH_BOTTOM_FRONT_LOC
#define UAC3_CH_BOTTOM_FRONT_ROC
#define UAC3_CH_BOTTOM_FRONT_WIDE_LEFT
#define UAC3_CH_BOTTOM_FRONT_WIDE_RIGHT
#define UAC3_CH_BOTTOM_SIDE_LEFT
#define UAC3_CH_BOTTOM_SIDE_RIGHT
#define UAC3_CH_BOTTOM_SURR_ARRAY_LEFT
#define UAC3_CH_BOTTOM_SURR_ARRAY_RIGHT
#define UAC3_CH_BOTTOM_BACK_LEFT
#define UAC3_CH_BOTTOM_BACK_RIGHT
#define UAC3_CH_BOTTOM_BACK_CENTER
#define UAC3_CH_BOTTOM_BACK_LOC
#define UAC3_CH_BOTTOM_BACK_ROC
#define UAC3_CH_BOTTOM_BACK_WIDE_LEFT
#define UAC3_CH_BOTTOM_BACK_WIDE_RIGHT
#define UAC3_CH_LOW_FREQUENCY_EFFECTS
#define UAC3_CH_LFE_LEFT
#define UAC3_CH_LFE_RIGHT
#define UAC3_CH_HEADPHONE_LEFT
#define UAC3_CH_HEADPHONE_RIGHT

/* A.15 AUDIO CLASS-SPECIFIC AC INTERFACE DESCRIPTOR SUBTYPES */
/* see audio.h for the rest, which is identical to v1 */
#define UAC3_EXTENDED_TERMINAL
#define UAC3_MIXER_UNIT
#define UAC3_SELECTOR_UNIT
#define UAC3_FEATURE_UNIT
#define UAC3_EFFECT_UNIT
#define UAC3_PROCESSING_UNIT
#define UAC3_EXTENSION_UNIT
#define UAC3_CLOCK_SOURCE
#define UAC3_CLOCK_SELECTOR
#define UAC3_CLOCK_MULTIPLIER
#define UAC3_SAMPLE_RATE_CONVERTER
#define UAC3_CONNECTORS
#define UAC3_POWER_DOMAIN

/* A.20 PROCESSING UNIT PROCESS TYPES */
#define UAC3_PROCESS_UNDEFINED
#define UAC3_PROCESS_UP_DOWNMIX
#define UAC3_PROCESS_STEREO_EXTENDER
#define UAC3_PROCESS_MULTI_FUNCTION

/* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */
/* see audio-v2.h for the rest, which is identical to v2 */
#define UAC3_CS_REQ_INTEN
#define UAC3_CS_REQ_STRING
#define UAC3_CS_REQ_HIGH_CAPABILITY_DESCRIPTOR

/* A.23.1 AUDIOCONTROL INTERFACE CONTROL SELECTORS */
#define UAC3_AC_CONTROL_UNDEFINED
#define UAC3_AC_ACTIVE_INTERFACE_CONTROL
#define UAC3_AC_POWER_DOMAIN_CONTROL

/* A.23.5 TERMINAL CONTROL SELECTORS */
#define UAC3_TE_UNDEFINED
#define UAC3_TE_INSERTION
#define UAC3_TE_OVERLOAD
#define UAC3_TE_UNDERFLOW
#define UAC3_TE_OVERFLOW
#define UAC3_TE_LATENCY

/* A.23.10 PROCESSING UNITS CONTROL SELECTROS */

/* Up/Down Mixer */
#define UAC3_UD_MODE_SELECT

/* Stereo Extender */
#define UAC3_EXT_WIDTH_CONTROL


/* BADD predefined Unit/Terminal values */
#define UAC3_BADD_IT_ID1
#define UAC3_BADD_FU_ID2
#define UAC3_BADD_OT_ID3
#define UAC3_BADD_IT_ID4
#define UAC3_BADD_FU_ID5
#define UAC3_BADD_OT_ID6
#define UAC3_BADD_FU_ID7
#define UAC3_BADD_MU_ID8
#define UAC3_BADD_CS_ID9
#define UAC3_BADD_PD_ID10
#define UAC3_BADD_PD_ID11

/* BADD wMaxPacketSize of AS endpoints */
#define UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_16
#define UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_16
#define UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_24
#define UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_24
#define UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_16
#define UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_16
#define UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_24
#define UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_24

/* BADD sample rate is always fixed to 48kHz */
#define UAC3_BADD_SAMPLING_RATE

/* BADD power domains recovery times in 50us increments */
#define UAC3_BADD_PD_RECOVER_D1D0
#define UAC3_BADD_PD_RECOVER_D2D0

#endif /* __LINUX_USB_AUDIO_V3_H */