linux/include/uapi/linux/usb/audio.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * <linux/usb/audio.h> -- USB Audio definitions.
 *
 * Copyright (C) 2006 Thumtronics Pty Ltd.
 * Developed for Thumtronics by Grey Innovation
 * Ben Williamson <[email protected]>
 *
 * This software is distributed under the terms of the GNU General Public
 * License ("GPL") version 2, as published by the Free Software Foundation.
 *
 * This file holds USB constants and structures defined
 * by the USB Device Class Definition for Audio Devices.
 * Comments below reference relevant sections of that document:
 *
 * http://www.usb.org/developers/devclass_docs/audio10.pdf
 *
 * Types and defines in this file are either specific to version 1.0 of
 * this standard or common for newer versions.
 */

#ifndef _UAPI__LINUX_USB_AUDIO_H
#define _UAPI__LINUX_USB_AUDIO_H

#include <linux/types.h>

/* bInterfaceProtocol values to denote the version of the standard used */
#define UAC_VERSION_1
#define UAC_VERSION_2
#define UAC_VERSION_3

/* A.2 Audio Interface Subclass Codes */
#define USB_SUBCLASS_AUDIOCONTROL
#define USB_SUBCLASS_AUDIOSTREAMING
#define USB_SUBCLASS_MIDISTREAMING

/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
#define UAC_HEADER
#define UAC_INPUT_TERMINAL
#define UAC_OUTPUT_TERMINAL
#define UAC_MIXER_UNIT
#define UAC_SELECTOR_UNIT
#define UAC_FEATURE_UNIT
#define UAC1_PROCESSING_UNIT
#define UAC1_EXTENSION_UNIT

/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
#define UAC_AS_GENERAL
#define UAC_FORMAT_TYPE
#define UAC_FORMAT_SPECIFIC

/* A.7 Processing Unit Process Types */
#define UAC_PROCESS_UNDEFINED
#define UAC_PROCESS_UP_DOWNMIX
#define UAC_PROCESS_DOLBY_PROLOGIC
#define UAC_PROCESS_STEREO_EXTENDER
#define UAC_PROCESS_REVERB
#define UAC_PROCESS_CHORUS
#define UAC_PROCESS_DYN_RANGE_COMP

/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
#define UAC_EP_GENERAL

/* A.9 Audio Class-Specific Request Codes */
#define UAC_SET_
#define UAC_GET_

#define UAC__CUR
#define UAC__MIN
#define UAC__MAX
#define UAC__RES
#define UAC__MEM

#define UAC_SET_CUR
#define UAC_GET_CUR
#define UAC_SET_MIN
#define UAC_GET_MIN
#define UAC_SET_MAX
#define UAC_GET_MAX
#define UAC_SET_RES
#define UAC_GET_RES
#define UAC_SET_MEM
#define UAC_GET_MEM

#define UAC_GET_STAT

/* A.10 Control Selector Codes */

/* A.10.1 Terminal Control Selectors */
#define UAC_TERM_COPY_PROTECT

/* A.10.2 Feature Unit Control Selectors */
#define UAC_FU_MUTE
#define UAC_FU_VOLUME
#define UAC_FU_BASS
#define UAC_FU_MID
#define UAC_FU_TREBLE
#define UAC_FU_GRAPHIC_EQUALIZER
#define UAC_FU_AUTOMATIC_GAIN
#define UAC_FU_DELAY
#define UAC_FU_BASS_BOOST
#define UAC_FU_LOUDNESS

#define UAC_CONTROL_BIT(CS)

/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
#define UAC_UD_ENABLE
#define UAC_UD_MODE_SELECT

/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
#define UAC_DP_ENABLE
#define UAC_DP_MODE_SELECT

/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
#define UAC_3D_ENABLE
#define UAC_3D_SPACE

/* A.10.3.4 Reverberation Processing Unit Control Selectors */
#define UAC_REVERB_ENABLE
#define UAC_REVERB_LEVEL
#define UAC_REVERB_TIME
#define UAC_REVERB_FEEDBACK

/* A.10.3.5 Chorus Processing Unit Control Selectors */
#define UAC_CHORUS_ENABLE
#define UAC_CHORUS_LEVEL
#define UAC_CHORUS_RATE
#define UAC_CHORUS_DEPTH

/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
#define UAC_DCR_ENABLE
#define UAC_DCR_RATE
#define UAC_DCR_MAXAMPL
#define UAC_DCR_THRESHOLD
#define UAC_DCR_ATTACK_TIME
#define UAC_DCR_RELEASE_TIME

/* A.10.4 Extension Unit Control Selectors */
#define UAC_XU_ENABLE

/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
#define UAC_MS_HEADER
#define UAC_MIDI_IN_JACK
#define UAC_MIDI_OUT_JACK

/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
#define UAC_MS_GENERAL

/* Terminals - 2.1 USB Terminal Types */
#define UAC_TERMINAL_UNDEFINED
#define UAC_TERMINAL_STREAMING
#define UAC_TERMINAL_VENDOR_SPEC

/* Terminal Control Selectors */
/* 4.3.2  Class-Specific AC Interface Descriptor */
struct uac1_ac_header_descriptor {} __attribute__ ((packed));

#define UAC_DT_AC_HEADER_SIZE(n)

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

/* 4.3.2.1 Input Terminal Descriptor */
struct uac_input_terminal_descriptor {} __attribute__ ((packed));

#define UAC_DT_INPUT_TERMINAL_SIZE

/* Terminals - 2.2 Input Terminal Types */
#define UAC_INPUT_TERMINAL_UNDEFINED
#define UAC_INPUT_TERMINAL_MICROPHONE
#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE
#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE
#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE
#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY
#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY

/* Terminals - control selectors */

#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL

/* 4.3.2.2 Output Terminal Descriptor */
struct uac1_output_terminal_descriptor {} __attribute__ ((packed));

#define UAC_DT_OUTPUT_TERMINAL_SIZE

/* Terminals - 2.3 Output Terminal Types */
#define UAC_OUTPUT_TERMINAL_UNDEFINED
#define UAC_OUTPUT_TERMINAL_SPEAKER
#define UAC_OUTPUT_TERMINAL_HEADPHONES
#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO
#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER
#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER
#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER
#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER

/* Terminals - 2.4 Bi-directional Terminal Types */
#define UAC_BIDIR_TERMINAL_UNDEFINED
#define UAC_BIDIR_TERMINAL_HANDSET
#define UAC_BIDIR_TERMINAL_HEADSET
#define UAC_BIDIR_TERMINAL_SPEAKER_PHONE
#define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING
#define UAC_BIDIR_TERMINAL_ECHO_CANCELING

/* Set bControlSize = 2 as default setting */
#define UAC_DT_FEATURE_UNIT_SIZE(ch)

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

/* 4.3.2.3 Mixer Unit Descriptor */
struct uac_mixer_unit_descriptor {} __attribute__ ((packed));

static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
{}

static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
						  int protocol)
{}

static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
						int protocol)
{}

static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
					      int protocol)
{}

static inline __u16 uac3_mixer_unit_wClusterDescrID(struct uac_mixer_unit_descriptor *desc)
{}

static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
{}

/* 4.3.2.4 Selector Unit Descriptor */
struct uac_selector_unit_descriptor {} __attribute__ ((packed));

static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
{}

/* 4.3.2.5 Feature Unit Descriptor */
struct uac_feature_unit_descriptor {} __attribute__((packed));

static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
{}

/* 4.3.2.6 Processing Unit Descriptors */
struct uac_processing_unit_descriptor {} __attribute__ ((packed));

static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
{}

static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
						       int protocol)
{}

static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
						     int protocol)
{}

static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
						    int protocol)
{}

static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
						   int protocol)
{}

static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
						   int protocol)
{}

static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
						 int protocol)
{}

/*
 * Extension Unit (XU) has almost compatible layout with Processing Unit, but
 * on UAC2, it has a different bmControls size (bControlSize); it's 1 byte for
 * XU while 2 bytes for PU.  The last iExtension field is a one-byte index as
 * well as iProcessing field of PU.
 */
static inline __u8 uac_extension_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
						   int protocol)
{}

static inline __u8 uac_extension_unit_iExtension(struct uac_processing_unit_descriptor *desc,
						 int protocol)
{}

/* 4.5.2 Class-Specific AS Interface Descriptor */
struct uac1_as_header_descriptor {} __attribute__ ((packed));

#define UAC_DT_AS_HEADER_SIZE

/* Formats - A.1.1 Audio Data Format Type I Codes */
#define UAC_FORMAT_TYPE_I_UNDEFINED
#define UAC_FORMAT_TYPE_I_PCM
#define UAC_FORMAT_TYPE_I_PCM8
#define UAC_FORMAT_TYPE_I_IEEE_FLOAT
#define UAC_FORMAT_TYPE_I_ALAW
#define UAC_FORMAT_TYPE_I_MULAW

struct uac_format_type_i_continuous_descriptor {} __attribute__ ((packed));

#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE

struct uac_format_type_i_discrete_descriptor {} __attribute__ ((packed));

#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n)

#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n)

struct uac_format_type_i_ext_descriptor {} __attribute__((packed));

/* Formats - Audio Data Format Type I Codes */

#define UAC_FORMAT_TYPE_II_MPEG
#define UAC_FORMAT_TYPE_II_AC3

struct uac_format_type_ii_discrete_descriptor {} __attribute__((packed));

struct uac_format_type_ii_ext_descriptor {} __attribute__((packed));

/* type III */
#define UAC_FORMAT_TYPE_III_IEC1937_AC3
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS
#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS

/* Formats - A.2 Format Type Codes */
#define UAC_FORMAT_TYPE_UNDEFINED
#define UAC_FORMAT_TYPE_I
#define UAC_FORMAT_TYPE_II
#define UAC_FORMAT_TYPE_III
#define UAC_EXT_FORMAT_TYPE_I
#define UAC_EXT_FORMAT_TYPE_II
#define UAC_EXT_FORMAT_TYPE_III

struct uac_iso_endpoint_descriptor {} __attribute__((packed));
#define UAC_ISO_ENDPOINT_DESC_SIZE

#define UAC_EP_CS_ATTR_SAMPLE_RATE
#define UAC_EP_CS_ATTR_PITCH_CONTROL
#define UAC_EP_CS_ATTR_FILL_MAX

/* status word format (3.7.1.1) */

#define UAC1_STATUS_TYPE_ORIG_MASK
#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF
#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF
#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP

#define UAC1_STATUS_TYPE_IRQ_PENDING
#define UAC1_STATUS_TYPE_MEM_CHANGED

struct uac1_status_word {} __attribute__((packed));


#endif /* _UAPI__LINUX_USB_AUDIO_H */