1d5ac70f0Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2d5ac70f0Sopenharmony_ci/*
3d5ac70f0Sopenharmony_ci *  Advanced Linux Sound Architecture - ALSA - Driver
4d5ac70f0Sopenharmony_ci *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
5d5ac70f0Sopenharmony_ci *                             Abramo Bagnara <abramo@alsa-project.org>
6d5ac70f0Sopenharmony_ci *
7d5ac70f0Sopenharmony_ci *
8d5ac70f0Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify
9d5ac70f0Sopenharmony_ci *   it under the terms of the GNU General Public License as published by
10d5ac70f0Sopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
11d5ac70f0Sopenharmony_ci *   (at your option) any later version.
12d5ac70f0Sopenharmony_ci *
13d5ac70f0Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
14d5ac70f0Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15d5ac70f0Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16d5ac70f0Sopenharmony_ci *   GNU General Public License for more details.
17d5ac70f0Sopenharmony_ci *
18d5ac70f0Sopenharmony_ci *   You should have received a copy of the GNU General Public License
19d5ac70f0Sopenharmony_ci *   along with this program; if not, write to the Free Software
20d5ac70f0Sopenharmony_ci *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21d5ac70f0Sopenharmony_ci *
22d5ac70f0Sopenharmony_ci */
23d5ac70f0Sopenharmony_ci
24d5ac70f0Sopenharmony_ci#ifndef __SOUND_ASOUND_H
25d5ac70f0Sopenharmony_ci#define __SOUND_ASOUND_H
26d5ac70f0Sopenharmony_ci
27d5ac70f0Sopenharmony_ci#if defined(__KERNEL__) || defined(__linux__)
28d5ac70f0Sopenharmony_ci#include <linux/types.h>
29d5ac70f0Sopenharmony_ci#include <asm/byteorder.h>
30d5ac70f0Sopenharmony_ci#else
31d5ac70f0Sopenharmony_ci#include <sys/endian.h>
32d5ac70f0Sopenharmony_ci#include <sys/ioctl.h>
33d5ac70f0Sopenharmony_ci#endif
34d5ac70f0Sopenharmony_ci
35d5ac70f0Sopenharmony_ci#include <stdlib.h>
36d5ac70f0Sopenharmony_ci#include <time.h>
37d5ac70f0Sopenharmony_ci
38d5ac70f0Sopenharmony_ci/*
39d5ac70f0Sopenharmony_ci *  protocol version
40d5ac70f0Sopenharmony_ci */
41d5ac70f0Sopenharmony_ci
42d5ac70f0Sopenharmony_ci#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
43d5ac70f0Sopenharmony_ci#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
44d5ac70f0Sopenharmony_ci#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
45d5ac70f0Sopenharmony_ci#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
46d5ac70f0Sopenharmony_ci#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
47d5ac70f0Sopenharmony_ci	(SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
48d5ac70f0Sopenharmony_ci	 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
49d5ac70f0Sopenharmony_ci	   SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
50d5ac70f0Sopenharmony_ci
51d5ac70f0Sopenharmony_ci/****************************************************************************
52d5ac70f0Sopenharmony_ci *                                                                          *
53d5ac70f0Sopenharmony_ci *        Digital audio interface					    *
54d5ac70f0Sopenharmony_ci *                                                                          *
55d5ac70f0Sopenharmony_ci ****************************************************************************/
56d5ac70f0Sopenharmony_ci
57d5ac70f0Sopenharmony_cistruct snd_aes_iec958 {
58d5ac70f0Sopenharmony_ci	unsigned char status[24];	/* AES/IEC958 channel status bits */
59d5ac70f0Sopenharmony_ci	unsigned char subcode[147];	/* AES/IEC958 subcode bits */
60d5ac70f0Sopenharmony_ci	unsigned char pad;		/* nothing */
61d5ac70f0Sopenharmony_ci	unsigned char dig_subframe[4];	/* AES/IEC958 subframe bits */
62d5ac70f0Sopenharmony_ci};
63d5ac70f0Sopenharmony_ci
64d5ac70f0Sopenharmony_ci/****************************************************************************
65d5ac70f0Sopenharmony_ci *                                                                          *
66d5ac70f0Sopenharmony_ci *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort		    *
67d5ac70f0Sopenharmony_ci *                                                                          *
68d5ac70f0Sopenharmony_ci ****************************************************************************/
69d5ac70f0Sopenharmony_ci
70d5ac70f0Sopenharmony_cistruct snd_cea_861_aud_if {
71d5ac70f0Sopenharmony_ci	unsigned char db1_ct_cc; /* coding type and channel count */
72d5ac70f0Sopenharmony_ci	unsigned char db2_sf_ss; /* sample frequency and size */
73d5ac70f0Sopenharmony_ci	unsigned char db3; /* not used, all zeros */
74d5ac70f0Sopenharmony_ci	unsigned char db4_ca; /* channel allocation code */
75d5ac70f0Sopenharmony_ci	unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
76d5ac70f0Sopenharmony_ci};
77d5ac70f0Sopenharmony_ci
78d5ac70f0Sopenharmony_ci/****************************************************************************
79d5ac70f0Sopenharmony_ci *                                                                          *
80d5ac70f0Sopenharmony_ci *      Section for driver hardware dependent interface - /dev/snd/hw?      *
81d5ac70f0Sopenharmony_ci *                                                                          *
82d5ac70f0Sopenharmony_ci ****************************************************************************/
83d5ac70f0Sopenharmony_ci
84d5ac70f0Sopenharmony_ci#define SNDRV_HWDEP_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
85d5ac70f0Sopenharmony_ci
86d5ac70f0Sopenharmony_cienum {
87d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL2 = 0,
88d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL3,
89d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL4,
90d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB16CSP,	/* Creative Signal Processor */
91d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMU10K1,	/* FX8010 processor in EMU10K1 chip */
92d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_YSS225,	/* Yamaha FX processor */
93d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_ICS2115,	/* Wavetable synth */
94d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_SSCAPE,	/* Ensoniq SoundScape ISA card (MC68EC000) */
95d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */
96d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */
97d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y,	/* Tascam US122, US224 & US428 usb */
98d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
99d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_BLUETOOTH,	/* Bluetooth audio */
100d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y_PCM,	/* Tascam US122, US224 & US428 rawusb pcm */
101d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_PCXHR,	/* Digigram PCXHR */
102d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB_RC,	/* SB Extigy/Audigy2NX remote control */
103d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_HDA,		/* HD-audio */
104d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_USB_STREAM,	/* direct access to usb stream */
105d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DICE,	/* TC DICE FireWire device */
106d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREWORKS,	/* Echo Audio Fireworks based device */
107d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_BEBOB,	/* BridgeCo BeBoB based device */
108d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_OXFW,	/* Oxford OXFW970/971 based device */
109d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DIGI00X,	/* Digidesign Digi 002/003 family */
110d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_TASCAM,	/* TASCAM FireWire series */
111d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_LINE6,	/* Line6 USB processors */
112d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_MOTU,	/* MOTU FireWire series */
113d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREFACE,	/* RME Fireface series */
114d5ac70f0Sopenharmony_ci
115d5ac70f0Sopenharmony_ci	/* Don't forget to change the following: */
116d5ac70f0Sopenharmony_ci	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
117d5ac70f0Sopenharmony_ci};
118d5ac70f0Sopenharmony_ci
119d5ac70f0Sopenharmony_cistruct snd_hwdep_info {
120d5ac70f0Sopenharmony_ci	unsigned int device;		/* WR: device number */
121d5ac70f0Sopenharmony_ci	int card;			/* R: card number */
122d5ac70f0Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
123d5ac70f0Sopenharmony_ci	unsigned char name[80];		/* hwdep name */
124d5ac70f0Sopenharmony_ci	int iface;			/* hwdep interface */
125d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
126d5ac70f0Sopenharmony_ci};
127d5ac70f0Sopenharmony_ci
128d5ac70f0Sopenharmony_ci/* generic DSP loader */
129d5ac70f0Sopenharmony_cistruct snd_hwdep_dsp_status {
130d5ac70f0Sopenharmony_ci	unsigned int version;		/* R: driver-specific version */
131d5ac70f0Sopenharmony_ci	unsigned char id[32];		/* R: driver-specific ID string */
132d5ac70f0Sopenharmony_ci	unsigned int num_dsps;		/* R: number of DSP images to transfer */
133d5ac70f0Sopenharmony_ci	unsigned int dsp_loaded;	/* R: bit flags indicating the loaded DSPs */
134d5ac70f0Sopenharmony_ci	unsigned int chip_ready;	/* R: 1 = initialization finished */
135d5ac70f0Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
136d5ac70f0Sopenharmony_ci};
137d5ac70f0Sopenharmony_ci
138d5ac70f0Sopenharmony_cistruct snd_hwdep_dsp_image {
139d5ac70f0Sopenharmony_ci	unsigned int index;		/* W: DSP index */
140d5ac70f0Sopenharmony_ci	unsigned char name[64];		/* W: ID (e.g. file name) */
141d5ac70f0Sopenharmony_ci	unsigned char *image;	/* W: binary image */
142d5ac70f0Sopenharmony_ci	size_t length;			/* W: size of image in bytes */
143d5ac70f0Sopenharmony_ci	unsigned long driver_data;	/* W: driver-specific data */
144d5ac70f0Sopenharmony_ci};
145d5ac70f0Sopenharmony_ci
146d5ac70f0Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_PVERSION	_IOR ('H', 0x00, int)
147d5ac70f0Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_INFO		_IOR ('H', 0x01, struct snd_hwdep_info)
148d5ac70f0Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_STATUS	_IOR('H', 0x02, struct snd_hwdep_dsp_status)
149d5ac70f0Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_LOAD	_IOW('H', 0x03, struct snd_hwdep_dsp_image)
150d5ac70f0Sopenharmony_ci
151d5ac70f0Sopenharmony_ci/*****************************************************************************
152d5ac70f0Sopenharmony_ci *                                                                           *
153d5ac70f0Sopenharmony_ci *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
154d5ac70f0Sopenharmony_ci *                                                                           *
155d5ac70f0Sopenharmony_ci *****************************************************************************/
156d5ac70f0Sopenharmony_ci
157d5ac70f0Sopenharmony_ci#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 15)
158d5ac70f0Sopenharmony_ci
159d5ac70f0Sopenharmony_citypedef unsigned long snd_pcm_uframes_t;
160d5ac70f0Sopenharmony_citypedef signed long snd_pcm_sframes_t;
161d5ac70f0Sopenharmony_ci
162d5ac70f0Sopenharmony_cienum {
163d5ac70f0Sopenharmony_ci	SNDRV_PCM_CLASS_GENERIC = 0,	/* standard mono or stereo device */
164d5ac70f0Sopenharmony_ci	SNDRV_PCM_CLASS_MULTI,		/* multichannel device */
165d5ac70f0Sopenharmony_ci	SNDRV_PCM_CLASS_MODEM,		/* software modem class */
166d5ac70f0Sopenharmony_ci	SNDRV_PCM_CLASS_DIGITIZER,	/* digitizer class */
167d5ac70f0Sopenharmony_ci	/* Don't forget to change the following: */
168d5ac70f0Sopenharmony_ci	SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
169d5ac70f0Sopenharmony_ci};
170d5ac70f0Sopenharmony_ci
171d5ac70f0Sopenharmony_cienum {
172d5ac70f0Sopenharmony_ci	SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
173d5ac70f0Sopenharmony_ci	SNDRV_PCM_SUBCLASS_MULTI_MIX,	/* multichannel subdevices are mixed together */
174d5ac70f0Sopenharmony_ci	/* Don't forget to change the following: */
175d5ac70f0Sopenharmony_ci	SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
176d5ac70f0Sopenharmony_ci};
177d5ac70f0Sopenharmony_ci
178d5ac70f0Sopenharmony_cienum {
179d5ac70f0Sopenharmony_ci	SNDRV_PCM_STREAM_PLAYBACK = 0,
180d5ac70f0Sopenharmony_ci	SNDRV_PCM_STREAM_CAPTURE,
181d5ac70f0Sopenharmony_ci	SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
182d5ac70f0Sopenharmony_ci};
183d5ac70f0Sopenharmony_ci
184d5ac70f0Sopenharmony_citypedef int __bitwise snd_pcm_access_t;
185d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_INTERLEAVED	((snd_pcm_access_t) 0) /* interleaved mmap */
186d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED	((snd_pcm_access_t) 1) /* noninterleaved mmap */
187d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_COMPLEX		((snd_pcm_access_t) 2) /* complex mmap */
188d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_INTERLEAVED		((snd_pcm_access_t) 3) /* readi/writei */
189d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_NONINTERLEAVED	((snd_pcm_access_t) 4) /* readn/writen */
190d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_ACCESS_LAST		SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
191d5ac70f0Sopenharmony_ci
192d5ac70f0Sopenharmony_citypedef int __bitwise snd_pcm_format_t;
193d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S8	((snd_pcm_format_t) 0)
194d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U8	((snd_pcm_format_t) 1)
195d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_LE	((snd_pcm_format_t) 2)
196d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_BE	((snd_pcm_format_t) 3)
197d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_LE	((snd_pcm_format_t) 4)
198d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_BE	((snd_pcm_format_t) 5)
199d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_LE	((snd_pcm_format_t) 6) /* low three bytes */
200d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_BE	((snd_pcm_format_t) 7) /* low three bytes */
201d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_LE	((snd_pcm_format_t) 8) /* low three bytes */
202d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_BE	((snd_pcm_format_t) 9) /* low three bytes */
203d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_LE	((snd_pcm_format_t) 10)
204d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_BE	((snd_pcm_format_t) 11)
205d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_LE	((snd_pcm_format_t) 12)
206d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_BE	((snd_pcm_format_t) 13)
207d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT_LE	((snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
208d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT_BE	((snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
209d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64_LE	((snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
210d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64_BE	((snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
211d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
212d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
213d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MU_LAW		((snd_pcm_format_t) 20)
214d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_A_LAW		((snd_pcm_format_t) 21)
215d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IMA_ADPCM	((snd_pcm_format_t) 22)
216d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MPEG		((snd_pcm_format_t) 23)
217d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_GSM		((snd_pcm_format_t) 24)
218d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_LE	((snd_pcm_format_t) 25) /* in four bytes, LSB justified */
219d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_BE	((snd_pcm_format_t) 26) /* in four bytes, LSB justified */
220d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_LE	((snd_pcm_format_t) 27) /* in four bytes, LSB justified */
221d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_BE	((snd_pcm_format_t) 28) /* in four bytes, LSB justified */
222d5ac70f0Sopenharmony_ci/* gap in the numbering for a future standard linear format */
223d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_SPECIAL	((snd_pcm_format_t) 31)
224d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3LE	((snd_pcm_format_t) 32)	/* in three bytes */
225d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3BE	((snd_pcm_format_t) 33)	/* in three bytes */
226d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3LE	((snd_pcm_format_t) 34)	/* in three bytes */
227d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3BE	((snd_pcm_format_t) 35)	/* in three bytes */
228d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3LE	((snd_pcm_format_t) 36)	/* in three bytes */
229d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3BE	((snd_pcm_format_t) 37)	/* in three bytes */
230d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3LE	((snd_pcm_format_t) 38)	/* in three bytes */
231d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3BE	((snd_pcm_format_t) 39)	/* in three bytes */
232d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3LE	((snd_pcm_format_t) 40)	/* in three bytes */
233d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3BE	((snd_pcm_format_t) 41)	/* in three bytes */
234d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3LE	((snd_pcm_format_t) 42)	/* in three bytes */
235d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3BE	((snd_pcm_format_t) 43)	/* in three bytes */
236d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24	((snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
237d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24_1B	((snd_pcm_format_t) 45) /* 1 sample in 1 byte */
238d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40	((snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
239d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40_1B	((snd_pcm_format_t) 47) /* 1 sample in 1 byte */
240d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U8		((snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
241d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_LE	((snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
242d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_LE	((snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
243d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_BE	((snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
244d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_BE	((snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
245d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_DSD_U32_BE
246d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FIRST		SNDRV_PCM_FORMAT_S8
247d5ac70f0Sopenharmony_ci
248d5ac70f0Sopenharmony_ci#ifdef SNDRV_LITTLE_ENDIAN
249d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_LE
250d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_LE
251d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_LE
252d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_LE
253d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_LE
254d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_LE
255d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_LE
256d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_LE
257d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
258d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_LE
259d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_LE
260d5ac70f0Sopenharmony_ci#endif
261d5ac70f0Sopenharmony_ci#ifdef SNDRV_BIG_ENDIAN
262d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_BE
263d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_BE
264d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_BE
265d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_BE
266d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_BE
267d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_BE
268d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_BE
269d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_BE
270d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
271d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_BE
272d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_BE
273d5ac70f0Sopenharmony_ci#endif
274d5ac70f0Sopenharmony_ci
275d5ac70f0Sopenharmony_citypedef int __bitwise snd_pcm_subformat_t;
276d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_STD		((snd_pcm_subformat_t) 0)
277d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_MSBITS_MAX	((snd_pcm_subformat_t) 1)
278d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_MSBITS_20	((snd_pcm_subformat_t) 2)
279d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_MSBITS_24	((snd_pcm_subformat_t) 3)
280d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_LAST	SNDRV_PCM_SUBFORMAT_MSBITS_24
281d5ac70f0Sopenharmony_ci
282d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP		0x00000001	/* hardware supports mmap */
283d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP_VALID	0x00000002	/* period data are valid during transfer */
284d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_DOUBLE		0x00000004	/* Double buffering needed for PCM start/stop */
285d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_BATCH		0x00000010	/* double buffering */
286d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_APPLPTR	0x00000020	/* need the explicit sync of appl_ptr update */
287d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_PERFECT_DRAIN	0x00000040	/* silencing at the end of stream is not required */
288d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_INTERLEAVED	0x00000100	/* channels are interleaved */
289d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_NONINTERLEAVED	0x00000200	/* channels are not interleaved */
290d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_COMPLEX		0x00000400	/* complex frame organization (mmap only) */
291d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_BLOCK_TRANSFER	0x00010000	/* hardware transfer block of samples */
292d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_OVERRANGE	0x00020000	/* hardware supports ADC (capture) overrange detection */
293d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_RESUME		0x00040000	/* hardware supports stream resume after suspend */
294d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_PAUSE		0x00080000	/* pause ioctl is supported */
295d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HALF_DUPLEX	0x00100000	/* only half duplex */
296d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_JOINT_DUPLEX	0x00200000	/* playback and capture stream are somewhat correlated */
297d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_START	0x00400000	/* pcm support some kind of sync go */
298d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP	0x00800000	/* period wakeup can be disabled */
299d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* (Deprecated)has audio wall clock for audio/system time sync */
300d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ATIME              0x01000000  /* report hardware link audio time, reset on startup */
301d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME     0x02000000  /* report absolute hardware link audio time, not reset on startup */
302d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME    0x04000000  /* report estimated link audio time */
303d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
304d5ac70f0Sopenharmony_ci
305d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_DRAIN_TRIGGER	0x40000000		/* internal kernel flag - trigger in drain */
306d5ac70f0Sopenharmony_ci#define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
307d5ac70f0Sopenharmony_ci
308d5ac70f0Sopenharmony_ci#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
309d5ac70f0Sopenharmony_ci#define __SND_STRUCT_TIME64
310d5ac70f0Sopenharmony_ci#endif
311d5ac70f0Sopenharmony_ci
312d5ac70f0Sopenharmony_citypedef int __bitwise snd_pcm_state_t;
313d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_OPEN		((snd_pcm_state_t) 0) /* stream is open */
314d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_SETUP		((snd_pcm_state_t) 1) /* stream has a setup */
315d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_PREPARED	((snd_pcm_state_t) 2) /* stream is ready to start */
316d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_RUNNING		((snd_pcm_state_t) 3) /* stream is running */
317d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_XRUN		((snd_pcm_state_t) 4) /* stream reached an xrun */
318d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_DRAINING	((snd_pcm_state_t) 5) /* stream is draining */
319d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_PAUSED		((snd_pcm_state_t) 6) /* stream is paused */
320d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_SUSPENDED	((snd_pcm_state_t) 7) /* hardware is suspended */
321d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_DISCONNECTED	((snd_pcm_state_t) 8) /* hardware is disconnected */
322d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_STATE_LAST		SNDRV_PCM_STATE_DISCONNECTED
323d5ac70f0Sopenharmony_ci
324d5ac70f0Sopenharmony_cienum {
325d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
326d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
327d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
328d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
329d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
330d5ac70f0Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
331d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
332d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
333d5ac70f0Sopenharmony_ci#else
334d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
335d5ac70f0Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
336d5ac70f0Sopenharmony_ci#endif
337d5ac70f0Sopenharmony_ci};
338d5ac70f0Sopenharmony_ci
339d5ac70f0Sopenharmony_ciunion snd_pcm_sync_id {
340d5ac70f0Sopenharmony_ci	unsigned char id[16];
341d5ac70f0Sopenharmony_ci	unsigned short id16[8];
342d5ac70f0Sopenharmony_ci	unsigned int id32[4];
343d5ac70f0Sopenharmony_ci};
344d5ac70f0Sopenharmony_ci
345d5ac70f0Sopenharmony_cistruct snd_pcm_info {
346d5ac70f0Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
347d5ac70f0Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
348d5ac70f0Sopenharmony_ci	int stream;			/* RO/WR (control): stream direction */
349d5ac70f0Sopenharmony_ci	int card;			/* R: card number */
350d5ac70f0Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
351d5ac70f0Sopenharmony_ci	unsigned char name[80];		/* name of this device */
352d5ac70f0Sopenharmony_ci	unsigned char subname[32];	/* subdevice name */
353d5ac70f0Sopenharmony_ci	int dev_class;			/* SNDRV_PCM_CLASS_* */
354d5ac70f0Sopenharmony_ci	int dev_subclass;		/* SNDRV_PCM_SUBCLASS_* */
355d5ac70f0Sopenharmony_ci	unsigned int subdevices_count;
356d5ac70f0Sopenharmony_ci	unsigned int subdevices_avail;
357d5ac70f0Sopenharmony_ci	union snd_pcm_sync_id sync;	/* hardware synchronization ID */
358d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future... */
359d5ac70f0Sopenharmony_ci};
360d5ac70f0Sopenharmony_ci
361d5ac70f0Sopenharmony_citypedef int snd_pcm_hw_param_t;
362d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_ACCESS	0	/* Access type */
363d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FORMAT	1	/* Format */
364d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SUBFORMAT	2	/* Subformat */
365d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_MASK	SNDRV_PCM_HW_PARAM_ACCESS
366d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_MASK	SNDRV_PCM_HW_PARAM_SUBFORMAT
367d5ac70f0Sopenharmony_ci
368d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SAMPLE_BITS	8	/* Bits per sample */
369d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FRAME_BITS	9	/* Bits per frame */
370d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_CHANNELS	10	/* Channels */
371d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_RATE		11	/* Approx rate */
372d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_TIME	12	/* Approx distance between
373d5ac70f0Sopenharmony_ci						 * interrupts in us
374d5ac70f0Sopenharmony_ci						 */
375d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_SIZE	13	/* Approx frames between
376d5ac70f0Sopenharmony_ci						 * interrupts
377d5ac70f0Sopenharmony_ci						 */
378d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_BYTES	14	/* Approx bytes between
379d5ac70f0Sopenharmony_ci						 * interrupts
380d5ac70f0Sopenharmony_ci						 */
381d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIODS	15	/* Approx interrupts per
382d5ac70f0Sopenharmony_ci						 * buffer
383d5ac70f0Sopenharmony_ci						 */
384d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_TIME	16	/* Approx duration of buffer
385d5ac70f0Sopenharmony_ci						 * in us
386d5ac70f0Sopenharmony_ci						 */
387d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_SIZE	17	/* Size of buffer in frames */
388d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_BYTES	18	/* Size of buffer in bytes */
389d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_TICK_TIME	19	/* Approx tick duration in us */
390d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_INTERVAL	SNDRV_PCM_HW_PARAM_SAMPLE_BITS
391d5ac70f0Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_INTERVAL	SNDRV_PCM_HW_PARAM_TICK_TIME
392d5ac70f0Sopenharmony_ci
393d5ac70f0Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NORESAMPLE	(1<<0)	/* avoid rate resampling */
394d5ac70f0Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER	(1<<1)	/* export buffer */
395d5ac70f0Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP	(1<<2)	/* disable period wakeups */
396d5ac70f0Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE	(1<<3)	/* suppress the silence fill
397d5ac70f0Sopenharmony_ci							 * for draining
398d5ac70f0Sopenharmony_ci							 */
399d5ac70f0Sopenharmony_ci
400d5ac70f0Sopenharmony_cistruct snd_interval {
401d5ac70f0Sopenharmony_ci	unsigned int min, max;
402d5ac70f0Sopenharmony_ci	unsigned int openmin:1,
403d5ac70f0Sopenharmony_ci		     openmax:1,
404d5ac70f0Sopenharmony_ci		     integer:1,
405d5ac70f0Sopenharmony_ci		     empty:1;
406d5ac70f0Sopenharmony_ci};
407d5ac70f0Sopenharmony_ci
408d5ac70f0Sopenharmony_ci#define SNDRV_MASK_MAX	256
409d5ac70f0Sopenharmony_ci
410d5ac70f0Sopenharmony_cistruct snd_mask {
411d5ac70f0Sopenharmony_ci	__u32 bits[(SNDRV_MASK_MAX+31)/32];
412d5ac70f0Sopenharmony_ci};
413d5ac70f0Sopenharmony_ci
414d5ac70f0Sopenharmony_cistruct snd_pcm_hw_params {
415d5ac70f0Sopenharmony_ci	unsigned int flags;
416d5ac70f0Sopenharmony_ci	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
417d5ac70f0Sopenharmony_ci			       SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
418d5ac70f0Sopenharmony_ci	struct snd_mask mres[5];	/* reserved masks */
419d5ac70f0Sopenharmony_ci	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
420d5ac70f0Sopenharmony_ci				        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
421d5ac70f0Sopenharmony_ci	struct snd_interval ires[9];	/* reserved intervals */
422d5ac70f0Sopenharmony_ci	unsigned int rmask;		/* W: requested masks */
423d5ac70f0Sopenharmony_ci	unsigned int cmask;		/* R: changed masks */
424d5ac70f0Sopenharmony_ci	unsigned int info;		/* R: Info flags for returned setup */
425d5ac70f0Sopenharmony_ci	unsigned int msbits;		/* R: used most significant bits */
426d5ac70f0Sopenharmony_ci	unsigned int rate_num;		/* R: rate numerator */
427d5ac70f0Sopenharmony_ci	unsigned int rate_den;		/* R: rate denominator */
428d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t fifo_size;	/* R: chip FIFO size in frames */
429d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
430d5ac70f0Sopenharmony_ci};
431d5ac70f0Sopenharmony_ci
432d5ac70f0Sopenharmony_cienum {
433d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_NONE = 0,
434d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_ENABLE,
435d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
436d5ac70f0Sopenharmony_ci};
437d5ac70f0Sopenharmony_ci
438d5ac70f0Sopenharmony_cistruct snd_pcm_sw_params {
439d5ac70f0Sopenharmony_ci	int tstamp_mode;			/* timestamp mode */
440d5ac70f0Sopenharmony_ci	unsigned int period_step;
441d5ac70f0Sopenharmony_ci	unsigned int sleep_min;			/* min ticks to sleep */
442d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t avail_min;		/* min avail frames for wakeup */
443d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t xfer_align;		/* obsolete: xfer size need to be a multiple */
444d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t start_threshold;	/* min hw_avail frames for automatic start */
445d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t stop_threshold;	/* min avail frames for automatic stop */
446d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t silence_threshold;	/* min distance from noise for silence filling */
447d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t silence_size;		/* silence block size */
448d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t boundary;		/* pointers wrap point */
449d5ac70f0Sopenharmony_ci	unsigned int proto;			/* protocol version */
450d5ac70f0Sopenharmony_ci	unsigned int tstamp_type;		/* timestamp type (req. proto >= 2.0.12) */
451d5ac70f0Sopenharmony_ci	unsigned char reserved[56];		/* reserved for future */
452d5ac70f0Sopenharmony_ci};
453d5ac70f0Sopenharmony_ci
454d5ac70f0Sopenharmony_cistruct snd_pcm_channel_info {
455d5ac70f0Sopenharmony_ci	unsigned int channel;
456d5ac70f0Sopenharmony_ci	__kernel_off_t offset;		/* mmap offset */
457d5ac70f0Sopenharmony_ci	unsigned int first;		/* offset to first sample in bits */
458d5ac70f0Sopenharmony_ci	unsigned int step;		/* samples distance in bits */
459d5ac70f0Sopenharmony_ci};
460d5ac70f0Sopenharmony_ci
461d5ac70f0Sopenharmony_cienum {
462d5ac70f0Sopenharmony_ci	/*
463d5ac70f0Sopenharmony_ci	 *  first definition for backwards compatibility only,
464d5ac70f0Sopenharmony_ci	 *  maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
465d5ac70f0Sopenharmony_ci	 */
466d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
467d5ac70f0Sopenharmony_ci
468d5ac70f0Sopenharmony_ci	/* timestamp definitions */
469d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1,           /* DMA time, reported as per hw_ptr */
470d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2,	           /* link time reported by sample or wallclock counter, reset on startup */
471d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3,	   /* link time reported by sample or wallclock counter, not reset on startup */
472d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4,    /* link time estimated indirectly */
473d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
474d5ac70f0Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
475d5ac70f0Sopenharmony_ci};
476d5ac70f0Sopenharmony_ci
477d5ac70f0Sopenharmony_ci/* explicit padding avoids incompatibility between i386 and x86-64 */
478d5ac70f0Sopenharmony_citypedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
479d5ac70f0Sopenharmony_ci
480d5ac70f0Sopenharmony_cistruct snd_pcm_status {
481d5ac70f0Sopenharmony_ci	snd_pcm_state_t state;		/* stream state */
482d5ac70f0Sopenharmony_ci	__time_pad pad1;		/* align to timespec */
483d5ac70f0Sopenharmony_ci	struct timespec trigger_tstamp;	/* time when stream was started/stopped/paused */
484d5ac70f0Sopenharmony_ci	struct timespec tstamp;		/* reference timestamp */
485d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* appl ptr */
486d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* hw ptr */
487d5ac70f0Sopenharmony_ci	snd_pcm_sframes_t delay;	/* current delay in frames */
488d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t avail;	/* number of frames available */
489d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t avail_max;	/* max frames available on hw since last status */
490d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t overrange;	/* count of ADC (capture) overrange detections from last status */
491d5ac70f0Sopenharmony_ci	snd_pcm_state_t suspended_state; /* suspended stream state */
492d5ac70f0Sopenharmony_ci	__u32 audio_tstamp_data;	 /* needed for 64-bit alignment, used for configs/report to/from userspace */
493d5ac70f0Sopenharmony_ci	struct timespec audio_tstamp;	/* sample counter, wall clock, PHC or on-demand sync'ed */
494d5ac70f0Sopenharmony_ci	struct timespec driver_tstamp;	/* useful in case reference system tstamp is reported with delay */
495d5ac70f0Sopenharmony_ci	__u32 audio_tstamp_accuracy;	/* in ns units, only valid if indicated in audio_tstamp_data */
496d5ac70f0Sopenharmony_ci	unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
497d5ac70f0Sopenharmony_ci};
498d5ac70f0Sopenharmony_ci
499d5ac70f0Sopenharmony_ci/*
500d5ac70f0Sopenharmony_ci * For mmap operations, we need the 64-bit layout, both for compat mode,
501d5ac70f0Sopenharmony_ci * and for y2038 compatibility. For 64-bit applications, the two definitions
502d5ac70f0Sopenharmony_ci * are identical, so we keep the traditional version.
503d5ac70f0Sopenharmony_ci */
504d5ac70f0Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
505d5ac70f0Sopenharmony_ci#define __snd_pcm_mmap_status64		snd_pcm_mmap_status
506d5ac70f0Sopenharmony_ci#define __snd_pcm_mmap_control64	snd_pcm_mmap_control
507d5ac70f0Sopenharmony_ci#define __snd_pcm_sync_ptr64		snd_pcm_sync_ptr
508d5ac70f0Sopenharmony_ci#define __snd_timespec64		timespec
509d5ac70f0Sopenharmony_cistruct __snd_timespec {
510d5ac70f0Sopenharmony_ci	__s32 tv_sec;
511d5ac70f0Sopenharmony_ci	__s32 tv_nsec;
512d5ac70f0Sopenharmony_ci};
513d5ac70f0Sopenharmony_ci#else
514d5ac70f0Sopenharmony_ci#define __snd_pcm_mmap_status		snd_pcm_mmap_status
515d5ac70f0Sopenharmony_ci#define __snd_pcm_mmap_control		snd_pcm_mmap_control
516d5ac70f0Sopenharmony_ci#define __snd_pcm_sync_ptr		snd_pcm_sync_ptr
517d5ac70f0Sopenharmony_ci#define __snd_timespec			timespec
518d5ac70f0Sopenharmony_cistruct __snd_timespec64 {
519d5ac70f0Sopenharmony_ci	__s64 tv_sec;
520d5ac70f0Sopenharmony_ci	__s64 tv_nsec;
521d5ac70f0Sopenharmony_ci};
522d5ac70f0Sopenharmony_ci
523d5ac70f0Sopenharmony_ci#endif
524d5ac70f0Sopenharmony_ci
525d5ac70f0Sopenharmony_cistruct __snd_pcm_mmap_status {
526d5ac70f0Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
527d5ac70f0Sopenharmony_ci	int pad1;			/* Needed for 64 bit alignment */
528d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
529d5ac70f0Sopenharmony_ci	struct __snd_timespec tstamp;	/* Timestamp */
530d5ac70f0Sopenharmony_ci	snd_pcm_state_t suspended_state; /* RO: suspended stream state */
531d5ac70f0Sopenharmony_ci	struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
532d5ac70f0Sopenharmony_ci};
533d5ac70f0Sopenharmony_ci
534d5ac70f0Sopenharmony_cistruct __snd_pcm_mmap_control {
535d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* RW: appl ptr (0...boundary-1) */
536d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t avail_min;	/* RW: min available frames for wakeup */
537d5ac70f0Sopenharmony_ci};
538d5ac70f0Sopenharmony_ci
539d5ac70f0Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_HWSYNC	(1<<0)	/* execute hwsync */
540d5ac70f0Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_APPL		(1<<1)	/* get appl_ptr from driver (r/w op) */
541d5ac70f0Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN	(1<<2)	/* get avail_min from driver */
542d5ac70f0Sopenharmony_ci
543d5ac70f0Sopenharmony_cistruct __snd_pcm_sync_ptr {
544d5ac70f0Sopenharmony_ci	unsigned int flags;
545d5ac70f0Sopenharmony_ci	union {
546d5ac70f0Sopenharmony_ci		struct __snd_pcm_mmap_status status;
547d5ac70f0Sopenharmony_ci		unsigned char reserved[64];
548d5ac70f0Sopenharmony_ci	} s;
549d5ac70f0Sopenharmony_ci	union {
550d5ac70f0Sopenharmony_ci		struct __snd_pcm_mmap_control control;
551d5ac70f0Sopenharmony_ci		unsigned char reserved[64];
552d5ac70f0Sopenharmony_ci	} c;
553d5ac70f0Sopenharmony_ci};
554d5ac70f0Sopenharmony_ci
555d5ac70f0Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
556d5ac70f0Sopenharmony_citypedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
557d5ac70f0Sopenharmony_citypedef char __pad_after_uframe[0];
558d5ac70f0Sopenharmony_ci#endif
559d5ac70f0Sopenharmony_ci
560d5ac70f0Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
561d5ac70f0Sopenharmony_citypedef char __pad_before_uframe[0];
562d5ac70f0Sopenharmony_citypedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
563d5ac70f0Sopenharmony_ci#endif
564d5ac70f0Sopenharmony_ci
565d5ac70f0Sopenharmony_cistruct __snd_pcm_mmap_status64 {
566d5ac70f0Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
567d5ac70f0Sopenharmony_ci	__u32 pad1;			/* Needed for 64 bit alignment */
568d5ac70f0Sopenharmony_ci	__pad_before_uframe __pad1;
569d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
570d5ac70f0Sopenharmony_ci	__pad_after_uframe __pad2;
571d5ac70f0Sopenharmony_ci	struct __snd_timespec64 tstamp;	/* Timestamp */
572d5ac70f0Sopenharmony_ci	snd_pcm_state_t suspended_state;/* RO: suspended stream state */
573d5ac70f0Sopenharmony_ci	__u32 pad3;			/* Needed for 64 bit alignment */
574d5ac70f0Sopenharmony_ci	struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
575d5ac70f0Sopenharmony_ci};
576d5ac70f0Sopenharmony_ci
577d5ac70f0Sopenharmony_cistruct __snd_pcm_mmap_control64 {
578d5ac70f0Sopenharmony_ci	__pad_before_uframe __pad1;
579d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
580d5ac70f0Sopenharmony_ci	__pad_before_uframe __pad2;
581d5ac70f0Sopenharmony_ci
582d5ac70f0Sopenharmony_ci	__pad_before_uframe __pad3;
583d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t  avail_min;	 /* RW: min available frames for wakeup */
584d5ac70f0Sopenharmony_ci	__pad_after_uframe __pad4;
585d5ac70f0Sopenharmony_ci};
586d5ac70f0Sopenharmony_ci
587d5ac70f0Sopenharmony_cistruct __snd_pcm_sync_ptr64 {
588d5ac70f0Sopenharmony_ci	__u32 flags;
589d5ac70f0Sopenharmony_ci	__u32 pad1;
590d5ac70f0Sopenharmony_ci	union {
591d5ac70f0Sopenharmony_ci		struct __snd_pcm_mmap_status64 status;
592d5ac70f0Sopenharmony_ci		unsigned char reserved[64];
593d5ac70f0Sopenharmony_ci	} s;
594d5ac70f0Sopenharmony_ci	union {
595d5ac70f0Sopenharmony_ci		struct __snd_pcm_mmap_control64 control;
596d5ac70f0Sopenharmony_ci		unsigned char reserved[64];
597d5ac70f0Sopenharmony_ci	} c;
598d5ac70f0Sopenharmony_ci};
599d5ac70f0Sopenharmony_ci
600d5ac70f0Sopenharmony_cistruct snd_xferi {
601d5ac70f0Sopenharmony_ci	snd_pcm_sframes_t result;
602d5ac70f0Sopenharmony_ci	void *buf;
603d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t frames;
604d5ac70f0Sopenharmony_ci};
605d5ac70f0Sopenharmony_ci
606d5ac70f0Sopenharmony_cistruct snd_xfern {
607d5ac70f0Sopenharmony_ci	snd_pcm_sframes_t result;
608d5ac70f0Sopenharmony_ci	void * *bufs;
609d5ac70f0Sopenharmony_ci	snd_pcm_uframes_t frames;
610d5ac70f0Sopenharmony_ci};
611d5ac70f0Sopenharmony_ci
612d5ac70f0Sopenharmony_cienum {
613d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,	/* gettimeofday equivalent */
614d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,	/* posix_clock_monotonic equivalent */
615d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,    /* monotonic_raw (no NTP) */
616d5ac70f0Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
617d5ac70f0Sopenharmony_ci};
618d5ac70f0Sopenharmony_ci
619d5ac70f0Sopenharmony_ci/* channel positions */
620d5ac70f0Sopenharmony_cienum {
621d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_UNKNOWN = 0,
622d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_NA,		/* N/A, silent */
623d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_MONO,	/* mono stream */
624d5ac70f0Sopenharmony_ci	/* this follows the alsa-lib mixer channel value + 3 */
625d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FL,		/* front left */
626d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FR,		/* front right */
627d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RL,		/* rear left */
628d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RR,		/* rear right */
629d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FC,		/* front center */
630d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_LFE,	/* LFE */
631d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_SL,		/* side left */
632d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_SR,		/* side right */
633d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RC,		/* rear center */
634d5ac70f0Sopenharmony_ci	/* new definitions */
635d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FLC,	/* front left center */
636d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FRC,	/* front right center */
637d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RLC,	/* rear left center */
638d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RRC,	/* rear right center */
639d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FLW,	/* front left wide */
640d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FRW,	/* front right wide */
641d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FLH,	/* front left high */
642d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FCH,	/* front center high */
643d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_FRH,	/* front right high */
644d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TC,		/* top center */
645d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TFL,	/* top front left */
646d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TFR,	/* top front right */
647d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TFC,	/* top front center */
648d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TRL,	/* top rear left */
649d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TRR,	/* top rear right */
650d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TRC,	/* top rear center */
651d5ac70f0Sopenharmony_ci	/* new definitions for UAC2 */
652d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TFLC,	/* top front left center */
653d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TFRC,	/* top front right center */
654d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TSL,	/* top side left */
655d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_TSR,	/* top side right */
656d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_LLFE,	/* left LFE */
657d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_RLFE,	/* right LFE */
658d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_BC,		/* bottom center */
659d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_BLC,	/* bottom left center */
660d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_BRC,	/* bottom right center */
661d5ac70f0Sopenharmony_ci	SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
662d5ac70f0Sopenharmony_ci};
663d5ac70f0Sopenharmony_ci
664d5ac70f0Sopenharmony_ci#define SNDRV_CHMAP_POSITION_MASK	0xffff
665d5ac70f0Sopenharmony_ci#define SNDRV_CHMAP_PHASE_INVERSE	(0x01 << 16)
666d5ac70f0Sopenharmony_ci#define SNDRV_CHMAP_DRIVER_SPEC		(0x02 << 16)
667d5ac70f0Sopenharmony_ci
668d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_PVERSION	_IOR('A', 0x00, int)
669d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_INFO		_IOR('A', 0x01, struct snd_pcm_info)
670d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_TSTAMP		_IOW('A', 0x02, int)
671d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_TTSTAMP		_IOW('A', 0x03, int)
672d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_USER_PVERSION	_IOW('A', 0x04, int)
673d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_REFINE	_IOWR('A', 0x10, struct snd_pcm_hw_params)
674d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_PARAMS	_IOWR('A', 0x11, struct snd_pcm_hw_params)
675d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_FREE		_IO('A', 0x12)
676d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_SW_PARAMS	_IOWR('A', 0x13, struct snd_pcm_sw_params)
677d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS		_IOR('A', 0x20, struct snd_pcm_status)
678d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_DELAY		_IOR('A', 0x21, snd_pcm_sframes_t)
679d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_HWSYNC		_IO('A', 0x22)
680d5ac70f0Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
681d5ac70f0Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR64	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
682d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct snd_pcm_sync_ptr)
683d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS_EXT	_IOWR('A', 0x24, struct snd_pcm_status)
684d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_CHANNEL_INFO	_IOR('A', 0x32, struct snd_pcm_channel_info)
685d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_PREPARE		_IO('A', 0x40)
686d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESET		_IO('A', 0x41)
687d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_START		_IO('A', 0x42)
688d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_DROP		_IO('A', 0x43)
689d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_DRAIN		_IO('A', 0x44)
690d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_PAUSE		_IOW('A', 0x45, int)
691d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_REWIND		_IOW('A', 0x46, snd_pcm_uframes_t)
692d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESUME		_IO('A', 0x47)
693d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_XRUN		_IO('A', 0x48)
694d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_FORWARD		_IOW('A', 0x49, snd_pcm_uframes_t)
695d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEI_FRAMES	_IOW('A', 0x50, struct snd_xferi)
696d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_READI_FRAMES	_IOR('A', 0x51, struct snd_xferi)
697d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEN_FRAMES	_IOW('A', 0x52, struct snd_xfern)
698d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_READN_FRAMES	_IOR('A', 0x53, struct snd_xfern)
699d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_LINK		_IOW('A', 0x60, int)
700d5ac70f0Sopenharmony_ci#define SNDRV_PCM_IOCTL_UNLINK		_IO('A', 0x61)
701d5ac70f0Sopenharmony_ci
702d5ac70f0Sopenharmony_ci/*****************************************************************************
703d5ac70f0Sopenharmony_ci *                                                                           *
704d5ac70f0Sopenharmony_ci *                            MIDI v1.0 interface                            *
705d5ac70f0Sopenharmony_ci *                                                                           *
706d5ac70f0Sopenharmony_ci *****************************************************************************/
707d5ac70f0Sopenharmony_ci
708d5ac70f0Sopenharmony_ci/*
709d5ac70f0Sopenharmony_ci *  Raw MIDI section - /dev/snd/midi??
710d5ac70f0Sopenharmony_ci */
711d5ac70f0Sopenharmony_ci
712d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 4)
713d5ac70f0Sopenharmony_ci
714d5ac70f0Sopenharmony_cienum {
715d5ac70f0Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
716d5ac70f0Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_INPUT,
717d5ac70f0Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
718d5ac70f0Sopenharmony_ci};
719d5ac70f0Sopenharmony_ci
720d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_OUTPUT		0x00000001
721d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_INPUT		0x00000002
722d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_DUPLEX		0x00000004
723d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_UMP			0x00000008
724d5ac70f0Sopenharmony_ci
725d5ac70f0Sopenharmony_cistruct snd_rawmidi_info {
726d5ac70f0Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
727d5ac70f0Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
728d5ac70f0Sopenharmony_ci	int stream;			/* WR: stream */
729d5ac70f0Sopenharmony_ci	int card;			/* R: card number */
730d5ac70f0Sopenharmony_ci	unsigned int flags;		/* SNDRV_RAWMIDI_INFO_XXXX */
731d5ac70f0Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
732d5ac70f0Sopenharmony_ci	unsigned char name[80];		/* name of device */
733d5ac70f0Sopenharmony_ci	unsigned char subname[32];	/* name of active or selected subdevice */
734d5ac70f0Sopenharmony_ci	unsigned int subdevices_count;
735d5ac70f0Sopenharmony_ci	unsigned int subdevices_avail;
736d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future use */
737d5ac70f0Sopenharmony_ci};
738d5ac70f0Sopenharmony_ci
739d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_MASK		(7<<0)
740d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_SHIFT	0
741d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_NONE		(0<<0)
742d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP	(1<<0)
743d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MASK		(7<<3)
744d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_SHIFT		3
745d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_NONE		(0<<3)
746d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_REALTIME	(1<<3)
747d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC	(2<<3)
748d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC_RAW	(3<<3)
749d5ac70f0Sopenharmony_ci
750d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_FRAMING_DATA_LENGTH 16
751d5ac70f0Sopenharmony_ci
752d5ac70f0Sopenharmony_cistruct snd_rawmidi_framing_tstamp {
753d5ac70f0Sopenharmony_ci	/* For now, frame_type is always 0. Midi 2.0 is expected to add new
754d5ac70f0Sopenharmony_ci	 * types here. Applications are expected to skip unknown frame types.
755d5ac70f0Sopenharmony_ci	 */
756d5ac70f0Sopenharmony_ci	__u8 frame_type;
757d5ac70f0Sopenharmony_ci	__u8 length; /* number of valid bytes in data field */
758d5ac70f0Sopenharmony_ci	__u8 reserved[2];
759d5ac70f0Sopenharmony_ci	__u32 tv_nsec;		/* nanoseconds */
760d5ac70f0Sopenharmony_ci	__u64 tv_sec;		/* seconds */
761d5ac70f0Sopenharmony_ci	__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
762d5ac70f0Sopenharmony_ci} __packed;
763d5ac70f0Sopenharmony_ci
764d5ac70f0Sopenharmony_cistruct snd_rawmidi_params {
765d5ac70f0Sopenharmony_ci	int stream;
766d5ac70f0Sopenharmony_ci	size_t buffer_size;		/* queue size in bytes */
767d5ac70f0Sopenharmony_ci	size_t avail_min;		/* minimum avail bytes for wakeup */
768d5ac70f0Sopenharmony_ci	unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
769d5ac70f0Sopenharmony_ci	unsigned int mode;		/* For input data only, frame incoming data */
770d5ac70f0Sopenharmony_ci	unsigned char reserved[12];	/* reserved for future use */
771d5ac70f0Sopenharmony_ci};
772d5ac70f0Sopenharmony_ci
773d5ac70f0Sopenharmony_cistruct snd_rawmidi_status {
774d5ac70f0Sopenharmony_ci	int stream;
775d5ac70f0Sopenharmony_ci	__time_pad pad1;
776d5ac70f0Sopenharmony_ci	struct timespec tstamp;		/* Timestamp */
777d5ac70f0Sopenharmony_ci	size_t avail;			/* available bytes */
778d5ac70f0Sopenharmony_ci	size_t xruns;			/* count of overruns since last status (in bytes) */
779d5ac70f0Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
780d5ac70f0Sopenharmony_ci};
781d5ac70f0Sopenharmony_ci
782d5ac70f0Sopenharmony_ci/* UMP EP info flags */
783d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS		0x01
784d5ac70f0Sopenharmony_ci
785d5ac70f0Sopenharmony_ci/* UMP EP Protocol / JRTS capability bits */
786d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK	0x0300
787d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI1		0x0100 /* MIDI 1.0 */
788d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI2		0x0200 /* MIDI 2.0 */
789d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK	0x0003
790d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX		0x0001 /* JRTS Transmit */
791d5ac70f0Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX		0x0002 /* JRTS Receive */
792d5ac70f0Sopenharmony_ci
793d5ac70f0Sopenharmony_ci/* UMP Endpoint information */
794d5ac70f0Sopenharmony_cistruct snd_ump_endpoint_info {
795d5ac70f0Sopenharmony_ci	int card;			/* card number */
796d5ac70f0Sopenharmony_ci	int device;			/* device number */
797d5ac70f0Sopenharmony_ci	unsigned int flags;		/* additional info */
798d5ac70f0Sopenharmony_ci	unsigned int protocol_caps;	/* protocol capabilities */
799d5ac70f0Sopenharmony_ci	unsigned int protocol;		/* current protocol */
800d5ac70f0Sopenharmony_ci	unsigned int num_blocks;	/* # of function blocks */
801d5ac70f0Sopenharmony_ci	unsigned short version;		/* UMP major/minor version */
802d5ac70f0Sopenharmony_ci	unsigned short family_id;	/* MIDI device family ID */
803d5ac70f0Sopenharmony_ci	unsigned short model_id;	/* MIDI family model ID */
804d5ac70f0Sopenharmony_ci	unsigned int manufacturer_id;	/* MIDI manufacturer ID */
805d5ac70f0Sopenharmony_ci	unsigned char sw_revision[4];	/* software revision */
806d5ac70f0Sopenharmony_ci	unsigned short padding;
807d5ac70f0Sopenharmony_ci	unsigned char name[128];	/* endpoint name string */
808d5ac70f0Sopenharmony_ci	unsigned char product_id[128];	/* unique product id string */
809d5ac70f0Sopenharmony_ci	unsigned char reserved[32];
810d5ac70f0Sopenharmony_ci} __packed;
811d5ac70f0Sopenharmony_ci
812d5ac70f0Sopenharmony_ci/* UMP direction */
813d5ac70f0Sopenharmony_ci#define SNDRV_UMP_DIR_INPUT		0x01
814d5ac70f0Sopenharmony_ci#define SNDRV_UMP_DIR_OUTPUT		0x02
815d5ac70f0Sopenharmony_ci#define SNDRV_UMP_DIR_BIDIRECTION	0x03
816d5ac70f0Sopenharmony_ci
817d5ac70f0Sopenharmony_ci/* UMP block info flags */
818d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_IS_MIDI1	(1U << 0) /* MIDI 1.0 port w/o restrict */
819d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_IS_LOWSPEED	(1U << 1) /* 31.25Kbps B/W MIDI1 port */
820d5ac70f0Sopenharmony_ci
821d5ac70f0Sopenharmony_ci/* UMP block user-interface hint */
822d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN		0x00
823d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER	0x01
824d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_SENDER		0x02
825d5ac70f0Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_BOTH		0x03
826d5ac70f0Sopenharmony_ci
827d5ac70f0Sopenharmony_ci/* UMP groups and blocks */
828d5ac70f0Sopenharmony_ci#define SNDRV_UMP_MAX_GROUPS		16
829d5ac70f0Sopenharmony_ci#define SNDRV_UMP_MAX_BLOCKS		32
830d5ac70f0Sopenharmony_ci
831d5ac70f0Sopenharmony_ci/* UMP Block information */
832d5ac70f0Sopenharmony_cistruct snd_ump_block_info {
833d5ac70f0Sopenharmony_ci	int card;			/* card number */
834d5ac70f0Sopenharmony_ci	int device;			/* device number */
835d5ac70f0Sopenharmony_ci	unsigned char block_id;		/* block ID (R/W) */
836d5ac70f0Sopenharmony_ci	unsigned char direction;	/* UMP direction */
837d5ac70f0Sopenharmony_ci	unsigned char active;		/* Activeness */
838d5ac70f0Sopenharmony_ci	unsigned char first_group;	/* first group ID */
839d5ac70f0Sopenharmony_ci	unsigned char num_groups;	/* number of groups */
840d5ac70f0Sopenharmony_ci	unsigned char midi_ci_version;	/* MIDI-CI support version */
841d5ac70f0Sopenharmony_ci	unsigned char sysex8_streams;	/* max number of sysex8 streams */
842d5ac70f0Sopenharmony_ci	unsigned char ui_hint;		/* user interface hint */
843d5ac70f0Sopenharmony_ci	unsigned int flags;		/* various info flags */
844d5ac70f0Sopenharmony_ci	unsigned char name[128];	/* block name string */
845d5ac70f0Sopenharmony_ci	unsigned char reserved[32];
846d5ac70f0Sopenharmony_ci} __packed;
847d5ac70f0Sopenharmony_ci
848d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PVERSION	_IOR('W', 0x00, int)
849d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_INFO	_IOR('W', 0x01, struct snd_rawmidi_info)
850d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
851d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PARAMS	_IOWR('W', 0x10, struct snd_rawmidi_params)
852d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_STATUS	_IOWR('W', 0x20, struct snd_rawmidi_status)
853d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DROP	_IOW('W', 0x30, int)
854d5ac70f0Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DRAIN	_IOW('W', 0x31, int)
855d5ac70f0Sopenharmony_ci/* Additional ioctls for UMP rawmidi devices */
856d5ac70f0Sopenharmony_ci#define SNDRV_UMP_IOCTL_ENDPOINT_INFO	_IOR('W', 0x40, struct snd_ump_endpoint_info)
857d5ac70f0Sopenharmony_ci#define SNDRV_UMP_IOCTL_BLOCK_INFO	_IOR('W', 0x41, struct snd_ump_block_info)
858d5ac70f0Sopenharmony_ci
859d5ac70f0Sopenharmony_ci/*
860d5ac70f0Sopenharmony_ci *  Timer section - /dev/snd/timer
861d5ac70f0Sopenharmony_ci */
862d5ac70f0Sopenharmony_ci
863d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
864d5ac70f0Sopenharmony_ci
865d5ac70f0Sopenharmony_cienum {
866d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_NONE = -1,
867d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_SLAVE = 0,
868d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_GLOBAL,
869d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_CARD,
870d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_PCM,
871d5ac70f0Sopenharmony_ci	SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
872d5ac70f0Sopenharmony_ci};
873d5ac70f0Sopenharmony_ci
874d5ac70f0Sopenharmony_ci/* slave timer classes */
875d5ac70f0Sopenharmony_cienum {
876d5ac70f0Sopenharmony_ci	SNDRV_TIMER_SCLASS_NONE = 0,
877d5ac70f0Sopenharmony_ci	SNDRV_TIMER_SCLASS_APPLICATION,
878d5ac70f0Sopenharmony_ci	SNDRV_TIMER_SCLASS_SEQUENCER,		/* alias */
879d5ac70f0Sopenharmony_ci	SNDRV_TIMER_SCLASS_OSS_SEQUENCER,	/* alias */
880d5ac70f0Sopenharmony_ci	SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
881d5ac70f0Sopenharmony_ci};
882d5ac70f0Sopenharmony_ci
883d5ac70f0Sopenharmony_ci/* global timers (device member) */
884d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_SYSTEM	0
885d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_RTC		1	/* unused */
886d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HPET		2
887d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HRTIMER	3
888d5ac70f0Sopenharmony_ci
889d5ac70f0Sopenharmony_ci/* info flags */
890d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
891d5ac70f0Sopenharmony_ci
892d5ac70f0Sopenharmony_cistruct snd_timer_id {
893d5ac70f0Sopenharmony_ci	int dev_class;
894d5ac70f0Sopenharmony_ci	int dev_sclass;
895d5ac70f0Sopenharmony_ci	int card;
896d5ac70f0Sopenharmony_ci	int device;
897d5ac70f0Sopenharmony_ci	int subdevice;
898d5ac70f0Sopenharmony_ci};
899d5ac70f0Sopenharmony_ci
900d5ac70f0Sopenharmony_cistruct snd_timer_ginfo {
901d5ac70f0Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
902d5ac70f0Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
903d5ac70f0Sopenharmony_ci	int card;			/* card number */
904d5ac70f0Sopenharmony_ci	unsigned char id[64];		/* timer identification */
905d5ac70f0Sopenharmony_ci	unsigned char name[80];		/* timer name */
906d5ac70f0Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
907d5ac70f0Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
908d5ac70f0Sopenharmony_ci	unsigned long resolution_min;	/* minimal period resolution in ns */
909d5ac70f0Sopenharmony_ci	unsigned long resolution_max;	/* maximal period resolution in ns */
910d5ac70f0Sopenharmony_ci	unsigned int clients;		/* active timer clients */
911d5ac70f0Sopenharmony_ci	unsigned char reserved[32];
912d5ac70f0Sopenharmony_ci};
913d5ac70f0Sopenharmony_ci
914d5ac70f0Sopenharmony_cistruct snd_timer_gparams {
915d5ac70f0Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
916d5ac70f0Sopenharmony_ci	unsigned long period_num;	/* requested precise period duration (in seconds) - numerator */
917d5ac70f0Sopenharmony_ci	unsigned long period_den;	/* requested precise period duration (in seconds) - denominator */
918d5ac70f0Sopenharmony_ci	unsigned char reserved[32];
919d5ac70f0Sopenharmony_ci};
920d5ac70f0Sopenharmony_ci
921d5ac70f0Sopenharmony_cistruct snd_timer_gstatus {
922d5ac70f0Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
923d5ac70f0Sopenharmony_ci	unsigned long resolution;	/* current period resolution in ns */
924d5ac70f0Sopenharmony_ci	unsigned long resolution_num;	/* precise current period resolution (in seconds) - numerator */
925d5ac70f0Sopenharmony_ci	unsigned long resolution_den;	/* precise current period resolution (in seconds) - denominator */
926d5ac70f0Sopenharmony_ci	unsigned char reserved[32];
927d5ac70f0Sopenharmony_ci};
928d5ac70f0Sopenharmony_ci
929d5ac70f0Sopenharmony_cistruct snd_timer_select {
930d5ac70f0Sopenharmony_ci	struct snd_timer_id id;	/* bind to timer ID */
931d5ac70f0Sopenharmony_ci	unsigned char reserved[32];	/* reserved */
932d5ac70f0Sopenharmony_ci};
933d5ac70f0Sopenharmony_ci
934d5ac70f0Sopenharmony_cistruct snd_timer_info {
935d5ac70f0Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
936d5ac70f0Sopenharmony_ci	int card;			/* card number */
937d5ac70f0Sopenharmony_ci	unsigned char id[64];		/* timer identificator */
938d5ac70f0Sopenharmony_ci	unsigned char name[80];		/* timer name */
939d5ac70f0Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
940d5ac70f0Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
941d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
942d5ac70f0Sopenharmony_ci};
943d5ac70f0Sopenharmony_ci
944d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_PSFLG_AUTO		(1<<0)	/* auto start, otherwise one-shot */
945d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EXCLUSIVE	(1<<1)	/* exclusive use, precise start/stop/pause/continue */
946d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EARLY_EVENT	(1<<2)	/* write early event to the poll queue */
947d5ac70f0Sopenharmony_ci
948d5ac70f0Sopenharmony_cistruct snd_timer_params {
949d5ac70f0Sopenharmony_ci	unsigned int flags;		/* flags - SNDRV_TIMER_PSFLG_* */
950d5ac70f0Sopenharmony_ci	unsigned int ticks;		/* requested resolution in ticks */
951d5ac70f0Sopenharmony_ci	unsigned int queue_size;	/* total size of queue (32-1024) */
952d5ac70f0Sopenharmony_ci	unsigned int reserved0;		/* reserved, was: failure locations */
953d5ac70f0Sopenharmony_ci	unsigned int filter;		/* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
954d5ac70f0Sopenharmony_ci	unsigned char reserved[60];	/* reserved */
955d5ac70f0Sopenharmony_ci};
956d5ac70f0Sopenharmony_ci
957d5ac70f0Sopenharmony_cistruct snd_timer_status {
958d5ac70f0Sopenharmony_ci	struct timespec tstamp;		/* Timestamp - last update */
959d5ac70f0Sopenharmony_ci	unsigned int resolution;	/* current period resolution in ns */
960d5ac70f0Sopenharmony_ci	unsigned int lost;		/* counter of master tick lost */
961d5ac70f0Sopenharmony_ci	unsigned int overrun;		/* count of read queue overruns */
962d5ac70f0Sopenharmony_ci	unsigned int queue;		/* used queue size */
963d5ac70f0Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
964d5ac70f0Sopenharmony_ci};
965d5ac70f0Sopenharmony_ci
966d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
967d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
968d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD_OLD	_IOW('T', 0x02, int)
969d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GINFO		_IOWR('T', 0x03, struct snd_timer_ginfo)
970d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GPARAMS	_IOW('T', 0x04, struct snd_timer_gparams)
971d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GSTATUS	_IOWR('T', 0x05, struct snd_timer_gstatus)
972d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_SELECT	_IOW('T', 0x10, struct snd_timer_select)
973d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_INFO		_IOR('T', 0x11, struct snd_timer_info)
974d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PARAMS	_IOW('T', 0x12, struct snd_timer_params)
975d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STATUS	_IOR('T', 0x14, struct snd_timer_status)
976d5ac70f0Sopenharmony_ci/* The following four ioctls are changed since 1.0.9 due to confliction */
977d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_START		_IO('T', 0xa0)
978d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STOP		_IO('T', 0xa1)
979d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
980d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
981d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
982d5ac70f0Sopenharmony_ci
983d5ac70f0Sopenharmony_ci#if __BITS_PER_LONG == 64
984d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
985d5ac70f0Sopenharmony_ci#else
986d5ac70f0Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
987d5ac70f0Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD_OLD : \
988d5ac70f0Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD64)
989d5ac70f0Sopenharmony_ci#endif
990d5ac70f0Sopenharmony_ci
991d5ac70f0Sopenharmony_cistruct snd_timer_read {
992d5ac70f0Sopenharmony_ci	unsigned int resolution;
993d5ac70f0Sopenharmony_ci	unsigned int ticks;
994d5ac70f0Sopenharmony_ci};
995d5ac70f0Sopenharmony_ci
996d5ac70f0Sopenharmony_cienum {
997d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_RESOLUTION = 0,	/* val = resolution in ns */
998d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_TICK,			/* val = ticks */
999d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_START,		/* val = resolution in ns */
1000d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_STOP,			/* val = 0 */
1001d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_CONTINUE,		/* val = resolution in ns */
1002d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_PAUSE,		/* val = 0 */
1003d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_EARLY,		/* val = 0, early event */
1004d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_SUSPEND,		/* val = 0 */
1005d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_RESUME,		/* val = resolution in ns */
1006d5ac70f0Sopenharmony_ci	/* master timer events for slave timer instances */
1007d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
1008d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
1009d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
1010d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
1011d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
1012d5ac70f0Sopenharmony_ci	SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
1013d5ac70f0Sopenharmony_ci};
1014d5ac70f0Sopenharmony_ci
1015d5ac70f0Sopenharmony_cistruct snd_timer_tread {
1016d5ac70f0Sopenharmony_ci	int event;
1017d5ac70f0Sopenharmony_ci	__time_pad pad1;
1018d5ac70f0Sopenharmony_ci	struct timespec tstamp;
1019d5ac70f0Sopenharmony_ci	unsigned int val;
1020d5ac70f0Sopenharmony_ci	__time_pad pad2;
1021d5ac70f0Sopenharmony_ci};
1022d5ac70f0Sopenharmony_ci
1023d5ac70f0Sopenharmony_ci/****************************************************************************
1024d5ac70f0Sopenharmony_ci *                                                                          *
1025d5ac70f0Sopenharmony_ci *        Section for driver control interface - /dev/snd/control?          *
1026d5ac70f0Sopenharmony_ci *                                                                          *
1027d5ac70f0Sopenharmony_ci ****************************************************************************/
1028d5ac70f0Sopenharmony_ci
1029d5ac70f0Sopenharmony_ci#define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 9)
1030d5ac70f0Sopenharmony_ci
1031d5ac70f0Sopenharmony_cistruct snd_ctl_card_info {
1032d5ac70f0Sopenharmony_ci	int card;			/* card number */
1033d5ac70f0Sopenharmony_ci	int pad;			/* reserved for future (was type) */
1034d5ac70f0Sopenharmony_ci	unsigned char id[16];		/* ID of card (user selectable) */
1035d5ac70f0Sopenharmony_ci	unsigned char driver[16];	/* Driver name */
1036d5ac70f0Sopenharmony_ci	unsigned char name[32];		/* Short name of soundcard */
1037d5ac70f0Sopenharmony_ci	unsigned char longname[80];	/* name + info text about soundcard */
1038d5ac70f0Sopenharmony_ci	unsigned char reserved_[16];	/* reserved for future (was ID of mixer) */
1039d5ac70f0Sopenharmony_ci	unsigned char mixername[80];	/* visual mixer identification */
1040d5ac70f0Sopenharmony_ci	unsigned char components[128];	/* card components / fine identification, delimited with one space (AC97 etc..) */
1041d5ac70f0Sopenharmony_ci};
1042d5ac70f0Sopenharmony_ci
1043d5ac70f0Sopenharmony_citypedef int __bitwise snd_ctl_elem_type_t;
1044d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_NONE	((snd_ctl_elem_type_t) 0) /* invalid */
1045d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BOOLEAN	((snd_ctl_elem_type_t) 1) /* boolean type */
1046d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER	((snd_ctl_elem_type_t) 2) /* integer type */
1047d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_ENUMERATED	((snd_ctl_elem_type_t) 3) /* enumerated type */
1048d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BYTES	((snd_ctl_elem_type_t) 4) /* byte array */
1049d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_IEC958	((snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
1050d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER64	((snd_ctl_elem_type_t) 6) /* 64-bit integer type */
1051d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_LAST	SNDRV_CTL_ELEM_TYPE_INTEGER64
1052d5ac70f0Sopenharmony_ci
1053d5ac70f0Sopenharmony_citypedef int __bitwise snd_ctl_elem_iface_t;
1054d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_CARD	((snd_ctl_elem_iface_t) 0) /* global control */
1055d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_HWDEP	((snd_ctl_elem_iface_t) 1) /* hardware dependent device */
1056d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_MIXER	((snd_ctl_elem_iface_t) 2) /* virtual mixer device */
1057d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_PCM	((snd_ctl_elem_iface_t) 3) /* PCM device */
1058d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_RAWMIDI	((snd_ctl_elem_iface_t) 4) /* RawMidi device */
1059d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_TIMER	((snd_ctl_elem_iface_t) 5) /* timer device */
1060d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_SEQUENCER	((snd_ctl_elem_iface_t) 6) /* sequencer client */
1061d5ac70f0Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_LAST	SNDRV_CTL_ELEM_IFACE_SEQUENCER
1062d5ac70f0Sopenharmony_ci
1063d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READ		(1<<0)
1064d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_WRITE		(1<<1)
1065d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READWRITE		(SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
1066d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_VOLATILE		(1<<2)	/* control value may be changed without a notification */
1067d5ac70f0Sopenharmony_ci// (1 << 3) is unused.
1068d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READ		(1<<4)	/* TLV read is possible */
1069d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE		(1<<5)	/* TLV write is possible */
1070d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE	(SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
1071d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND	(1<<6)	/* TLV command is possible */
1072d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */
1073d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */
1074d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */
1075d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */
1076d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_USER		(1<<29) /* user space element */
1077d5ac70f0Sopenharmony_ci/* bits 30 and 31 are obsoleted (for indirect access) */
1078d5ac70f0Sopenharmony_ci
1079d5ac70f0Sopenharmony_ci/* for further details see the ACPI and PCI power management specification */
1080d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D0		0x0000	/* full On */
1081d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D1		0x0100	/* partial On */
1082d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D2		0x0200	/* partial On */
1083d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D3		0x0300	/* Off */
1084d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D3hot		(SNDRV_CTL_POWER_D3|0x0000)	/* Off, with power */
1085d5ac70f0Sopenharmony_ci#define SNDRV_CTL_POWER_D3cold		(SNDRV_CTL_POWER_D3|0x0001)	/* Off, without power */
1086d5ac70f0Sopenharmony_ci
1087d5ac70f0Sopenharmony_ci#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN	44
1088d5ac70f0Sopenharmony_ci
1089d5ac70f0Sopenharmony_cistruct snd_ctl_elem_id {
1090d5ac70f0Sopenharmony_ci	unsigned int numid;		/* numeric identifier, zero = invalid */
1091d5ac70f0Sopenharmony_ci	snd_ctl_elem_iface_t iface;	/* interface identifier */
1092d5ac70f0Sopenharmony_ci	unsigned int device;		/* device/client number */
1093d5ac70f0Sopenharmony_ci	unsigned int subdevice;		/* subdevice (substream) number */
1094d5ac70f0Sopenharmony_ci	unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];		/* ASCII name of item */
1095d5ac70f0Sopenharmony_ci	unsigned int index;		/* index of item */
1096d5ac70f0Sopenharmony_ci};
1097d5ac70f0Sopenharmony_ci
1098d5ac70f0Sopenharmony_cistruct snd_ctl_elem_list {
1099d5ac70f0Sopenharmony_ci	unsigned int offset;		/* W: first element ID to get */
1100d5ac70f0Sopenharmony_ci	unsigned int space;		/* W: count of element IDs to get */
1101d5ac70f0Sopenharmony_ci	unsigned int used;		/* R: count of element IDs set */
1102d5ac70f0Sopenharmony_ci	unsigned int count;		/* R: count of all elements */
1103d5ac70f0Sopenharmony_ci	struct snd_ctl_elem_id *pids; /* R: IDs */
1104d5ac70f0Sopenharmony_ci	unsigned char reserved[50];
1105d5ac70f0Sopenharmony_ci};
1106d5ac70f0Sopenharmony_ci
1107d5ac70f0Sopenharmony_cistruct snd_ctl_elem_info {
1108d5ac70f0Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
1109d5ac70f0Sopenharmony_ci	snd_ctl_elem_type_t type;	/* R: value type - SNDRV_CTL_ELEM_TYPE_* */
1110d5ac70f0Sopenharmony_ci	unsigned int access;		/* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
1111d5ac70f0Sopenharmony_ci	unsigned int count;		/* count of values */
1112d5ac70f0Sopenharmony_ci	__kernel_pid_t owner;		/* owner's PID of this control */
1113d5ac70f0Sopenharmony_ci	union {
1114d5ac70f0Sopenharmony_ci		struct {
1115d5ac70f0Sopenharmony_ci			long min;		/* R: minimum value */
1116d5ac70f0Sopenharmony_ci			long max;		/* R: maximum value */
1117d5ac70f0Sopenharmony_ci			long step;		/* R: step (0 variable) */
1118d5ac70f0Sopenharmony_ci		} integer;
1119d5ac70f0Sopenharmony_ci		struct {
1120d5ac70f0Sopenharmony_ci			long long min;		/* R: minimum value */
1121d5ac70f0Sopenharmony_ci			long long max;		/* R: maximum value */
1122d5ac70f0Sopenharmony_ci			long long step;		/* R: step (0 variable) */
1123d5ac70f0Sopenharmony_ci		} integer64;
1124d5ac70f0Sopenharmony_ci		struct {
1125d5ac70f0Sopenharmony_ci			unsigned int items;	/* R: number of items */
1126d5ac70f0Sopenharmony_ci			unsigned int item;	/* W: item number */
1127d5ac70f0Sopenharmony_ci			char name[64];		/* R: value name */
1128d5ac70f0Sopenharmony_ci			__u64 names_ptr;	/* W: names list (ELEM_ADD only) */
1129d5ac70f0Sopenharmony_ci			unsigned int names_length;
1130d5ac70f0Sopenharmony_ci		} enumerated;
1131d5ac70f0Sopenharmony_ci		unsigned char reserved[128];
1132d5ac70f0Sopenharmony_ci	} value;
1133d5ac70f0Sopenharmony_ci	unsigned char reserved[64];
1134d5ac70f0Sopenharmony_ci};
1135d5ac70f0Sopenharmony_ci
1136d5ac70f0Sopenharmony_cistruct snd_ctl_elem_value {
1137d5ac70f0Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
1138d5ac70f0Sopenharmony_ci	unsigned int indirect: 1;	/* W: indirect access - obsoleted */
1139d5ac70f0Sopenharmony_ci	union {
1140d5ac70f0Sopenharmony_ci		union {
1141d5ac70f0Sopenharmony_ci			long value[128];
1142d5ac70f0Sopenharmony_ci			long *value_ptr;	/* obsoleted */
1143d5ac70f0Sopenharmony_ci		} integer;
1144d5ac70f0Sopenharmony_ci		union {
1145d5ac70f0Sopenharmony_ci			long long value[64];
1146d5ac70f0Sopenharmony_ci			long long *value_ptr;	/* obsoleted */
1147d5ac70f0Sopenharmony_ci		} integer64;
1148d5ac70f0Sopenharmony_ci		union {
1149d5ac70f0Sopenharmony_ci			unsigned int item[128];
1150d5ac70f0Sopenharmony_ci			unsigned int *item_ptr;	/* obsoleted */
1151d5ac70f0Sopenharmony_ci		} enumerated;
1152d5ac70f0Sopenharmony_ci		union {
1153d5ac70f0Sopenharmony_ci			unsigned char data[512];
1154d5ac70f0Sopenharmony_ci			unsigned char *data_ptr;	/* obsoleted */
1155d5ac70f0Sopenharmony_ci		} bytes;
1156d5ac70f0Sopenharmony_ci		struct snd_aes_iec958 iec958;
1157d5ac70f0Sopenharmony_ci	} value;		/* RO */
1158d5ac70f0Sopenharmony_ci	unsigned char reserved[128];
1159d5ac70f0Sopenharmony_ci};
1160d5ac70f0Sopenharmony_ci
1161d5ac70f0Sopenharmony_cistruct snd_ctl_tlv {
1162d5ac70f0Sopenharmony_ci	unsigned int numid;	/* control element numeric identification */
1163d5ac70f0Sopenharmony_ci	unsigned int length;	/* in bytes aligned to 4 */
1164d5ac70f0Sopenharmony_ci	unsigned int tlv[0];	/* first TLV */
1165d5ac70f0Sopenharmony_ci};
1166d5ac70f0Sopenharmony_ci
1167d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_PVERSION	_IOR('U', 0x00, int)
1168d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_CARD_INFO	_IOR('U', 0x01, struct snd_ctl_card_info)
1169d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LIST	_IOWR('U', 0x10, struct snd_ctl_elem_list)
1170d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_INFO	_IOWR('U', 0x11, struct snd_ctl_elem_info)
1171d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_READ	_IOWR('U', 0x12, struct snd_ctl_elem_value)
1172d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_WRITE	_IOWR('U', 0x13, struct snd_ctl_elem_value)
1173d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LOCK	_IOW('U', 0x14, struct snd_ctl_elem_id)
1174d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_UNLOCK	_IOW('U', 0x15, struct snd_ctl_elem_id)
1175d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
1176d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_ADD	_IOWR('U', 0x17, struct snd_ctl_elem_info)
1177d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REPLACE	_IOWR('U', 0x18, struct snd_ctl_elem_info)
1178d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REMOVE	_IOWR('U', 0x19, struct snd_ctl_elem_id)
1179d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_READ	_IOWR('U', 0x1a, struct snd_ctl_tlv)
1180d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_WRITE	_IOWR('U', 0x1b, struct snd_ctl_tlv)
1181d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_COMMAND	_IOWR('U', 0x1c, struct snd_ctl_tlv)
1182d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
1183d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_INFO	_IOR('U', 0x21, struct snd_hwdep_info)
1184d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE	_IOR('U', 0x30, int)
1185d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_INFO	_IOWR('U', 0x31, struct snd_pcm_info)
1186d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
1187d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
1188d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_INFO	_IOWR('U', 0x41, struct snd_rawmidi_info)
1189d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
1190d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE	_IOWR('U', 0x43, int)
1191d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
1192d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO	_IOWR('U', 0x45, struct snd_ump_block_info)
1193d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER		_IOWR('U', 0xd0, int)
1194d5ac70f0Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER_STATE	_IOR('U', 0xd1, int)
1195d5ac70f0Sopenharmony_ci
1196d5ac70f0Sopenharmony_ci/*
1197d5ac70f0Sopenharmony_ci *  Read interface.
1198d5ac70f0Sopenharmony_ci */
1199d5ac70f0Sopenharmony_ci
1200d5ac70f0Sopenharmony_cienum sndrv_ctl_event_type {
1201d5ac70f0Sopenharmony_ci	SNDRV_CTL_EVENT_ELEM = 0,
1202d5ac70f0Sopenharmony_ci	SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
1203d5ac70f0Sopenharmony_ci};
1204d5ac70f0Sopenharmony_ci
1205d5ac70f0Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_VALUE	(1<<0)	/* element value was changed */
1206d5ac70f0Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_INFO	(1<<1)	/* element info was changed */
1207d5ac70f0Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_ADD	(1<<2)	/* element was added */
1208d5ac70f0Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_TLV	(1<<3)	/* element TLV tree was changed */
1209d5ac70f0Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_REMOVE	(~0U)	/* element was removed */
1210d5ac70f0Sopenharmony_ci
1211d5ac70f0Sopenharmony_cistruct snd_ctl_event {
1212d5ac70f0Sopenharmony_ci	int type;	/* event type - SNDRV_CTL_EVENT_* */
1213d5ac70f0Sopenharmony_ci	union {
1214d5ac70f0Sopenharmony_ci		struct {
1215d5ac70f0Sopenharmony_ci			unsigned int mask;
1216d5ac70f0Sopenharmony_ci			struct snd_ctl_elem_id id;
1217d5ac70f0Sopenharmony_ci		} elem;
1218d5ac70f0Sopenharmony_ci		unsigned char data8[60];
1219d5ac70f0Sopenharmony_ci	} data;
1220d5ac70f0Sopenharmony_ci};
1221d5ac70f0Sopenharmony_ci
1222d5ac70f0Sopenharmony_ci/*
1223d5ac70f0Sopenharmony_ci *  Control names
1224d5ac70f0Sopenharmony_ci */
1225d5ac70f0Sopenharmony_ci
1226d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_NONE				""
1227d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_PLAYBACK				"Playback "
1228d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_CAPTURE				"Capture "
1229d5ac70f0Sopenharmony_ci
1230d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_NONE			""
1231d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_SWITCH			"Switch"
1232d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_VOLUME			"Volume"
1233d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_DEFAULT			"Default"
1234d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_MASK			"Mask"
1235d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_CON_MASK			"Con Mask"
1236d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PRO_MASK			"Pro Mask"
1237d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PCM_STREAM		"PCM Stream"
1238d5ac70f0Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958(expl,direction,what)	"IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
1239d5ac70f0Sopenharmony_ci
1240d5ac70f0Sopenharmony_ci#endif /* __SOUND_ASOUND_H */
1241