xref: /openbmc/linux/include/uapi/sound/asound.h (revision 975cc02a)
1674e95caSDavid Howells /*
2674e95caSDavid Howells  *  Advanced Linux Sound Architecture - ALSA - Driver
3674e95caSDavid Howells  *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
4674e95caSDavid Howells  *                             Abramo Bagnara <abramo@alsa-project.org>
5674e95caSDavid Howells  *
6674e95caSDavid Howells  *
7674e95caSDavid Howells  *   This program is free software; you can redistribute it and/or modify
8674e95caSDavid Howells  *   it under the terms of the GNU General Public License as published by
9674e95caSDavid Howells  *   the Free Software Foundation; either version 2 of the License, or
10674e95caSDavid Howells  *   (at your option) any later version.
11674e95caSDavid Howells  *
12674e95caSDavid Howells  *   This program is distributed in the hope that it will be useful,
13674e95caSDavid Howells  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14674e95caSDavid Howells  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15674e95caSDavid Howells  *   GNU General Public License for more details.
16674e95caSDavid Howells  *
17674e95caSDavid Howells  *   You should have received a copy of the GNU General Public License
18674e95caSDavid Howells  *   along with this program; if not, write to the Free Software
19674e95caSDavid Howells  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20674e95caSDavid Howells  *
21674e95caSDavid Howells  */
22674e95caSDavid Howells 
23674e95caSDavid Howells #ifndef _UAPI__SOUND_ASOUND_H
24674e95caSDavid Howells #define _UAPI__SOUND_ASOUND_H
25674e95caSDavid Howells 
26674e95caSDavid Howells #include <linux/types.h>
27674e95caSDavid Howells 
28674e95caSDavid Howells 
29674e95caSDavid Howells /*
30674e95caSDavid Howells  *  protocol version
31674e95caSDavid Howells  */
32674e95caSDavid Howells 
33674e95caSDavid Howells #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
34674e95caSDavid Howells #define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
35674e95caSDavid Howells #define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
36674e95caSDavid Howells #define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
37674e95caSDavid Howells #define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
38674e95caSDavid Howells 	(SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
39674e95caSDavid Howells 	 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
40674e95caSDavid Howells 	   SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
41674e95caSDavid Howells 
42674e95caSDavid Howells /****************************************************************************
43674e95caSDavid Howells  *                                                                          *
44674e95caSDavid Howells  *        Digital audio interface					    *
45674e95caSDavid Howells  *                                                                          *
46674e95caSDavid Howells  ****************************************************************************/
47674e95caSDavid Howells 
48674e95caSDavid Howells struct snd_aes_iec958 {
49674e95caSDavid Howells 	unsigned char status[24];	/* AES/IEC958 channel status bits */
50674e95caSDavid Howells 	unsigned char subcode[147];	/* AES/IEC958 subcode bits */
51674e95caSDavid Howells 	unsigned char pad;		/* nothing */
52674e95caSDavid Howells 	unsigned char dig_subframe[4];	/* AES/IEC958 subframe bits */
53674e95caSDavid Howells };
54674e95caSDavid Howells 
55674e95caSDavid Howells /****************************************************************************
56674e95caSDavid Howells  *                                                                          *
57674e95caSDavid Howells  *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort		    *
58674e95caSDavid Howells  *                                                                          *
59674e95caSDavid Howells  ****************************************************************************/
60674e95caSDavid Howells 
61674e95caSDavid Howells struct snd_cea_861_aud_if {
62674e95caSDavid Howells 	unsigned char db1_ct_cc; /* coding type and channel count */
63674e95caSDavid Howells 	unsigned char db2_sf_ss; /* sample frequency and size */
64674e95caSDavid Howells 	unsigned char db3; /* not used, all zeros */
65674e95caSDavid Howells 	unsigned char db4_ca; /* channel allocation code */
66674e95caSDavid Howells 	unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
67674e95caSDavid Howells };
68674e95caSDavid Howells 
69674e95caSDavid Howells /****************************************************************************
70674e95caSDavid Howells  *                                                                          *
71674e95caSDavid Howells  *      Section for driver hardware dependent interface - /dev/snd/hw?      *
72674e95caSDavid Howells  *                                                                          *
73674e95caSDavid Howells  ****************************************************************************/
74674e95caSDavid Howells 
75674e95caSDavid Howells #define SNDRV_HWDEP_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
76674e95caSDavid Howells 
77674e95caSDavid Howells enum {
78674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_OPL2 = 0,
79674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_OPL3,
80674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_OPL4,
81674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_SB16CSP,	/* Creative Signal Processor */
82674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_EMU10K1,	/* FX8010 processor in EMU10K1 chip */
83674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_YSS225,	/* Yamaha FX processor */
84674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_ICS2115,	/* Wavetable synth */
85674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_SSCAPE,	/* Ensoniq SoundScape ISA card (MC68EC000) */
86674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */
87674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */
88674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_USX2Y,	/* Tascam US122, US224 & US428 usb */
89674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
90674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_BLUETOOTH,	/* Bluetooth audio */
91674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_USX2Y_PCM,	/* Tascam US122, US224 & US428 rawusb pcm */
92674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_PCXHR,	/* Digigram PCXHR */
93674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_SB_RC,	/* SB Extigy/Audigy2NX remote control */
94674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_HDA,		/* HD-audio */
95674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_USB_STREAM,	/* direct access to usb stream */
96674e95caSDavid Howells 
97674e95caSDavid Howells 	/* Don't forget to change the following: */
98674e95caSDavid Howells 	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
99674e95caSDavid Howells };
100674e95caSDavid Howells 
101674e95caSDavid Howells struct snd_hwdep_info {
102674e95caSDavid Howells 	unsigned int device;		/* WR: device number */
103674e95caSDavid Howells 	int card;			/* R: card number */
104674e95caSDavid Howells 	unsigned char id[64];		/* ID (user selectable) */
105674e95caSDavid Howells 	unsigned char name[80];		/* hwdep name */
106674e95caSDavid Howells 	int iface;			/* hwdep interface */
107674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved for future */
108674e95caSDavid Howells };
109674e95caSDavid Howells 
110674e95caSDavid Howells /* generic DSP loader */
111674e95caSDavid Howells struct snd_hwdep_dsp_status {
112674e95caSDavid Howells 	unsigned int version;		/* R: driver-specific version */
113674e95caSDavid Howells 	unsigned char id[32];		/* R: driver-specific ID string */
114674e95caSDavid Howells 	unsigned int num_dsps;		/* R: number of DSP images to transfer */
115674e95caSDavid Howells 	unsigned int dsp_loaded;	/* R: bit flags indicating the loaded DSPs */
116674e95caSDavid Howells 	unsigned int chip_ready;	/* R: 1 = initialization finished */
117674e95caSDavid Howells 	unsigned char reserved[16];	/* reserved for future use */
118674e95caSDavid Howells };
119674e95caSDavid Howells 
120674e95caSDavid Howells struct snd_hwdep_dsp_image {
121674e95caSDavid Howells 	unsigned int index;		/* W: DSP index */
122674e95caSDavid Howells 	unsigned char name[64];		/* W: ID (e.g. file name) */
123674e95caSDavid Howells 	unsigned char __user *image;	/* W: binary image */
124674e95caSDavid Howells 	size_t length;			/* W: size of image in bytes */
125674e95caSDavid Howells 	unsigned long driver_data;	/* W: driver-specific data */
126674e95caSDavid Howells };
127674e95caSDavid Howells 
128674e95caSDavid Howells #define SNDRV_HWDEP_IOCTL_PVERSION	_IOR ('H', 0x00, int)
129674e95caSDavid Howells #define SNDRV_HWDEP_IOCTL_INFO		_IOR ('H', 0x01, struct snd_hwdep_info)
130674e95caSDavid Howells #define SNDRV_HWDEP_IOCTL_DSP_STATUS	_IOR('H', 0x02, struct snd_hwdep_dsp_status)
131674e95caSDavid Howells #define SNDRV_HWDEP_IOCTL_DSP_LOAD	_IOW('H', 0x03, struct snd_hwdep_dsp_image)
132674e95caSDavid Howells 
133674e95caSDavid Howells /*****************************************************************************
134674e95caSDavid Howells  *                                                                           *
135674e95caSDavid Howells  *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
136674e95caSDavid Howells  *                                                                           *
137674e95caSDavid Howells  *****************************************************************************/
138674e95caSDavid Howells 
1394eeaaeaeSPierre-Louis Bossart #define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 11)
140674e95caSDavid Howells 
141674e95caSDavid Howells typedef unsigned long snd_pcm_uframes_t;
142674e95caSDavid Howells typedef signed long snd_pcm_sframes_t;
143674e95caSDavid Howells 
144674e95caSDavid Howells enum {
145674e95caSDavid Howells 	SNDRV_PCM_CLASS_GENERIC = 0,	/* standard mono or stereo device */
146674e95caSDavid Howells 	SNDRV_PCM_CLASS_MULTI,		/* multichannel device */
147674e95caSDavid Howells 	SNDRV_PCM_CLASS_MODEM,		/* software modem class */
148674e95caSDavid Howells 	SNDRV_PCM_CLASS_DIGITIZER,	/* digitizer class */
149674e95caSDavid Howells 	/* Don't forget to change the following: */
150674e95caSDavid Howells 	SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
151674e95caSDavid Howells };
152674e95caSDavid Howells 
153674e95caSDavid Howells enum {
154674e95caSDavid Howells 	SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
155674e95caSDavid Howells 	SNDRV_PCM_SUBCLASS_MULTI_MIX,	/* multichannel subdevices are mixed together */
156674e95caSDavid Howells 	/* Don't forget to change the following: */
157674e95caSDavid Howells 	SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
158674e95caSDavid Howells };
159674e95caSDavid Howells 
160674e95caSDavid Howells enum {
161674e95caSDavid Howells 	SNDRV_PCM_STREAM_PLAYBACK = 0,
162674e95caSDavid Howells 	SNDRV_PCM_STREAM_CAPTURE,
163674e95caSDavid Howells 	SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
164674e95caSDavid Howells };
165674e95caSDavid Howells 
166674e95caSDavid Howells typedef int __bitwise snd_pcm_access_t;
167674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_MMAP_INTERLEAVED	((__force snd_pcm_access_t) 0) /* interleaved mmap */
168674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED	((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
169674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_MMAP_COMPLEX		((__force snd_pcm_access_t) 2) /* complex mmap */
170674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_RW_INTERLEAVED		((__force snd_pcm_access_t) 3) /* readi/writei */
171674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_RW_NONINTERLEAVED	((__force snd_pcm_access_t) 4) /* readn/writen */
172674e95caSDavid Howells #define	SNDRV_PCM_ACCESS_LAST		SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
173674e95caSDavid Howells 
174674e95caSDavid Howells typedef int __bitwise snd_pcm_format_t;
175674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S8	((__force snd_pcm_format_t) 0)
176674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U8	((__force snd_pcm_format_t) 1)
177674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S16_LE	((__force snd_pcm_format_t) 2)
178674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S16_BE	((__force snd_pcm_format_t) 3)
179674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U16_LE	((__force snd_pcm_format_t) 4)
180674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U16_BE	((__force snd_pcm_format_t) 5)
181674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24_LE	((__force snd_pcm_format_t) 6) /* low three bytes */
182674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24_BE	((__force snd_pcm_format_t) 7) /* low three bytes */
183674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24_LE	((__force snd_pcm_format_t) 8) /* low three bytes */
184674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24_BE	((__force snd_pcm_format_t) 9) /* low three bytes */
185674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S32_LE	((__force snd_pcm_format_t) 10)
186674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S32_BE	((__force snd_pcm_format_t) 11)
187674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U32_LE	((__force snd_pcm_format_t) 12)
188674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U32_BE	((__force snd_pcm_format_t) 13)
189674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT_LE	((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
190674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT_BE	((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
191674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT64_LE	((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
192674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT64_BE	((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
193674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
194674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
195674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_MU_LAW		((__force snd_pcm_format_t) 20)
196674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_A_LAW		((__force snd_pcm_format_t) 21)
197674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_IMA_ADPCM	((__force snd_pcm_format_t) 22)
198674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_MPEG		((__force snd_pcm_format_t) 23)
199674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_GSM		((__force snd_pcm_format_t) 24)
200674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_SPECIAL	((__force snd_pcm_format_t) 31)
201674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24_3LE	((__force snd_pcm_format_t) 32)	/* in three bytes */
202674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24_3BE	((__force snd_pcm_format_t) 33)	/* in three bytes */
203674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24_3LE	((__force snd_pcm_format_t) 34)	/* in three bytes */
204674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24_3BE	((__force snd_pcm_format_t) 35)	/* in three bytes */
205674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S20_3LE	((__force snd_pcm_format_t) 36)	/* in three bytes */
206674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S20_3BE	((__force snd_pcm_format_t) 37)	/* in three bytes */
207674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U20_3LE	((__force snd_pcm_format_t) 38)	/* in three bytes */
208674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U20_3BE	((__force snd_pcm_format_t) 39)	/* in three bytes */
209674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S18_3LE	((__force snd_pcm_format_t) 40)	/* in three bytes */
210674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S18_3BE	((__force snd_pcm_format_t) 41)	/* in three bytes */
211674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U18_3LE	((__force snd_pcm_format_t) 42)	/* in three bytes */
212674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U18_3BE	((__force snd_pcm_format_t) 43)	/* in three bytes */
213674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_G723_24	((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
214674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_G723_24_1B	((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
215674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_G723_40	((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
216674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_G723_40_1B	((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
217ef7a4f97SDaniel Mack #define	SNDRV_PCM_FORMAT_DSD_U8		((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
218ef7a4f97SDaniel Mack #define	SNDRV_PCM_FORMAT_DSD_U16_LE	((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
219ef7a4f97SDaniel Mack #define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_DSD_U16_LE
220674e95caSDavid Howells 
221674e95caSDavid Howells #ifdef SNDRV_LITTLE_ENDIAN
222674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_LE
223674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_LE
224674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_LE
225674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_LE
226674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_LE
227674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_LE
228674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_LE
229674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_LE
230674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
231674e95caSDavid Howells #endif
232674e95caSDavid Howells #ifdef SNDRV_BIG_ENDIAN
233674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_BE
234674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_BE
235674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_BE
236674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_BE
237674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_BE
238674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_BE
239674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_BE
240674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_BE
241674e95caSDavid Howells #define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
242674e95caSDavid Howells #endif
243674e95caSDavid Howells 
244674e95caSDavid Howells typedef int __bitwise snd_pcm_subformat_t;
245674e95caSDavid Howells #define	SNDRV_PCM_SUBFORMAT_STD		((__force snd_pcm_subformat_t) 0)
246674e95caSDavid Howells #define	SNDRV_PCM_SUBFORMAT_LAST	SNDRV_PCM_SUBFORMAT_STD
247674e95caSDavid Howells 
248674e95caSDavid Howells #define SNDRV_PCM_INFO_MMAP		0x00000001	/* hardware supports mmap */
249674e95caSDavid Howells #define SNDRV_PCM_INFO_MMAP_VALID	0x00000002	/* period data are valid during transfer */
250674e95caSDavid Howells #define SNDRV_PCM_INFO_DOUBLE		0x00000004	/* Double buffering needed for PCM start/stop */
251674e95caSDavid Howells #define SNDRV_PCM_INFO_BATCH		0x00000010	/* double buffering */
252674e95caSDavid Howells #define SNDRV_PCM_INFO_INTERLEAVED	0x00000100	/* channels are interleaved */
253674e95caSDavid Howells #define SNDRV_PCM_INFO_NONINTERLEAVED	0x00000200	/* channels are not interleaved */
254674e95caSDavid Howells #define SNDRV_PCM_INFO_COMPLEX		0x00000400	/* complex frame organization (mmap only) */
255674e95caSDavid Howells #define SNDRV_PCM_INFO_BLOCK_TRANSFER	0x00010000	/* hardware transfer block of samples */
256674e95caSDavid Howells #define SNDRV_PCM_INFO_OVERRANGE	0x00020000	/* hardware supports ADC (capture) overrange detection */
257674e95caSDavid Howells #define SNDRV_PCM_INFO_RESUME		0x00040000	/* hardware supports stream resume after suspend */
258674e95caSDavid Howells #define SNDRV_PCM_INFO_PAUSE		0x00080000	/* pause ioctl is supported */
259674e95caSDavid Howells #define SNDRV_PCM_INFO_HALF_DUPLEX	0x00100000	/* only half duplex */
260674e95caSDavid Howells #define SNDRV_PCM_INFO_JOINT_DUPLEX	0x00200000	/* playback and capture stream are somewhat correlated */
261674e95caSDavid Howells #define SNDRV_PCM_INFO_SYNC_START	0x00400000	/* pcm support some kind of sync go */
262674e95caSDavid Howells #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP	0x00800000	/* period wakeup can be disabled */
2634eeaaeaeSPierre-Louis Bossart #define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* has audio wall clock for audio/system time sync */
264674e95caSDavid Howells #define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
265674e95caSDavid Howells 
266674e95caSDavid Howells typedef int __bitwise snd_pcm_state_t;
267674e95caSDavid Howells #define	SNDRV_PCM_STATE_OPEN		((__force snd_pcm_state_t) 0) /* stream is open */
268674e95caSDavid Howells #define	SNDRV_PCM_STATE_SETUP		((__force snd_pcm_state_t) 1) /* stream has a setup */
269674e95caSDavid Howells #define	SNDRV_PCM_STATE_PREPARED	((__force snd_pcm_state_t) 2) /* stream is ready to start */
270674e95caSDavid Howells #define	SNDRV_PCM_STATE_RUNNING		((__force snd_pcm_state_t) 3) /* stream is running */
271674e95caSDavid Howells #define	SNDRV_PCM_STATE_XRUN		((__force snd_pcm_state_t) 4) /* stream reached an xrun */
272674e95caSDavid Howells #define	SNDRV_PCM_STATE_DRAINING	((__force snd_pcm_state_t) 5) /* stream is draining */
273674e95caSDavid Howells #define	SNDRV_PCM_STATE_PAUSED		((__force snd_pcm_state_t) 6) /* stream is paused */
274674e95caSDavid Howells #define	SNDRV_PCM_STATE_SUSPENDED	((__force snd_pcm_state_t) 7) /* hardware is suspended */
275674e95caSDavid Howells #define	SNDRV_PCM_STATE_DISCONNECTED	((__force snd_pcm_state_t) 8) /* hardware is disconnected */
276674e95caSDavid Howells #define	SNDRV_PCM_STATE_LAST		SNDRV_PCM_STATE_DISCONNECTED
277674e95caSDavid Howells 
278674e95caSDavid Howells enum {
279674e95caSDavid Howells 	SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
280674e95caSDavid Howells 	SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
281674e95caSDavid Howells 	SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
282674e95caSDavid Howells };
283674e95caSDavid Howells 
284674e95caSDavid Howells union snd_pcm_sync_id {
285674e95caSDavid Howells 	unsigned char id[16];
286674e95caSDavid Howells 	unsigned short id16[8];
287674e95caSDavid Howells 	unsigned int id32[4];
288674e95caSDavid Howells };
289674e95caSDavid Howells 
290674e95caSDavid Howells struct snd_pcm_info {
291674e95caSDavid Howells 	unsigned int device;		/* RO/WR (control): device number */
292674e95caSDavid Howells 	unsigned int subdevice;		/* RO/WR (control): subdevice number */
293674e95caSDavid Howells 	int stream;			/* RO/WR (control): stream direction */
294674e95caSDavid Howells 	int card;			/* R: card number */
295674e95caSDavid Howells 	unsigned char id[64];		/* ID (user selectable) */
296674e95caSDavid Howells 	unsigned char name[80];		/* name of this device */
297674e95caSDavid Howells 	unsigned char subname[32];	/* subdevice name */
298674e95caSDavid Howells 	int dev_class;			/* SNDRV_PCM_CLASS_* */
299674e95caSDavid Howells 	int dev_subclass;		/* SNDRV_PCM_SUBCLASS_* */
300674e95caSDavid Howells 	unsigned int subdevices_count;
301674e95caSDavid Howells 	unsigned int subdevices_avail;
302674e95caSDavid Howells 	union snd_pcm_sync_id sync;	/* hardware synchronization ID */
303674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved for future... */
304674e95caSDavid Howells };
305674e95caSDavid Howells 
306674e95caSDavid Howells typedef int snd_pcm_hw_param_t;
307674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_ACCESS	0	/* Access type */
308674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_FORMAT	1	/* Format */
309674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_SUBFORMAT	2	/* Subformat */
310674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_FIRST_MASK	SNDRV_PCM_HW_PARAM_ACCESS
311674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_LAST_MASK	SNDRV_PCM_HW_PARAM_SUBFORMAT
312674e95caSDavid Howells 
313674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_SAMPLE_BITS	8	/* Bits per sample */
314674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_FRAME_BITS	9	/* Bits per frame */
315674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_CHANNELS	10	/* Channels */
316674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_RATE		11	/* Approx rate */
317674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_PERIOD_TIME	12	/* Approx distance between
318674e95caSDavid Howells 						 * interrupts in us
319674e95caSDavid Howells 						 */
320674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_PERIOD_SIZE	13	/* Approx frames between
321674e95caSDavid Howells 						 * interrupts
322674e95caSDavid Howells 						 */
323674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_PERIOD_BYTES	14	/* Approx bytes between
324674e95caSDavid Howells 						 * interrupts
325674e95caSDavid Howells 						 */
326674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_PERIODS	15	/* Approx interrupts per
327674e95caSDavid Howells 						 * buffer
328674e95caSDavid Howells 						 */
329674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_BUFFER_TIME	16	/* Approx duration of buffer
330674e95caSDavid Howells 						 * in us
331674e95caSDavid Howells 						 */
332674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_BUFFER_SIZE	17	/* Size of buffer in frames */
333674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_BUFFER_BYTES	18	/* Size of buffer in bytes */
334674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_TICK_TIME	19	/* Approx tick duration in us */
335674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_FIRST_INTERVAL	SNDRV_PCM_HW_PARAM_SAMPLE_BITS
336674e95caSDavid Howells #define	SNDRV_PCM_HW_PARAM_LAST_INTERVAL	SNDRV_PCM_HW_PARAM_TICK_TIME
337674e95caSDavid Howells 
338674e95caSDavid Howells #define SNDRV_PCM_HW_PARAMS_NORESAMPLE	(1<<0)	/* avoid rate resampling */
339674e95caSDavid Howells #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER	(1<<1)	/* export buffer */
340674e95caSDavid Howells #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP	(1<<2)	/* disable period wakeups */
341674e95caSDavid Howells 
342674e95caSDavid Howells struct snd_interval {
343674e95caSDavid Howells 	unsigned int min, max;
344674e95caSDavid Howells 	unsigned int openmin:1,
345674e95caSDavid Howells 		     openmax:1,
346674e95caSDavid Howells 		     integer:1,
347674e95caSDavid Howells 		     empty:1;
348674e95caSDavid Howells };
349674e95caSDavid Howells 
350674e95caSDavid Howells #define SNDRV_MASK_MAX	256
351674e95caSDavid Howells 
352674e95caSDavid Howells struct snd_mask {
353674e95caSDavid Howells 	__u32 bits[(SNDRV_MASK_MAX+31)/32];
354674e95caSDavid Howells };
355674e95caSDavid Howells 
356674e95caSDavid Howells struct snd_pcm_hw_params {
357674e95caSDavid Howells 	unsigned int flags;
358674e95caSDavid Howells 	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
359674e95caSDavid Howells 			       SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
360674e95caSDavid Howells 	struct snd_mask mres[5];	/* reserved masks */
361674e95caSDavid Howells 	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
362674e95caSDavid Howells 				        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
363674e95caSDavid Howells 	struct snd_interval ires[9];	/* reserved intervals */
364674e95caSDavid Howells 	unsigned int rmask;		/* W: requested masks */
365674e95caSDavid Howells 	unsigned int cmask;		/* R: changed masks */
366674e95caSDavid Howells 	unsigned int info;		/* R: Info flags for returned setup */
367674e95caSDavid Howells 	unsigned int msbits;		/* R: used most significant bits */
368674e95caSDavid Howells 	unsigned int rate_num;		/* R: rate numerator */
369674e95caSDavid Howells 	unsigned int rate_den;		/* R: rate denominator */
370674e95caSDavid Howells 	snd_pcm_uframes_t fifo_size;	/* R: chip FIFO size in frames */
371674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved for future */
372674e95caSDavid Howells };
373674e95caSDavid Howells 
374674e95caSDavid Howells enum {
375674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_NONE = 0,
376674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_ENABLE,
377674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
378674e95caSDavid Howells };
379674e95caSDavid Howells 
380674e95caSDavid Howells struct snd_pcm_sw_params {
381674e95caSDavid Howells 	int tstamp_mode;			/* timestamp mode */
382674e95caSDavid Howells 	unsigned int period_step;
383674e95caSDavid Howells 	unsigned int sleep_min;			/* min ticks to sleep */
384674e95caSDavid Howells 	snd_pcm_uframes_t avail_min;		/* min avail frames for wakeup */
385674e95caSDavid Howells 	snd_pcm_uframes_t xfer_align;		/* obsolete: xfer size need to be a multiple */
386674e95caSDavid Howells 	snd_pcm_uframes_t start_threshold;	/* min hw_avail frames for automatic start */
387674e95caSDavid Howells 	snd_pcm_uframes_t stop_threshold;	/* min avail frames for automatic stop */
388674e95caSDavid Howells 	snd_pcm_uframes_t silence_threshold;	/* min distance from noise for silence filling */
389674e95caSDavid Howells 	snd_pcm_uframes_t silence_size;		/* silence block size */
390674e95caSDavid Howells 	snd_pcm_uframes_t boundary;		/* pointers wrap point */
391674e95caSDavid Howells 	unsigned char reserved[64];		/* reserved for future */
392674e95caSDavid Howells };
393674e95caSDavid Howells 
394674e95caSDavid Howells struct snd_pcm_channel_info {
395674e95caSDavid Howells 	unsigned int channel;
396674e95caSDavid Howells 	__kernel_off_t offset;		/* mmap offset */
397674e95caSDavid Howells 	unsigned int first;		/* offset to first sample in bits */
398674e95caSDavid Howells 	unsigned int step;		/* samples distance in bits */
399674e95caSDavid Howells };
400674e95caSDavid Howells 
401674e95caSDavid Howells struct snd_pcm_status {
402674e95caSDavid Howells 	snd_pcm_state_t state;		/* stream state */
403674e95caSDavid Howells 	struct timespec trigger_tstamp;	/* time when stream was started/stopped/paused */
404674e95caSDavid Howells 	struct timespec tstamp;		/* reference timestamp */
405674e95caSDavid Howells 	snd_pcm_uframes_t appl_ptr;	/* appl ptr */
406674e95caSDavid Howells 	snd_pcm_uframes_t hw_ptr;	/* hw ptr */
407674e95caSDavid Howells 	snd_pcm_sframes_t delay;	/* current delay in frames */
408674e95caSDavid Howells 	snd_pcm_uframes_t avail;	/* number of frames available */
409674e95caSDavid Howells 	snd_pcm_uframes_t avail_max;	/* max frames available on hw since last status */
410674e95caSDavid Howells 	snd_pcm_uframes_t overrange;	/* count of ADC (capture) overrange detections from last status */
411674e95caSDavid Howells 	snd_pcm_state_t suspended_state; /* suspended stream state */
4129c7066aeSClemens Ladisch 	__u32 reserved_alignment;	/* must be filled with zero */
4134eeaaeaeSPierre-Louis Bossart 	struct timespec audio_tstamp;	/* from sample counter or wall clock */
4149c7066aeSClemens Ladisch 	unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
415674e95caSDavid Howells };
416674e95caSDavid Howells 
417674e95caSDavid Howells struct snd_pcm_mmap_status {
418674e95caSDavid Howells 	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
419674e95caSDavid Howells 	int pad1;			/* Needed for 64 bit alignment */
420674e95caSDavid Howells 	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
421674e95caSDavid Howells 	struct timespec tstamp;		/* Timestamp */
422674e95caSDavid Howells 	snd_pcm_state_t suspended_state; /* RO: suspended stream state */
4234eeaaeaeSPierre-Louis Bossart 	struct timespec audio_tstamp;	/* from sample counter or wall clock */
424674e95caSDavid Howells };
425674e95caSDavid Howells 
426674e95caSDavid Howells struct snd_pcm_mmap_control {
427674e95caSDavid Howells 	snd_pcm_uframes_t appl_ptr;	/* RW: appl ptr (0...boundary-1) */
428674e95caSDavid Howells 	snd_pcm_uframes_t avail_min;	/* RW: min available frames for wakeup */
429674e95caSDavid Howells };
430674e95caSDavid Howells 
431674e95caSDavid Howells #define SNDRV_PCM_SYNC_PTR_HWSYNC	(1<<0)	/* execute hwsync */
432674e95caSDavid Howells #define SNDRV_PCM_SYNC_PTR_APPL		(1<<1)	/* get appl_ptr from driver (r/w op) */
433674e95caSDavid Howells #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN	(1<<2)	/* get avail_min from driver */
434674e95caSDavid Howells 
435674e95caSDavid Howells struct snd_pcm_sync_ptr {
436674e95caSDavid Howells 	unsigned int flags;
437674e95caSDavid Howells 	union {
438674e95caSDavid Howells 		struct snd_pcm_mmap_status status;
439674e95caSDavid Howells 		unsigned char reserved[64];
440674e95caSDavid Howells 	} s;
441674e95caSDavid Howells 	union {
442674e95caSDavid Howells 		struct snd_pcm_mmap_control control;
443674e95caSDavid Howells 		unsigned char reserved[64];
444674e95caSDavid Howells 	} c;
445674e95caSDavid Howells };
446674e95caSDavid Howells 
447674e95caSDavid Howells struct snd_xferi {
448674e95caSDavid Howells 	snd_pcm_sframes_t result;
449674e95caSDavid Howells 	void __user *buf;
450674e95caSDavid Howells 	snd_pcm_uframes_t frames;
451674e95caSDavid Howells };
452674e95caSDavid Howells 
453674e95caSDavid Howells struct snd_xfern {
454674e95caSDavid Howells 	snd_pcm_sframes_t result;
455674e95caSDavid Howells 	void __user * __user *bufs;
456674e95caSDavid Howells 	snd_pcm_uframes_t frames;
457674e95caSDavid Howells };
458674e95caSDavid Howells 
459674e95caSDavid Howells enum {
460674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,	/* gettimeofday equivalent */
461674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,	/* posix_clock_monotonic equivalent */
462674e95caSDavid Howells 	SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
463674e95caSDavid Howells };
464674e95caSDavid Howells 
465674e95caSDavid Howells /* channel positions */
466674e95caSDavid Howells enum {
467674e95caSDavid Howells 	SNDRV_CHMAP_UNKNOWN = 0,
468674e95caSDavid Howells 	SNDRV_CHMAP_NA,		/* N/A, silent */
469674e95caSDavid Howells 	SNDRV_CHMAP_MONO,	/* mono stream */
470674e95caSDavid Howells 	/* this follows the alsa-lib mixer channel value + 3 */
471674e95caSDavid Howells 	SNDRV_CHMAP_FL,		/* front left */
472674e95caSDavid Howells 	SNDRV_CHMAP_FR,		/* front right */
473674e95caSDavid Howells 	SNDRV_CHMAP_RL,		/* rear left */
474674e95caSDavid Howells 	SNDRV_CHMAP_RR,		/* rear right */
475674e95caSDavid Howells 	SNDRV_CHMAP_FC,		/* front center */
476674e95caSDavid Howells 	SNDRV_CHMAP_LFE,	/* LFE */
477674e95caSDavid Howells 	SNDRV_CHMAP_SL,		/* side left */
478674e95caSDavid Howells 	SNDRV_CHMAP_SR,		/* side right */
479674e95caSDavid Howells 	SNDRV_CHMAP_RC,		/* rear center */
480674e95caSDavid Howells 	/* new definitions */
481674e95caSDavid Howells 	SNDRV_CHMAP_FLC,	/* front left center */
482674e95caSDavid Howells 	SNDRV_CHMAP_FRC,	/* front right center */
483674e95caSDavid Howells 	SNDRV_CHMAP_RLC,	/* rear left center */
484674e95caSDavid Howells 	SNDRV_CHMAP_RRC,	/* rear right center */
485674e95caSDavid Howells 	SNDRV_CHMAP_FLW,	/* front left wide */
486674e95caSDavid Howells 	SNDRV_CHMAP_FRW,	/* front right wide */
487674e95caSDavid Howells 	SNDRV_CHMAP_FLH,	/* front left high */
488674e95caSDavid Howells 	SNDRV_CHMAP_FCH,	/* front center high */
489674e95caSDavid Howells 	SNDRV_CHMAP_FRH,	/* front right high */
490674e95caSDavid Howells 	SNDRV_CHMAP_TC,		/* top center */
491674e95caSDavid Howells 	SNDRV_CHMAP_TFL,	/* top front left */
492674e95caSDavid Howells 	SNDRV_CHMAP_TFR,	/* top front right */
493674e95caSDavid Howells 	SNDRV_CHMAP_TFC,	/* top front center */
494674e95caSDavid Howells 	SNDRV_CHMAP_TRL,	/* top rear left */
495674e95caSDavid Howells 	SNDRV_CHMAP_TRR,	/* top rear right */
496674e95caSDavid Howells 	SNDRV_CHMAP_TRC,	/* top rear center */
4977cc17a31STakashi Iwai 	/* new definitions for UAC2 */
4987cc17a31STakashi Iwai 	SNDRV_CHMAP_TFLC,	/* top front left center */
4997cc17a31STakashi Iwai 	SNDRV_CHMAP_TFRC,	/* top front right center */
5007cc17a31STakashi Iwai 	SNDRV_CHMAP_TSL,	/* top side left */
5017cc17a31STakashi Iwai 	SNDRV_CHMAP_TSR,	/* top side right */
5027cc17a31STakashi Iwai 	SNDRV_CHMAP_LLFE,	/* left LFE */
5037cc17a31STakashi Iwai 	SNDRV_CHMAP_RLFE,	/* right LFE */
5047cc17a31STakashi Iwai 	SNDRV_CHMAP_BC,		/* bottom center */
5057cc17a31STakashi Iwai 	SNDRV_CHMAP_BLC,	/* bottom left center */
5067cc17a31STakashi Iwai 	SNDRV_CHMAP_BRC,	/* bottom right center */
5077cc17a31STakashi Iwai 	SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
508674e95caSDavid Howells };
509674e95caSDavid Howells 
510674e95caSDavid Howells #define SNDRV_CHMAP_POSITION_MASK	0xffff
511674e95caSDavid Howells #define SNDRV_CHMAP_PHASE_INVERSE	(0x01 << 16)
512674e95caSDavid Howells #define SNDRV_CHMAP_DRIVER_SPEC		(0x02 << 16)
513674e95caSDavid Howells 
514674e95caSDavid Howells #define SNDRV_PCM_IOCTL_PVERSION	_IOR('A', 0x00, int)
515674e95caSDavid Howells #define SNDRV_PCM_IOCTL_INFO		_IOR('A', 0x01, struct snd_pcm_info)
516674e95caSDavid Howells #define SNDRV_PCM_IOCTL_TSTAMP		_IOW('A', 0x02, int)
517674e95caSDavid Howells #define SNDRV_PCM_IOCTL_TTSTAMP		_IOW('A', 0x03, int)
518674e95caSDavid Howells #define SNDRV_PCM_IOCTL_HW_REFINE	_IOWR('A', 0x10, struct snd_pcm_hw_params)
519674e95caSDavid Howells #define SNDRV_PCM_IOCTL_HW_PARAMS	_IOWR('A', 0x11, struct snd_pcm_hw_params)
520674e95caSDavid Howells #define SNDRV_PCM_IOCTL_HW_FREE		_IO('A', 0x12)
521674e95caSDavid Howells #define SNDRV_PCM_IOCTL_SW_PARAMS	_IOWR('A', 0x13, struct snd_pcm_sw_params)
522674e95caSDavid Howells #define SNDRV_PCM_IOCTL_STATUS		_IOR('A', 0x20, struct snd_pcm_status)
523674e95caSDavid Howells #define SNDRV_PCM_IOCTL_DELAY		_IOR('A', 0x21, snd_pcm_sframes_t)
524674e95caSDavid Howells #define SNDRV_PCM_IOCTL_HWSYNC		_IO('A', 0x22)
525674e95caSDavid Howells #define SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct snd_pcm_sync_ptr)
526674e95caSDavid Howells #define SNDRV_PCM_IOCTL_CHANNEL_INFO	_IOR('A', 0x32, struct snd_pcm_channel_info)
527674e95caSDavid Howells #define SNDRV_PCM_IOCTL_PREPARE		_IO('A', 0x40)
528674e95caSDavid Howells #define SNDRV_PCM_IOCTL_RESET		_IO('A', 0x41)
529674e95caSDavid Howells #define SNDRV_PCM_IOCTL_START		_IO('A', 0x42)
530674e95caSDavid Howells #define SNDRV_PCM_IOCTL_DROP		_IO('A', 0x43)
531674e95caSDavid Howells #define SNDRV_PCM_IOCTL_DRAIN		_IO('A', 0x44)
532674e95caSDavid Howells #define SNDRV_PCM_IOCTL_PAUSE		_IOW('A', 0x45, int)
533674e95caSDavid Howells #define SNDRV_PCM_IOCTL_REWIND		_IOW('A', 0x46, snd_pcm_uframes_t)
534674e95caSDavid Howells #define SNDRV_PCM_IOCTL_RESUME		_IO('A', 0x47)
535674e95caSDavid Howells #define SNDRV_PCM_IOCTL_XRUN		_IO('A', 0x48)
536674e95caSDavid Howells #define SNDRV_PCM_IOCTL_FORWARD		_IOW('A', 0x49, snd_pcm_uframes_t)
537674e95caSDavid Howells #define SNDRV_PCM_IOCTL_WRITEI_FRAMES	_IOW('A', 0x50, struct snd_xferi)
538674e95caSDavid Howells #define SNDRV_PCM_IOCTL_READI_FRAMES	_IOR('A', 0x51, struct snd_xferi)
539674e95caSDavid Howells #define SNDRV_PCM_IOCTL_WRITEN_FRAMES	_IOW('A', 0x52, struct snd_xfern)
540674e95caSDavid Howells #define SNDRV_PCM_IOCTL_READN_FRAMES	_IOR('A', 0x53, struct snd_xfern)
541674e95caSDavid Howells #define SNDRV_PCM_IOCTL_LINK		_IOW('A', 0x60, int)
542674e95caSDavid Howells #define SNDRV_PCM_IOCTL_UNLINK		_IO('A', 0x61)
543674e95caSDavid Howells 
544674e95caSDavid Howells /*****************************************************************************
545674e95caSDavid Howells  *                                                                           *
546674e95caSDavid Howells  *                            MIDI v1.0 interface                            *
547674e95caSDavid Howells  *                                                                           *
548674e95caSDavid Howells  *****************************************************************************/
549674e95caSDavid Howells 
550674e95caSDavid Howells /*
551674e95caSDavid Howells  *  Raw MIDI section - /dev/snd/midi??
552674e95caSDavid Howells  */
553674e95caSDavid Howells 
554674e95caSDavid Howells #define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 0)
555674e95caSDavid Howells 
556674e95caSDavid Howells enum {
557674e95caSDavid Howells 	SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
558674e95caSDavid Howells 	SNDRV_RAWMIDI_STREAM_INPUT,
559674e95caSDavid Howells 	SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
560674e95caSDavid Howells };
561674e95caSDavid Howells 
562674e95caSDavid Howells #define SNDRV_RAWMIDI_INFO_OUTPUT		0x00000001
563674e95caSDavid Howells #define SNDRV_RAWMIDI_INFO_INPUT		0x00000002
564674e95caSDavid Howells #define SNDRV_RAWMIDI_INFO_DUPLEX		0x00000004
565674e95caSDavid Howells 
566674e95caSDavid Howells struct snd_rawmidi_info {
567674e95caSDavid Howells 	unsigned int device;		/* RO/WR (control): device number */
568674e95caSDavid Howells 	unsigned int subdevice;		/* RO/WR (control): subdevice number */
569674e95caSDavid Howells 	int stream;			/* WR: stream */
570674e95caSDavid Howells 	int card;			/* R: card number */
571674e95caSDavid Howells 	unsigned int flags;		/* SNDRV_RAWMIDI_INFO_XXXX */
572674e95caSDavid Howells 	unsigned char id[64];		/* ID (user selectable) */
573674e95caSDavid Howells 	unsigned char name[80];		/* name of device */
574674e95caSDavid Howells 	unsigned char subname[32];	/* name of active or selected subdevice */
575674e95caSDavid Howells 	unsigned int subdevices_count;
576674e95caSDavid Howells 	unsigned int subdevices_avail;
577674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved for future use */
578674e95caSDavid Howells };
579674e95caSDavid Howells 
580674e95caSDavid Howells struct snd_rawmidi_params {
581674e95caSDavid Howells 	int stream;
582674e95caSDavid Howells 	size_t buffer_size;		/* queue size in bytes */
583674e95caSDavid Howells 	size_t avail_min;		/* minimum avail bytes for wakeup */
584674e95caSDavid Howells 	unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
585674e95caSDavid Howells 	unsigned char reserved[16];	/* reserved for future use */
586674e95caSDavid Howells };
587674e95caSDavid Howells 
588674e95caSDavid Howells struct snd_rawmidi_status {
589674e95caSDavid Howells 	int stream;
590674e95caSDavid Howells 	struct timespec tstamp;		/* Timestamp */
591674e95caSDavid Howells 	size_t avail;			/* available bytes */
592674e95caSDavid Howells 	size_t xruns;			/* count of overruns since last status (in bytes) */
593674e95caSDavid Howells 	unsigned char reserved[16];	/* reserved for future use */
594674e95caSDavid Howells };
595674e95caSDavid Howells 
596674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_PVERSION	_IOR('W', 0x00, int)
597674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_INFO	_IOR('W', 0x01, struct snd_rawmidi_info)
598674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_PARAMS	_IOWR('W', 0x10, struct snd_rawmidi_params)
599674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_STATUS	_IOWR('W', 0x20, struct snd_rawmidi_status)
600674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_DROP	_IOW('W', 0x30, int)
601674e95caSDavid Howells #define SNDRV_RAWMIDI_IOCTL_DRAIN	_IOW('W', 0x31, int)
602674e95caSDavid Howells 
603674e95caSDavid Howells /*
604674e95caSDavid Howells  *  Timer section - /dev/snd/timer
605674e95caSDavid Howells  */
606674e95caSDavid Howells 
607674e95caSDavid Howells #define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 6)
608674e95caSDavid Howells 
609674e95caSDavid Howells enum {
610674e95caSDavid Howells 	SNDRV_TIMER_CLASS_NONE = -1,
611674e95caSDavid Howells 	SNDRV_TIMER_CLASS_SLAVE = 0,
612674e95caSDavid Howells 	SNDRV_TIMER_CLASS_GLOBAL,
613674e95caSDavid Howells 	SNDRV_TIMER_CLASS_CARD,
614674e95caSDavid Howells 	SNDRV_TIMER_CLASS_PCM,
615674e95caSDavid Howells 	SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
616674e95caSDavid Howells };
617674e95caSDavid Howells 
618674e95caSDavid Howells /* slave timer classes */
619674e95caSDavid Howells enum {
620674e95caSDavid Howells 	SNDRV_TIMER_SCLASS_NONE = 0,
621674e95caSDavid Howells 	SNDRV_TIMER_SCLASS_APPLICATION,
622674e95caSDavid Howells 	SNDRV_TIMER_SCLASS_SEQUENCER,		/* alias */
623674e95caSDavid Howells 	SNDRV_TIMER_SCLASS_OSS_SEQUENCER,	/* alias */
624674e95caSDavid Howells 	SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
625674e95caSDavid Howells };
626674e95caSDavid Howells 
627674e95caSDavid Howells /* global timers (device member) */
628674e95caSDavid Howells #define SNDRV_TIMER_GLOBAL_SYSTEM	0
629674e95caSDavid Howells #define SNDRV_TIMER_GLOBAL_RTC		1
630674e95caSDavid Howells #define SNDRV_TIMER_GLOBAL_HPET		2
631674e95caSDavid Howells #define SNDRV_TIMER_GLOBAL_HRTIMER	3
632674e95caSDavid Howells 
633674e95caSDavid Howells /* info flags */
634674e95caSDavid Howells #define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
635674e95caSDavid Howells 
636674e95caSDavid Howells struct snd_timer_id {
637674e95caSDavid Howells 	int dev_class;
638674e95caSDavid Howells 	int dev_sclass;
639674e95caSDavid Howells 	int card;
640674e95caSDavid Howells 	int device;
641674e95caSDavid Howells 	int subdevice;
642674e95caSDavid Howells };
643674e95caSDavid Howells 
644674e95caSDavid Howells struct snd_timer_ginfo {
645674e95caSDavid Howells 	struct snd_timer_id tid;	/* requested timer ID */
646674e95caSDavid Howells 	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
647674e95caSDavid Howells 	int card;			/* card number */
648674e95caSDavid Howells 	unsigned char id[64];		/* timer identification */
649674e95caSDavid Howells 	unsigned char name[80];		/* timer name */
650674e95caSDavid Howells 	unsigned long reserved0;	/* reserved for future use */
651674e95caSDavid Howells 	unsigned long resolution;	/* average period resolution in ns */
652674e95caSDavid Howells 	unsigned long resolution_min;	/* minimal period resolution in ns */
653674e95caSDavid Howells 	unsigned long resolution_max;	/* maximal period resolution in ns */
654674e95caSDavid Howells 	unsigned int clients;		/* active timer clients */
655674e95caSDavid Howells 	unsigned char reserved[32];
656674e95caSDavid Howells };
657674e95caSDavid Howells 
658674e95caSDavid Howells struct snd_timer_gparams {
659674e95caSDavid Howells 	struct snd_timer_id tid;	/* requested timer ID */
660674e95caSDavid Howells 	unsigned long period_num;	/* requested precise period duration (in seconds) - numerator */
661674e95caSDavid Howells 	unsigned long period_den;	/* requested precise period duration (in seconds) - denominator */
662674e95caSDavid Howells 	unsigned char reserved[32];
663674e95caSDavid Howells };
664674e95caSDavid Howells 
665674e95caSDavid Howells struct snd_timer_gstatus {
666674e95caSDavid Howells 	struct snd_timer_id tid;	/* requested timer ID */
667674e95caSDavid Howells 	unsigned long resolution;	/* current period resolution in ns */
668674e95caSDavid Howells 	unsigned long resolution_num;	/* precise current period resolution (in seconds) - numerator */
669674e95caSDavid Howells 	unsigned long resolution_den;	/* precise current period resolution (in seconds) - denominator */
670674e95caSDavid Howells 	unsigned char reserved[32];
671674e95caSDavid Howells };
672674e95caSDavid Howells 
673674e95caSDavid Howells struct snd_timer_select {
674674e95caSDavid Howells 	struct snd_timer_id id;	/* bind to timer ID */
675674e95caSDavid Howells 	unsigned char reserved[32];	/* reserved */
676674e95caSDavid Howells };
677674e95caSDavid Howells 
678674e95caSDavid Howells struct snd_timer_info {
679674e95caSDavid Howells 	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
680674e95caSDavid Howells 	int card;			/* card number */
681674e95caSDavid Howells 	unsigned char id[64];		/* timer identificator */
682674e95caSDavid Howells 	unsigned char name[80];		/* timer name */
683674e95caSDavid Howells 	unsigned long reserved0;	/* reserved for future use */
684674e95caSDavid Howells 	unsigned long resolution;	/* average period resolution in ns */
685674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved */
686674e95caSDavid Howells };
687674e95caSDavid Howells 
688674e95caSDavid Howells #define SNDRV_TIMER_PSFLG_AUTO		(1<<0)	/* auto start, otherwise one-shot */
689674e95caSDavid Howells #define SNDRV_TIMER_PSFLG_EXCLUSIVE	(1<<1)	/* exclusive use, precise start/stop/pause/continue */
690674e95caSDavid Howells #define SNDRV_TIMER_PSFLG_EARLY_EVENT	(1<<2)	/* write early event to the poll queue */
691674e95caSDavid Howells 
692674e95caSDavid Howells struct snd_timer_params {
693674e95caSDavid Howells 	unsigned int flags;		/* flags - SNDRV_MIXER_PSFLG_* */
694674e95caSDavid Howells 	unsigned int ticks;		/* requested resolution in ticks */
695674e95caSDavid Howells 	unsigned int queue_size;	/* total size of queue (32-1024) */
696674e95caSDavid Howells 	unsigned int reserved0;		/* reserved, was: failure locations */
697674e95caSDavid Howells 	unsigned int filter;		/* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
698674e95caSDavid Howells 	unsigned char reserved[60];	/* reserved */
699674e95caSDavid Howells };
700674e95caSDavid Howells 
701674e95caSDavid Howells struct snd_timer_status {
702674e95caSDavid Howells 	struct timespec tstamp;		/* Timestamp - last update */
703674e95caSDavid Howells 	unsigned int resolution;	/* current period resolution in ns */
704674e95caSDavid Howells 	unsigned int lost;		/* counter of master tick lost */
705674e95caSDavid Howells 	unsigned int overrun;		/* count of read queue overruns */
706674e95caSDavid Howells 	unsigned int queue;		/* used queue size */
707674e95caSDavid Howells 	unsigned char reserved[64];	/* reserved */
708674e95caSDavid Howells };
709674e95caSDavid Howells 
710674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
711674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
712674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_TREAD		_IOW('T', 0x02, int)
713674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_GINFO		_IOWR('T', 0x03, struct snd_timer_ginfo)
714674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_GPARAMS	_IOW('T', 0x04, struct snd_timer_gparams)
715674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_GSTATUS	_IOWR('T', 0x05, struct snd_timer_gstatus)
716674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_SELECT	_IOW('T', 0x10, struct snd_timer_select)
717674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_INFO		_IOR('T', 0x11, struct snd_timer_info)
718674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_PARAMS	_IOW('T', 0x12, struct snd_timer_params)
719674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_STATUS	_IOR('T', 0x14, struct snd_timer_status)
720674e95caSDavid Howells /* The following four ioctls are changed since 1.0.9 due to confliction */
721674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_START		_IO('T', 0xa0)
722674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_STOP		_IO('T', 0xa1)
723674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
724674e95caSDavid Howells #define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
725674e95caSDavid Howells 
726674e95caSDavid Howells struct snd_timer_read {
727674e95caSDavid Howells 	unsigned int resolution;
728674e95caSDavid Howells 	unsigned int ticks;
729674e95caSDavid Howells };
730674e95caSDavid Howells 
731674e95caSDavid Howells enum {
732674e95caSDavid Howells 	SNDRV_TIMER_EVENT_RESOLUTION = 0,	/* val = resolution in ns */
733674e95caSDavid Howells 	SNDRV_TIMER_EVENT_TICK,			/* val = ticks */
734674e95caSDavid Howells 	SNDRV_TIMER_EVENT_START,		/* val = resolution in ns */
735674e95caSDavid Howells 	SNDRV_TIMER_EVENT_STOP,			/* val = 0 */
736674e95caSDavid Howells 	SNDRV_TIMER_EVENT_CONTINUE,		/* val = resolution in ns */
737674e95caSDavid Howells 	SNDRV_TIMER_EVENT_PAUSE,		/* val = 0 */
738674e95caSDavid Howells 	SNDRV_TIMER_EVENT_EARLY,		/* val = 0, early event */
739674e95caSDavid Howells 	SNDRV_TIMER_EVENT_SUSPEND,		/* val = 0 */
740674e95caSDavid Howells 	SNDRV_TIMER_EVENT_RESUME,		/* val = resolution in ns */
741674e95caSDavid Howells 	/* master timer events for slave timer instances */
742674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
743674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
744674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
745674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
746674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
747674e95caSDavid Howells 	SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
748674e95caSDavid Howells };
749674e95caSDavid Howells 
750674e95caSDavid Howells struct snd_timer_tread {
751674e95caSDavid Howells 	int event;
752674e95caSDavid Howells 	struct timespec tstamp;
753674e95caSDavid Howells 	unsigned int val;
754674e95caSDavid Howells };
755674e95caSDavid Howells 
756674e95caSDavid Howells /****************************************************************************
757674e95caSDavid Howells  *                                                                          *
758674e95caSDavid Howells  *        Section for driver control interface - /dev/snd/control?          *
759674e95caSDavid Howells  *                                                                          *
760674e95caSDavid Howells  ****************************************************************************/
761674e95caSDavid Howells 
762674e95caSDavid Howells #define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
763674e95caSDavid Howells 
764674e95caSDavid Howells struct snd_ctl_card_info {
765674e95caSDavid Howells 	int card;			/* card number */
766674e95caSDavid Howells 	int pad;			/* reserved for future (was type) */
767674e95caSDavid Howells 	unsigned char id[16];		/* ID of card (user selectable) */
768674e95caSDavid Howells 	unsigned char driver[16];	/* Driver name */
769674e95caSDavid Howells 	unsigned char name[32];		/* Short name of soundcard */
770674e95caSDavid Howells 	unsigned char longname[80];	/* name + info text about soundcard */
771674e95caSDavid Howells 	unsigned char reserved_[16];	/* reserved for future (was ID of mixer) */
772674e95caSDavid Howells 	unsigned char mixername[80];	/* visual mixer identification */
773674e95caSDavid Howells 	unsigned char components[128];	/* card components / fine identification, delimited with one space (AC97 etc..) */
774674e95caSDavid Howells };
775674e95caSDavid Howells 
776674e95caSDavid Howells typedef int __bitwise snd_ctl_elem_type_t;
777674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_NONE	((__force snd_ctl_elem_type_t) 0) /* invalid */
778674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_BOOLEAN	((__force snd_ctl_elem_type_t) 1) /* boolean type */
779674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_INTEGER	((__force snd_ctl_elem_type_t) 2) /* integer type */
780674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_ENUMERATED	((__force snd_ctl_elem_type_t) 3) /* enumerated type */
781674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_BYTES	((__force snd_ctl_elem_type_t) 4) /* byte array */
782674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_IEC958	((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
783674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_INTEGER64	((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
784674e95caSDavid Howells #define	SNDRV_CTL_ELEM_TYPE_LAST	SNDRV_CTL_ELEM_TYPE_INTEGER64
785674e95caSDavid Howells 
786674e95caSDavid Howells typedef int __bitwise snd_ctl_elem_iface_t;
787674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_CARD	((__force snd_ctl_elem_iface_t) 0) /* global control */
788674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_HWDEP	((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
789674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_MIXER	((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
790674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_PCM	((__force snd_ctl_elem_iface_t) 3) /* PCM device */
791674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_RAWMIDI	((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
792674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_TIMER	((__force snd_ctl_elem_iface_t) 5) /* timer device */
793674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_SEQUENCER	((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
794674e95caSDavid Howells #define	SNDRV_CTL_ELEM_IFACE_LAST	SNDRV_CTL_ELEM_IFACE_SEQUENCER
795674e95caSDavid Howells 
796674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_READ		(1<<0)
797674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_WRITE		(1<<1)
798674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_READWRITE		(SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
799674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_VOLATILE		(1<<2)	/* control value may be changed without a notification */
800674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP		(1<<3)	/* when was control changed */
801674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TLV_READ		(1<<4)	/* TLV read is possible */
802674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE		(1<<5)	/* TLV write is possible */
803674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE	(SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
804674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND	(1<<6)	/* TLV command is possible */
805674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */
806674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */
807674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */
808674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */
809674e95caSDavid Howells #define SNDRV_CTL_ELEM_ACCESS_USER		(1<<29) /* user space element */
810674e95caSDavid Howells /* bits 30 and 31 are obsoleted (for indirect access) */
811674e95caSDavid Howells 
812674e95caSDavid Howells /* for further details see the ACPI and PCI power management specification */
813674e95caSDavid Howells #define SNDRV_CTL_POWER_D0		0x0000	/* full On */
814674e95caSDavid Howells #define SNDRV_CTL_POWER_D1		0x0100	/* partial On */
815674e95caSDavid Howells #define SNDRV_CTL_POWER_D2		0x0200	/* partial On */
816674e95caSDavid Howells #define SNDRV_CTL_POWER_D3		0x0300	/* Off */
817674e95caSDavid Howells #define SNDRV_CTL_POWER_D3hot		(SNDRV_CTL_POWER_D3|0x0000)	/* Off, with power */
818674e95caSDavid Howells #define SNDRV_CTL_POWER_D3cold		(SNDRV_CTL_POWER_D3|0x0001)	/* Off, without power */
819674e95caSDavid Howells 
820975cc02aSTakashi Iwai #define SNDRV_CTL_ELEM_ID_NAME_MAXLEN	44
821975cc02aSTakashi Iwai 
822674e95caSDavid Howells struct snd_ctl_elem_id {
823674e95caSDavid Howells 	unsigned int numid;		/* numeric identifier, zero = invalid */
824674e95caSDavid Howells 	snd_ctl_elem_iface_t iface;	/* interface identifier */
825674e95caSDavid Howells 	unsigned int device;		/* device/client number */
826674e95caSDavid Howells 	unsigned int subdevice;		/* subdevice (substream) number */
827674e95caSDavid Howells 	unsigned char name[44];		/* ASCII name of item */
828674e95caSDavid Howells 	unsigned int index;		/* index of item */
829674e95caSDavid Howells };
830674e95caSDavid Howells 
831674e95caSDavid Howells struct snd_ctl_elem_list {
832674e95caSDavid Howells 	unsigned int offset;		/* W: first element ID to get */
833674e95caSDavid Howells 	unsigned int space;		/* W: count of element IDs to get */
834674e95caSDavid Howells 	unsigned int used;		/* R: count of element IDs set */
835674e95caSDavid Howells 	unsigned int count;		/* R: count of all elements */
836674e95caSDavid Howells 	struct snd_ctl_elem_id __user *pids; /* R: IDs */
837674e95caSDavid Howells 	unsigned char reserved[50];
838674e95caSDavid Howells };
839674e95caSDavid Howells 
840674e95caSDavid Howells struct snd_ctl_elem_info {
841674e95caSDavid Howells 	struct snd_ctl_elem_id id;	/* W: element ID */
842674e95caSDavid Howells 	snd_ctl_elem_type_t type;	/* R: value type - SNDRV_CTL_ELEM_TYPE_* */
843674e95caSDavid Howells 	unsigned int access;		/* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
844674e95caSDavid Howells 	unsigned int count;		/* count of values */
845674e95caSDavid Howells 	__kernel_pid_t owner;		/* owner's PID of this control */
846674e95caSDavid Howells 	union {
847674e95caSDavid Howells 		struct {
848674e95caSDavid Howells 			long min;		/* R: minimum value */
849674e95caSDavid Howells 			long max;		/* R: maximum value */
850674e95caSDavid Howells 			long step;		/* R: step (0 variable) */
851674e95caSDavid Howells 		} integer;
852674e95caSDavid Howells 		struct {
853674e95caSDavid Howells 			long long min;		/* R: minimum value */
854674e95caSDavid Howells 			long long max;		/* R: maximum value */
855674e95caSDavid Howells 			long long step;		/* R: step (0 variable) */
856674e95caSDavid Howells 		} integer64;
857674e95caSDavid Howells 		struct {
858674e95caSDavid Howells 			unsigned int items;	/* R: number of items */
859674e95caSDavid Howells 			unsigned int item;	/* W: item number */
860674e95caSDavid Howells 			char name[64];		/* R: value name */
861674e95caSDavid Howells 			__u64 names_ptr;	/* W: names list (ELEM_ADD only) */
862674e95caSDavid Howells 			unsigned int names_length;
863674e95caSDavid Howells 		} enumerated;
864674e95caSDavid Howells 		unsigned char reserved[128];
865674e95caSDavid Howells 	} value;
866674e95caSDavid Howells 	union {
867674e95caSDavid Howells 		unsigned short d[4];		/* dimensions */
868674e95caSDavid Howells 		unsigned short *d_ptr;		/* indirect - obsoleted */
869674e95caSDavid Howells 	} dimen;
870674e95caSDavid Howells 	unsigned char reserved[64-4*sizeof(unsigned short)];
871674e95caSDavid Howells };
872674e95caSDavid Howells 
873674e95caSDavid Howells struct snd_ctl_elem_value {
874674e95caSDavid Howells 	struct snd_ctl_elem_id id;	/* W: element ID */
875674e95caSDavid Howells 	unsigned int indirect: 1;	/* W: indirect access - obsoleted */
876674e95caSDavid Howells 	union {
877674e95caSDavid Howells 		union {
878674e95caSDavid Howells 			long value[128];
879674e95caSDavid Howells 			long *value_ptr;	/* obsoleted */
880674e95caSDavid Howells 		} integer;
881674e95caSDavid Howells 		union {
882674e95caSDavid Howells 			long long value[64];
883674e95caSDavid Howells 			long long *value_ptr;	/* obsoleted */
884674e95caSDavid Howells 		} integer64;
885674e95caSDavid Howells 		union {
886674e95caSDavid Howells 			unsigned int item[128];
887674e95caSDavid Howells 			unsigned int *item_ptr;	/* obsoleted */
888674e95caSDavid Howells 		} enumerated;
889674e95caSDavid Howells 		union {
890674e95caSDavid Howells 			unsigned char data[512];
891674e95caSDavid Howells 			unsigned char *data_ptr;	/* obsoleted */
892674e95caSDavid Howells 		} bytes;
893674e95caSDavid Howells 		struct snd_aes_iec958 iec958;
894674e95caSDavid Howells 	} value;		/* RO */
895674e95caSDavid Howells 	struct timespec tstamp;
896674e95caSDavid Howells 	unsigned char reserved[128-sizeof(struct timespec)];
897674e95caSDavid Howells };
898674e95caSDavid Howells 
899674e95caSDavid Howells struct snd_ctl_tlv {
900674e95caSDavid Howells 	unsigned int numid;	/* control element numeric identification */
901674e95caSDavid Howells 	unsigned int length;	/* in bytes aligned to 4 */
902674e95caSDavid Howells 	unsigned int tlv[0];	/* first TLV */
903674e95caSDavid Howells };
904674e95caSDavid Howells 
905674e95caSDavid Howells #define SNDRV_CTL_IOCTL_PVERSION	_IOR('U', 0x00, int)
906674e95caSDavid Howells #define SNDRV_CTL_IOCTL_CARD_INFO	_IOR('U', 0x01, struct snd_ctl_card_info)
907674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_LIST	_IOWR('U', 0x10, struct snd_ctl_elem_list)
908674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_INFO	_IOWR('U', 0x11, struct snd_ctl_elem_info)
909674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_READ	_IOWR('U', 0x12, struct snd_ctl_elem_value)
910674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_WRITE	_IOWR('U', 0x13, struct snd_ctl_elem_value)
911674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_LOCK	_IOW('U', 0x14, struct snd_ctl_elem_id)
912674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_UNLOCK	_IOW('U', 0x15, struct snd_ctl_elem_id)
913674e95caSDavid Howells #define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
914674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_ADD	_IOWR('U', 0x17, struct snd_ctl_elem_info)
915674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_REPLACE	_IOWR('U', 0x18, struct snd_ctl_elem_info)
916674e95caSDavid Howells #define SNDRV_CTL_IOCTL_ELEM_REMOVE	_IOWR('U', 0x19, struct snd_ctl_elem_id)
917674e95caSDavid Howells #define SNDRV_CTL_IOCTL_TLV_READ	_IOWR('U', 0x1a, struct snd_ctl_tlv)
918674e95caSDavid Howells #define SNDRV_CTL_IOCTL_TLV_WRITE	_IOWR('U', 0x1b, struct snd_ctl_tlv)
919674e95caSDavid Howells #define SNDRV_CTL_IOCTL_TLV_COMMAND	_IOWR('U', 0x1c, struct snd_ctl_tlv)
920674e95caSDavid Howells #define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
921674e95caSDavid Howells #define SNDRV_CTL_IOCTL_HWDEP_INFO	_IOR('U', 0x21, struct snd_hwdep_info)
922674e95caSDavid Howells #define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE	_IOR('U', 0x30, int)
923674e95caSDavid Howells #define SNDRV_CTL_IOCTL_PCM_INFO	_IOWR('U', 0x31, struct snd_pcm_info)
924674e95caSDavid Howells #define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
925674e95caSDavid Howells #define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
926674e95caSDavid Howells #define SNDRV_CTL_IOCTL_RAWMIDI_INFO	_IOWR('U', 0x41, struct snd_rawmidi_info)
927674e95caSDavid Howells #define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
928674e95caSDavid Howells #define SNDRV_CTL_IOCTL_POWER		_IOWR('U', 0xd0, int)
929674e95caSDavid Howells #define SNDRV_CTL_IOCTL_POWER_STATE	_IOR('U', 0xd1, int)
930674e95caSDavid Howells 
931674e95caSDavid Howells /*
932674e95caSDavid Howells  *  Read interface.
933674e95caSDavid Howells  */
934674e95caSDavid Howells 
935674e95caSDavid Howells enum sndrv_ctl_event_type {
936674e95caSDavid Howells 	SNDRV_CTL_EVENT_ELEM = 0,
937674e95caSDavid Howells 	SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
938674e95caSDavid Howells };
939674e95caSDavid Howells 
940674e95caSDavid Howells #define SNDRV_CTL_EVENT_MASK_VALUE	(1<<0)	/* element value was changed */
941674e95caSDavid Howells #define SNDRV_CTL_EVENT_MASK_INFO	(1<<1)	/* element info was changed */
942674e95caSDavid Howells #define SNDRV_CTL_EVENT_MASK_ADD	(1<<2)	/* element was added */
943674e95caSDavid Howells #define SNDRV_CTL_EVENT_MASK_TLV	(1<<3)	/* element TLV tree was changed */
944674e95caSDavid Howells #define SNDRV_CTL_EVENT_MASK_REMOVE	(~0U)	/* element was removed */
945674e95caSDavid Howells 
946674e95caSDavid Howells struct snd_ctl_event {
947674e95caSDavid Howells 	int type;	/* event type - SNDRV_CTL_EVENT_* */
948674e95caSDavid Howells 	union {
949674e95caSDavid Howells 		struct {
950674e95caSDavid Howells 			unsigned int mask;
951674e95caSDavid Howells 			struct snd_ctl_elem_id id;
952674e95caSDavid Howells 		} elem;
953674e95caSDavid Howells 		unsigned char data8[60];
954674e95caSDavid Howells 	} data;
955674e95caSDavid Howells };
956674e95caSDavid Howells 
957674e95caSDavid Howells /*
958674e95caSDavid Howells  *  Control names
959674e95caSDavid Howells  */
960674e95caSDavid Howells 
961674e95caSDavid Howells #define SNDRV_CTL_NAME_NONE				""
962674e95caSDavid Howells #define SNDRV_CTL_NAME_PLAYBACK				"Playback "
963674e95caSDavid Howells #define SNDRV_CTL_NAME_CAPTURE				"Capture "
964674e95caSDavid Howells 
965674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_NONE			""
966674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_SWITCH			"Switch"
967674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_VOLUME			"Volume"
968674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_DEFAULT			"Default"
969674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_MASK			"Mask"
970674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_CON_MASK			"Con Mask"
971674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_PRO_MASK			"Pro Mask"
972674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958_PCM_STREAM		"PCM Stream"
973674e95caSDavid Howells #define SNDRV_CTL_NAME_IEC958(expl,direction,what)	"IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
974674e95caSDavid Howells 
975674e95caSDavid Howells #endif /* _UAPI__SOUND_ASOUND_H */
976