162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Advanced Linux Sound Architecture - ALSA - Driver
462306a36Sopenharmony_ci *  Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
562306a36Sopenharmony_ci *                             Abramo Bagnara <abramo@alsa-project.org>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _UAPI__SOUND_ASOUND_H
962306a36Sopenharmony_ci#define _UAPI__SOUND_ASOUND_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#if defined(__KERNEL__) || defined(__linux__)
1262306a36Sopenharmony_ci#include <linux/types.h>
1362306a36Sopenharmony_ci#include <asm/byteorder.h>
1462306a36Sopenharmony_ci#else
1562306a36Sopenharmony_ci#include <endian.h>
1662306a36Sopenharmony_ci#include <sys/ioctl.h>
1762306a36Sopenharmony_ci#endif
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#ifndef __KERNEL__
2062306a36Sopenharmony_ci#include <stdlib.h>
2162306a36Sopenharmony_ci#include <time.h>
2262306a36Sopenharmony_ci#endif
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/*
2562306a36Sopenharmony_ci *  protocol version
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
2962306a36Sopenharmony_ci#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
3062306a36Sopenharmony_ci#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
3162306a36Sopenharmony_ci#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
3262306a36Sopenharmony_ci#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
3362306a36Sopenharmony_ci	(SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
3462306a36Sopenharmony_ci	 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
3562306a36Sopenharmony_ci	   SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/****************************************************************************
3862306a36Sopenharmony_ci *                                                                          *
3962306a36Sopenharmony_ci *        Digital audio interface					    *
4062306a36Sopenharmony_ci *                                                                          *
4162306a36Sopenharmony_ci ****************************************************************************/
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define AES_IEC958_STATUS_SIZE		24
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistruct snd_aes_iec958 {
4662306a36Sopenharmony_ci	unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
4762306a36Sopenharmony_ci	unsigned char subcode[147];	/* AES/IEC958 subcode bits */
4862306a36Sopenharmony_ci	unsigned char pad;		/* nothing */
4962306a36Sopenharmony_ci	unsigned char dig_subframe[4];	/* AES/IEC958 subframe bits */
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/****************************************************************************
5362306a36Sopenharmony_ci *                                                                          *
5462306a36Sopenharmony_ci *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort		    *
5562306a36Sopenharmony_ci *                                                                          *
5662306a36Sopenharmony_ci ****************************************************************************/
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cistruct snd_cea_861_aud_if {
5962306a36Sopenharmony_ci	unsigned char db1_ct_cc; /* coding type and channel count */
6062306a36Sopenharmony_ci	unsigned char db2_sf_ss; /* sample frequency and size */
6162306a36Sopenharmony_ci	unsigned char db3; /* not used, all zeros */
6262306a36Sopenharmony_ci	unsigned char db4_ca; /* channel allocation code */
6362306a36Sopenharmony_ci	unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
6462306a36Sopenharmony_ci};
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/****************************************************************************
6762306a36Sopenharmony_ci *                                                                          *
6862306a36Sopenharmony_ci *      Section for driver hardware dependent interface - /dev/snd/hw?      *
6962306a36Sopenharmony_ci *                                                                          *
7062306a36Sopenharmony_ci ****************************************************************************/
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define SNDRV_HWDEP_VERSION		SNDRV_PROTOCOL_VERSION(1, 0, 1)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cienum {
7562306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL2 = 0,
7662306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL3,
7762306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_OPL4,
7862306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB16CSP,	/* Creative Signal Processor */
7962306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMU10K1,	/* FX8010 processor in EMU10K1 chip */
8062306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_YSS225,	/* Yamaha FX processor */
8162306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_ICS2115,	/* Wavetable synth */
8262306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_SSCAPE,	/* Ensoniq SoundScape ISA card (MC68EC000) */
8362306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_VX,		/* Digigram VX cards */
8462306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_MIXART,	/* Digigram miXart cards */
8562306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y,	/* Tascam US122, US224 & US428 usb */
8662306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
8762306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_BLUETOOTH,	/* Bluetooth audio */
8862306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_USX2Y_PCM,	/* Tascam US122, US224 & US428 rawusb pcm */
8962306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_PCXHR,	/* Digigram PCXHR */
9062306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_SB_RC,	/* SB Extigy/Audigy2NX remote control */
9162306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_HDA,		/* HD-audio */
9262306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_USB_STREAM,	/* direct access to usb stream */
9362306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DICE,	/* TC DICE FireWire device */
9462306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREWORKS,	/* Echo Audio Fireworks based device */
9562306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_BEBOB,	/* BridgeCo BeBoB based device */
9662306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_OXFW,	/* Oxford OXFW970/971 based device */
9762306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_DIGI00X,	/* Digidesign Digi 002/003 family */
9862306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_TASCAM,	/* TASCAM FireWire series */
9962306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_LINE6,	/* Line6 USB processors */
10062306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_MOTU,	/* MOTU FireWire series */
10162306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_FW_FIREFACE,	/* RME Fireface series */
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	/* Don't forget to change the following: */
10462306a36Sopenharmony_ci	SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cistruct snd_hwdep_info {
10862306a36Sopenharmony_ci	unsigned int device;		/* WR: device number */
10962306a36Sopenharmony_ci	int card;			/* R: card number */
11062306a36Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
11162306a36Sopenharmony_ci	unsigned char name[80];		/* hwdep name */
11262306a36Sopenharmony_ci	int iface;			/* hwdep interface */
11362306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
11462306a36Sopenharmony_ci};
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* generic DSP loader */
11762306a36Sopenharmony_cistruct snd_hwdep_dsp_status {
11862306a36Sopenharmony_ci	unsigned int version;		/* R: driver-specific version */
11962306a36Sopenharmony_ci	unsigned char id[32];		/* R: driver-specific ID string */
12062306a36Sopenharmony_ci	unsigned int num_dsps;		/* R: number of DSP images to transfer */
12162306a36Sopenharmony_ci	unsigned int dsp_loaded;	/* R: bit flags indicating the loaded DSPs */
12262306a36Sopenharmony_ci	unsigned int chip_ready;	/* R: 1 = initialization finished */
12362306a36Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
12462306a36Sopenharmony_ci};
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_cistruct snd_hwdep_dsp_image {
12762306a36Sopenharmony_ci	unsigned int index;		/* W: DSP index */
12862306a36Sopenharmony_ci	unsigned char name[64];		/* W: ID (e.g. file name) */
12962306a36Sopenharmony_ci	unsigned char __user *image;	/* W: binary image */
13062306a36Sopenharmony_ci	size_t length;			/* W: size of image in bytes */
13162306a36Sopenharmony_ci	unsigned long driver_data;	/* W: driver-specific data */
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_PVERSION	_IOR ('H', 0x00, int)
13562306a36Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_INFO		_IOR ('H', 0x01, struct snd_hwdep_info)
13662306a36Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_STATUS	_IOR('H', 0x02, struct snd_hwdep_dsp_status)
13762306a36Sopenharmony_ci#define SNDRV_HWDEP_IOCTL_DSP_LOAD	_IOW('H', 0x03, struct snd_hwdep_dsp_image)
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci/*****************************************************************************
14062306a36Sopenharmony_ci *                                                                           *
14162306a36Sopenharmony_ci *             Digital Audio (PCM) interface - /dev/snd/pcm??                *
14262306a36Sopenharmony_ci *                                                                           *
14362306a36Sopenharmony_ci *****************************************************************************/
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 15)
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_citypedef unsigned long snd_pcm_uframes_t;
14862306a36Sopenharmony_citypedef signed long snd_pcm_sframes_t;
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_cienum {
15162306a36Sopenharmony_ci	SNDRV_PCM_CLASS_GENERIC = 0,	/* standard mono or stereo device */
15262306a36Sopenharmony_ci	SNDRV_PCM_CLASS_MULTI,		/* multichannel device */
15362306a36Sopenharmony_ci	SNDRV_PCM_CLASS_MODEM,		/* software modem class */
15462306a36Sopenharmony_ci	SNDRV_PCM_CLASS_DIGITIZER,	/* digitizer class */
15562306a36Sopenharmony_ci	/* Don't forget to change the following: */
15662306a36Sopenharmony_ci	SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
15762306a36Sopenharmony_ci};
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_cienum {
16062306a36Sopenharmony_ci	SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
16162306a36Sopenharmony_ci	SNDRV_PCM_SUBCLASS_MULTI_MIX,	/* multichannel subdevices are mixed together */
16262306a36Sopenharmony_ci	/* Don't forget to change the following: */
16362306a36Sopenharmony_ci	SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
16462306a36Sopenharmony_ci};
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_cienum {
16762306a36Sopenharmony_ci	SNDRV_PCM_STREAM_PLAYBACK = 0,
16862306a36Sopenharmony_ci	SNDRV_PCM_STREAM_CAPTURE,
16962306a36Sopenharmony_ci	SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
17062306a36Sopenharmony_ci};
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_citypedef int __bitwise snd_pcm_access_t;
17362306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_INTERLEAVED	((__force snd_pcm_access_t) 0) /* interleaved mmap */
17462306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED	((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
17562306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_MMAP_COMPLEX		((__force snd_pcm_access_t) 2) /* complex mmap */
17662306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_INTERLEAVED		((__force snd_pcm_access_t) 3) /* readi/writei */
17762306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_RW_NONINTERLEAVED	((__force snd_pcm_access_t) 4) /* readn/writen */
17862306a36Sopenharmony_ci#define	SNDRV_PCM_ACCESS_LAST		SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_citypedef int __bitwise snd_pcm_format_t;
18162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S8	((__force snd_pcm_format_t) 0)
18262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U8	((__force snd_pcm_format_t) 1)
18362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_LE	((__force snd_pcm_format_t) 2)
18462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16_BE	((__force snd_pcm_format_t) 3)
18562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_LE	((__force snd_pcm_format_t) 4)
18662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16_BE	((__force snd_pcm_format_t) 5)
18762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_LE	((__force snd_pcm_format_t) 6) /* low three bytes */
18862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_BE	((__force snd_pcm_format_t) 7) /* low three bytes */
18962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_LE	((__force snd_pcm_format_t) 8) /* low three bytes */
19062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_BE	((__force snd_pcm_format_t) 9) /* low three bytes */
19162306a36Sopenharmony_ci/*
19262306a36Sopenharmony_ci * For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
19362306a36Sopenharmony_ci * available bit count in most significant bit. It's for the case of so-called 'left-justified' or
19462306a36Sopenharmony_ci * `right-padding` sample which has less width than 32 bit.
19562306a36Sopenharmony_ci */
19662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_LE	((__force snd_pcm_format_t) 10)
19762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32_BE	((__force snd_pcm_format_t) 11)
19862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_LE	((__force snd_pcm_format_t) 12)
19962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32_BE	((__force snd_pcm_format_t) 13)
20062306a36Sopenharmony_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 */
20162306a36Sopenharmony_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 */
20262306a36Sopenharmony_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 */
20362306a36Sopenharmony_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 */
20462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
20562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
20662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MU_LAW		((__force snd_pcm_format_t) 20)
20762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_A_LAW		((__force snd_pcm_format_t) 21)
20862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IMA_ADPCM	((__force snd_pcm_format_t) 22)
20962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_MPEG		((__force snd_pcm_format_t) 23)
21062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_GSM		((__force snd_pcm_format_t) 24)
21162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_LE	((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
21262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_BE	((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
21362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_LE	((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
21462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_BE	((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
21562306a36Sopenharmony_ci/* gap in the numbering for a future standard linear format */
21662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_SPECIAL	((__force snd_pcm_format_t) 31)
21762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3LE	((__force snd_pcm_format_t) 32)	/* in three bytes */
21862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24_3BE	((__force snd_pcm_format_t) 33)	/* in three bytes */
21962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3LE	((__force snd_pcm_format_t) 34)	/* in three bytes */
22062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24_3BE	((__force snd_pcm_format_t) 35)	/* in three bytes */
22162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3LE	((__force snd_pcm_format_t) 36)	/* in three bytes */
22262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20_3BE	((__force snd_pcm_format_t) 37)	/* in three bytes */
22362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3LE	((__force snd_pcm_format_t) 38)	/* in three bytes */
22462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20_3BE	((__force snd_pcm_format_t) 39)	/* in three bytes */
22562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3LE	((__force snd_pcm_format_t) 40)	/* in three bytes */
22662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S18_3BE	((__force snd_pcm_format_t) 41)	/* in three bytes */
22762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3LE	((__force snd_pcm_format_t) 42)	/* in three bytes */
22862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U18_3BE	((__force snd_pcm_format_t) 43)	/* in three bytes */
22962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24	((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
23062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_24_1B	((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
23162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40	((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
23262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_G723_40_1B	((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
23362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U8		((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
23462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_LE	((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
23562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_LE	((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
23662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U16_BE	((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
23762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_DSD_U32_BE	((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
23862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_DSD_U32_BE
23962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FIRST		SNDRV_PCM_FORMAT_S8
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci#ifdef SNDRV_LITTLE_ENDIAN
24262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_LE
24362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_LE
24462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_LE
24562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_LE
24662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_LE
24762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_LE
24862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_LE
24962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_LE
25062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
25162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_LE
25262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_LE
25362306a36Sopenharmony_ci#endif
25462306a36Sopenharmony_ci#ifdef SNDRV_BIG_ENDIAN
25562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_BE
25662306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U16		SNDRV_PCM_FORMAT_U16_BE
25762306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S24		SNDRV_PCM_FORMAT_S24_BE
25862306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U24		SNDRV_PCM_FORMAT_U24_BE
25962306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S32		SNDRV_PCM_FORMAT_S32_BE
26062306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U32		SNDRV_PCM_FORMAT_U32_BE
26162306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT		SNDRV_PCM_FORMAT_FLOAT_BE
26262306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_FLOAT64	SNDRV_PCM_FORMAT_FLOAT64_BE
26362306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
26462306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_S20		SNDRV_PCM_FORMAT_S20_BE
26562306a36Sopenharmony_ci#define	SNDRV_PCM_FORMAT_U20		SNDRV_PCM_FORMAT_U20_BE
26662306a36Sopenharmony_ci#endif
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_citypedef int __bitwise snd_pcm_subformat_t;
26962306a36Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_STD		((__force snd_pcm_subformat_t) 0)
27062306a36Sopenharmony_ci#define	SNDRV_PCM_SUBFORMAT_LAST	SNDRV_PCM_SUBFORMAT_STD
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP		0x00000001	/* hardware supports mmap */
27362306a36Sopenharmony_ci#define SNDRV_PCM_INFO_MMAP_VALID	0x00000002	/* period data are valid during transfer */
27462306a36Sopenharmony_ci#define SNDRV_PCM_INFO_DOUBLE		0x00000004	/* Double buffering needed for PCM start/stop */
27562306a36Sopenharmony_ci#define SNDRV_PCM_INFO_BATCH		0x00000010	/* double buffering */
27662306a36Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_APPLPTR	0x00000020	/* need the explicit sync of appl_ptr update */
27762306a36Sopenharmony_ci#define SNDRV_PCM_INFO_PERFECT_DRAIN	0x00000040	/* silencing at the end of stream is not required */
27862306a36Sopenharmony_ci#define SNDRV_PCM_INFO_INTERLEAVED	0x00000100	/* channels are interleaved */
27962306a36Sopenharmony_ci#define SNDRV_PCM_INFO_NONINTERLEAVED	0x00000200	/* channels are not interleaved */
28062306a36Sopenharmony_ci#define SNDRV_PCM_INFO_COMPLEX		0x00000400	/* complex frame organization (mmap only) */
28162306a36Sopenharmony_ci#define SNDRV_PCM_INFO_BLOCK_TRANSFER	0x00010000	/* hardware transfer block of samples */
28262306a36Sopenharmony_ci#define SNDRV_PCM_INFO_OVERRANGE	0x00020000	/* hardware supports ADC (capture) overrange detection */
28362306a36Sopenharmony_ci#define SNDRV_PCM_INFO_RESUME		0x00040000	/* hardware supports stream resume after suspend */
28462306a36Sopenharmony_ci#define SNDRV_PCM_INFO_PAUSE		0x00080000	/* pause ioctl is supported */
28562306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HALF_DUPLEX	0x00100000	/* only half duplex */
28662306a36Sopenharmony_ci#define SNDRV_PCM_INFO_JOINT_DUPLEX	0x00200000	/* playback and capture stream are somewhat correlated */
28762306a36Sopenharmony_ci#define SNDRV_PCM_INFO_SYNC_START	0x00400000	/* pcm support some kind of sync go */
28862306a36Sopenharmony_ci#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP	0x00800000	/* period wakeup can be disabled */
28962306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* (Deprecated)has audio wall clock for audio/system time sync */
29062306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ATIME              0x01000000  /* report hardware link audio time, reset on startup */
29162306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME     0x02000000  /* report absolute hardware link audio time, not reset on startup */
29262306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME    0x04000000  /* report estimated link audio time */
29362306a36Sopenharmony_ci#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000  /* report synchronized audio/system time */
29462306a36Sopenharmony_ci#define SNDRV_PCM_INFO_EXPLICIT_SYNC	0x10000000	/* needs explicit sync of pointers and data */
29562306a36Sopenharmony_ci#define SNDRV_PCM_INFO_NO_REWINDS	0x20000000	/* hardware can only support monotonic changes of appl_ptr */
29662306a36Sopenharmony_ci#define SNDRV_PCM_INFO_DRAIN_TRIGGER	0x40000000		/* internal kernel flag - trigger in drain */
29762306a36Sopenharmony_ci#define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
30062306a36Sopenharmony_ci#define __SND_STRUCT_TIME64
30162306a36Sopenharmony_ci#endif
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_citypedef int __bitwise snd_pcm_state_t;
30462306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_OPEN		((__force snd_pcm_state_t) 0) /* stream is open */
30562306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_SETUP		((__force snd_pcm_state_t) 1) /* stream has a setup */
30662306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_PREPARED	((__force snd_pcm_state_t) 2) /* stream is ready to start */
30762306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_RUNNING		((__force snd_pcm_state_t) 3) /* stream is running */
30862306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_XRUN		((__force snd_pcm_state_t) 4) /* stream reached an xrun */
30962306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_DRAINING	((__force snd_pcm_state_t) 5) /* stream is draining */
31062306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_PAUSED		((__force snd_pcm_state_t) 6) /* stream is paused */
31162306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_SUSPENDED	((__force snd_pcm_state_t) 7) /* hardware is suspended */
31262306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_DISCONNECTED	((__force snd_pcm_state_t) 8) /* hardware is disconnected */
31362306a36Sopenharmony_ci#define	SNDRV_PCM_STATE_LAST		SNDRV_PCM_STATE_DISCONNECTED
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_cienum {
31662306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
31762306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
31862306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
31962306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
32062306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
32162306a36Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
32262306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
32362306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
32462306a36Sopenharmony_ci#else
32562306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
32662306a36Sopenharmony_ci	SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
32762306a36Sopenharmony_ci#endif
32862306a36Sopenharmony_ci};
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ciunion snd_pcm_sync_id {
33162306a36Sopenharmony_ci	unsigned char id[16];
33262306a36Sopenharmony_ci	unsigned short id16[8];
33362306a36Sopenharmony_ci	unsigned int id32[4];
33462306a36Sopenharmony_ci};
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_cistruct snd_pcm_info {
33762306a36Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
33862306a36Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
33962306a36Sopenharmony_ci	int stream;			/* RO/WR (control): stream direction */
34062306a36Sopenharmony_ci	int card;			/* R: card number */
34162306a36Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
34262306a36Sopenharmony_ci	unsigned char name[80];		/* name of this device */
34362306a36Sopenharmony_ci	unsigned char subname[32];	/* subdevice name */
34462306a36Sopenharmony_ci	int dev_class;			/* SNDRV_PCM_CLASS_* */
34562306a36Sopenharmony_ci	int dev_subclass;		/* SNDRV_PCM_SUBCLASS_* */
34662306a36Sopenharmony_ci	unsigned int subdevices_count;
34762306a36Sopenharmony_ci	unsigned int subdevices_avail;
34862306a36Sopenharmony_ci	union snd_pcm_sync_id sync;	/* hardware synchronization ID */
34962306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future... */
35062306a36Sopenharmony_ci};
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_citypedef int snd_pcm_hw_param_t;
35362306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_ACCESS	0	/* Access type */
35462306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FORMAT	1	/* Format */
35562306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SUBFORMAT	2	/* Subformat */
35662306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_MASK	SNDRV_PCM_HW_PARAM_ACCESS
35762306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_MASK	SNDRV_PCM_HW_PARAM_SUBFORMAT
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_SAMPLE_BITS	8	/* Bits per sample */
36062306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FRAME_BITS	9	/* Bits per frame */
36162306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_CHANNELS	10	/* Channels */
36262306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_RATE		11	/* Approx rate */
36362306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_TIME	12	/* Approx distance between
36462306a36Sopenharmony_ci						 * interrupts in us
36562306a36Sopenharmony_ci						 */
36662306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_SIZE	13	/* Approx frames between
36762306a36Sopenharmony_ci						 * interrupts
36862306a36Sopenharmony_ci						 */
36962306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIOD_BYTES	14	/* Approx bytes between
37062306a36Sopenharmony_ci						 * interrupts
37162306a36Sopenharmony_ci						 */
37262306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_PERIODS	15	/* Approx interrupts per
37362306a36Sopenharmony_ci						 * buffer
37462306a36Sopenharmony_ci						 */
37562306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_TIME	16	/* Approx duration of buffer
37662306a36Sopenharmony_ci						 * in us
37762306a36Sopenharmony_ci						 */
37862306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_SIZE	17	/* Size of buffer in frames */
37962306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_BUFFER_BYTES	18	/* Size of buffer in bytes */
38062306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_TICK_TIME	19	/* Approx tick duration in us */
38162306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_FIRST_INTERVAL	SNDRV_PCM_HW_PARAM_SAMPLE_BITS
38262306a36Sopenharmony_ci#define	SNDRV_PCM_HW_PARAM_LAST_INTERVAL	SNDRV_PCM_HW_PARAM_TICK_TIME
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NORESAMPLE	(1<<0)	/* avoid rate resampling */
38562306a36Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER	(1<<1)	/* export buffer */
38662306a36Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP	(1<<2)	/* disable period wakeups */
38762306a36Sopenharmony_ci#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE	(1<<3)	/* suppress drain with the filling
38862306a36Sopenharmony_ci							 * of the silence samples
38962306a36Sopenharmony_ci							 */
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_cistruct snd_interval {
39262306a36Sopenharmony_ci	unsigned int min, max;
39362306a36Sopenharmony_ci	unsigned int openmin:1,
39462306a36Sopenharmony_ci		     openmax:1,
39562306a36Sopenharmony_ci		     integer:1,
39662306a36Sopenharmony_ci		     empty:1;
39762306a36Sopenharmony_ci};
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci#define SNDRV_MASK_MAX	256
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_cistruct snd_mask {
40262306a36Sopenharmony_ci	__u32 bits[(SNDRV_MASK_MAX+31)/32];
40362306a36Sopenharmony_ci};
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_cistruct snd_pcm_hw_params {
40662306a36Sopenharmony_ci	unsigned int flags;
40762306a36Sopenharmony_ci	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
40862306a36Sopenharmony_ci			       SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
40962306a36Sopenharmony_ci	struct snd_mask mres[5];	/* reserved masks */
41062306a36Sopenharmony_ci	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
41162306a36Sopenharmony_ci				        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
41262306a36Sopenharmony_ci	struct snd_interval ires[9];	/* reserved intervals */
41362306a36Sopenharmony_ci	unsigned int rmask;		/* W: requested masks */
41462306a36Sopenharmony_ci	unsigned int cmask;		/* R: changed masks */
41562306a36Sopenharmony_ci	unsigned int info;		/* R: Info flags for returned setup */
41662306a36Sopenharmony_ci	unsigned int msbits;		/* R: used most significant bits */
41762306a36Sopenharmony_ci	unsigned int rate_num;		/* R: rate numerator */
41862306a36Sopenharmony_ci	unsigned int rate_den;		/* R: rate denominator */
41962306a36Sopenharmony_ci	snd_pcm_uframes_t fifo_size;	/* R: chip FIFO size in frames */
42062306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future */
42162306a36Sopenharmony_ci};
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_cienum {
42462306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_NONE = 0,
42562306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_ENABLE,
42662306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
42762306a36Sopenharmony_ci};
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_cistruct snd_pcm_sw_params {
43062306a36Sopenharmony_ci	int tstamp_mode;			/* timestamp mode */
43162306a36Sopenharmony_ci	unsigned int period_step;
43262306a36Sopenharmony_ci	unsigned int sleep_min;			/* min ticks to sleep */
43362306a36Sopenharmony_ci	snd_pcm_uframes_t avail_min;		/* min avail frames for wakeup */
43462306a36Sopenharmony_ci	snd_pcm_uframes_t xfer_align;		/* obsolete: xfer size need to be a multiple */
43562306a36Sopenharmony_ci	snd_pcm_uframes_t start_threshold;	/* min hw_avail frames for automatic start */
43662306a36Sopenharmony_ci	/*
43762306a36Sopenharmony_ci	 * The following two thresholds alleviate playback buffer underruns; when
43862306a36Sopenharmony_ci	 * hw_avail drops below the threshold, the respective action is triggered:
43962306a36Sopenharmony_ci	 */
44062306a36Sopenharmony_ci	snd_pcm_uframes_t stop_threshold;	/* - stop playback */
44162306a36Sopenharmony_ci	snd_pcm_uframes_t silence_threshold;	/* - pre-fill buffer with silence */
44262306a36Sopenharmony_ci	snd_pcm_uframes_t silence_size;		/* max size of silence pre-fill; when >= boundary,
44362306a36Sopenharmony_ci						 * fill played area with silence immediately */
44462306a36Sopenharmony_ci	snd_pcm_uframes_t boundary;		/* pointers wrap point */
44562306a36Sopenharmony_ci	unsigned int proto;			/* protocol version */
44662306a36Sopenharmony_ci	unsigned int tstamp_type;		/* timestamp type (req. proto >= 2.0.12) */
44762306a36Sopenharmony_ci	unsigned char reserved[56];		/* reserved for future */
44862306a36Sopenharmony_ci};
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_cistruct snd_pcm_channel_info {
45162306a36Sopenharmony_ci	unsigned int channel;
45262306a36Sopenharmony_ci	__kernel_off_t offset;		/* mmap offset */
45362306a36Sopenharmony_ci	unsigned int first;		/* offset to first sample in bits */
45462306a36Sopenharmony_ci	unsigned int step;		/* samples distance in bits */
45562306a36Sopenharmony_ci};
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_cienum {
45862306a36Sopenharmony_ci	/*
45962306a36Sopenharmony_ci	 *  first definition for backwards compatibility only,
46062306a36Sopenharmony_ci	 *  maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
46162306a36Sopenharmony_ci	 */
46262306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ci	/* timestamp definitions */
46562306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1,           /* DMA time, reported as per hw_ptr */
46662306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2,	           /* link time reported by sample or wallclock counter, reset on startup */
46762306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3,	   /* link time reported by sample or wallclock counter, not reset on startup */
46862306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4,    /* link time estimated indirectly */
46962306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
47062306a36Sopenharmony_ci	SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
47162306a36Sopenharmony_ci};
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci#ifndef __KERNEL__
47462306a36Sopenharmony_ci/* explicit padding avoids incompatibility between i386 and x86-64 */
47562306a36Sopenharmony_citypedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_cistruct snd_pcm_status {
47862306a36Sopenharmony_ci	snd_pcm_state_t state;		/* stream state */
47962306a36Sopenharmony_ci	__time_pad pad1;		/* align to timespec */
48062306a36Sopenharmony_ci	struct timespec trigger_tstamp;	/* time when stream was started/stopped/paused */
48162306a36Sopenharmony_ci	struct timespec tstamp;		/* reference timestamp */
48262306a36Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* appl ptr */
48362306a36Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* hw ptr */
48462306a36Sopenharmony_ci	snd_pcm_sframes_t delay;	/* current delay in frames */
48562306a36Sopenharmony_ci	snd_pcm_uframes_t avail;	/* number of frames available */
48662306a36Sopenharmony_ci	snd_pcm_uframes_t avail_max;	/* max frames available on hw since last status */
48762306a36Sopenharmony_ci	snd_pcm_uframes_t overrange;	/* count of ADC (capture) overrange detections from last status */
48862306a36Sopenharmony_ci	snd_pcm_state_t suspended_state; /* suspended stream state */
48962306a36Sopenharmony_ci	__u32 audio_tstamp_data;	 /* needed for 64-bit alignment, used for configs/report to/from userspace */
49062306a36Sopenharmony_ci	struct timespec audio_tstamp;	/* sample counter, wall clock, PHC or on-demand sync'ed */
49162306a36Sopenharmony_ci	struct timespec driver_tstamp;	/* useful in case reference system tstamp is reported with delay */
49262306a36Sopenharmony_ci	__u32 audio_tstamp_accuracy;	/* in ns units, only valid if indicated in audio_tstamp_data */
49362306a36Sopenharmony_ci	unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
49462306a36Sopenharmony_ci};
49562306a36Sopenharmony_ci#endif
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/*
49862306a36Sopenharmony_ci * For mmap operations, we need the 64-bit layout, both for compat mode,
49962306a36Sopenharmony_ci * and for y2038 compatibility. For 64-bit applications, the two definitions
50062306a36Sopenharmony_ci * are identical, so we keep the traditional version.
50162306a36Sopenharmony_ci */
50262306a36Sopenharmony_ci#ifdef __SND_STRUCT_TIME64
50362306a36Sopenharmony_ci#define __snd_pcm_mmap_status64		snd_pcm_mmap_status
50462306a36Sopenharmony_ci#define __snd_pcm_mmap_control64	snd_pcm_mmap_control
50562306a36Sopenharmony_ci#define __snd_pcm_sync_ptr64		snd_pcm_sync_ptr
50662306a36Sopenharmony_ci#ifdef __KERNEL__
50762306a36Sopenharmony_ci#define __snd_timespec64		__kernel_timespec
50862306a36Sopenharmony_ci#else
50962306a36Sopenharmony_ci#define __snd_timespec64		timespec
51062306a36Sopenharmony_ci#endif
51162306a36Sopenharmony_cistruct __snd_timespec {
51262306a36Sopenharmony_ci	__s32 tv_sec;
51362306a36Sopenharmony_ci	__s32 tv_nsec;
51462306a36Sopenharmony_ci};
51562306a36Sopenharmony_ci#else
51662306a36Sopenharmony_ci#define __snd_pcm_mmap_status		snd_pcm_mmap_status
51762306a36Sopenharmony_ci#define __snd_pcm_mmap_control		snd_pcm_mmap_control
51862306a36Sopenharmony_ci#define __snd_pcm_sync_ptr		snd_pcm_sync_ptr
51962306a36Sopenharmony_ci#define __snd_timespec			timespec
52062306a36Sopenharmony_cistruct __snd_timespec64 {
52162306a36Sopenharmony_ci	__s64 tv_sec;
52262306a36Sopenharmony_ci	__s64 tv_nsec;
52362306a36Sopenharmony_ci};
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci#endif
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_cistruct __snd_pcm_mmap_status {
52862306a36Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
52962306a36Sopenharmony_ci	int pad1;			/* Needed for 64 bit alignment */
53062306a36Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
53162306a36Sopenharmony_ci	struct __snd_timespec tstamp;	/* Timestamp */
53262306a36Sopenharmony_ci	snd_pcm_state_t suspended_state; /* RO: suspended stream state */
53362306a36Sopenharmony_ci	struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
53462306a36Sopenharmony_ci};
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_cistruct __snd_pcm_mmap_control {
53762306a36Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	/* RW: appl ptr (0...boundary-1) */
53862306a36Sopenharmony_ci	snd_pcm_uframes_t avail_min;	/* RW: min available frames for wakeup */
53962306a36Sopenharmony_ci};
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_HWSYNC	(1<<0)	/* execute hwsync */
54262306a36Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_APPL		(1<<1)	/* get appl_ptr from driver (r/w op) */
54362306a36Sopenharmony_ci#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN	(1<<2)	/* get avail_min from driver */
54462306a36Sopenharmony_ci
54562306a36Sopenharmony_cistruct __snd_pcm_sync_ptr {
54662306a36Sopenharmony_ci	unsigned int flags;
54762306a36Sopenharmony_ci	union {
54862306a36Sopenharmony_ci		struct __snd_pcm_mmap_status status;
54962306a36Sopenharmony_ci		unsigned char reserved[64];
55062306a36Sopenharmony_ci	} s;
55162306a36Sopenharmony_ci	union {
55262306a36Sopenharmony_ci		struct __snd_pcm_mmap_control control;
55362306a36Sopenharmony_ci		unsigned char reserved[64];
55462306a36Sopenharmony_ci	} c;
55562306a36Sopenharmony_ci};
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
55862306a36Sopenharmony_citypedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
55962306a36Sopenharmony_citypedef char __pad_after_uframe[0];
56062306a36Sopenharmony_ci#endif
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ci#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
56362306a36Sopenharmony_citypedef char __pad_before_uframe[0];
56462306a36Sopenharmony_citypedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
56562306a36Sopenharmony_ci#endif
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_cistruct __snd_pcm_mmap_status64 {
56862306a36Sopenharmony_ci	snd_pcm_state_t state;		/* RO: state - SNDRV_PCM_STATE_XXXX */
56962306a36Sopenharmony_ci	__u32 pad1;			/* Needed for 64 bit alignment */
57062306a36Sopenharmony_ci	__pad_before_uframe __pad1;
57162306a36Sopenharmony_ci	snd_pcm_uframes_t hw_ptr;	/* RO: hw ptr (0...boundary-1) */
57262306a36Sopenharmony_ci	__pad_after_uframe __pad2;
57362306a36Sopenharmony_ci	struct __snd_timespec64 tstamp;	/* Timestamp */
57462306a36Sopenharmony_ci	snd_pcm_state_t suspended_state;/* RO: suspended stream state */
57562306a36Sopenharmony_ci	__u32 pad3;			/* Needed for 64 bit alignment */
57662306a36Sopenharmony_ci	struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
57762306a36Sopenharmony_ci};
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_cistruct __snd_pcm_mmap_control64 {
58062306a36Sopenharmony_ci	__pad_before_uframe __pad1;
58162306a36Sopenharmony_ci	snd_pcm_uframes_t appl_ptr;	 /* RW: appl ptr (0...boundary-1) */
58262306a36Sopenharmony_ci	__pad_before_uframe __pad2;	 // This should be __pad_after_uframe, but binary
58362306a36Sopenharmony_ci					 // backwards compatibility constraints prevent a fix.
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ci	__pad_before_uframe __pad3;
58662306a36Sopenharmony_ci	snd_pcm_uframes_t  avail_min;	 /* RW: min available frames for wakeup */
58762306a36Sopenharmony_ci	__pad_after_uframe __pad4;
58862306a36Sopenharmony_ci};
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_cistruct __snd_pcm_sync_ptr64 {
59162306a36Sopenharmony_ci	__u32 flags;
59262306a36Sopenharmony_ci	__u32 pad1;
59362306a36Sopenharmony_ci	union {
59462306a36Sopenharmony_ci		struct __snd_pcm_mmap_status64 status;
59562306a36Sopenharmony_ci		unsigned char reserved[64];
59662306a36Sopenharmony_ci	} s;
59762306a36Sopenharmony_ci	union {
59862306a36Sopenharmony_ci		struct __snd_pcm_mmap_control64 control;
59962306a36Sopenharmony_ci		unsigned char reserved[64];
60062306a36Sopenharmony_ci	} c;
60162306a36Sopenharmony_ci};
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_cistruct snd_xferi {
60462306a36Sopenharmony_ci	snd_pcm_sframes_t result;
60562306a36Sopenharmony_ci	void __user *buf;
60662306a36Sopenharmony_ci	snd_pcm_uframes_t frames;
60762306a36Sopenharmony_ci};
60862306a36Sopenharmony_ci
60962306a36Sopenharmony_cistruct snd_xfern {
61062306a36Sopenharmony_ci	snd_pcm_sframes_t result;
61162306a36Sopenharmony_ci	void __user * __user *bufs;
61262306a36Sopenharmony_ci	snd_pcm_uframes_t frames;
61362306a36Sopenharmony_ci};
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_cienum {
61662306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,	/* gettimeofday equivalent */
61762306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,	/* posix_clock_monotonic equivalent */
61862306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,    /* monotonic_raw (no NTP) */
61962306a36Sopenharmony_ci	SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
62062306a36Sopenharmony_ci};
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_ci/* channel positions */
62362306a36Sopenharmony_cienum {
62462306a36Sopenharmony_ci	SNDRV_CHMAP_UNKNOWN = 0,
62562306a36Sopenharmony_ci	SNDRV_CHMAP_NA,		/* N/A, silent */
62662306a36Sopenharmony_ci	SNDRV_CHMAP_MONO,	/* mono stream */
62762306a36Sopenharmony_ci	/* this follows the alsa-lib mixer channel value + 3 */
62862306a36Sopenharmony_ci	SNDRV_CHMAP_FL,		/* front left */
62962306a36Sopenharmony_ci	SNDRV_CHMAP_FR,		/* front right */
63062306a36Sopenharmony_ci	SNDRV_CHMAP_RL,		/* rear left */
63162306a36Sopenharmony_ci	SNDRV_CHMAP_RR,		/* rear right */
63262306a36Sopenharmony_ci	SNDRV_CHMAP_FC,		/* front center */
63362306a36Sopenharmony_ci	SNDRV_CHMAP_LFE,	/* LFE */
63462306a36Sopenharmony_ci	SNDRV_CHMAP_SL,		/* side left */
63562306a36Sopenharmony_ci	SNDRV_CHMAP_SR,		/* side right */
63662306a36Sopenharmony_ci	SNDRV_CHMAP_RC,		/* rear center */
63762306a36Sopenharmony_ci	/* new definitions */
63862306a36Sopenharmony_ci	SNDRV_CHMAP_FLC,	/* front left center */
63962306a36Sopenharmony_ci	SNDRV_CHMAP_FRC,	/* front right center */
64062306a36Sopenharmony_ci	SNDRV_CHMAP_RLC,	/* rear left center */
64162306a36Sopenharmony_ci	SNDRV_CHMAP_RRC,	/* rear right center */
64262306a36Sopenharmony_ci	SNDRV_CHMAP_FLW,	/* front left wide */
64362306a36Sopenharmony_ci	SNDRV_CHMAP_FRW,	/* front right wide */
64462306a36Sopenharmony_ci	SNDRV_CHMAP_FLH,	/* front left high */
64562306a36Sopenharmony_ci	SNDRV_CHMAP_FCH,	/* front center high */
64662306a36Sopenharmony_ci	SNDRV_CHMAP_FRH,	/* front right high */
64762306a36Sopenharmony_ci	SNDRV_CHMAP_TC,		/* top center */
64862306a36Sopenharmony_ci	SNDRV_CHMAP_TFL,	/* top front left */
64962306a36Sopenharmony_ci	SNDRV_CHMAP_TFR,	/* top front right */
65062306a36Sopenharmony_ci	SNDRV_CHMAP_TFC,	/* top front center */
65162306a36Sopenharmony_ci	SNDRV_CHMAP_TRL,	/* top rear left */
65262306a36Sopenharmony_ci	SNDRV_CHMAP_TRR,	/* top rear right */
65362306a36Sopenharmony_ci	SNDRV_CHMAP_TRC,	/* top rear center */
65462306a36Sopenharmony_ci	/* new definitions for UAC2 */
65562306a36Sopenharmony_ci	SNDRV_CHMAP_TFLC,	/* top front left center */
65662306a36Sopenharmony_ci	SNDRV_CHMAP_TFRC,	/* top front right center */
65762306a36Sopenharmony_ci	SNDRV_CHMAP_TSL,	/* top side left */
65862306a36Sopenharmony_ci	SNDRV_CHMAP_TSR,	/* top side right */
65962306a36Sopenharmony_ci	SNDRV_CHMAP_LLFE,	/* left LFE */
66062306a36Sopenharmony_ci	SNDRV_CHMAP_RLFE,	/* right LFE */
66162306a36Sopenharmony_ci	SNDRV_CHMAP_BC,		/* bottom center */
66262306a36Sopenharmony_ci	SNDRV_CHMAP_BLC,	/* bottom left center */
66362306a36Sopenharmony_ci	SNDRV_CHMAP_BRC,	/* bottom right center */
66462306a36Sopenharmony_ci	SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
66562306a36Sopenharmony_ci};
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci#define SNDRV_CHMAP_POSITION_MASK	0xffff
66862306a36Sopenharmony_ci#define SNDRV_CHMAP_PHASE_INVERSE	(0x01 << 16)
66962306a36Sopenharmony_ci#define SNDRV_CHMAP_DRIVER_SPEC		(0x02 << 16)
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_PVERSION	_IOR('A', 0x00, int)
67262306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_INFO		_IOR('A', 0x01, struct snd_pcm_info)
67362306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_TSTAMP		_IOW('A', 0x02, int)
67462306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_TTSTAMP		_IOW('A', 0x03, int)
67562306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_USER_PVERSION	_IOW('A', 0x04, int)
67662306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_REFINE	_IOWR('A', 0x10, struct snd_pcm_hw_params)
67762306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_PARAMS	_IOWR('A', 0x11, struct snd_pcm_hw_params)
67862306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_HW_FREE		_IO('A', 0x12)
67962306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_SW_PARAMS	_IOWR('A', 0x13, struct snd_pcm_sw_params)
68062306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS		_IOR('A', 0x20, struct snd_pcm_status)
68162306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_DELAY		_IOR('A', 0x21, snd_pcm_sframes_t)
68262306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_HWSYNC		_IO('A', 0x22)
68362306a36Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
68462306a36Sopenharmony_ci#define __SNDRV_PCM_IOCTL_SYNC_PTR64	_IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
68562306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct snd_pcm_sync_ptr)
68662306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_STATUS_EXT	_IOWR('A', 0x24, struct snd_pcm_status)
68762306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_CHANNEL_INFO	_IOR('A', 0x32, struct snd_pcm_channel_info)
68862306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_PREPARE		_IO('A', 0x40)
68962306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESET		_IO('A', 0x41)
69062306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_START		_IO('A', 0x42)
69162306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_DROP		_IO('A', 0x43)
69262306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_DRAIN		_IO('A', 0x44)
69362306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_PAUSE		_IOW('A', 0x45, int)
69462306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_REWIND		_IOW('A', 0x46, snd_pcm_uframes_t)
69562306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_RESUME		_IO('A', 0x47)
69662306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_XRUN		_IO('A', 0x48)
69762306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_FORWARD		_IOW('A', 0x49, snd_pcm_uframes_t)
69862306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEI_FRAMES	_IOW('A', 0x50, struct snd_xferi)
69962306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_READI_FRAMES	_IOR('A', 0x51, struct snd_xferi)
70062306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_WRITEN_FRAMES	_IOW('A', 0x52, struct snd_xfern)
70162306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_READN_FRAMES	_IOR('A', 0x53, struct snd_xfern)
70262306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_LINK		_IOW('A', 0x60, int)
70362306a36Sopenharmony_ci#define SNDRV_PCM_IOCTL_UNLINK		_IO('A', 0x61)
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ci/*****************************************************************************
70662306a36Sopenharmony_ci *                                                                           *
70762306a36Sopenharmony_ci *                            MIDI v1.0 interface                            *
70862306a36Sopenharmony_ci *                                                                           *
70962306a36Sopenharmony_ci *****************************************************************************/
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_ci/*
71262306a36Sopenharmony_ci *  Raw MIDI section - /dev/snd/midi??
71362306a36Sopenharmony_ci */
71462306a36Sopenharmony_ci
71562306a36Sopenharmony_ci#define SNDRV_RAWMIDI_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 4)
71662306a36Sopenharmony_ci
71762306a36Sopenharmony_cienum {
71862306a36Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
71962306a36Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_INPUT,
72062306a36Sopenharmony_ci	SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
72162306a36Sopenharmony_ci};
72262306a36Sopenharmony_ci
72362306a36Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_OUTPUT		0x00000001
72462306a36Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_INPUT		0x00000002
72562306a36Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_DUPLEX		0x00000004
72662306a36Sopenharmony_ci#define SNDRV_RAWMIDI_INFO_UMP			0x00000008
72762306a36Sopenharmony_ci
72862306a36Sopenharmony_cistruct snd_rawmidi_info {
72962306a36Sopenharmony_ci	unsigned int device;		/* RO/WR (control): device number */
73062306a36Sopenharmony_ci	unsigned int subdevice;		/* RO/WR (control): subdevice number */
73162306a36Sopenharmony_ci	int stream;			/* WR: stream */
73262306a36Sopenharmony_ci	int card;			/* R: card number */
73362306a36Sopenharmony_ci	unsigned int flags;		/* SNDRV_RAWMIDI_INFO_XXXX */
73462306a36Sopenharmony_ci	unsigned char id[64];		/* ID (user selectable) */
73562306a36Sopenharmony_ci	unsigned char name[80];		/* name of device */
73662306a36Sopenharmony_ci	unsigned char subname[32];	/* name of active or selected subdevice */
73762306a36Sopenharmony_ci	unsigned int subdevices_count;
73862306a36Sopenharmony_ci	unsigned int subdevices_avail;
73962306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved for future use */
74062306a36Sopenharmony_ci};
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_MASK		(7<<0)
74362306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_SHIFT	0
74462306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_NONE		(0<<0)
74562306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP	(1<<0)
74662306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MASK		(7<<3)
74762306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_SHIFT		3
74862306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_NONE		(0<<3)
74962306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_REALTIME	(1<<3)
75062306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC	(2<<3)
75162306a36Sopenharmony_ci#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC_RAW	(3<<3)
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci#define SNDRV_RAWMIDI_FRAMING_DATA_LENGTH 16
75462306a36Sopenharmony_ci
75562306a36Sopenharmony_cistruct snd_rawmidi_framing_tstamp {
75662306a36Sopenharmony_ci	/* For now, frame_type is always 0. Midi 2.0 is expected to add new
75762306a36Sopenharmony_ci	 * types here. Applications are expected to skip unknown frame types.
75862306a36Sopenharmony_ci	 */
75962306a36Sopenharmony_ci	__u8 frame_type;
76062306a36Sopenharmony_ci	__u8 length; /* number of valid bytes in data field */
76162306a36Sopenharmony_ci	__u8 reserved[2];
76262306a36Sopenharmony_ci	__u32 tv_nsec;		/* nanoseconds */
76362306a36Sopenharmony_ci	__u64 tv_sec;		/* seconds */
76462306a36Sopenharmony_ci	__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
76562306a36Sopenharmony_ci} __packed;
76662306a36Sopenharmony_ci
76762306a36Sopenharmony_cistruct snd_rawmidi_params {
76862306a36Sopenharmony_ci	int stream;
76962306a36Sopenharmony_ci	size_t buffer_size;		/* queue size in bytes */
77062306a36Sopenharmony_ci	size_t avail_min;		/* minimum avail bytes for wakeup */
77162306a36Sopenharmony_ci	unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
77262306a36Sopenharmony_ci	unsigned int mode;		/* For input data only, frame incoming data */
77362306a36Sopenharmony_ci	unsigned char reserved[12];	/* reserved for future use */
77462306a36Sopenharmony_ci};
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci#ifndef __KERNEL__
77762306a36Sopenharmony_cistruct snd_rawmidi_status {
77862306a36Sopenharmony_ci	int stream;
77962306a36Sopenharmony_ci	__time_pad pad1;
78062306a36Sopenharmony_ci	struct timespec tstamp;		/* Timestamp */
78162306a36Sopenharmony_ci	size_t avail;			/* available bytes */
78262306a36Sopenharmony_ci	size_t xruns;			/* count of overruns since last status (in bytes) */
78362306a36Sopenharmony_ci	unsigned char reserved[16];	/* reserved for future use */
78462306a36Sopenharmony_ci};
78562306a36Sopenharmony_ci#endif
78662306a36Sopenharmony_ci
78762306a36Sopenharmony_ci/* UMP EP info flags */
78862306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS		0x01
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci/* UMP EP Protocol / JRTS capability bits */
79162306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK	0x0300
79262306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI1		0x0100 /* MIDI 1.0 */
79362306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_MIDI2		0x0200 /* MIDI 2.0 */
79462306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK	0x0003
79562306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX		0x0001 /* JRTS Transmit */
79662306a36Sopenharmony_ci#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX		0x0002 /* JRTS Receive */
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci/* UMP Endpoint information */
79962306a36Sopenharmony_cistruct snd_ump_endpoint_info {
80062306a36Sopenharmony_ci	int card;			/* card number */
80162306a36Sopenharmony_ci	int device;			/* device number */
80262306a36Sopenharmony_ci	unsigned int flags;		/* additional info */
80362306a36Sopenharmony_ci	unsigned int protocol_caps;	/* protocol capabilities */
80462306a36Sopenharmony_ci	unsigned int protocol;		/* current protocol */
80562306a36Sopenharmony_ci	unsigned int num_blocks;	/* # of function blocks */
80662306a36Sopenharmony_ci	unsigned short version;		/* UMP major/minor version */
80762306a36Sopenharmony_ci	unsigned short family_id;	/* MIDI device family ID */
80862306a36Sopenharmony_ci	unsigned short model_id;	/* MIDI family model ID */
80962306a36Sopenharmony_ci	unsigned int manufacturer_id;	/* MIDI manufacturer ID */
81062306a36Sopenharmony_ci	unsigned char sw_revision[4];	/* software revision */
81162306a36Sopenharmony_ci	unsigned short padding;
81262306a36Sopenharmony_ci	unsigned char name[128];	/* endpoint name string */
81362306a36Sopenharmony_ci	unsigned char product_id[128];	/* unique product id string */
81462306a36Sopenharmony_ci	unsigned char reserved[32];
81562306a36Sopenharmony_ci} __packed;
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ci/* UMP direction */
81862306a36Sopenharmony_ci#define SNDRV_UMP_DIR_INPUT		0x01
81962306a36Sopenharmony_ci#define SNDRV_UMP_DIR_OUTPUT		0x02
82062306a36Sopenharmony_ci#define SNDRV_UMP_DIR_BIDIRECTION	0x03
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ci/* UMP block info flags */
82362306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_IS_MIDI1	(1U << 0) /* MIDI 1.0 port w/o restrict */
82462306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_IS_LOWSPEED	(1U << 1) /* 31.25Kbps B/W MIDI1 port */
82562306a36Sopenharmony_ci
82662306a36Sopenharmony_ci/* UMP block user-interface hint */
82762306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN		0x00
82862306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER	0x01
82962306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_SENDER		0x02
83062306a36Sopenharmony_ci#define SNDRV_UMP_BLOCK_UI_HINT_BOTH		0x03
83162306a36Sopenharmony_ci
83262306a36Sopenharmony_ci/* UMP groups and blocks */
83362306a36Sopenharmony_ci#define SNDRV_UMP_MAX_GROUPS		16
83462306a36Sopenharmony_ci#define SNDRV_UMP_MAX_BLOCKS		32
83562306a36Sopenharmony_ci
83662306a36Sopenharmony_ci/* UMP Block information */
83762306a36Sopenharmony_cistruct snd_ump_block_info {
83862306a36Sopenharmony_ci	int card;			/* card number */
83962306a36Sopenharmony_ci	int device;			/* device number */
84062306a36Sopenharmony_ci	unsigned char block_id;		/* block ID (R/W) */
84162306a36Sopenharmony_ci	unsigned char direction;	/* UMP direction */
84262306a36Sopenharmony_ci	unsigned char active;		/* Activeness */
84362306a36Sopenharmony_ci	unsigned char first_group;	/* first group ID */
84462306a36Sopenharmony_ci	unsigned char num_groups;	/* number of groups */
84562306a36Sopenharmony_ci	unsigned char midi_ci_version;	/* MIDI-CI support version */
84662306a36Sopenharmony_ci	unsigned char sysex8_streams;	/* max number of sysex8 streams */
84762306a36Sopenharmony_ci	unsigned char ui_hint;		/* user interface hint */
84862306a36Sopenharmony_ci	unsigned int flags;		/* various info flags */
84962306a36Sopenharmony_ci	unsigned char name[128];	/* block name string */
85062306a36Sopenharmony_ci	unsigned char reserved[32];
85162306a36Sopenharmony_ci} __packed;
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PVERSION	_IOR('W', 0x00, int)
85462306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_INFO	_IOR('W', 0x01, struct snd_rawmidi_info)
85562306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
85662306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_PARAMS	_IOWR('W', 0x10, struct snd_rawmidi_params)
85762306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_STATUS	_IOWR('W', 0x20, struct snd_rawmidi_status)
85862306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DROP	_IOW('W', 0x30, int)
85962306a36Sopenharmony_ci#define SNDRV_RAWMIDI_IOCTL_DRAIN	_IOW('W', 0x31, int)
86062306a36Sopenharmony_ci/* Additional ioctls for UMP rawmidi devices */
86162306a36Sopenharmony_ci#define SNDRV_UMP_IOCTL_ENDPOINT_INFO	_IOR('W', 0x40, struct snd_ump_endpoint_info)
86262306a36Sopenharmony_ci#define SNDRV_UMP_IOCTL_BLOCK_INFO	_IOR('W', 0x41, struct snd_ump_block_info)
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci/*
86562306a36Sopenharmony_ci *  Timer section - /dev/snd/timer
86662306a36Sopenharmony_ci */
86762306a36Sopenharmony_ci
86862306a36Sopenharmony_ci#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_cienum {
87162306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_NONE = -1,
87262306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_SLAVE = 0,
87362306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_GLOBAL,
87462306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_CARD,
87562306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_PCM,
87662306a36Sopenharmony_ci	SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
87762306a36Sopenharmony_ci};
87862306a36Sopenharmony_ci
87962306a36Sopenharmony_ci/* slave timer classes */
88062306a36Sopenharmony_cienum {
88162306a36Sopenharmony_ci	SNDRV_TIMER_SCLASS_NONE = 0,
88262306a36Sopenharmony_ci	SNDRV_TIMER_SCLASS_APPLICATION,
88362306a36Sopenharmony_ci	SNDRV_TIMER_SCLASS_SEQUENCER,		/* alias */
88462306a36Sopenharmony_ci	SNDRV_TIMER_SCLASS_OSS_SEQUENCER,	/* alias */
88562306a36Sopenharmony_ci	SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
88662306a36Sopenharmony_ci};
88762306a36Sopenharmony_ci
88862306a36Sopenharmony_ci/* global timers (device member) */
88962306a36Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_SYSTEM	0
89062306a36Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_RTC		1	/* unused */
89162306a36Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HPET		2
89262306a36Sopenharmony_ci#define SNDRV_TIMER_GLOBAL_HRTIMER	3
89362306a36Sopenharmony_ci
89462306a36Sopenharmony_ci/* info flags */
89562306a36Sopenharmony_ci#define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
89662306a36Sopenharmony_ci
89762306a36Sopenharmony_cistruct snd_timer_id {
89862306a36Sopenharmony_ci	int dev_class;
89962306a36Sopenharmony_ci	int dev_sclass;
90062306a36Sopenharmony_ci	int card;
90162306a36Sopenharmony_ci	int device;
90262306a36Sopenharmony_ci	int subdevice;
90362306a36Sopenharmony_ci};
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_cistruct snd_timer_ginfo {
90662306a36Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
90762306a36Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
90862306a36Sopenharmony_ci	int card;			/* card number */
90962306a36Sopenharmony_ci	unsigned char id[64];		/* timer identification */
91062306a36Sopenharmony_ci	unsigned char name[80];		/* timer name */
91162306a36Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
91262306a36Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
91362306a36Sopenharmony_ci	unsigned long resolution_min;	/* minimal period resolution in ns */
91462306a36Sopenharmony_ci	unsigned long resolution_max;	/* maximal period resolution in ns */
91562306a36Sopenharmony_ci	unsigned int clients;		/* active timer clients */
91662306a36Sopenharmony_ci	unsigned char reserved[32];
91762306a36Sopenharmony_ci};
91862306a36Sopenharmony_ci
91962306a36Sopenharmony_cistruct snd_timer_gparams {
92062306a36Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
92162306a36Sopenharmony_ci	unsigned long period_num;	/* requested precise period duration (in seconds) - numerator */
92262306a36Sopenharmony_ci	unsigned long period_den;	/* requested precise period duration (in seconds) - denominator */
92362306a36Sopenharmony_ci	unsigned char reserved[32];
92462306a36Sopenharmony_ci};
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_cistruct snd_timer_gstatus {
92762306a36Sopenharmony_ci	struct snd_timer_id tid;	/* requested timer ID */
92862306a36Sopenharmony_ci	unsigned long resolution;	/* current period resolution in ns */
92962306a36Sopenharmony_ci	unsigned long resolution_num;	/* precise current period resolution (in seconds) - numerator */
93062306a36Sopenharmony_ci	unsigned long resolution_den;	/* precise current period resolution (in seconds) - denominator */
93162306a36Sopenharmony_ci	unsigned char reserved[32];
93262306a36Sopenharmony_ci};
93362306a36Sopenharmony_ci
93462306a36Sopenharmony_cistruct snd_timer_select {
93562306a36Sopenharmony_ci	struct snd_timer_id id;	/* bind to timer ID */
93662306a36Sopenharmony_ci	unsigned char reserved[32];	/* reserved */
93762306a36Sopenharmony_ci};
93862306a36Sopenharmony_ci
93962306a36Sopenharmony_cistruct snd_timer_info {
94062306a36Sopenharmony_ci	unsigned int flags;		/* timer flags - SNDRV_TIMER_FLG_* */
94162306a36Sopenharmony_ci	int card;			/* card number */
94262306a36Sopenharmony_ci	unsigned char id[64];		/* timer identificator */
94362306a36Sopenharmony_ci	unsigned char name[80];		/* timer name */
94462306a36Sopenharmony_ci	unsigned long reserved0;	/* reserved for future use */
94562306a36Sopenharmony_ci	unsigned long resolution;	/* average period resolution in ns */
94662306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
94762306a36Sopenharmony_ci};
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_ci#define SNDRV_TIMER_PSFLG_AUTO		(1<<0)	/* auto start, otherwise one-shot */
95062306a36Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EXCLUSIVE	(1<<1)	/* exclusive use, precise start/stop/pause/continue */
95162306a36Sopenharmony_ci#define SNDRV_TIMER_PSFLG_EARLY_EVENT	(1<<2)	/* write early event to the poll queue */
95262306a36Sopenharmony_ci
95362306a36Sopenharmony_cistruct snd_timer_params {
95462306a36Sopenharmony_ci	unsigned int flags;		/* flags - SNDRV_TIMER_PSFLG_* */
95562306a36Sopenharmony_ci	unsigned int ticks;		/* requested resolution in ticks */
95662306a36Sopenharmony_ci	unsigned int queue_size;	/* total size of queue (32-1024) */
95762306a36Sopenharmony_ci	unsigned int reserved0;		/* reserved, was: failure locations */
95862306a36Sopenharmony_ci	unsigned int filter;		/* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
95962306a36Sopenharmony_ci	unsigned char reserved[60];	/* reserved */
96062306a36Sopenharmony_ci};
96162306a36Sopenharmony_ci
96262306a36Sopenharmony_ci#ifndef __KERNEL__
96362306a36Sopenharmony_cistruct snd_timer_status {
96462306a36Sopenharmony_ci	struct timespec tstamp;		/* Timestamp - last update */
96562306a36Sopenharmony_ci	unsigned int resolution;	/* current period resolution in ns */
96662306a36Sopenharmony_ci	unsigned int lost;		/* counter of master tick lost */
96762306a36Sopenharmony_ci	unsigned int overrun;		/* count of read queue overruns */
96862306a36Sopenharmony_ci	unsigned int queue;		/* used queue size */
96962306a36Sopenharmony_ci	unsigned char reserved[64];	/* reserved */
97062306a36Sopenharmony_ci};
97162306a36Sopenharmony_ci#endif
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
97462306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
97562306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD_OLD	_IOW('T', 0x02, int)
97662306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GINFO		_IOWR('T', 0x03, struct snd_timer_ginfo)
97762306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GPARAMS	_IOW('T', 0x04, struct snd_timer_gparams)
97862306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_GSTATUS	_IOWR('T', 0x05, struct snd_timer_gstatus)
97962306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_SELECT	_IOW('T', 0x10, struct snd_timer_select)
98062306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_INFO		_IOR('T', 0x11, struct snd_timer_info)
98162306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PARAMS	_IOW('T', 0x12, struct snd_timer_params)
98262306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STATUS	_IOR('T', 0x14, struct snd_timer_status)
98362306a36Sopenharmony_ci/* The following four ioctls are changed since 1.0.9 due to confliction */
98462306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_START		_IO('T', 0xa0)
98562306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_STOP		_IO('T', 0xa1)
98662306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
98762306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
98862306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
98962306a36Sopenharmony_ci
99062306a36Sopenharmony_ci#if __BITS_PER_LONG == 64
99162306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
99262306a36Sopenharmony_ci#else
99362306a36Sopenharmony_ci#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
99462306a36Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD_OLD : \
99562306a36Sopenharmony_ci				 SNDRV_TIMER_IOCTL_TREAD64)
99662306a36Sopenharmony_ci#endif
99762306a36Sopenharmony_ci
99862306a36Sopenharmony_cistruct snd_timer_read {
99962306a36Sopenharmony_ci	unsigned int resolution;
100062306a36Sopenharmony_ci	unsigned int ticks;
100162306a36Sopenharmony_ci};
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_cienum {
100462306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_RESOLUTION = 0,	/* val = resolution in ns */
100562306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_TICK,			/* val = ticks */
100662306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_START,		/* val = resolution in ns */
100762306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_STOP,			/* val = 0 */
100862306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_CONTINUE,		/* val = resolution in ns */
100962306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_PAUSE,		/* val = 0 */
101062306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_EARLY,		/* val = 0, early event */
101162306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_SUSPEND,		/* val = 0 */
101262306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_RESUME,		/* val = resolution in ns */
101362306a36Sopenharmony_ci	/* master timer events for slave timer instances */
101462306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
101562306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
101662306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
101762306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
101862306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
101962306a36Sopenharmony_ci	SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
102062306a36Sopenharmony_ci};
102162306a36Sopenharmony_ci
102262306a36Sopenharmony_ci#ifndef __KERNEL__
102362306a36Sopenharmony_cistruct snd_timer_tread {
102462306a36Sopenharmony_ci	int event;
102562306a36Sopenharmony_ci	__time_pad pad1;
102662306a36Sopenharmony_ci	struct timespec tstamp;
102762306a36Sopenharmony_ci	unsigned int val;
102862306a36Sopenharmony_ci	__time_pad pad2;
102962306a36Sopenharmony_ci};
103062306a36Sopenharmony_ci#endif
103162306a36Sopenharmony_ci
103262306a36Sopenharmony_ci/****************************************************************************
103362306a36Sopenharmony_ci *                                                                          *
103462306a36Sopenharmony_ci *        Section for driver control interface - /dev/snd/control?          *
103562306a36Sopenharmony_ci *                                                                          *
103662306a36Sopenharmony_ci ****************************************************************************/
103762306a36Sopenharmony_ci
103862306a36Sopenharmony_ci#define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 9)
103962306a36Sopenharmony_ci
104062306a36Sopenharmony_cistruct snd_ctl_card_info {
104162306a36Sopenharmony_ci	int card;			/* card number */
104262306a36Sopenharmony_ci	int pad;			/* reserved for future (was type) */
104362306a36Sopenharmony_ci	unsigned char id[16];		/* ID of card (user selectable) */
104462306a36Sopenharmony_ci	unsigned char driver[16];	/* Driver name */
104562306a36Sopenharmony_ci	unsigned char name[32];		/* Short name of soundcard */
104662306a36Sopenharmony_ci	unsigned char longname[80];	/* name + info text about soundcard */
104762306a36Sopenharmony_ci	unsigned char reserved_[16];	/* reserved for future (was ID of mixer) */
104862306a36Sopenharmony_ci	unsigned char mixername[80];	/* visual mixer identification */
104962306a36Sopenharmony_ci	unsigned char components[128];	/* card components / fine identification, delimited with one space (AC97 etc..) */
105062306a36Sopenharmony_ci};
105162306a36Sopenharmony_ci
105262306a36Sopenharmony_citypedef int __bitwise snd_ctl_elem_type_t;
105362306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_NONE	((__force snd_ctl_elem_type_t) 0) /* invalid */
105462306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BOOLEAN	((__force snd_ctl_elem_type_t) 1) /* boolean type */
105562306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER	((__force snd_ctl_elem_type_t) 2) /* integer type */
105662306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_ENUMERATED	((__force snd_ctl_elem_type_t) 3) /* enumerated type */
105762306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_BYTES	((__force snd_ctl_elem_type_t) 4) /* byte array */
105862306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_IEC958	((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
105962306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_INTEGER64	((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
106062306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_TYPE_LAST	SNDRV_CTL_ELEM_TYPE_INTEGER64
106162306a36Sopenharmony_ci
106262306a36Sopenharmony_citypedef int __bitwise snd_ctl_elem_iface_t;
106362306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_CARD	((__force snd_ctl_elem_iface_t) 0) /* global control */
106462306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_HWDEP	((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
106562306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_MIXER	((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
106662306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_PCM	((__force snd_ctl_elem_iface_t) 3) /* PCM device */
106762306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_RAWMIDI	((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
106862306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_TIMER	((__force snd_ctl_elem_iface_t) 5) /* timer device */
106962306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_SEQUENCER	((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
107062306a36Sopenharmony_ci#define	SNDRV_CTL_ELEM_IFACE_LAST	SNDRV_CTL_ELEM_IFACE_SEQUENCER
107162306a36Sopenharmony_ci
107262306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READ		(1<<0)
107362306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_WRITE		(1<<1)
107462306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_READWRITE		(SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
107562306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_VOLATILE		(1<<2)	/* control value may be changed without a notification */
107662306a36Sopenharmony_ci/* (1 << 3) is unused. */
107762306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READ		(1<<4)	/* TLV read is possible */
107862306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE		(1<<5)	/* TLV write is possible */
107962306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE	(SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
108062306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND	(1<<6)	/* TLV command is possible */
108162306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */
108262306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */
108362306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */
108462306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK	(1<<28)	/* kernel use a TLV callback */
108562306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ACCESS_USER		(1<<29) /* user space element */
108662306a36Sopenharmony_ci/* bits 30 and 31 are obsoleted (for indirect access) */
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_ci/* for further details see the ACPI and PCI power management specification */
108962306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D0		0x0000	/* full On */
109062306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D1		0x0100	/* partial On */
109162306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D2		0x0200	/* partial On */
109262306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D3		0x0300	/* Off */
109362306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D3hot		(SNDRV_CTL_POWER_D3|0x0000)	/* Off, with power */
109462306a36Sopenharmony_ci#define SNDRV_CTL_POWER_D3cold		(SNDRV_CTL_POWER_D3|0x0001)	/* Off, without power */
109562306a36Sopenharmony_ci
109662306a36Sopenharmony_ci#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN	44
109762306a36Sopenharmony_ci
109862306a36Sopenharmony_cistruct snd_ctl_elem_id {
109962306a36Sopenharmony_ci	unsigned int numid;		/* numeric identifier, zero = invalid */
110062306a36Sopenharmony_ci	snd_ctl_elem_iface_t iface;	/* interface identifier */
110162306a36Sopenharmony_ci	unsigned int device;		/* device/client number */
110262306a36Sopenharmony_ci	unsigned int subdevice;		/* subdevice (substream) number */
110362306a36Sopenharmony_ci	unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];		/* ASCII name of item */
110462306a36Sopenharmony_ci	unsigned int index;		/* index of item */
110562306a36Sopenharmony_ci};
110662306a36Sopenharmony_ci
110762306a36Sopenharmony_cistruct snd_ctl_elem_list {
110862306a36Sopenharmony_ci	unsigned int offset;		/* W: first element ID to get */
110962306a36Sopenharmony_ci	unsigned int space;		/* W: count of element IDs to get */
111062306a36Sopenharmony_ci	unsigned int used;		/* R: count of element IDs set */
111162306a36Sopenharmony_ci	unsigned int count;		/* R: count of all elements */
111262306a36Sopenharmony_ci	struct snd_ctl_elem_id __user *pids; /* R: IDs */
111362306a36Sopenharmony_ci	unsigned char reserved[50];
111462306a36Sopenharmony_ci};
111562306a36Sopenharmony_ci
111662306a36Sopenharmony_cistruct snd_ctl_elem_info {
111762306a36Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
111862306a36Sopenharmony_ci	snd_ctl_elem_type_t type;	/* R: value type - SNDRV_CTL_ELEM_TYPE_* */
111962306a36Sopenharmony_ci	unsigned int access;		/* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
112062306a36Sopenharmony_ci	unsigned int count;		/* count of values */
112162306a36Sopenharmony_ci	__kernel_pid_t owner;		/* owner's PID of this control */
112262306a36Sopenharmony_ci	union {
112362306a36Sopenharmony_ci		struct {
112462306a36Sopenharmony_ci			long min;		/* R: minimum value */
112562306a36Sopenharmony_ci			long max;		/* R: maximum value */
112662306a36Sopenharmony_ci			long step;		/* R: step (0 variable) */
112762306a36Sopenharmony_ci		} integer;
112862306a36Sopenharmony_ci		struct {
112962306a36Sopenharmony_ci			long long min;		/* R: minimum value */
113062306a36Sopenharmony_ci			long long max;		/* R: maximum value */
113162306a36Sopenharmony_ci			long long step;		/* R: step (0 variable) */
113262306a36Sopenharmony_ci		} integer64;
113362306a36Sopenharmony_ci		struct {
113462306a36Sopenharmony_ci			unsigned int items;	/* R: number of items */
113562306a36Sopenharmony_ci			unsigned int item;	/* W: item number */
113662306a36Sopenharmony_ci			char name[64];		/* R: value name */
113762306a36Sopenharmony_ci			__u64 names_ptr;	/* W: names list (ELEM_ADD only) */
113862306a36Sopenharmony_ci			unsigned int names_length;
113962306a36Sopenharmony_ci		} enumerated;
114062306a36Sopenharmony_ci		unsigned char reserved[128];
114162306a36Sopenharmony_ci	} value;
114262306a36Sopenharmony_ci	unsigned char reserved[64];
114362306a36Sopenharmony_ci};
114462306a36Sopenharmony_ci
114562306a36Sopenharmony_cistruct snd_ctl_elem_value {
114662306a36Sopenharmony_ci	struct snd_ctl_elem_id id;	/* W: element ID */
114762306a36Sopenharmony_ci	unsigned int indirect: 1;	/* W: indirect access - obsoleted */
114862306a36Sopenharmony_ci	union {
114962306a36Sopenharmony_ci		union {
115062306a36Sopenharmony_ci			long value[128];
115162306a36Sopenharmony_ci			long *value_ptr;	/* obsoleted */
115262306a36Sopenharmony_ci		} integer;
115362306a36Sopenharmony_ci		union {
115462306a36Sopenharmony_ci			long long value[64];
115562306a36Sopenharmony_ci			long long *value_ptr;	/* obsoleted */
115662306a36Sopenharmony_ci		} integer64;
115762306a36Sopenharmony_ci		union {
115862306a36Sopenharmony_ci			unsigned int item[128];
115962306a36Sopenharmony_ci			unsigned int *item_ptr;	/* obsoleted */
116062306a36Sopenharmony_ci		} enumerated;
116162306a36Sopenharmony_ci		union {
116262306a36Sopenharmony_ci			unsigned char data[512];
116362306a36Sopenharmony_ci			unsigned char *data_ptr;	/* obsoleted */
116462306a36Sopenharmony_ci		} bytes;
116562306a36Sopenharmony_ci		struct snd_aes_iec958 iec958;
116662306a36Sopenharmony_ci	} value;		/* RO */
116762306a36Sopenharmony_ci	unsigned char reserved[128];
116862306a36Sopenharmony_ci};
116962306a36Sopenharmony_ci
117062306a36Sopenharmony_cistruct snd_ctl_tlv {
117162306a36Sopenharmony_ci	unsigned int numid;	/* control element numeric identification */
117262306a36Sopenharmony_ci	unsigned int length;	/* in bytes aligned to 4 */
117362306a36Sopenharmony_ci	unsigned int tlv[];	/* first TLV */
117462306a36Sopenharmony_ci};
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_PVERSION	_IOR('U', 0x00, int)
117762306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_CARD_INFO	_IOR('U', 0x01, struct snd_ctl_card_info)
117862306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LIST	_IOWR('U', 0x10, struct snd_ctl_elem_list)
117962306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_INFO	_IOWR('U', 0x11, struct snd_ctl_elem_info)
118062306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_READ	_IOWR('U', 0x12, struct snd_ctl_elem_value)
118162306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_WRITE	_IOWR('U', 0x13, struct snd_ctl_elem_value)
118262306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_LOCK	_IOW('U', 0x14, struct snd_ctl_elem_id)
118362306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_UNLOCK	_IOW('U', 0x15, struct snd_ctl_elem_id)
118462306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
118562306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_ADD	_IOWR('U', 0x17, struct snd_ctl_elem_info)
118662306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REPLACE	_IOWR('U', 0x18, struct snd_ctl_elem_info)
118762306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_ELEM_REMOVE	_IOWR('U', 0x19, struct snd_ctl_elem_id)
118862306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_READ	_IOWR('U', 0x1a, struct snd_ctl_tlv)
118962306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_WRITE	_IOWR('U', 0x1b, struct snd_ctl_tlv)
119062306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_TLV_COMMAND	_IOWR('U', 0x1c, struct snd_ctl_tlv)
119162306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
119262306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_HWDEP_INFO	_IOR('U', 0x21, struct snd_hwdep_info)
119362306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE	_IOR('U', 0x30, int)
119462306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_INFO	_IOWR('U', 0x31, struct snd_pcm_info)
119562306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
119662306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
119762306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_INFO	_IOWR('U', 0x41, struct snd_rawmidi_info)
119862306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
119962306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE	_IOWR('U', 0x43, int)
120062306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
120162306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO	_IOWR('U', 0x45, struct snd_ump_block_info)
120262306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER		_IOWR('U', 0xd0, int)
120362306a36Sopenharmony_ci#define SNDRV_CTL_IOCTL_POWER_STATE	_IOR('U', 0xd1, int)
120462306a36Sopenharmony_ci
120562306a36Sopenharmony_ci/*
120662306a36Sopenharmony_ci *  Read interface.
120762306a36Sopenharmony_ci */
120862306a36Sopenharmony_ci
120962306a36Sopenharmony_cienum sndrv_ctl_event_type {
121062306a36Sopenharmony_ci	SNDRV_CTL_EVENT_ELEM = 0,
121162306a36Sopenharmony_ci	SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
121262306a36Sopenharmony_ci};
121362306a36Sopenharmony_ci
121462306a36Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_VALUE	(1<<0)	/* element value was changed */
121562306a36Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_INFO	(1<<1)	/* element info was changed */
121662306a36Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_ADD	(1<<2)	/* element was added */
121762306a36Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_TLV	(1<<3)	/* element TLV tree was changed */
121862306a36Sopenharmony_ci#define SNDRV_CTL_EVENT_MASK_REMOVE	(~0U)	/* element was removed */
121962306a36Sopenharmony_ci
122062306a36Sopenharmony_cistruct snd_ctl_event {
122162306a36Sopenharmony_ci	int type;	/* event type - SNDRV_CTL_EVENT_* */
122262306a36Sopenharmony_ci	union {
122362306a36Sopenharmony_ci		struct {
122462306a36Sopenharmony_ci			unsigned int mask;
122562306a36Sopenharmony_ci			struct snd_ctl_elem_id id;
122662306a36Sopenharmony_ci		} elem;
122762306a36Sopenharmony_ci		unsigned char data8[60];
122862306a36Sopenharmony_ci	} data;
122962306a36Sopenharmony_ci};
123062306a36Sopenharmony_ci
123162306a36Sopenharmony_ci/*
123262306a36Sopenharmony_ci *  Control names
123362306a36Sopenharmony_ci */
123462306a36Sopenharmony_ci
123562306a36Sopenharmony_ci#define SNDRV_CTL_NAME_NONE				""
123662306a36Sopenharmony_ci#define SNDRV_CTL_NAME_PLAYBACK				"Playback "
123762306a36Sopenharmony_ci#define SNDRV_CTL_NAME_CAPTURE				"Capture "
123862306a36Sopenharmony_ci
123962306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_NONE			""
124062306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_SWITCH			"Switch"
124162306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_VOLUME			"Volume"
124262306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_DEFAULT			"Default"
124362306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_MASK			"Mask"
124462306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_CON_MASK			"Con Mask"
124562306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PRO_MASK			"Pro Mask"
124662306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958_PCM_STREAM		"PCM Stream"
124762306a36Sopenharmony_ci#define SNDRV_CTL_NAME_IEC958(expl,direction,what)	"IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
124862306a36Sopenharmony_ci
124962306a36Sopenharmony_ci#endif /* _UAPI__SOUND_ASOUND_H */
1250