Home | History | Annotate | Line # | Download | only in usb
      1  1.19   mlelstv /*	$NetBSD: uaudioreg.h,v 1.19 2023/04/16 19:26:20 mlelstv Exp $	*/
      2   1.1  augustss 
      3   1.1  augustss /*
      4   1.1  augustss  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5   1.1  augustss  * All rights reserved.
      6   1.1  augustss  *
      7   1.5  augustss  * This code is derived from software contributed to The NetBSD Foundation
      8   1.5  augustss  * by Lennart Augustsson (lennart (at) augustsson.net) at
      9   1.5  augustss  * Carlstedt Research & Technology.
     10   1.1  augustss  *
     11   1.1  augustss  * Redistribution and use in source and binary forms, with or without
     12   1.1  augustss  * modification, are permitted provided that the following conditions
     13   1.1  augustss  * are met:
     14   1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     15   1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     16   1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     17   1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     18   1.1  augustss  *    documentation and/or other materials provided with the distribution.
     19   1.1  augustss  *
     20   1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21   1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22   1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23   1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24   1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25   1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26   1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27   1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28   1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29   1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30   1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     31   1.1  augustss  */
     32   1.1  augustss 
     33  1.17   mlelstv #define UAUDIO_VERSION1		0x100
     34  1.17   mlelstv #define UAUDIO_VERSION2		0x200
     35   1.1  augustss 
     36   1.1  augustss #define UDESC_CS_CONFIG		0x22
     37   1.1  augustss #define UDESC_CS_STRING		0x23
     38   1.1  augustss #define UDESC_CS_INTERFACE	0x24
     39   1.1  augustss #define UDESC_CS_ENDPOINT	0x25
     40   1.1  augustss 
     41   1.1  augustss #define UDESCSUB_AC_HEADER	1
     42   1.1  augustss #define UDESCSUB_AC_INPUT	2
     43   1.1  augustss #define UDESCSUB_AC_OUTPUT	3
     44   1.1  augustss #define UDESCSUB_AC_MIXER	4
     45   1.1  augustss #define UDESCSUB_AC_SELECTOR	5
     46   1.1  augustss #define UDESCSUB_AC_FEATURE	6
     47  1.17   mlelstv #define UDESCSUB_AC_EFFECT      7
     48  1.17   mlelstv #define UDESCSUB_AC_PROCESSING	8
     49  1.17   mlelstv #define UDESCSUB_AC_EXTENSION	9
     50  1.17   mlelstv #define UDESCSUB_AC_CLKSRC	10
     51  1.17   mlelstv #define UDESCSUB_AC_CLKSEL	11
     52  1.17   mlelstv #define UDESCSUB_AC_CLKMULT	12
     53  1.17   mlelstv #define UDESCSUB_AC_RATECONV    13
     54   1.1  augustss 
     55   1.1  augustss /* The first fields are identical to usb_endpoint_descriptor_t */
     56   1.1  augustss typedef struct {
     57   1.1  augustss 	uByte		bLength;
     58   1.1  augustss 	uByte		bDescriptorType;
     59   1.1  augustss 	uByte		bEndpointAddress;
     60   1.1  augustss 	uByte		bmAttributes;
     61   1.1  augustss 	uWord		wMaxPacketSize;
     62   1.1  augustss 	uByte		bInterval;
     63   1.9  augustss 	/*
     64   1.1  augustss 	 * The following two entries are only used by the Audio Class.
     65   1.1  augustss 	 * And according to the specs the Audio Class is the only one
     66   1.1  augustss 	 * allowed to extend the endpoint descriptor.
     67   1.1  augustss 	 * Who knows what goes on in the minds of the people in the USB
     68   1.1  augustss 	 * standardization?  :-(
     69  1.19   mlelstv 	 *
     70  1.19   mlelstv 	 * UAC2 no longer uses these extra fields. Check bLength to
     71  1.19   mlelstv 	 * find out if these exist.
     72   1.1  augustss 	 */
     73   1.1  augustss 	uByte		bRefresh;
     74   1.1  augustss 	uByte		bSynchAddress;
     75   1.6  augustss } UPACKED usb_endpoint_descriptor_audio_t;
     76   1.1  augustss 
     77  1.14  drochner /* generic, for iteration */
     78  1.14  drochner typedef struct {
     79  1.14  drochner 	uByte		bLength;
     80  1.14  drochner 	uByte		bDescriptorType;
     81  1.14  drochner 	uByte		bDescriptorSubtype;
     82  1.14  drochner } UPACKED uaudio_cs_descriptor_t;
     83  1.14  drochner 
     84   1.1  augustss struct usb_audio_control_descriptor {
     85   1.1  augustss 	uByte		bLength;
     86   1.1  augustss 	uByte		bDescriptorType;
     87   1.1  augustss 	uByte		bDescriptorSubtype;
     88   1.1  augustss 	uWord		bcdADC;
     89   1.1  augustss 	uWord		wTotalLength;
     90   1.1  augustss 	uByte		bInCollection;
     91   1.1  augustss 	uByte		baInterfaceNr[1];
     92   1.6  augustss } UPACKED;
     93   1.1  augustss 
     94  1.17   mlelstv struct usb_audio_streaming_interface_v1_descriptor {
     95   1.1  augustss 	uByte		bLength;
     96   1.1  augustss 	uByte		bDescriptorType;
     97   1.1  augustss 	uByte		bDescriptorSubtype;
     98   1.1  augustss 	uByte		bTerminalLink;
     99   1.1  augustss 	uByte		bDelay;
    100   1.1  augustss 	uWord		wFormatTag;
    101   1.6  augustss } UPACKED;
    102   1.1  augustss 
    103  1.17   mlelstv struct usb_audio_streaming_interface_v2_descriptor {
    104  1.17   mlelstv 	uByte		bLength;
    105  1.17   mlelstv 	uByte		bDescriptorType;
    106  1.17   mlelstv 	uByte		bDescriptorSubtype;
    107  1.17   mlelstv 	uByte		bTerminalLink;
    108  1.17   mlelstv 	uByte		bmControls;
    109  1.17   mlelstv 	uByte		bFormatType;
    110  1.17   mlelstv 	uDWord		bmFormats;
    111  1.17   mlelstv 	uByte		bNrChannels;
    112  1.17   mlelstv 	uDWord		bmChannelConfig;
    113  1.17   mlelstv 	uByte		iChannelNames;
    114  1.17   mlelstv } UPACKED;
    115  1.17   mlelstv 
    116  1.17   mlelstv union usb_audio_streaming_interface_descriptor {
    117  1.17   mlelstv 	struct usb_audio_streaming_interface_v1_descriptor v1;
    118  1.17   mlelstv 	struct usb_audio_streaming_interface_v2_descriptor v2;
    119  1.17   mlelstv };
    120  1.17   mlelstv 
    121   1.1  augustss struct usb_audio_streaming_endpoint_descriptor {
    122   1.1  augustss 	uByte		bLength;
    123   1.1  augustss 	uByte		bDescriptorType;
    124   1.1  augustss 	uByte		bDescriptorSubtype;
    125   1.1  augustss 	uByte		bmAttributes;
    126   1.8      kent #define UA_SED_FREQ_CONTROL	0x01
    127   1.8      kent #define UA_SED_PITCH_CONTROL	0x02
    128   1.8      kent #define UA_SED_MAXPACKETSONLY	0x80
    129   1.1  augustss 	uByte		bLockDelayUnits;
    130   1.1  augustss 	uWord		wLockDelay;
    131   1.6  augustss } UPACKED;
    132   1.1  augustss 
    133  1.17   mlelstv struct usb_audio_streaming_type1_v1_descriptor {
    134   1.1  augustss 	uByte		bLength;
    135   1.1  augustss 	uByte		bDescriptorType;
    136   1.1  augustss 	uByte		bDescriptorSubtype;
    137   1.1  augustss 	uByte		bFormatType;
    138   1.1  augustss 	uByte		bNrChannels;
    139   1.1  augustss 	uByte		bSubFrameSize;
    140   1.1  augustss 	uByte		bBitResolution;
    141   1.1  augustss 	uByte		bSamFreqType;
    142  1.17   mlelstv #define UA_SAMP_CONTINUOUS 0
    143  1.16       jdc 	uByte		tSamFreq[3*AUFMT_MAX_FREQUENCIES];
    144   1.1  augustss #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16))
    145   1.1  augustss #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
    146   1.1  augustss #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
    147   1.6  augustss } UPACKED;
    148   1.1  augustss 
    149  1.17   mlelstv struct usb_audio_streaming_type1_v2_descriptor {
    150  1.17   mlelstv 	uByte		bLength;
    151  1.17   mlelstv 	uByte		bDescriptorType;
    152  1.17   mlelstv 	uByte		bDescriptorSubtype;
    153  1.17   mlelstv 	uByte		bFormatType;
    154  1.17   mlelstv 	uByte		bSubslotSize;
    155  1.17   mlelstv 	uByte		bBitResolution;
    156  1.17   mlelstv } UPACKED;
    157  1.17   mlelstv 
    158  1.17   mlelstv union usb_audio_streaming_type1_descriptor {
    159  1.17   mlelstv 	struct usb_audio_streaming_type1_v1_descriptor v1;
    160  1.17   mlelstv 	struct usb_audio_streaming_type1_v2_descriptor v2;
    161  1.17   mlelstv };
    162  1.17   mlelstv 
    163  1.18   mlelstv struct usb_audio_v1_cluster {
    164   1.1  augustss 	uByte		bNrChannels;
    165   1.1  augustss 	uWord		wChannelConfig;
    166  1.12      kent #define	UA_CHANNEL_LEFT		0x0001
    167  1.12      kent #define	UA_CHANNEL_RIGHT	0x0002
    168  1.12      kent #define	UA_CHANNEL_CENTER	0x0004
    169  1.12      kent #define	UA_CHANNEL_LFE		0x0008
    170  1.12      kent #define	UA_CHANNEL_L_SURROUND	0x0010
    171  1.12      kent #define	UA_CHANNEL_R_SURROUND	0x0020
    172  1.12      kent #define	UA_CHANNEL_L_CENTER	0x0040
    173  1.12      kent #define	UA_CHANNEL_R_CENTER	0x0080
    174  1.12      kent #define	UA_CHANNEL_SURROUND	0x0100
    175  1.12      kent #define	UA_CHANNEL_L_SIDE	0x0200
    176  1.12      kent #define	UA_CHANNEL_R_SIDE	0x0400
    177  1.12      kent #define	UA_CHANNEL_TOP		0x0800
    178   1.1  augustss 	uByte		iChannelNames;
    179   1.6  augustss } UPACKED;
    180  1.10  augustss 
    181  1.18   mlelstv struct usb_audio_v2_cluster {
    182  1.18   mlelstv 	uByte		bNrChannels;
    183  1.18   mlelstv 	uDWord		bmChannelConfig;
    184  1.18   mlelstv /*#define	UA_CHANNEL_LEFT		0x00000001 */
    185  1.18   mlelstv /*#define	UA_CHANNEL_RIGHT	0x00000002 */
    186  1.18   mlelstv /*#define	UA_CHANNEL_CENTER	0x00000004 */
    187  1.18   mlelstv /*#define	UA_CHANNEL_LFE		0x00000008 */
    188  1.18   mlelstv #define	UA_CHANNEL_BL		0x00000010
    189  1.18   mlelstv #define	UA_CHANNEL_BR		0x00000020
    190  1.18   mlelstv #define	UA_CHANNEL_FLC		0x00000040
    191  1.18   mlelstv #define	UA_CHANNEL_FRC		0x00000080
    192  1.18   mlelstv #define	UA_CHANNEL_BC		0x00000100
    193  1.18   mlelstv #define	UA_CHANNEL_SL		0x00000200
    194  1.18   mlelstv #define	UA_CHANNEL_SR		0x00000400
    195  1.18   mlelstv #define	UA_CHANNEL_TC		0x00000800
    196  1.18   mlelstv #define	UA_CHANNEL_TFL		0x00001000
    197  1.18   mlelstv #define	UA_CHANNEL_TFC		0x00002000
    198  1.18   mlelstv #define	UA_CHANNEL_TFR		0x00004000
    199  1.18   mlelstv #define	UA_CHANNEL_TBL		0x00008000
    200  1.18   mlelstv #define	UA_CHANNEL_TBC		0x00010000
    201  1.18   mlelstv #define	UA_CHANNEL_TBR		0x00020000
    202  1.18   mlelstv #define	UA_CHANNEL_TFLC		0x00040000
    203  1.18   mlelstv #define	UA_CHANNEL_TFRC		0x00080000
    204  1.18   mlelstv #define	UA_CHANNEL_LLFE		0x00100000
    205  1.18   mlelstv #define	UA_CHANNEL_RLFE		0x00200000
    206  1.18   mlelstv #define	UA_CHANNEL_TSL		0x00400000
    207  1.18   mlelstv #define	UA_CHANNEL_TSR		0x00800000
    208  1.18   mlelstv #define	UA_CHANNEL_BOTTOM	0x01000000
    209  1.18   mlelstv #define	UA_CHANNEL_BOTTOMLC	0x02000000
    210  1.18   mlelstv #define	UA_CHANNEL_BOTTOMRC	0x04000000
    211  1.18   mlelstv #define	UA_CHANNEL_RD		0x80000000
    212  1.18   mlelstv 	uByte		iChannelNames;
    213  1.18   mlelstv } UPACKED;
    214  1.18   mlelstv 
    215  1.18   mlelstv union usb_audio_cluster {
    216  1.18   mlelstv 	struct usb_audio_v1_cluster v1;
    217  1.18   mlelstv 	struct usb_audio_v2_cluster v2;
    218  1.18   mlelstv };
    219  1.18   mlelstv 
    220  1.10  augustss /* Shared by all units and terminals */
    221  1.10  augustss struct usb_audio_unit {
    222  1.10  augustss 	uByte		bLength;
    223  1.10  augustss 	uByte		bDescriptorType;
    224  1.10  augustss 	uByte		bDescriptorSubtype;
    225  1.10  augustss 	uByte		bUnitId;
    226  1.10  augustss };
    227   1.1  augustss 
    228   1.1  augustss /* UDESCSUB_AC_INPUT */
    229  1.18   mlelstv struct usb_audio_input_v1_terminal {
    230   1.1  augustss 	uByte		bLength;
    231   1.1  augustss 	uByte		bDescriptorType;
    232   1.1  augustss 	uByte		bDescriptorSubtype;
    233   1.1  augustss 	uByte		bTerminalId;
    234   1.1  augustss 	uWord		wTerminalType;
    235   1.1  augustss 	uByte		bAssocTerminal;
    236   1.1  augustss 	uByte		bNrChannels;
    237   1.1  augustss 	uWord		wChannelConfig;
    238   1.1  augustss 	uByte		iChannelNames;
    239   1.1  augustss 	uByte		iTerminal;
    240   1.6  augustss } UPACKED;
    241  1.18   mlelstv struct usb_audio_input_v2_terminal {
    242  1.18   mlelstv 	uByte		bLength;
    243  1.18   mlelstv 	uByte		bDescriptorType;
    244  1.18   mlelstv 	uByte		bDescriptorSubtype;
    245  1.18   mlelstv 	uByte		bTerminalId;
    246  1.18   mlelstv 	uWord		wTerminalType;
    247  1.18   mlelstv 	uByte		bAssocTerminal;
    248  1.18   mlelstv 	uByte		bCSourceId;
    249  1.18   mlelstv 	uByte		bNrChannels;
    250  1.18   mlelstv 	uDWord		bmChannelConfig;
    251  1.18   mlelstv 	uByte		iChannelNames;
    252  1.18   mlelstv 	uWord		bmControls;
    253  1.18   mlelstv 	uByte		iTerminal;
    254  1.18   mlelstv } UPACKED;
    255  1.18   mlelstv 
    256  1.18   mlelstv union usb_audio_input_terminal {
    257  1.18   mlelstv 	struct usb_audio_input_v1_terminal v1;
    258  1.18   mlelstv 	struct usb_audio_input_v2_terminal v2;
    259  1.18   mlelstv };
    260   1.1  augustss 
    261   1.1  augustss /* UDESCSUB_AC_OUTPUT */
    262  1.18   mlelstv struct usb_audio_output_v1_terminal {
    263   1.1  augustss 	uByte		bLength;
    264   1.1  augustss 	uByte		bDescriptorType;
    265   1.1  augustss 	uByte		bDescriptorSubtype;
    266   1.1  augustss 	uByte		bTerminalId;
    267   1.1  augustss 	uWord		wTerminalType;
    268   1.1  augustss 	uByte		bAssocTerminal;
    269   1.1  augustss 	uByte		bSourceId;
    270   1.1  augustss 	uByte		iTerminal;
    271   1.6  augustss } UPACKED;
    272  1.18   mlelstv struct usb_audio_output_v2_terminal {
    273  1.18   mlelstv 	uByte		bLength;
    274  1.18   mlelstv 	uByte		bDescriptorType;
    275  1.18   mlelstv 	uByte		bDescriptorSubtype;
    276  1.18   mlelstv 	uByte		bTerminalId;
    277  1.18   mlelstv 	uWord		wTerminalType;
    278  1.18   mlelstv 	uByte		bAssocTerminal;
    279  1.18   mlelstv 	uByte		bSourceId;
    280  1.18   mlelstv 	uByte		bCSourceId;
    281  1.18   mlelstv 	uWord		bmControls;
    282  1.18   mlelstv 	uByte		iTerminal;
    283  1.18   mlelstv } UPACKED;
    284  1.18   mlelstv 
    285  1.18   mlelstv union usb_audio_output_terminal {
    286  1.18   mlelstv 	struct usb_audio_output_v1_terminal v1;
    287  1.18   mlelstv 	struct usb_audio_output_v2_terminal v2;
    288  1.18   mlelstv };
    289   1.1  augustss 
    290   1.1  augustss /* UDESCSUB_AC_MIXER */
    291   1.1  augustss struct usb_audio_mixer_unit {
    292   1.1  augustss 	uByte		bLength;
    293   1.1  augustss 	uByte		bDescriptorType;
    294   1.1  augustss 	uByte		bDescriptorSubtype;
    295   1.1  augustss 	uByte		bUnitId;
    296   1.1  augustss 	uByte		bNrInPins;
    297   1.4  augustss 	uByte		baSourceId[255]; /* [bNrInPins] */
    298  1.18   mlelstv 	/* union usb_audio_mixer_unit_1 */
    299   1.6  augustss } UPACKED;
    300  1.18   mlelstv struct usb_audio_mixer_v1_unit_1 {
    301   1.1  augustss 	uByte		bNrChannels;
    302   1.1  augustss 	uWord		wChannelConfig;
    303   1.1  augustss 	uByte		iChannelNames;
    304   1.4  augustss 	uByte		bmControls[255]; /* [bNrChannels] */
    305   1.1  augustss 	/*uByte		iMixer;*/
    306   1.6  augustss } UPACKED;
    307  1.18   mlelstv struct usb_audio_mixer_v2_unit_1 {
    308  1.18   mlelstv 	uByte		bNrChannels;
    309  1.18   mlelstv 	uDWord		bmChannelConfig;
    310  1.18   mlelstv 	uByte		iChannelNames;
    311  1.19   mlelstv 	uByte		bmMixerControls[255]; /* [bNrChannels] */
    312  1.19   mlelstv 	/*uByte		bmControls;*/
    313  1.18   mlelstv 	/*uByte		iMixer;*/
    314  1.18   mlelstv } UPACKED;
    315  1.19   mlelstv #define UA_MIX_CLUSTER_MASK	0x03
    316  1.19   mlelstv #define UA_MIX_CLUSTER_RO	0x01
    317  1.19   mlelstv #define UA_MIX_CLUSTER_RW	0x03
    318  1.19   mlelstv /* UAC2 */
    319  1.19   mlelstv #define UA_MIX_UNDERFLOW_MASK	0x0c
    320  1.19   mlelstv #define UA_MIX_UNDERFLOW_RO	0x04
    321  1.19   mlelstv #define UA_MIX_UNDERFLOW_RW	0x0c
    322  1.19   mlelstv #define UA_MIX_OVERFLOW_MASK	0x30
    323  1.19   mlelstv #define UA_MIX_OVERFLOW_RO	0x10
    324  1.19   mlelstv #define UA_MIX_OVERFLOW_RW	0x30
    325  1.18   mlelstv 
    326  1.18   mlelstv union usb_audio_mixer_unit_1 {
    327  1.18   mlelstv 	struct usb_audio_mixer_v1_unit_1 v1;
    328  1.18   mlelstv 	struct usb_audio_mixer_v2_unit_1 v2;
    329  1.18   mlelstv };
    330   1.1  augustss 
    331   1.1  augustss /* UDESCSUB_AC_SELECTOR */
    332   1.1  augustss struct usb_audio_selector_unit {
    333   1.1  augustss 	uByte		bLength;
    334   1.1  augustss 	uByte		bDescriptorType;
    335   1.1  augustss 	uByte		bDescriptorSubtype;
    336   1.1  augustss 	uByte		bUnitId;
    337   1.1  augustss 	uByte		bNrInPins;
    338   1.4  augustss 	uByte		baSourceId[255]; /* [bNrInPins] */
    339   1.1  augustss 	/* uByte	iSelector; */
    340   1.6  augustss } UPACKED;
    341   1.1  augustss 
    342   1.1  augustss /* UDESCSUB_AC_FEATURE */
    343  1.19   mlelstv struct usb_audio_feature_v1_unit {
    344   1.1  augustss 	uByte		bLength;
    345   1.1  augustss 	uByte		bDescriptorType;
    346   1.1  augustss 	uByte		bDescriptorSubtype;
    347   1.1  augustss 	uByte		bUnitId;
    348   1.1  augustss 	uByte		bSourceId;
    349   1.1  augustss 	uByte		bControlSize;
    350   1.1  augustss 	uByte		bmaControls[255]; /* size for more than enough */
    351   1.1  augustss 	/* uByte	iFeature; */
    352   1.6  augustss } UPACKED;
    353  1.19   mlelstv struct usb_audio_feature_v2_unit {
    354  1.19   mlelstv 	uByte		bLength;
    355  1.19   mlelstv 	uByte		bDescriptorType;
    356  1.19   mlelstv 	uByte		bDescriptorSubtype;
    357  1.19   mlelstv 	uByte		bUnitId;
    358  1.19   mlelstv 	uByte		bSourceId;
    359  1.19   mlelstv 	uDWord		bmaControls[255]; /* size for more than enough */
    360  1.19   mlelstv 	/* uByte	iFeature; */
    361  1.19   mlelstv } UPACKED;
    362  1.19   mlelstv 
    363  1.19   mlelstv union usb_audio_feature_unit {
    364  1.19   mlelstv 	struct usb_audio_feature_v1_unit v1;
    365  1.19   mlelstv 	struct usb_audio_feature_v2_unit v2;
    366  1.19   mlelstv };
    367   1.1  augustss 
    368   1.1  augustss /* UDESCSUB_AC_PROCESSING */
    369   1.1  augustss struct usb_audio_processing_unit {
    370   1.1  augustss 	uByte		bLength;
    371   1.1  augustss 	uByte		bDescriptorType;
    372   1.1  augustss 	uByte		bDescriptorSubtype;
    373   1.1  augustss 	uByte		bUnitId;
    374   1.1  augustss 	uWord		wProcessType;
    375   1.1  augustss 	uByte		bNrInPins;
    376   1.4  augustss 	uByte		baSourceId[255]; /* [bNrInPins] */
    377   1.1  augustss 	/* struct usb_audio_processing_unit_1 */
    378   1.6  augustss } UPACKED;
    379   1.1  augustss struct usb_audio_processing_unit_1{
    380   1.1  augustss 	uByte		bNrChannels;
    381   1.1  augustss 	uWord		wChannelConfig;
    382   1.1  augustss 	uByte		iChannelNames;
    383   1.1  augustss 	uByte		bControlSize;
    384   1.4  augustss 	uByte		bmControls[255]; /* [bControlSize] */
    385   1.3  augustss #define UA_PROC_ENABLE_MASK 1
    386   1.6  augustss } UPACKED;
    387   1.4  augustss 
    388   1.4  augustss struct usb_audio_processing_unit_updown {
    389   1.4  augustss 	uByte		iProcessing;
    390   1.4  augustss 	uByte		bNrModes;
    391   1.4  augustss 	uWord		waModes[255]; /* [bNrModes] */
    392   1.6  augustss } UPACKED;
    393   1.1  augustss 
    394   1.1  augustss /* UDESCSUB_AC_EXTENSION */
    395   1.1  augustss struct usb_audio_extension_unit {
    396   1.1  augustss 	uByte		bLength;
    397   1.1  augustss 	uByte		bDescriptorType;
    398   1.1  augustss 	uByte		bDescriptorSubtype;
    399   1.1  augustss 	uByte		bUnitId;
    400   1.1  augustss 	uWord		wExtensionCode;
    401   1.1  augustss 	uByte		bNrInPins;
    402   1.4  augustss 	uByte		baSourceId[255]; /* [bNrInPins] */
    403   1.1  augustss 	/* struct usb_audio_extension_unit_1 */
    404   1.6  augustss } UPACKED;
    405   1.1  augustss struct usb_audio_extension_unit_1 {
    406   1.1  augustss 	uByte		bNrChannels;
    407   1.1  augustss 	uWord		wChannelConfig;
    408   1.1  augustss 	uByte		iChannelNames;
    409   1.1  augustss 	uByte		bControlSize;
    410   1.4  augustss 	uByte		bmControls[255]; /* [bControlSize] */
    411   1.3  augustss #define UA_EXT_ENABLE_MASK 1
    412   1.3  augustss #define UA_EXT_ENABLE 1
    413   1.1  augustss 	/*uByte		iExtension;*/
    414   1.6  augustss } UPACKED;
    415   1.1  augustss 
    416  1.17   mlelstv /* UDESCSUB_AC_CLKSRC */
    417  1.17   mlelstv struct usb_audio_clksrc_unit {
    418  1.17   mlelstv 	uByte		bLength;
    419  1.17   mlelstv 	uByte		bDescriptorType;
    420  1.17   mlelstv 	uByte		bDescriptorSubtype;
    421  1.17   mlelstv 	uByte		bClockId;
    422  1.17   mlelstv 	uByte		bmAttributes;
    423  1.17   mlelstv 	uByte		bmControls;
    424  1.17   mlelstv 	uByte		bAssocTerminal;
    425  1.17   mlelstv 	uByte		iClockSource;
    426  1.17   mlelstv } UPACKED;
    427  1.17   mlelstv 
    428  1.17   mlelstv /* UDESCSUB_AC_CLKSEL */
    429  1.17   mlelstv struct usb_audio_clksel_unit {
    430  1.17   mlelstv 	uByte		bLength;
    431  1.17   mlelstv 	uByte		bDescriptorType;
    432  1.17   mlelstv 	uByte		bDescriptorSubtype;
    433  1.17   mlelstv 	uByte		bClockId;
    434  1.17   mlelstv 	uByte		bNrInPins;
    435  1.17   mlelstv 	uByte		baCSourceId[255];
    436  1.17   mlelstv 	/*uByte		bmControls;*/
    437  1.17   mlelstv 	/*uByte		iClockSelector;*/
    438  1.17   mlelstv } UPACKED;
    439  1.17   mlelstv 
    440  1.17   mlelstv /* UDESCSUB_AC_CLKMULT */
    441  1.17   mlelstv struct usb_audio_clkmult_unit {
    442  1.17   mlelstv 	uByte		bLength;
    443  1.17   mlelstv 	uByte		bDescriptorType;
    444  1.17   mlelstv 	uByte		bDescriptorSubtype;
    445  1.17   mlelstv 	uByte		bClockId;
    446  1.17   mlelstv 	uByte		bCSourceId;
    447  1.17   mlelstv 	uByte		bmControls;
    448  1.17   mlelstv 	uByte		iClockMultiplier;
    449  1.17   mlelstv } UPACKED;
    450  1.17   mlelstv 
    451   1.7  augustss /* USB terminal types */
    452   1.7  augustss #define UAT_UNDEFINED		0x0100
    453   1.7  augustss #define UAT_STREAM		0x0101
    454   1.7  augustss #define UAT_VENDOR		0x01ff
    455   1.7  augustss /* input terminal types */
    456   1.7  augustss #define UATI_UNDEFINED		0x0200
    457   1.7  augustss #define UATI_MICROPHONE		0x0201
    458   1.7  augustss #define UATI_DESKMICROPHONE	0x0202
    459   1.7  augustss #define UATI_PERSONALMICROPHONE	0x0203
    460   1.7  augustss #define UATI_OMNIMICROPHONE	0x0204
    461   1.7  augustss #define UATI_MICROPHONEARRAY	0x0205
    462   1.7  augustss #define UATI_PROCMICROPHONEARR	0x0206
    463   1.7  augustss /* output terminal types */
    464   1.7  augustss #define UATO_UNDEFINED		0x0300
    465   1.7  augustss #define UATO_SPEAKER		0x0301
    466   1.7  augustss #define UATO_HEADPHONES		0x0302
    467   1.7  augustss #define UATO_DISPLAYAUDIO	0x0303
    468   1.7  augustss #define UATO_DESKTOPSPEAKER	0x0304
    469   1.7  augustss #define UATO_ROOMSPEAKER	0x0305
    470   1.7  augustss #define UATO_COMMSPEAKER	0x0306
    471   1.7  augustss #define UATO_SUBWOOFER		0x0307
    472   1.7  augustss /* bidir terminal types */
    473   1.7  augustss #define UATB_UNDEFINED		0x0400
    474   1.7  augustss #define UATB_HANDSET		0x0401
    475   1.7  augustss #define UATB_HEADSET		0x0402
    476   1.7  augustss #define UATB_SPEAKERPHONE	0x0403
    477   1.7  augustss #define UATB_SPEAKERPHONEESUP	0x0404
    478   1.7  augustss #define UATB_SPEAKERPHONEECANC	0x0405
    479   1.7  augustss /* telephony terminal types */
    480   1.7  augustss #define UATT_UNDEFINED		0x0500
    481   1.7  augustss #define UATT_PHONELINE		0x0501
    482   1.7  augustss #define UATT_TELEPHONE		0x0502
    483   1.7  augustss #define UATT_DOWNLINEPHONE	0x0503
    484   1.7  augustss /* external terminal types */
    485   1.7  augustss #define UATE_UNDEFINED		0x0600
    486   1.7  augustss #define UATE_ANALOGCONN		0x0601
    487   1.7  augustss #define UATE_DIGITALAUIFC	0x0602
    488   1.7  augustss #define UATE_LINECONN		0x0603
    489   1.7  augustss #define UATE_LEGACYCONN		0x0604
    490   1.7  augustss #define UATE_SPDIF		0x0605
    491   1.7  augustss #define UATE_1394DA		0x0606
    492   1.7  augustss #define UATE_1394DV		0x0607
    493   1.7  augustss /* embedded function terminal types */
    494   1.7  augustss #define UATF_UNDEFINED		0x0700
    495   1.7  augustss #define UATF_CALIBNOISE		0x0701
    496   1.7  augustss #define UATF_EQUNOISE		0x0702
    497   1.7  augustss #define UATF_CDPLAYER		0x0703
    498   1.7  augustss #define UATF_DAT		0x0704
    499   1.7  augustss #define UATF_DCC		0x0705
    500   1.7  augustss #define UATF_MINIDISK		0x0706
    501   1.7  augustss #define UATF_ANALOGTAPE		0x0707
    502   1.7  augustss #define UATF_PHONOGRAPH		0x0708
    503   1.7  augustss #define UATF_VCRAUDIO		0x0709
    504   1.7  augustss #define UATF_VIDEODISCAUDIO	0x070a
    505   1.7  augustss #define UATF_DVDAUDIO		0x070b
    506   1.7  augustss #define UATF_TVTUNERAUDIO	0x070c
    507   1.7  augustss #define UATF_SATELLITE		0x070d
    508   1.7  augustss #define UATF_CABLETUNER		0x070e
    509   1.7  augustss #define UATF_DSS		0x070f
    510   1.7  augustss #define UATF_RADIORECV		0x0710
    511   1.7  augustss #define UATF_RADIOXMIT		0x0711
    512   1.7  augustss #define UATF_MULTITRACK		0x0712
    513   1.7  augustss #define UATF_SYNTHESIZER	0x0713
    514   1.7  augustss 
    515   1.1  augustss 
    516   1.1  augustss #define SET_CUR 0x01
    517   1.1  augustss #define GET_CUR 0x81
    518   1.1  augustss #define SET_MIN 0x02
    519   1.1  augustss #define GET_MIN 0x82
    520   1.1  augustss #define SET_MAX 0x03
    521   1.1  augustss #define GET_MAX 0x83
    522   1.1  augustss #define SET_RES 0x04
    523   1.1  augustss #define GET_RES 0x84
    524   1.1  augustss #define SET_MEM 0x05
    525   1.1  augustss #define GET_MEM 0x85
    526   1.1  augustss #define GET_STAT 0xff
    527  1.19   mlelstv 
    528  1.19   mlelstv #define V2_CUR		0x01
    529  1.19   mlelstv #define V2_RANGES	0x02
    530  1.17   mlelstv 
    531  1.17   mlelstv #define V2_CUR_CLKFREQ	0x01
    532  1.17   mlelstv #define V2_CUR_CLKSEL	0x01
    533  1.19   mlelstv #define V2_CUR_SELECTOR 0x01
    534  1.17   mlelstv 
    535   1.1  augustss 
    536   1.1  augustss #define MUTE_CONTROL	0x01
    537   1.1  augustss #define VOLUME_CONTROL	0x02
    538   1.1  augustss #define BASS_CONTROL	0x03
    539   1.1  augustss #define MID_CONTROL	0x04
    540   1.1  augustss #define TREBLE_CONTROL	0x05
    541   1.1  augustss #define GRAPHIC_EQUALIZER_CONTROL	0x06
    542   1.1  augustss #define AGC_CONTROL	0x07
    543   1.1  augustss #define DELAY_CONTROL	0x08
    544   1.1  augustss #define BASS_BOOST_CONTROL 0x09
    545   1.1  augustss #define LOUDNESS_CONTROL 0x0a
    546  1.17   mlelstv #define GAIN_CONTROL	0x0b
    547  1.17   mlelstv #define GAINPAD_CONTROL	0x0c
    548  1.17   mlelstv #define PHASEINV_CONTROL 0x0d
    549  1.19   mlelstv /* V2 */
    550  1.19   mlelstv #define UNDERFLOW_CONTROL 0x0e
    551  1.19   mlelstv #define OVERFLOW_CONTROL 0x0f
    552   1.1  augustss 
    553   1.1  augustss #define FU_MASK(u) (1 << ((u)-1))
    554  1.19   mlelstv #define V2_FU_MASK(u) (3 << ((u)-1)*2)
    555   1.1  augustss 
    556   1.2  augustss #define MASTER_CHAN	0
    557   1.1  augustss 
    558   1.2  augustss #define AS_GENERAL	1
    559   1.2  augustss #define FORMAT_TYPE	2
    560   1.1  augustss #define FORMAT_SPECIFIC 3
    561   1.1  augustss 
    562   1.2  augustss #define UA_FMT_PCM	1
    563   1.2  augustss #define UA_FMT_PCM8	2
    564   1.2  augustss #define UA_FMT_IEEE_FLOAT 3
    565   1.2  augustss #define UA_FMT_ALAW	4
    566   1.2  augustss #define UA_FMT_MULAW	5
    567   1.8      kent #define UA_FMT_MPEG	0x1001
    568   1.8      kent #define UA_FMT_AC3	0x1002
    569   1.1  augustss 
    570  1.17   mlelstv #define UA_V2_FMT_PCM		0x01
    571  1.17   mlelstv #define UA_V2_FMT_PCM8		0x02
    572  1.17   mlelstv #define UA_V2_FMT_IEEE_FLOAT	0x04
    573  1.17   mlelstv #define UA_V2_FMT_ALAW		0x08
    574  1.17   mlelstv #define UA_V2_FMT_MULAW		0x10
    575  1.17   mlelstv 
    576   1.8      kent #define SAMPLING_FREQ_CONTROL	0x01
    577   1.8      kent #define PITCH_CONTROL		0x02
    578   1.2  augustss 
    579   1.2  augustss #define FORMAT_TYPE_UNDEFINED 0
    580   1.2  augustss #define FORMAT_TYPE_I 1
    581   1.2  augustss #define FORMAT_TYPE_II 2
    582   1.2  augustss #define FORMAT_TYPE_III 3
    583   1.3  augustss 
    584   1.4  augustss #define UA_PROC_MASK(n) (1<< ((n)-1))
    585   1.3  augustss #define PROCESS_UNDEFINED		0
    586   1.3  augustss #define  XX_ENABLE_CONTROL			1
    587   1.3  augustss #define UPDOWNMIX_PROCESS		1
    588   1.3  augustss #define  UD_ENABLE_CONTROL			1
    589   1.3  augustss #define  UD_MODE_SELECT_CONTROL			2
    590   1.3  augustss #define DOLBY_PROLOGIC_PROCESS		2
    591   1.3  augustss #define  DP_ENABLE_CONTROL			1
    592   1.3  augustss #define  DP_MODE_SELECT_CONTROL			2
    593   1.3  augustss #define P3D_STEREO_EXTENDER_PROCESS	3
    594   1.3  augustss #define  P3D_ENABLE_CONTROL			1
    595   1.3  augustss #define  P3D_SPACIOUSNESS_CONTROL		2
    596   1.3  augustss #define REVERBATION_PROCESS		4
    597   1.3  augustss #define  RV_ENABLE_CONTROL			1
    598   1.3  augustss #define  RV_LEVEL_CONTROL			2
    599   1.3  augustss #define  RV_TIME_CONTROL			3
    600   1.3  augustss #define  RV_FEEDBACK_CONTROL			4
    601   1.3  augustss #define CHORUS_PROCESS			5
    602   1.3  augustss #define  CH_ENABLE_CONTROL			1
    603   1.3  augustss #define  CH_LEVEL_CONTROL			2
    604   1.3  augustss #define  CH_RATE_CONTROL			3
    605   1.3  augustss #define  CH_DEPTH_CONTROL			4
    606   1.3  augustss #define DYN_RANGE_COMP_PROCESS		6
    607   1.3  augustss #define  DR_ENABLE_CONTROL			1
    608   1.3  augustss #define  DR_COMPRESSION_RATE_CONTROL		2
    609   1.3  augustss #define  DR_MAXAMPL_CONTROL			3
    610   1.3  augustss #define  DR_THRESHOLD_CONTROL			4
    611   1.3  augustss #define  DR_ATTACK_TIME_CONTROL			5
    612   1.3  augustss #define  DR_RELEASE_TIME_CONTROL		6
    613