18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Advanced Linux Sound Architecture - ALSA - Driver
48c2ecf20Sopenharmony_ci *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
58c2ecf20Sopenharmony_ci *                             Abramo Bagnara <abramo@alsa-project.org>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify
98c2ecf20Sopenharmony_ci *   it under the terms of the GNU General Public License as published by
108c2ecf20Sopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
118c2ecf20Sopenharmony_ci *   (at your option) any later version.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
148c2ecf20Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
158c2ecf20Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
168c2ecf20Sopenharmony_ci *   GNU General Public License for more details.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *   You should have received a copy of the GNU General Public License
198c2ecf20Sopenharmony_ci *   along with this program; if not, write to the Free Software
208c2ecf20Sopenharmony_ci *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifndef _UAPI__SOUND_ASOUND_H
258c2ecf20Sopenharmony_ci#define _UAPI__SOUND_ASOUND_H
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#if defined(__KERNEL__) || defined(__linux__)
288c2ecf20Sopenharmony_ci#include <linux/types.h>
298c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_ci#include <endian.h>
328c2ecf20Sopenharmony_ci#include <sys/ioctl.h>
338c2ecf20Sopenharmony_ci#endif
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef __KERNEL__
368c2ecf20Sopenharmony_ci#include <stdlib.h>
378c2ecf20Sopenharmony_ci#include <time.h>
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/*
418c2ecf20Sopenharmony_ci *  protocol version
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
458c2ecf20Sopenharmony_ci#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
468c2ecf20Sopenharmony_ci#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
478c2ecf20Sopenharmony_ci#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
488c2ecf20Sopenharmony_ci#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
498c2ecf20Sopenharmony_ci	(SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
508c2ecf20Sopenharmony_ci	 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
518c2ecf20Sopenharmony_ci	   SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/****************************************************************************
548c2ecf20Sopenharmony_ci *                                                                          *
558c2ecf20Sopenharmony_ci *        Digital audio interface					    *
568c2ecf20Sopenharmony_ci *                                                                          *
578c2ecf20Sopenharmony_ci ****************************************************************************/
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cistruct snd_aes_iec958 {
608c2ecf20Sopenharmony_ci	unsigned char status[24];	/* AES/IEC958 channel status bits */
618c2ecf20Sopenharmony_ci	unsigned char subcode[147];	/* AES/IEC958 subcode bits */
628c2ecf20Sopenharmony_ci	unsigned char pad;		/* nothing */
638c2ecf20Sopenharmony_ci	unsigned char dig_subframe[4];	/* AES/IEC958 subframe bits */
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/****************************************************************************
678c2ecf20Sopenharmony_ci *                                                                          *
688c2ecf20Sopenharmony_ci *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort		    *
698c2ecf20Sopenharmony_ci *                                                                          *
708c2ecf20Sopenharmony_ci ****************************************************************************/
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistruct snd_cea_861_aud_if {
738c2ecf20Sopenharmony_ci	unsigned char db1_ct_cc; /* coding type and channel count */
748c2ecf20Sopenharmony_ci	unsigned char db2_sf_ss; /* sample frequency and size */
758c2ecf20Sopenharmony_ci	unsigned char db3; /* not used, all zeros */
768c2ecf20Sopenharmony_ci	unsigned char db4_ca; /* channel allocation code */
778c2ecf20Sopenharmony_ci	unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/****************************************************************************
818c2ecf20Sopenharmony_ci *                                                                          *
828c2ecf20Sopenharmony_ci *      Section for driver hardware dependent interface - /dev/snd/hw?      *
838c2ecf20Sopenharmony_ci *                                                                          *
848c2ecf20Sopenharmony_ci ****************************************************************************/
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define SNDRV_HWDEP_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cienum {
898c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL2 = 0,
908c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL3,
918c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL4,
928c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB16CSP,	/* Creative Signal Processor */
938c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMU10K1,	/* FX8010 processor in EMU10K1 chip */
948c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_YSS225,	/* Yamaha FX processor */
958c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_ICS2115,	/* Wavetable synth */
968c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_SSCAPE,	/* Ensoniq SoundScape ISA card (MC68EC000) */
978c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */
988c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */
998c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y,	/* Tascam US122, US224 & US428 usb */
1008c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
1018c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_BLUETOOTH,	/* Bluetooth audio */
1028c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y_PCM,	/* Tascam US122, US224 & US428 rawusb pcm */
1038c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_PCXHR,	/* Digigram PCXHR */
1048c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB_RC,	/* SB Extigy/Audigy2NX remote control */
1058c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_HDA,		/* HD-audio */
1068c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_USB_STREAM,	/* direct access to usb stream */
1078c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DICE,	/* TC DICE FireWire device */
1088c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREWORKS,	/* Echo Audio Fireworks based device */
1098c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_BEBOB,	/* BridgeCo BeBoB based device */
1108c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_OXFW,	/* Oxford OXFW970/971 based device */
1118c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DIGI00X,	/* Digidesign Digi 002/003 family */
1128c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_TASCAM,	/* TASCAM FireWire series */
1138c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_LINE6,	/* Line6 USB processors */
1148c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_MOTU,	/* MOTU FireWire series */
1158c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREFACE,	/* RME Fireface series */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	/* Don't forget to change the following: */
1188c2ecf20Sopenharmony_ci	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
1198c2ecf20Sopenharmony_ci};
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_cistruct snd_hwdep_info {
1228c2ecf20Sopenharmony_ci	unsigned int device;		/* WR: device number */
1238c2ecf20Sopenharmony_ci	int card;			/* R: card number */
1248c2ecf20Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
1258c2ecf20Sopenharmony_ci	unsigned char name[80];		/* hwdep name */
1268c2ecf20Sopenharmony_ci	int iface;			/* hwdep interface */
1278c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/* generic DSP loader */
1318c2ecf20Sopenharmony_cistruct snd_hwdep_dsp_status {
1328c2ecf20Sopenharmony_ci	unsigned int version;		/* R: driver-specific version */
1338c2ecf20Sopenharmony_ci	unsigned char id[32];		/* R: driver-specific ID string */
1348c2ecf20Sopenharmony_ci	unsigned int num_dsps;		/* R: number of DSP images to transfer */
1358c2ecf20Sopenharmony_ci	unsigned int dsp_loaded;	/* R: bit flags indicating the loaded DSPs */
1368c2ecf20Sopenharmony_ci	unsigned int chip_ready;	/* R: 1 = initialization finished */
1378c2ecf20Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistruct snd_hwdep_dsp_image {
1418c2ecf20Sopenharmony_ci	unsigned int index;		/* W: DSP index */
1428c2ecf20Sopenharmony_ci	unsigned char name[64];		/* W: ID (e.g. file name) */
1438c2ecf20Sopenharmony_ci	unsigned char __user *image;	/* W: binary image */
1448c2ecf20Sopenharmony_ci	size_t length;			/* W: size of image in bytes */
1458c2ecf20Sopenharmony_ci	unsigned long driver_data;	/* W: driver-specific data */
1468c2ecf20Sopenharmony_ci};
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_PVERSION	_IOR ('H', 0x00, int)
1498c2ecf20Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_INFO		_IOR ('H', 0x01, struct snd_hwdep_info)
1508c2ecf20Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_STATUS	_IOR('H', 0x02, struct snd_hwdep_dsp_status)
1518c2ecf20Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_LOAD	_IOW('H', 0x03, struct snd_hwdep_dsp_image)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/*****************************************************************************
1548c2ecf20Sopenharmony_ci *                                                                           *
1558c2ecf20Sopenharmony_ci *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
1568c2ecf20Sopenharmony_ci *                                                                           *
1578c2ecf20Sopenharmony_ci *****************************************************************************/
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 15)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_citypedef unsigned long snd_pcm_uframes_t;
1628c2ecf20Sopenharmony_citypedef signed long snd_pcm_sframes_t;
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_cienum {
1658c2ecf20Sopenharmony_ci	SNDRV_PCM_CLASS_GENERIC = 0,	/* standard mono or stereo device */
1668c2ecf20Sopenharmony_ci	SNDRV_PCM_CLASS_MULTI,		/* multichannel device */
1678c2ecf20Sopenharmony_ci	SNDRV_PCM_CLASS_MODEM,		/* software modem class */
1688c2ecf20Sopenharmony_ci	SNDRV_PCM_CLASS_DIGITIZER,	/* digitizer class */
1698c2ecf20Sopenharmony_ci	/* Don't forget to change the following: */
1708c2ecf20Sopenharmony_ci	SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
1718c2ecf20Sopenharmony_ci};
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_cienum {
1748c2ecf20Sopenharmony_ci	SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
1758c2ecf20Sopenharmony_ci	SNDRV_PCM_SUBCLASS_MULTI_MIX,	/* multichannel subdevices are mixed together */
1768c2ecf20Sopenharmony_ci	/* Don't forget to change the following: */
1778c2ecf20Sopenharmony_ci	SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
1788c2ecf20Sopenharmony_ci};
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_cienum {
1818c2ecf20Sopenharmony_ci	SNDRV_PCM_STREAM_PLAYBACK = 0,
1828c2ecf20Sopenharmony_ci	SNDRV_PCM_STREAM_CAPTURE,
1838c2ecf20Sopenharmony_ci	SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
1848c2ecf20Sopenharmony_ci};
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_citypedef int __bitwise snd_pcm_access_t;
1878c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_INTERLEAVED	((__force snd_pcm_access_t) 0) /* interleaved mmap */
1888c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED	((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
1898c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_COMPLEX		((__force snd_pcm_access_t) 2) /* complex mmap */
1908c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_INTERLEAVED		((__force snd_pcm_access_t) 3) /* readi/writei */
1918c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_NONINTERLEAVED	((__force snd_pcm_access_t) 4) /* readn/writen */
1928c2ecf20Sopenharmony_ci#define	SNDRV_PCM_ACCESS_LAST		SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_citypedef int __bitwise snd_pcm_format_t;
1958c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S8	((__force snd_pcm_format_t) 0)
1968c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U8	((__force snd_pcm_format_t) 1)
1978c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_LE	((__force snd_pcm_format_t) 2)
1988c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_BE	((__force snd_pcm_format_t) 3)
1998c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_LE	((__force snd_pcm_format_t) 4)
2008c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_BE	((__force snd_pcm_format_t) 5)
2018c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_LE	((__force snd_pcm_format_t) 6) /* low three bytes */
2028c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_BE	((__force snd_pcm_format_t) 7) /* low three bytes */
2038c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_LE	((__force snd_pcm_format_t) 8) /* low three bytes */
2048c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_BE	((__force snd_pcm_format_t) 9) /* low three bytes */
2058c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_LE	((__force snd_pcm_format_t) 10)
2068c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_BE	((__force snd_pcm_format_t) 11)
2078c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_LE	((__force snd_pcm_format_t) 12)
2088c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_BE	((__force snd_pcm_format_t) 13)
2098c2ecf20Sopenharmony_ci#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 */
2108c2ecf20Sopenharmony_ci#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 */
2118c2ecf20Sopenharmony_ci#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 */
2128c2ecf20Sopenharmony_ci#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 */
2138c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
2148c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
2158c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MU_LAW		((__force snd_pcm_format_t) 20)
2168c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_A_LAW		((__force snd_pcm_format_t) 21)
2178c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IMA_ADPCM	((__force snd_pcm_format_t) 22)
2188c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MPEG		((__force snd_pcm_format_t) 23)
2198c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_GSM		((__force snd_pcm_format_t) 24)
2208c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_LE	((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
2218c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_BE	((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
2228c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_LE	((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
2238c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_BE	((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
2248c2ecf20Sopenharmony_ci/* gap in the numbering for a future standard linear format */
2258c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_SPECIAL	((__force snd_pcm_format_t) 31)
2268c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3LE	((__force snd_pcm_format_t) 32)	/* in three bytes */
2278c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3BE	((__force snd_pcm_format_t) 33)	/* in three bytes */
2288c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3LE	((__force snd_pcm_format_t) 34)	/* in three bytes */
2298c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3BE	((__force snd_pcm_format_t) 35)	/* in three bytes */
2308c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3LE	((__force snd_pcm_format_t) 36)	/* in three bytes */
2318c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3BE	((__force snd_pcm_format_t) 37)	/* in three bytes */
2328c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3LE	((__force snd_pcm_format_t) 38)	/* in three bytes */
2338c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3BE	((__force snd_pcm_format_t) 39)	/* in three bytes */
2348c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3LE	((__force snd_pcm_format_t) 40)	/* in three bytes */
2358c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3BE	((__force snd_pcm_format_t) 41)	/* in three bytes */
2368c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3LE	((__force snd_pcm_format_t) 42)	/* in three bytes */
2378c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3BE	((__force snd_pcm_format_t) 43)	/* in three bytes */
2388c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24	((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
2398c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24_1B	((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
2408c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40	((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
2418c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40_1B	((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
2428c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U8		((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
2438c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_LE	((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
2448c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_LE	((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
2458c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_BE	((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
2468c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_BE	((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
2478c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_DSD_U32_BE
2488c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FIRST		SNDRV_PCM_FORMAT_S8
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci#ifdef SNDRV_LITTLE_ENDIAN
2518c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_LE
2528c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_LE
2538c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_LE
2548c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_LE
2558c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_LE
2568c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_LE
2578c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_LE
2588c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_LE
2598c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
2608c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_LE
2618c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_LE
2628c2ecf20Sopenharmony_ci#endif
2638c2ecf20Sopenharmony_ci#ifdef SNDRV_BIG_ENDIAN
2648c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_BE
2658c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_BE
2668c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_BE
2678c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_BE
2688c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_BE
2698c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_BE
2708c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_BE
2718c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_BE
2728c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
2738c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_BE
2748c2ecf20Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_BE
2758c2ecf20Sopenharmony_ci#endif
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_citypedef int __bitwise snd_pcm_subformat_t;
2788c2ecf20Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_STD		((__force snd_pcm_subformat_t) 0)
2798c2ecf20Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_LAST	SNDRV_PCM_SUBFORMAT_STD
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP		0x00000001	/* hardware supports mmap */
2828c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP_VALID	0x00000002	/* period data are valid during transfer */
2838c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_DOUBLE		0x00000004	/* Double buffering needed for PCM start/stop */
2848c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_BATCH		0x00000010	/* double buffering */
2858c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_APPLPTR	0x00000020	/* need the explicit sync of appl_ptr update */
2868c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_INTERLEAVED	0x00000100	/* channels are interleaved */
2878c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_NONINTERLEAVED	0x00000200	/* channels are not interleaved */
2888c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_COMPLEX		0x00000400	/* complex frame organization (mmap only) */
2898c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_BLOCK_TRANSFER	0x00010000	/* hardware transfer block of samples */
2908c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_OVERRANGE	0x00020000	/* hardware supports ADC (capture) overrange detection */
2918c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_RESUME		0x00040000	/* hardware supports stream resume after suspend */
2928c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_PAUSE		0x00080000	/* pause ioctl is supported */
2938c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HALF_DUPLEX	0x00100000	/* only half duplex */
2948c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_JOINT_DUPLEX	0x00200000	/* playback and capture stream are somewhat correlated */
2958c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_START	0x00400000	/* pcm support some kind of sync go */
2968c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP	0x00800000	/* period wakeup can be disabled */
2978c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* (Deprecated)has audio wall clock for audio/system time sync */
2988c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ATIME              0x01000000  /* report hardware link audio time, reset on startup */
2998c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME     0x02000000  /* report absolute hardware link audio time, not reset on startup */
3008c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME    0x04000000  /* report estimated link audio time */
3018c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_DRAIN_TRIGGER	0x40000000		/* internal kernel flag - trigger in drain */
3048c2ecf20Sopenharmony_ci#define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
3078c2ecf20Sopenharmony_ci#define __SND_STRUCT_TIME64
3088c2ecf20Sopenharmony_ci#endif
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_citypedef int __bitwise snd_pcm_state_t;
3118c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_OPEN		((__force snd_pcm_state_t) 0) /* stream is open */
3128c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_SETUP		((__force snd_pcm_state_t) 1) /* stream has a setup */
3138c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_PREPARED	((__force snd_pcm_state_t) 2) /* stream is ready to start */
3148c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_RUNNING		((__force snd_pcm_state_t) 3) /* stream is running */
3158c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_XRUN		((__force snd_pcm_state_t) 4) /* stream reached an xrun */
3168c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_DRAINING	((__force snd_pcm_state_t) 5) /* stream is draining */
3178c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_PAUSED		((__force snd_pcm_state_t) 6) /* stream is paused */
3188c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_SUSPENDED	((__force snd_pcm_state_t) 7) /* hardware is suspended */
3198c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_DISCONNECTED	((__force snd_pcm_state_t) 8) /* hardware is disconnected */
3208c2ecf20Sopenharmony_ci#define	SNDRV_PCM_STATE_LAST		SNDRV_PCM_STATE_DISCONNECTED
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_cienum {
3238c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
3248c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
3258c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
3268c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
3278c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
3288c2ecf20Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
3298c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
3308c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
3318c2ecf20Sopenharmony_ci#else
3328c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
3338c2ecf20Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
3348c2ecf20Sopenharmony_ci#endif
3358c2ecf20Sopenharmony_ci};
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ciunion snd_pcm_sync_id {
3388c2ecf20Sopenharmony_ci	unsigned char id[16];
3398c2ecf20Sopenharmony_ci	unsigned short id16[8];
3408c2ecf20Sopenharmony_ci	unsigned int id32[4];
3418c2ecf20Sopenharmony_ci};
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistruct snd_pcm_info {
3448c2ecf20Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
3458c2ecf20Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
3468c2ecf20Sopenharmony_ci	int stream;			/* RO/WR (control): stream direction */
3478c2ecf20Sopenharmony_ci	int card;			/* R: card number */
3488c2ecf20Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
3498c2ecf20Sopenharmony_ci	unsigned char name[80];		/* name of this device */
3508c2ecf20Sopenharmony_ci	unsigned char subname[32];	/* subdevice name */
3518c2ecf20Sopenharmony_ci	int dev_class;			/* SNDRV_PCM_CLASS_* */
3528c2ecf20Sopenharmony_ci	int dev_subclass;		/* SNDRV_PCM_SUBCLASS_* */
3538c2ecf20Sopenharmony_ci	unsigned int subdevices_count;
3548c2ecf20Sopenharmony_ci	unsigned int subdevices_avail;
3558c2ecf20Sopenharmony_ci	union snd_pcm_sync_id sync;	/* hardware synchronization ID */
3568c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future... */
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_citypedef int snd_pcm_hw_param_t;
3608c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_ACCESS	0	/* Access type */
3618c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FORMAT	1	/* Format */
3628c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SUBFORMAT	2	/* Subformat */
3638c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_MASK	SNDRV_PCM_HW_PARAM_ACCESS
3648c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_MASK	SNDRV_PCM_HW_PARAM_SUBFORMAT
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SAMPLE_BITS	8	/* Bits per sample */
3678c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FRAME_BITS	9	/* Bits per frame */
3688c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_CHANNELS	10	/* Channels */
3698c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_RATE		11	/* Approx rate */
3708c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_TIME	12	/* Approx distance between
3718c2ecf20Sopenharmony_ci						 * interrupts in us
3728c2ecf20Sopenharmony_ci						 */
3738c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_SIZE	13	/* Approx frames between
3748c2ecf20Sopenharmony_ci						 * interrupts
3758c2ecf20Sopenharmony_ci						 */
3768c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_BYTES	14	/* Approx bytes between
3778c2ecf20Sopenharmony_ci						 * interrupts
3788c2ecf20Sopenharmony_ci						 */
3798c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIODS	15	/* Approx interrupts per
3808c2ecf20Sopenharmony_ci						 * buffer
3818c2ecf20Sopenharmony_ci						 */
3828c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_TIME	16	/* Approx duration of buffer
3838c2ecf20Sopenharmony_ci						 * in us
3848c2ecf20Sopenharmony_ci						 */
3858c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_SIZE	17	/* Size of buffer in frames */
3868c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_BYTES	18	/* Size of buffer in bytes */
3878c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_TICK_TIME	19	/* Approx tick duration in us */
3888c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_INTERVAL	SNDRV_PCM_HW_PARAM_SAMPLE_BITS
3898c2ecf20Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_INTERVAL	SNDRV_PCM_HW_PARAM_TICK_TIME
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NORESAMPLE	(1<<0)	/* avoid rate resampling */
3928c2ecf20Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER	(1<<1)	/* export buffer */
3938c2ecf20Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP	(1<<2)	/* disable period wakeups */
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_cistruct snd_interval {
3968c2ecf20Sopenharmony_ci	unsigned int min, max;
3978c2ecf20Sopenharmony_ci	unsigned int openmin:1,
3988c2ecf20Sopenharmony_ci		     openmax:1,
3998c2ecf20Sopenharmony_ci		     integer:1,
4008c2ecf20Sopenharmony_ci		     empty:1;
4018c2ecf20Sopenharmony_ci};
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci#define SNDRV_MASK_MAX	256
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_cistruct snd_mask {
4068c2ecf20Sopenharmony_ci	__u32 bits[(SNDRV_MASK_MAX+31)/32];
4078c2ecf20Sopenharmony_ci};
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_cistruct snd_pcm_hw_params {
4108c2ecf20Sopenharmony_ci	unsigned int flags;
4118c2ecf20Sopenharmony_ci	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
4128c2ecf20Sopenharmony_ci			       SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
4138c2ecf20Sopenharmony_ci	struct snd_mask mres[5];	/* reserved masks */
4148c2ecf20Sopenharmony_ci	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
4158c2ecf20Sopenharmony_ci				        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
4168c2ecf20Sopenharmony_ci	struct snd_interval ires[9];	/* reserved intervals */
4178c2ecf20Sopenharmony_ci	unsigned int rmask;		/* W: requested masks */
4188c2ecf20Sopenharmony_ci	unsigned int cmask;		/* R: changed masks */
4198c2ecf20Sopenharmony_ci	unsigned int info;		/* R: Info flags for returned setup */
4208c2ecf20Sopenharmony_ci	unsigned int msbits;		/* R: used most significant bits */
4218c2ecf20Sopenharmony_ci	unsigned int rate_num;		/* R: rate numerator */
4228c2ecf20Sopenharmony_ci	unsigned int rate_den;		/* R: rate denominator */
4238c2ecf20Sopenharmony_ci	snd_pcm_uframes_t fifo_size;	/* R: chip FIFO size in frames */
4248c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
4258c2ecf20Sopenharmony_ci};
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cienum {
4288c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_NONE = 0,
4298c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_ENABLE,
4308c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
4318c2ecf20Sopenharmony_ci};
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_cistruct snd_pcm_sw_params {
4348c2ecf20Sopenharmony_ci	int tstamp_mode;			/* timestamp mode */
4358c2ecf20Sopenharmony_ci	unsigned int period_step;
4368c2ecf20Sopenharmony_ci	unsigned int sleep_min;			/* min ticks to sleep */
4378c2ecf20Sopenharmony_ci	snd_pcm_uframes_t avail_min;		/* min avail frames for wakeup */
4388c2ecf20Sopenharmony_ci	snd_pcm_uframes_t xfer_align;		/* obsolete: xfer size need to be a multiple */
4398c2ecf20Sopenharmony_ci	snd_pcm_uframes_t start_threshold;	/* min hw_avail frames for automatic start */
4408c2ecf20Sopenharmony_ci	snd_pcm_uframes_t stop_threshold;	/* min avail frames for automatic stop */
4418c2ecf20Sopenharmony_ci	snd_pcm_uframes_t silence_threshold;	/* min distance from noise for silence filling */
4428c2ecf20Sopenharmony_ci	snd_pcm_uframes_t silence_size;		/* silence block size */
4438c2ecf20Sopenharmony_ci	snd_pcm_uframes_t boundary;		/* pointers wrap point */
4448c2ecf20Sopenharmony_ci	unsigned int proto;			/* protocol version */
4458c2ecf20Sopenharmony_ci	unsigned int tstamp_type;		/* timestamp type (req. proto >= 2.0.12) */
4468c2ecf20Sopenharmony_ci	unsigned char reserved[56];		/* reserved for future */
4478c2ecf20Sopenharmony_ci};
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_cistruct snd_pcm_channel_info {
4508c2ecf20Sopenharmony_ci	unsigned int channel;
4518c2ecf20Sopenharmony_ci	__kernel_off_t offset;		/* mmap offset */
4528c2ecf20Sopenharmony_ci	unsigned int first;		/* offset to first sample in bits */
4538c2ecf20Sopenharmony_ci	unsigned int step;		/* samples distance in bits */
4548c2ecf20Sopenharmony_ci};
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_cienum {
4578c2ecf20Sopenharmony_ci	/*
4588c2ecf20Sopenharmony_ci	 *  first definition for backwards compatibility only,
4598c2ecf20Sopenharmony_ci	 *  maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
4608c2ecf20Sopenharmony_ci	 */
4618c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci	/* timestamp definitions */
4648c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1,           /* DMA time, reported as per hw_ptr */
4658c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2,	           /* link time reported by sample or wallclock counter, reset on startup */
4668c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3,	   /* link time reported by sample or wallclock counter, not reset on startup */
4678c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4,    /* link time estimated indirectly */
4688c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
4698c2ecf20Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
4708c2ecf20Sopenharmony_ci};
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci#ifndef __KERNEL__
4738c2ecf20Sopenharmony_ci/* explicit padding avoids incompatibility between i386 and x86-64 */
4748c2ecf20Sopenharmony_citypedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_cistruct snd_pcm_status {
4778c2ecf20Sopenharmony_ci	snd_pcm_state_t state;		/* stream state */
4788c2ecf20Sopenharmony_ci	__time_pad pad1;		/* align to timespec */
4798c2ecf20Sopenharmony_ci	struct timespec trigger_tstamp;	/* time when stream was started/stopped/paused */
4808c2ecf20Sopenharmony_ci	struct timespec tstamp;		/* reference timestamp */
4818c2ecf20Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* appl ptr */
4828c2ecf20Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* hw ptr */
4838c2ecf20Sopenharmony_ci	snd_pcm_sframes_t delay;	/* current delay in frames */
4848c2ecf20Sopenharmony_ci	snd_pcm_uframes_t avail;	/* number of frames available */
4858c2ecf20Sopenharmony_ci	snd_pcm_uframes_t avail_max;	/* max frames available on hw since last status */
4868c2ecf20Sopenharmony_ci	snd_pcm_uframes_t overrange;	/* count of ADC (capture) overrange detections from last status */
4878c2ecf20Sopenharmony_ci	snd_pcm_state_t suspended_state; /* suspended stream state */
4888c2ecf20Sopenharmony_ci	__u32 audio_tstamp_data;	 /* needed for 64-bit alignment, used for configs/report to/from userspace */
4898c2ecf20Sopenharmony_ci	struct timespec audio_tstamp;	/* sample counter, wall clock, PHC or on-demand sync'ed */
4908c2ecf20Sopenharmony_ci	struct timespec driver_tstamp;	/* useful in case reference system tstamp is reported with delay */
4918c2ecf20Sopenharmony_ci	__u32 audio_tstamp_accuracy;	/* in ns units, only valid if indicated in audio_tstamp_data */
4928c2ecf20Sopenharmony_ci	unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
4938c2ecf20Sopenharmony_ci};
4948c2ecf20Sopenharmony_ci#endif
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/*
4978c2ecf20Sopenharmony_ci * For mmap operations, we need the 64-bit layout, both for compat mode,
4988c2ecf20Sopenharmony_ci * and for y2038 compatibility. For 64-bit applications, the two definitions
4998c2ecf20Sopenharmony_ci * are identical, so we keep the traditional version.
5008c2ecf20Sopenharmony_ci */
5018c2ecf20Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
5028c2ecf20Sopenharmony_ci#define __snd_pcm_mmap_status64		snd_pcm_mmap_status
5038c2ecf20Sopenharmony_ci#define __snd_pcm_mmap_control64	snd_pcm_mmap_control
5048c2ecf20Sopenharmony_ci#define __snd_pcm_sync_ptr64		snd_pcm_sync_ptr
5058c2ecf20Sopenharmony_ci#ifdef __KERNEL__
5068c2ecf20Sopenharmony_ci#define __snd_timespec64		__kernel_timespec
5078c2ecf20Sopenharmony_ci#else
5088c2ecf20Sopenharmony_ci#define __snd_timespec64		timespec
5098c2ecf20Sopenharmony_ci#endif
5108c2ecf20Sopenharmony_cistruct __snd_timespec {
5118c2ecf20Sopenharmony_ci	__s32 tv_sec;
5128c2ecf20Sopenharmony_ci	__s32 tv_nsec;
5138c2ecf20Sopenharmony_ci};
5148c2ecf20Sopenharmony_ci#else
5158c2ecf20Sopenharmony_ci#define __snd_pcm_mmap_status		snd_pcm_mmap_status
5168c2ecf20Sopenharmony_ci#define __snd_pcm_mmap_control		snd_pcm_mmap_control
5178c2ecf20Sopenharmony_ci#define __snd_pcm_sync_ptr		snd_pcm_sync_ptr
5188c2ecf20Sopenharmony_ci#define __snd_timespec			timespec
5198c2ecf20Sopenharmony_cistruct __snd_timespec64 {
5208c2ecf20Sopenharmony_ci	__s64 tv_sec;
5218c2ecf20Sopenharmony_ci	__s64 tv_nsec;
5228c2ecf20Sopenharmony_ci};
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci#endif
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_cistruct __snd_pcm_mmap_status {
5278c2ecf20Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
5288c2ecf20Sopenharmony_ci	int pad1;			/* Needed for 64 bit alignment */
5298c2ecf20Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
5308c2ecf20Sopenharmony_ci	struct __snd_timespec tstamp;	/* Timestamp */
5318c2ecf20Sopenharmony_ci	snd_pcm_state_t suspended_state; /* RO: suspended stream state */
5328c2ecf20Sopenharmony_ci	struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
5338c2ecf20Sopenharmony_ci};
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_cistruct __snd_pcm_mmap_control {
5368c2ecf20Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* RW: appl ptr (0...boundary-1) */
5378c2ecf20Sopenharmony_ci	snd_pcm_uframes_t avail_min;	/* RW: min available frames for wakeup */
5388c2ecf20Sopenharmony_ci};
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_HWSYNC	(1<<0)	/* execute hwsync */
5418c2ecf20Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_APPL		(1<<1)	/* get appl_ptr from driver (r/w op) */
5428c2ecf20Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN	(1<<2)	/* get avail_min from driver */
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_cistruct __snd_pcm_sync_ptr {
5458c2ecf20Sopenharmony_ci	unsigned int flags;
5468c2ecf20Sopenharmony_ci	union {
5478c2ecf20Sopenharmony_ci		struct __snd_pcm_mmap_status status;
5488c2ecf20Sopenharmony_ci		unsigned char reserved[64];
5498c2ecf20Sopenharmony_ci	} s;
5508c2ecf20Sopenharmony_ci	union {
5518c2ecf20Sopenharmony_ci		struct __snd_pcm_mmap_control control;
5528c2ecf20Sopenharmony_ci		unsigned char reserved[64];
5538c2ecf20Sopenharmony_ci	} c;
5548c2ecf20Sopenharmony_ci};
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
5578c2ecf20Sopenharmony_citypedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
5588c2ecf20Sopenharmony_citypedef char __pad_after_uframe[0];
5598c2ecf20Sopenharmony_ci#endif
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
5628c2ecf20Sopenharmony_citypedef char __pad_before_uframe[0];
5638c2ecf20Sopenharmony_citypedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
5648c2ecf20Sopenharmony_ci#endif
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_cistruct __snd_pcm_mmap_status64 {
5678c2ecf20Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
5688c2ecf20Sopenharmony_ci	__u32 pad1;			/* Needed for 64 bit alignment */
5698c2ecf20Sopenharmony_ci	__pad_before_uframe __pad1;
5708c2ecf20Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
5718c2ecf20Sopenharmony_ci	__pad_after_uframe __pad2;
5728c2ecf20Sopenharmony_ci	struct __snd_timespec64 tstamp;	/* Timestamp */
5738c2ecf20Sopenharmony_ci	snd_pcm_state_t suspended_state;/* RO: suspended stream state */
5748c2ecf20Sopenharmony_ci	__u32 pad3;			/* Needed for 64 bit alignment */
5758c2ecf20Sopenharmony_ci	struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
5768c2ecf20Sopenharmony_ci};
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_cistruct __snd_pcm_mmap_control64 {
5798c2ecf20Sopenharmony_ci	__pad_before_uframe __pad1;
5808c2ecf20Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
5818c2ecf20Sopenharmony_ci	__pad_before_uframe __pad2;
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci	__pad_before_uframe __pad3;
5848c2ecf20Sopenharmony_ci	snd_pcm_uframes_t  avail_min;	 /* RW: min available frames for wakeup */
5858c2ecf20Sopenharmony_ci	__pad_after_uframe __pad4;
5868c2ecf20Sopenharmony_ci};
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_cistruct __snd_pcm_sync_ptr64 {
5898c2ecf20Sopenharmony_ci	__u32 flags;
5908c2ecf20Sopenharmony_ci	__u32 pad1;
5918c2ecf20Sopenharmony_ci	union {
5928c2ecf20Sopenharmony_ci		struct __snd_pcm_mmap_status64 status;
5938c2ecf20Sopenharmony_ci		unsigned char reserved[64];
5948c2ecf20Sopenharmony_ci	} s;
5958c2ecf20Sopenharmony_ci	union {
5968c2ecf20Sopenharmony_ci		struct __snd_pcm_mmap_control64 control;
5978c2ecf20Sopenharmony_ci		unsigned char reserved[64];
5988c2ecf20Sopenharmony_ci	} c;
5998c2ecf20Sopenharmony_ci};
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_cistruct snd_xferi {
6028c2ecf20Sopenharmony_ci	snd_pcm_sframes_t result;
6038c2ecf20Sopenharmony_ci	void __user *buf;
6048c2ecf20Sopenharmony_ci	snd_pcm_uframes_t frames;
6058c2ecf20Sopenharmony_ci};
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_cistruct snd_xfern {
6088c2ecf20Sopenharmony_ci	snd_pcm_sframes_t result;
6098c2ecf20Sopenharmony_ci	void __user * __user *bufs;
6108c2ecf20Sopenharmony_ci	snd_pcm_uframes_t frames;
6118c2ecf20Sopenharmony_ci};
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_cienum {
6148c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,	/* gettimeofday equivalent */
6158c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,	/* posix_clock_monotonic equivalent */
6168c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,    /* monotonic_raw (no NTP) */
6178c2ecf20Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
6188c2ecf20Sopenharmony_ci};
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/* channel positions */
6218c2ecf20Sopenharmony_cienum {
6228c2ecf20Sopenharmony_ci	SNDRV_CHMAP_UNKNOWN = 0,
6238c2ecf20Sopenharmony_ci	SNDRV_CHMAP_NA,		/* N/A, silent */
6248c2ecf20Sopenharmony_ci	SNDRV_CHMAP_MONO,	/* mono stream */
6258c2ecf20Sopenharmony_ci	/* this follows the alsa-lib mixer channel value + 3 */
6268c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FL,		/* front left */
6278c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FR,		/* front right */
6288c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RL,		/* rear left */
6298c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RR,		/* rear right */
6308c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FC,		/* front center */
6318c2ecf20Sopenharmony_ci	SNDRV_CHMAP_LFE,	/* LFE */
6328c2ecf20Sopenharmony_ci	SNDRV_CHMAP_SL,		/* side left */
6338c2ecf20Sopenharmony_ci	SNDRV_CHMAP_SR,		/* side right */
6348c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RC,		/* rear center */
6358c2ecf20Sopenharmony_ci	/* new definitions */
6368c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FLC,	/* front left center */
6378c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FRC,	/* front right center */
6388c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RLC,	/* rear left center */
6398c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RRC,	/* rear right center */
6408c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FLW,	/* front left wide */
6418c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FRW,	/* front right wide */
6428c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FLH,	/* front left high */
6438c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FCH,	/* front center high */
6448c2ecf20Sopenharmony_ci	SNDRV_CHMAP_FRH,	/* front right high */
6458c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TC,		/* top center */
6468c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TFL,	/* top front left */
6478c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TFR,	/* top front right */
6488c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TFC,	/* top front center */
6498c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TRL,	/* top rear left */
6508c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TRR,	/* top rear right */
6518c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TRC,	/* top rear center */
6528c2ecf20Sopenharmony_ci	/* new definitions for UAC2 */
6538c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TFLC,	/* top front left center */
6548c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TFRC,	/* top front right center */
6558c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TSL,	/* top side left */
6568c2ecf20Sopenharmony_ci	SNDRV_CHMAP_TSR,	/* top side right */
6578c2ecf20Sopenharmony_ci	SNDRV_CHMAP_LLFE,	/* left LFE */
6588c2ecf20Sopenharmony_ci	SNDRV_CHMAP_RLFE,	/* right LFE */
6598c2ecf20Sopenharmony_ci	SNDRV_CHMAP_BC,		/* bottom center */
6608c2ecf20Sopenharmony_ci	SNDRV_CHMAP_BLC,	/* bottom left center */
6618c2ecf20Sopenharmony_ci	SNDRV_CHMAP_BRC,	/* bottom right center */
6628c2ecf20Sopenharmony_ci	SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
6638c2ecf20Sopenharmony_ci};
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci#define SNDRV_CHMAP_POSITION_MASK	0xffff
6668c2ecf20Sopenharmony_ci#define SNDRV_CHMAP_PHASE_INVERSE	(0x01 << 16)
6678c2ecf20Sopenharmony_ci#define SNDRV_CHMAP_DRIVER_SPEC		(0x02 << 16)
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_PVERSION	_IOR('A', 0x00, int)
6708c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_INFO		_IOR('A', 0x01, struct snd_pcm_info)
6718c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_TSTAMP		_IOW('A', 0x02, int)
6728c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_TTSTAMP		_IOW('A', 0x03, int)
6738c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_USER_PVERSION	_IOW('A', 0x04, int)
6748c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_REFINE	_IOWR('A', 0x10, struct snd_pcm_hw_params)
6758c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_PARAMS	_IOWR('A', 0x11, struct snd_pcm_hw_params)
6768c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_FREE		_IO('A', 0x12)
6778c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_SW_PARAMS	_IOWR('A', 0x13, struct snd_pcm_sw_params)
6788c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS		_IOR('A', 0x20, struct snd_pcm_status)
6798c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_DELAY		_IOR('A', 0x21, snd_pcm_sframes_t)
6808c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_HWSYNC		_IO('A', 0x22)
6818c2ecf20Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
6828c2ecf20Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR64	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
6838c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct snd_pcm_sync_ptr)
6848c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS_EXT	_IOWR('A', 0x24, struct snd_pcm_status)
6858c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_CHANNEL_INFO	_IOR('A', 0x32, struct snd_pcm_channel_info)
6868c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_PREPARE		_IO('A', 0x40)
6878c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESET		_IO('A', 0x41)
6888c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_START		_IO('A', 0x42)
6898c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_DROP		_IO('A', 0x43)
6908c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_DRAIN		_IO('A', 0x44)
6918c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_PAUSE		_IOW('A', 0x45, int)
6928c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_REWIND		_IOW('A', 0x46, snd_pcm_uframes_t)
6938c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESUME		_IO('A', 0x47)
6948c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_XRUN		_IO('A', 0x48)
6958c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_FORWARD		_IOW('A', 0x49, snd_pcm_uframes_t)
6968c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEI_FRAMES	_IOW('A', 0x50, struct snd_xferi)
6978c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_READI_FRAMES	_IOR('A', 0x51, struct snd_xferi)
6988c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEN_FRAMES	_IOW('A', 0x52, struct snd_xfern)
6998c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_READN_FRAMES	_IOR('A', 0x53, struct snd_xfern)
7008c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_LINK		_IOW('A', 0x60, int)
7018c2ecf20Sopenharmony_ci#define SNDRV_PCM_IOCTL_UNLINK		_IO('A', 0x61)
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/*****************************************************************************
7048c2ecf20Sopenharmony_ci *                                                                           *
7058c2ecf20Sopenharmony_ci *                            MIDI v1.0 interface                            *
7068c2ecf20Sopenharmony_ci *                                                                           *
7078c2ecf20Sopenharmony_ci *****************************************************************************/
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci/*
7108c2ecf20Sopenharmony_ci *  Raw MIDI section - /dev/snd/midi??
7118c2ecf20Sopenharmony_ci */
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 1)
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_cienum {
7168c2ecf20Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
7178c2ecf20Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_INPUT,
7188c2ecf20Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
7198c2ecf20Sopenharmony_ci};
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_OUTPUT		0x00000001
7228c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_INPUT		0x00000002
7238c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_DUPLEX		0x00000004
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_cistruct snd_rawmidi_info {
7268c2ecf20Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
7278c2ecf20Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
7288c2ecf20Sopenharmony_ci	int stream;			/* WR: stream */
7298c2ecf20Sopenharmony_ci	int card;			/* R: card number */
7308c2ecf20Sopenharmony_ci	unsigned int flags;		/* SNDRV_RAWMIDI_INFO_XXXX */
7318c2ecf20Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
7328c2ecf20Sopenharmony_ci	unsigned char name[80];		/* name of device */
7338c2ecf20Sopenharmony_ci	unsigned char subname[32];	/* name of active or selected subdevice */
7348c2ecf20Sopenharmony_ci	unsigned int subdevices_count;
7358c2ecf20Sopenharmony_ci	unsigned int subdevices_avail;
7368c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future use */
7378c2ecf20Sopenharmony_ci};
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_cistruct snd_rawmidi_params {
7408c2ecf20Sopenharmony_ci	int stream;
7418c2ecf20Sopenharmony_ci	size_t buffer_size;		/* queue size in bytes */
7428c2ecf20Sopenharmony_ci	size_t avail_min;		/* minimum avail bytes for wakeup */
7438c2ecf20Sopenharmony_ci	unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
7448c2ecf20Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
7458c2ecf20Sopenharmony_ci};
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci#ifndef __KERNEL__
7488c2ecf20Sopenharmony_cistruct snd_rawmidi_status {
7498c2ecf20Sopenharmony_ci	int stream;
7508c2ecf20Sopenharmony_ci	__time_pad pad1;
7518c2ecf20Sopenharmony_ci	struct timespec tstamp;		/* Timestamp */
7528c2ecf20Sopenharmony_ci	size_t avail;			/* available bytes */
7538c2ecf20Sopenharmony_ci	size_t xruns;			/* count of overruns since last status (in bytes) */
7548c2ecf20Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
7558c2ecf20Sopenharmony_ci};
7568c2ecf20Sopenharmony_ci#endif
7578c2ecf20Sopenharmony_ci
7588c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PVERSION	_IOR('W', 0x00, int)
7598c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_INFO	_IOR('W', 0x01, struct snd_rawmidi_info)
7608c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PARAMS	_IOWR('W', 0x10, struct snd_rawmidi_params)
7618c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_STATUS	_IOWR('W', 0x20, struct snd_rawmidi_status)
7628c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DROP	_IOW('W', 0x30, int)
7638c2ecf20Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DRAIN	_IOW('W', 0x31, int)
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci/*
7668c2ecf20Sopenharmony_ci *  Timer section - /dev/snd/timer
7678c2ecf20Sopenharmony_ci */
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_cienum {
7728c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_NONE = -1,
7738c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_SLAVE = 0,
7748c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_GLOBAL,
7758c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_CARD,
7768c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_PCM,
7778c2ecf20Sopenharmony_ci	SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
7788c2ecf20Sopenharmony_ci};
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_ci/* slave timer classes */
7818c2ecf20Sopenharmony_cienum {
7828c2ecf20Sopenharmony_ci	SNDRV_TIMER_SCLASS_NONE = 0,
7838c2ecf20Sopenharmony_ci	SNDRV_TIMER_SCLASS_APPLICATION,
7848c2ecf20Sopenharmony_ci	SNDRV_TIMER_SCLASS_SEQUENCER,		/* alias */
7858c2ecf20Sopenharmony_ci	SNDRV_TIMER_SCLASS_OSS_SEQUENCER,	/* alias */
7868c2ecf20Sopenharmony_ci	SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
7878c2ecf20Sopenharmony_ci};
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci/* global timers (device member) */
7908c2ecf20Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_SYSTEM	0
7918c2ecf20Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_RTC		1	/* unused */
7928c2ecf20Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HPET		2
7938c2ecf20Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HRTIMER	3
7948c2ecf20Sopenharmony_ci
7958c2ecf20Sopenharmony_ci/* info flags */
7968c2ecf20Sopenharmony_ci#define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
7978c2ecf20Sopenharmony_ci
7988c2ecf20Sopenharmony_cistruct snd_timer_id {
7998c2ecf20Sopenharmony_ci	int dev_class;
8008c2ecf20Sopenharmony_ci	int dev_sclass;
8018c2ecf20Sopenharmony_ci	int card;
8028c2ecf20Sopenharmony_ci	int device;
8038c2ecf20Sopenharmony_ci	int subdevice;
8048c2ecf20Sopenharmony_ci};
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_cistruct snd_timer_ginfo {
8078c2ecf20Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
8088c2ecf20Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
8098c2ecf20Sopenharmony_ci	int card;			/* card number */
8108c2ecf20Sopenharmony_ci	unsigned char id[64];		/* timer identification */
8118c2ecf20Sopenharmony_ci	unsigned char name[80];		/* timer name */
8128c2ecf20Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
8138c2ecf20Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
8148c2ecf20Sopenharmony_ci	unsigned long resolution_min;	/* minimal period resolution in ns */
8158c2ecf20Sopenharmony_ci	unsigned long resolution_max;	/* maximal period resolution in ns */
8168c2ecf20Sopenharmony_ci	unsigned int clients;		/* active timer clients */
8178c2ecf20Sopenharmony_ci	unsigned char reserved[32];
8188c2ecf20Sopenharmony_ci};
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_cistruct snd_timer_gparams {
8218c2ecf20Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
8228c2ecf20Sopenharmony_ci	unsigned long period_num;	/* requested precise period duration (in seconds) - numerator */
8238c2ecf20Sopenharmony_ci	unsigned long period_den;	/* requested precise period duration (in seconds) - denominator */
8248c2ecf20Sopenharmony_ci	unsigned char reserved[32];
8258c2ecf20Sopenharmony_ci};
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_cistruct snd_timer_gstatus {
8288c2ecf20Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
8298c2ecf20Sopenharmony_ci	unsigned long resolution;	/* current period resolution in ns */
8308c2ecf20Sopenharmony_ci	unsigned long resolution_num;	/* precise current period resolution (in seconds) - numerator */
8318c2ecf20Sopenharmony_ci	unsigned long resolution_den;	/* precise current period resolution (in seconds) - denominator */
8328c2ecf20Sopenharmony_ci	unsigned char reserved[32];
8338c2ecf20Sopenharmony_ci};
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_cistruct snd_timer_select {
8368c2ecf20Sopenharmony_ci	struct snd_timer_id id;	/* bind to timer ID */
8378c2ecf20Sopenharmony_ci	unsigned char reserved[32];	/* reserved */
8388c2ecf20Sopenharmony_ci};
8398c2ecf20Sopenharmony_ci
8408c2ecf20Sopenharmony_cistruct snd_timer_info {
8418c2ecf20Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
8428c2ecf20Sopenharmony_ci	int card;			/* card number */
8438c2ecf20Sopenharmony_ci	unsigned char id[64];		/* timer identificator */
8448c2ecf20Sopenharmony_ci	unsigned char name[80];		/* timer name */
8458c2ecf20Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
8468c2ecf20Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
8478c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
8488c2ecf20Sopenharmony_ci};
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci#define SNDRV_TIMER_PSFLG_AUTO		(1<<0)	/* auto start, otherwise one-shot */
8518c2ecf20Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EXCLUSIVE	(1<<1)	/* exclusive use, precise start/stop/pause/continue */
8528c2ecf20Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EARLY_EVENT	(1<<2)	/* write early event to the poll queue */
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_cistruct snd_timer_params {
8558c2ecf20Sopenharmony_ci	unsigned int flags;		/* flags - SNDRV_TIMER_PSFLG_* */
8568c2ecf20Sopenharmony_ci	unsigned int ticks;		/* requested resolution in ticks */
8578c2ecf20Sopenharmony_ci	unsigned int queue_size;	/* total size of queue (32-1024) */
8588c2ecf20Sopenharmony_ci	unsigned int reserved0;		/* reserved, was: failure locations */
8598c2ecf20Sopenharmony_ci	unsigned int filter;		/* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
8608c2ecf20Sopenharmony_ci	unsigned char reserved[60];	/* reserved */
8618c2ecf20Sopenharmony_ci};
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci#ifndef __KERNEL__
8648c2ecf20Sopenharmony_cistruct snd_timer_status {
8658c2ecf20Sopenharmony_ci	struct timespec tstamp;		/* Timestamp - last update */
8668c2ecf20Sopenharmony_ci	unsigned int resolution;	/* current period resolution in ns */
8678c2ecf20Sopenharmony_ci	unsigned int lost;		/* counter of master tick lost */
8688c2ecf20Sopenharmony_ci	unsigned int overrun;		/* count of read queue overruns */
8698c2ecf20Sopenharmony_ci	unsigned int queue;		/* used queue size */
8708c2ecf20Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
8718c2ecf20Sopenharmony_ci};
8728c2ecf20Sopenharmony_ci#endif
8738c2ecf20Sopenharmony_ci
8748c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
8758c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
8768c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD_OLD	_IOW('T', 0x02, int)
8778c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GINFO		_IOWR('T', 0x03, struct snd_timer_ginfo)
8788c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GPARAMS	_IOW('T', 0x04, struct snd_timer_gparams)
8798c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GSTATUS	_IOWR('T', 0x05, struct snd_timer_gstatus)
8808c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_SELECT	_IOW('T', 0x10, struct snd_timer_select)
8818c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_INFO		_IOR('T', 0x11, struct snd_timer_info)
8828c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PARAMS	_IOW('T', 0x12, struct snd_timer_params)
8838c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STATUS	_IOR('T', 0x14, struct snd_timer_status)
8848c2ecf20Sopenharmony_ci/* The following four ioctls are changed since 1.0.9 due to confliction */
8858c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_START		_IO('T', 0xa0)
8868c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STOP		_IO('T', 0xa1)
8878c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
8888c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
8898c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci#if __BITS_PER_LONG == 64
8928c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
8938c2ecf20Sopenharmony_ci#else
8948c2ecf20Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
8958c2ecf20Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD_OLD : \
8968c2ecf20Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD64)
8978c2ecf20Sopenharmony_ci#endif
8988c2ecf20Sopenharmony_ci
8998c2ecf20Sopenharmony_cistruct snd_timer_read {
9008c2ecf20Sopenharmony_ci	unsigned int resolution;
9018c2ecf20Sopenharmony_ci	unsigned int ticks;
9028c2ecf20Sopenharmony_ci};
9038c2ecf20Sopenharmony_ci
9048c2ecf20Sopenharmony_cienum {
9058c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_RESOLUTION = 0,	/* val = resolution in ns */
9068c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_TICK,			/* val = ticks */
9078c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_START,		/* val = resolution in ns */
9088c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_STOP,			/* val = 0 */
9098c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_CONTINUE,		/* val = resolution in ns */
9108c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_PAUSE,		/* val = 0 */
9118c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_EARLY,		/* val = 0, early event */
9128c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_SUSPEND,		/* val = 0 */
9138c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_RESUME,		/* val = resolution in ns */
9148c2ecf20Sopenharmony_ci	/* master timer events for slave timer instances */
9158c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
9168c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
9178c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
9188c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
9198c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
9208c2ecf20Sopenharmony_ci	SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
9218c2ecf20Sopenharmony_ci};
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ci#ifndef __KERNEL__
9248c2ecf20Sopenharmony_cistruct snd_timer_tread {
9258c2ecf20Sopenharmony_ci	int event;
9268c2ecf20Sopenharmony_ci	__time_pad pad1;
9278c2ecf20Sopenharmony_ci	struct timespec tstamp;
9288c2ecf20Sopenharmony_ci	unsigned int val;
9298c2ecf20Sopenharmony_ci	__time_pad pad2;
9308c2ecf20Sopenharmony_ci};
9318c2ecf20Sopenharmony_ci#endif
9328c2ecf20Sopenharmony_ci
9338c2ecf20Sopenharmony_ci/****************************************************************************
9348c2ecf20Sopenharmony_ci *                                                                          *
9358c2ecf20Sopenharmony_ci *        Section for driver control interface - /dev/snd/control?          *
9368c2ecf20Sopenharmony_ci *                                                                          *
9378c2ecf20Sopenharmony_ci ****************************************************************************/
9388c2ecf20Sopenharmony_ci
9398c2ecf20Sopenharmony_ci#define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 8)
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_cistruct snd_ctl_card_info {
9428c2ecf20Sopenharmony_ci	int card;			/* card number */
9438c2ecf20Sopenharmony_ci	int pad;			/* reserved for future (was type) */
9448c2ecf20Sopenharmony_ci	unsigned char id[16];		/* ID of card (user selectable) */
9458c2ecf20Sopenharmony_ci	unsigned char driver[16];	/* Driver name */
9468c2ecf20Sopenharmony_ci	unsigned char name[32];		/* Short name of soundcard */
9478c2ecf20Sopenharmony_ci	unsigned char longname[80];	/* name + info text about soundcard */
9488c2ecf20Sopenharmony_ci	unsigned char reserved_[16];	/* reserved for future (was ID of mixer) */
9498c2ecf20Sopenharmony_ci	unsigned char mixername[80];	/* visual mixer identification */
9508c2ecf20Sopenharmony_ci	unsigned char components[128];	/* card components / fine identification, delimited with one space (AC97 etc..) */
9518c2ecf20Sopenharmony_ci};
9528c2ecf20Sopenharmony_ci
9538c2ecf20Sopenharmony_citypedef int __bitwise snd_ctl_elem_type_t;
9548c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_NONE	((__force snd_ctl_elem_type_t) 0) /* invalid */
9558c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BOOLEAN	((__force snd_ctl_elem_type_t) 1) /* boolean type */
9568c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER	((__force snd_ctl_elem_type_t) 2) /* integer type */
9578c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_ENUMERATED	((__force snd_ctl_elem_type_t) 3) /* enumerated type */
9588c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BYTES	((__force snd_ctl_elem_type_t) 4) /* byte array */
9598c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_IEC958	((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
9608c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER64	((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
9618c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_LAST	SNDRV_CTL_ELEM_TYPE_INTEGER64
9628c2ecf20Sopenharmony_ci
9638c2ecf20Sopenharmony_citypedef int __bitwise snd_ctl_elem_iface_t;
9648c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_CARD	((__force snd_ctl_elem_iface_t) 0) /* global control */
9658c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_HWDEP	((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
9668c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_MIXER	((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
9678c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_PCM	((__force snd_ctl_elem_iface_t) 3) /* PCM device */
9688c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_RAWMIDI	((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
9698c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_TIMER	((__force snd_ctl_elem_iface_t) 5) /* timer device */
9708c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_SEQUENCER	((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
9718c2ecf20Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_LAST	SNDRV_CTL_ELEM_IFACE_SEQUENCER
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READ		(1<<0)
9748c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_WRITE		(1<<1)
9758c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READWRITE		(SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
9768c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_VOLATILE		(1<<2)	/* control value may be changed without a notification */
9778c2ecf20Sopenharmony_ci// (1 << 3) is unused.
9788c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READ		(1<<4)	/* TLV read is possible */
9798c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE		(1<<5)	/* TLV write is possible */
9808c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE	(SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
9818c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND	(1<<6)	/* TLV command is possible */
9828c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */
9838c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */
9848c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */
9858c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */
9868c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_USER		(1<<29) /* user space element */
9878c2ecf20Sopenharmony_ci/* bits 30 and 31 are obsoleted (for indirect access) */
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci/* for further details see the ACPI and PCI power management specification */
9908c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D0		0x0000	/* full On */
9918c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D1		0x0100	/* partial On */
9928c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D2		0x0200	/* partial On */
9938c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D3		0x0300	/* Off */
9948c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D3hot		(SNDRV_CTL_POWER_D3|0x0000)	/* Off, with power */
9958c2ecf20Sopenharmony_ci#define SNDRV_CTL_POWER_D3cold		(SNDRV_CTL_POWER_D3|0x0001)	/* Off, without power */
9968c2ecf20Sopenharmony_ci
9978c2ecf20Sopenharmony_ci#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN	44
9988c2ecf20Sopenharmony_ci
9998c2ecf20Sopenharmony_cistruct snd_ctl_elem_id {
10008c2ecf20Sopenharmony_ci	unsigned int numid;		/* numeric identifier, zero = invalid */
10018c2ecf20Sopenharmony_ci	snd_ctl_elem_iface_t iface;	/* interface identifier */
10028c2ecf20Sopenharmony_ci	unsigned int device;		/* device/client number */
10038c2ecf20Sopenharmony_ci	unsigned int subdevice;		/* subdevice (substream) number */
10048c2ecf20Sopenharmony_ci	unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];		/* ASCII name of item */
10058c2ecf20Sopenharmony_ci	unsigned int index;		/* index of item */
10068c2ecf20Sopenharmony_ci};
10078c2ecf20Sopenharmony_ci
10088c2ecf20Sopenharmony_cistruct snd_ctl_elem_list {
10098c2ecf20Sopenharmony_ci	unsigned int offset;		/* W: first element ID to get */
10108c2ecf20Sopenharmony_ci	unsigned int space;		/* W: count of element IDs to get */
10118c2ecf20Sopenharmony_ci	unsigned int used;		/* R: count of element IDs set */
10128c2ecf20Sopenharmony_ci	unsigned int count;		/* R: count of all elements */
10138c2ecf20Sopenharmony_ci	struct snd_ctl_elem_id __user *pids; /* R: IDs */
10148c2ecf20Sopenharmony_ci	unsigned char reserved[50];
10158c2ecf20Sopenharmony_ci};
10168c2ecf20Sopenharmony_ci
10178c2ecf20Sopenharmony_cistruct snd_ctl_elem_info {
10188c2ecf20Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
10198c2ecf20Sopenharmony_ci	snd_ctl_elem_type_t type;	/* R: value type - SNDRV_CTL_ELEM_TYPE_* */
10208c2ecf20Sopenharmony_ci	unsigned int access;		/* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
10218c2ecf20Sopenharmony_ci	unsigned int count;		/* count of values */
10228c2ecf20Sopenharmony_ci	__kernel_pid_t owner;		/* owner's PID of this control */
10238c2ecf20Sopenharmony_ci	union {
10248c2ecf20Sopenharmony_ci		struct {
10258c2ecf20Sopenharmony_ci			long min;		/* R: minimum value */
10268c2ecf20Sopenharmony_ci			long max;		/* R: maximum value */
10278c2ecf20Sopenharmony_ci			long step;		/* R: step (0 variable) */
10288c2ecf20Sopenharmony_ci		} integer;
10298c2ecf20Sopenharmony_ci		struct {
10308c2ecf20Sopenharmony_ci			long long min;		/* R: minimum value */
10318c2ecf20Sopenharmony_ci			long long max;		/* R: maximum value */
10328c2ecf20Sopenharmony_ci			long long step;		/* R: step (0 variable) */
10338c2ecf20Sopenharmony_ci		} integer64;
10348c2ecf20Sopenharmony_ci		struct {
10358c2ecf20Sopenharmony_ci			unsigned int items;	/* R: number of items */
10368c2ecf20Sopenharmony_ci			unsigned int item;	/* W: item number */
10378c2ecf20Sopenharmony_ci			char name[64];		/* R: value name */
10388c2ecf20Sopenharmony_ci			__u64 names_ptr;	/* W: names list (ELEM_ADD only) */
10398c2ecf20Sopenharmony_ci			unsigned int names_length;
10408c2ecf20Sopenharmony_ci		} enumerated;
10418c2ecf20Sopenharmony_ci		unsigned char reserved[128];
10428c2ecf20Sopenharmony_ci	} value;
10438c2ecf20Sopenharmony_ci	unsigned char reserved[64];
10448c2ecf20Sopenharmony_ci};
10458c2ecf20Sopenharmony_ci
10468c2ecf20Sopenharmony_cistruct snd_ctl_elem_value {
10478c2ecf20Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
10488c2ecf20Sopenharmony_ci	unsigned int indirect: 1;	/* W: indirect access - obsoleted */
10498c2ecf20Sopenharmony_ci	union {
10508c2ecf20Sopenharmony_ci		union {
10518c2ecf20Sopenharmony_ci			long value[128];
10528c2ecf20Sopenharmony_ci			long *value_ptr;	/* obsoleted */
10538c2ecf20Sopenharmony_ci		} integer;
10548c2ecf20Sopenharmony_ci		union {
10558c2ecf20Sopenharmony_ci			long long value[64];
10568c2ecf20Sopenharmony_ci			long long *value_ptr;	/* obsoleted */
10578c2ecf20Sopenharmony_ci		} integer64;
10588c2ecf20Sopenharmony_ci		union {
10598c2ecf20Sopenharmony_ci			unsigned int item[128];
10608c2ecf20Sopenharmony_ci			unsigned int *item_ptr;	/* obsoleted */
10618c2ecf20Sopenharmony_ci		} enumerated;
10628c2ecf20Sopenharmony_ci		union {
10638c2ecf20Sopenharmony_ci			unsigned char data[512];
10648c2ecf20Sopenharmony_ci			unsigned char *data_ptr;	/* obsoleted */
10658c2ecf20Sopenharmony_ci		} bytes;
10668c2ecf20Sopenharmony_ci		struct snd_aes_iec958 iec958;
10678c2ecf20Sopenharmony_ci	} value;		/* RO */
10688c2ecf20Sopenharmony_ci	unsigned char reserved[128];
10698c2ecf20Sopenharmony_ci};
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_cistruct snd_ctl_tlv {
10728c2ecf20Sopenharmony_ci	unsigned int numid;	/* control element numeric identification */
10738c2ecf20Sopenharmony_ci	unsigned int length;	/* in bytes aligned to 4 */
10748c2ecf20Sopenharmony_ci	unsigned int tlv[0];	/* first TLV */
10758c2ecf20Sopenharmony_ci};
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_PVERSION	_IOR('U', 0x00, int)
10788c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_CARD_INFO	_IOR('U', 0x01, struct snd_ctl_card_info)
10798c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LIST	_IOWR('U', 0x10, struct snd_ctl_elem_list)
10808c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_INFO	_IOWR('U', 0x11, struct snd_ctl_elem_info)
10818c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_READ	_IOWR('U', 0x12, struct snd_ctl_elem_value)
10828c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_WRITE	_IOWR('U', 0x13, struct snd_ctl_elem_value)
10838c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LOCK	_IOW('U', 0x14, struct snd_ctl_elem_id)
10848c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_UNLOCK	_IOW('U', 0x15, struct snd_ctl_elem_id)
10858c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
10868c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_ADD	_IOWR('U', 0x17, struct snd_ctl_elem_info)
10878c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REPLACE	_IOWR('U', 0x18, struct snd_ctl_elem_info)
10888c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REMOVE	_IOWR('U', 0x19, struct snd_ctl_elem_id)
10898c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_READ	_IOWR('U', 0x1a, struct snd_ctl_tlv)
10908c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_WRITE	_IOWR('U', 0x1b, struct snd_ctl_tlv)
10918c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_COMMAND	_IOWR('U', 0x1c, struct snd_ctl_tlv)
10928c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
10938c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_INFO	_IOR('U', 0x21, struct snd_hwdep_info)
10948c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE	_IOR('U', 0x30, int)
10958c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_INFO	_IOWR('U', 0x31, struct snd_pcm_info)
10968c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
10978c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
10988c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_INFO	_IOWR('U', 0x41, struct snd_rawmidi_info)
10998c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
11008c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER		_IOWR('U', 0xd0, int)
11018c2ecf20Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER_STATE	_IOR('U', 0xd1, int)
11028c2ecf20Sopenharmony_ci
11038c2ecf20Sopenharmony_ci/*
11048c2ecf20Sopenharmony_ci *  Read interface.
11058c2ecf20Sopenharmony_ci */
11068c2ecf20Sopenharmony_ci
11078c2ecf20Sopenharmony_cienum sndrv_ctl_event_type {
11088c2ecf20Sopenharmony_ci	SNDRV_CTL_EVENT_ELEM = 0,
11098c2ecf20Sopenharmony_ci	SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
11108c2ecf20Sopenharmony_ci};
11118c2ecf20Sopenharmony_ci
11128c2ecf20Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_VALUE	(1<<0)	/* element value was changed */
11138c2ecf20Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_INFO	(1<<1)	/* element info was changed */
11148c2ecf20Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_ADD	(1<<2)	/* element was added */
11158c2ecf20Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_TLV	(1<<3)	/* element TLV tree was changed */
11168c2ecf20Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_REMOVE	(~0U)	/* element was removed */
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_cistruct snd_ctl_event {
11198c2ecf20Sopenharmony_ci	int type;	/* event type - SNDRV_CTL_EVENT_* */
11208c2ecf20Sopenharmony_ci	union {
11218c2ecf20Sopenharmony_ci		struct {
11228c2ecf20Sopenharmony_ci			unsigned int mask;
11238c2ecf20Sopenharmony_ci			struct snd_ctl_elem_id id;
11248c2ecf20Sopenharmony_ci		} elem;
11258c2ecf20Sopenharmony_ci		unsigned char data8[60];
11268c2ecf20Sopenharmony_ci	} data;
11278c2ecf20Sopenharmony_ci};
11288c2ecf20Sopenharmony_ci
11298c2ecf20Sopenharmony_ci/*
11308c2ecf20Sopenharmony_ci *  Control names
11318c2ecf20Sopenharmony_ci */
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_NONE				""
11348c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_PLAYBACK				"Playback "
11358c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_CAPTURE				"Capture "
11368c2ecf20Sopenharmony_ci
11378c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_NONE			""
11388c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_SWITCH			"Switch"
11398c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_VOLUME			"Volume"
11408c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_DEFAULT			"Default"
11418c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_MASK			"Mask"
11428c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_CON_MASK			"Con Mask"
11438c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PRO_MASK			"Pro Mask"
11448c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PCM_STREAM		"PCM Stream"
11458c2ecf20Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958(expl,direction,what)	"IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
11468c2ecf20Sopenharmony_ci
11478c2ecf20Sopenharmony_ci#endif /* _UAPI__SOUND_ASOUND_H */
1148