summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0001-Fix-alsa-sound-.h-for-external-programs.patch7104
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0001-configure.ac-remove-an-unnecessary-libtool-fix.patch50
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0001-uapi-Move-typedefs-from-uapi-to-sound.patch137
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch41
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch45
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0003-namehint-correct-the-args-check.patch34
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0004-namehint-improve-the-previous-patch-check-the-return.patch31
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib/0005-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch86
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib_1.2.2.bb (renamed from meta/recipes-multimedia/alsa/alsa-lib_1.2.1.2.bb)15
9 files changed, 3 insertions, 7540 deletions
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0001-Fix-alsa-sound-.h-for-external-programs.patch b/meta/recipes-multimedia/alsa/alsa-lib/0001-Fix-alsa-sound-.h-for-external-programs.patch
deleted file mode 100644
index 890650a772..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0001-Fix-alsa-sound-.h-for-external-programs.patch
+++ /dev/null
@@ -1,7104 +0,0 @@
1From ae564665ec261cf104de499b1cdda3564070fc65 Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Fri, 20 Dec 2019 15:46:48 +0100
4Subject: [PATCH] Fix alsa/sound/*.h for external programs
5
6The recent update of sound/*.h to sync with the latest Linus uapi
7files broke the build of alsa-tools programs. These files used to be
8a modified version of Linux sound/* header files, so that they could
9be built without Linux headers. The special prefix like __user and
10other things were worked around there.
11
12We may do that again, but a better approach is to fix those things in
13Linux kernel uapi side, while we keep the minimal workaround in
14alsa-lib such as the __u16 and co type definitions.
15
16This patch is such an attempt, namely:
17- Keep the original $LINUX/uapi/sound/*.h in include/sound/uapi
18 directory
19- The "fixes" are applied to some uapi headers, so that they don't
20 contain Linux-specific prefix and use of opaque struct like
21 snd_ctl_elem_id
22- The uapi headers are included indirectly from include/sound/*.h
23- Some headers have inclusion of type_compat.h for the Linux variable
24 types and prefixes
25- type_compat.h tries to use <linux/types.h> when __linux__ is
26 defined, instead of the own conflicting definitions
27
28The last type might need a bit more adjustment depending on the
29compiler, but it can be fixed locally without disturbing else.
30
31Signed-off-by: Takashi Iwai <tiwai@suse.de>
32
33Upstream-Status: Backport
34
35Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
36
37---
38 configure.ac | 3 +-
39 include/sound/Makefile.am | 6 +-
40 include/sound/asequencer.h | 613 +----------------
41 include/sound/asoc.h | 634 +-----------------
42 include/sound/asound.h | 1039 +----------------------------
43 include/sound/asound_fm.h | 136 +---
44 include/sound/emu10k1.h | 383 +----------
45 include/sound/hdsp.h | 113 +---
46 include/sound/hdspm.h | 234 +------
47 include/sound/sb16_csp.h | 124 +---
48 include/sound/sscape_ioctl.h | 22 +-
49 include/sound/tlv.h | 118 +---
50 include/sound/type_compat.h | 13 +
51 include/sound/uapi/Makefile.am | 6 +
52 include/sound/uapi/asequencer.h | 612 +++++++++++++++++
53 include/sound/uapi/asoc.h | 633 ++++++++++++++++++
54 include/sound/uapi/asound.h | 1038 ++++++++++++++++++++++++++++
55 include/sound/uapi/asound_fm.h | 135 ++++
56 include/sound/uapi/emu10k1.h | 395 +++++++++++
57 include/sound/uapi/hdsp.h | 109 +++
58 include/sound/uapi/hdspm.h | 230 +++++++
59 include/sound/uapi/sb16_csp.h | 123 ++++
60 include/sound/uapi/sscape_ioctl.h | 21 +
61 include/sound/uapi/tlv.h | 117 ++++
62 src/topology/tplg_local.h | 3 +-
63 25 files changed, 3452 insertions(+), 3408 deletions(-)
64 create mode 100644 include/sound/uapi/Makefile.am
65 create mode 100644 include/sound/uapi/asequencer.h
66 create mode 100644 include/sound/uapi/asoc.h
67 create mode 100644 include/sound/uapi/asound.h
68 create mode 100644 include/sound/uapi/asound_fm.h
69 create mode 100644 include/sound/uapi/emu10k1.h
70 create mode 100644 include/sound/uapi/hdsp.h
71 create mode 100644 include/sound/uapi/hdspm.h
72 create mode 100644 include/sound/uapi/sb16_csp.h
73 create mode 100644 include/sound/uapi/sscape_ioctl.h
74 create mode 100644 include/sound/uapi/tlv.h
75
76diff --git a/configure.ac b/configure.ac
77index 119ef600..886f87bc 100644
78--- a/configure.ac
79+++ b/configure.ac
80@@ -707,7 +707,8 @@ if test ! -L "$srcdir"/include/alsa ; then
81 fi
82
83 AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
84- include/Makefile include/sound/Makefile src/Versions src/Makefile \
85+ include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
86+ src/Versions src/Makefile \
87 src/control/Makefile src/mixer/Makefile \
88 src/pcm/Makefile src/pcm/scopes/Makefile \
89 src/rawmidi/Makefile src/timer/Makefile \
90diff --git a/include/sound/Makefile.am b/include/sound/Makefile.am
91index 99c42211..ccc7d273 100644
92--- a/include/sound/Makefile.am
93+++ b/include/sound/Makefile.am
94@@ -1,7 +1,9 @@
95+SUBDIRS = uapi
96+
97 alsasoundincludedir = ${includedir}/alsa/sound
98
99 alsasoundinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \
100- sscape_ioctl.h emu10k1.h type_compat.h \
101- asoc.h tlv.h
102+ sscape_ioctl.h emu10k1.h asoc.h tlv.h \
103+ type_compat.h
104
105 noinst_HEADERS = asound.h asequencer.h
106diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
107index a75e14ed..e539a77e 100644
108--- a/include/sound/asequencer.h
109+++ b/include/sound/asequencer.h
110@@ -1,612 +1 @@
111-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
112-/*
113- * Main header file for the ALSA sequencer
114- * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
115- * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
116- *
117- *
118- * This program is free software; you can redistribute it and/or modify
119- * it under the terms of the GNU General Public License as published by
120- * the Free Software Foundation; either version 2 of the License, or
121- * (at your option) any later version.
122- *
123- * This program is distributed in the hope that it will be useful,
124- * but WITHOUT ANY WARRANTY; without even the implied warranty of
125- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126- * GNU General Public License for more details.
127- *
128- * You should have received a copy of the GNU General Public License
129- * along with this program; if not, write to the Free Software
130- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
131- *
132- */
133-#ifndef _UAPI__SOUND_ASEQUENCER_H
134-#define _UAPI__SOUND_ASEQUENCER_H
135-
136-#include <sound/asound.h>
137-
138-/** version of the sequencer */
139-#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
140-
141-/**
142- * definition of sequencer event types
143- */
144-
145-/** system messages
146- * event data type = #snd_seq_result
147- */
148-#define SNDRV_SEQ_EVENT_SYSTEM 0
149-#define SNDRV_SEQ_EVENT_RESULT 1
150-
151-/** note messages (channel specific)
152- * event data type = #snd_seq_ev_note
153- */
154-#define SNDRV_SEQ_EVENT_NOTE 5
155-#define SNDRV_SEQ_EVENT_NOTEON 6
156-#define SNDRV_SEQ_EVENT_NOTEOFF 7
157-#define SNDRV_SEQ_EVENT_KEYPRESS 8
158-
159-/** control messages (channel specific)
160- * event data type = #snd_seq_ev_ctrl
161- */
162-#define SNDRV_SEQ_EVENT_CONTROLLER 10
163-#define SNDRV_SEQ_EVENT_PGMCHANGE 11
164-#define SNDRV_SEQ_EVENT_CHANPRESS 12
165-#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
166-#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
167-#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
168-#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
169-
170-/** synchronisation messages
171- * event data type = #snd_seq_ev_ctrl
172- */
173-#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
174-#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
175-#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
176-#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
177-#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
178-
179-/** timer messages
180- * event data type = snd_seq_ev_queue_control
181- */
182-#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
183-#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
184-#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
185-#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
186-#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
187-#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
188-#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
189-#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
190-#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
191-
192-/** others
193- * event data type = none
194- */
195-#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
196-#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
197-#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
198-
199-/** echo back, kernel private messages
200- * event data type = any type
201- */
202-#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
203-#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
204-
205-/** system status messages (broadcast for subscribers)
206- * event data type = snd_seq_addr
207- */
208-#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
209-#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
210-#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
211-#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
212-#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
213-#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
214-
215-/** port connection changes
216- * event data type = snd_seq_connect
217- */
218-#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
219-#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
220-
221-/* 70-89: synthesizer events - obsoleted */
222-
223-/** user-defined events with fixed length
224- * event data type = any
225- */
226-#define SNDRV_SEQ_EVENT_USR0 90
227-#define SNDRV_SEQ_EVENT_USR1 91
228-#define SNDRV_SEQ_EVENT_USR2 92
229-#define SNDRV_SEQ_EVENT_USR3 93
230-#define SNDRV_SEQ_EVENT_USR4 94
231-#define SNDRV_SEQ_EVENT_USR5 95
232-#define SNDRV_SEQ_EVENT_USR6 96
233-#define SNDRV_SEQ_EVENT_USR7 97
234-#define SNDRV_SEQ_EVENT_USR8 98
235-#define SNDRV_SEQ_EVENT_USR9 99
236-
237-/* 100-118: instrument layer - obsoleted */
238-/* 119-129: reserved */
239-
240-/* 130-139: variable length events
241- * event data type = snd_seq_ev_ext
242- * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
243- */
244-#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
245-#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
246-/* 132-134: reserved */
247-#define SNDRV_SEQ_EVENT_USR_VAR0 135
248-#define SNDRV_SEQ_EVENT_USR_VAR1 136
249-#define SNDRV_SEQ_EVENT_USR_VAR2 137
250-#define SNDRV_SEQ_EVENT_USR_VAR3 138
251-#define SNDRV_SEQ_EVENT_USR_VAR4 139
252-
253-/* 150-151: kernel events with quote - DO NOT use in user clients */
254-#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
255-#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
256-
257-/* 152-191: reserved */
258-
259-/* 192-254: hardware specific events */
260-
261-/* 255: special event */
262-#define SNDRV_SEQ_EVENT_NONE 255
263-
264-
265-typedef unsigned char snd_seq_event_type_t;
266-
267-/** event address */
268-struct snd_seq_addr {
269- unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
270- unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
271-};
272-
273-/** port connection */
274-struct snd_seq_connect {
275- struct snd_seq_addr sender;
276- struct snd_seq_addr dest;
277-};
278-
279-
280-#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
281-#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
282-#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
283-#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
284-
285- /* event mode flag - NOTE: only 8 bits available! */
286-#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
287-#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
288-#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
289-
290-#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
291-#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
292-#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
293-
294-#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
295-#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
296-#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
297-#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
298-
299-#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
300-#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
301-#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
302-
303-
304- /* note event */
305-struct snd_seq_ev_note {
306- unsigned char channel;
307- unsigned char note;
308- unsigned char velocity;
309- unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
310- unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
311-};
312-
313- /* controller event */
314-struct snd_seq_ev_ctrl {
315- unsigned char channel;
316- unsigned char unused1, unused2, unused3; /* pad */
317- unsigned int param;
318- signed int value;
319-};
320-
321- /* generic set of bytes (12x8 bit) */
322-struct snd_seq_ev_raw8 {
323- unsigned char d[12]; /* 8 bit value */
324-};
325-
326- /* generic set of integers (3x32 bit) */
327-struct snd_seq_ev_raw32 {
328- unsigned int d[3]; /* 32 bit value */
329-};
330-
331- /* external stored data */
332-struct snd_seq_ev_ext {
333- unsigned int len; /* length of data */
334- void *ptr; /* pointer to data (note: maybe 64-bit) */
335-} __attribute__((packed));
336-
337-struct snd_seq_result {
338- int event; /* processed event type */
339- int result;
340-};
341-
342-
343-struct snd_seq_real_time {
344- unsigned int tv_sec; /* seconds */
345- unsigned int tv_nsec; /* nanoseconds */
346-};
347-
348-typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
349-
350-union snd_seq_timestamp {
351- snd_seq_tick_time_t tick;
352- struct snd_seq_real_time time;
353-};
354-
355-struct snd_seq_queue_skew {
356- unsigned int value;
357- unsigned int base;
358-};
359-
360- /* queue timer control */
361-struct snd_seq_ev_queue_control {
362- unsigned char queue; /* affected queue */
363- unsigned char pad[3]; /* reserved */
364- union {
365- signed int value; /* affected value (e.g. tempo) */
366- union snd_seq_timestamp time; /* time */
367- unsigned int position; /* sync position */
368- struct snd_seq_queue_skew skew;
369- unsigned int d32[2];
370- unsigned char d8[8];
371- } param;
372-};
373-
374- /* quoted event - inside the kernel only */
375-struct snd_seq_ev_quote {
376- struct snd_seq_addr origin; /* original sender */
377- unsigned short value; /* optional data */
378- struct snd_seq_event *event; /* quoted event */
379-} __attribute__((packed));
380-
381-
382- /* sequencer event */
383-struct snd_seq_event {
384- snd_seq_event_type_t type; /* event type */
385- unsigned char flags; /* event flags */
386- char tag;
387-
388- unsigned char queue; /* schedule queue */
389- union snd_seq_timestamp time; /* schedule time */
390-
391-
392- struct snd_seq_addr source; /* source address */
393- struct snd_seq_addr dest; /* destination address */
394-
395- union { /* event data... */
396- struct snd_seq_ev_note note;
397- struct snd_seq_ev_ctrl control;
398- struct snd_seq_ev_raw8 raw8;
399- struct snd_seq_ev_raw32 raw32;
400- struct snd_seq_ev_ext ext;
401- struct snd_seq_ev_queue_control queue;
402- union snd_seq_timestamp time;
403- struct snd_seq_addr addr;
404- struct snd_seq_connect connect;
405- struct snd_seq_result result;
406- struct snd_seq_ev_quote quote;
407- } data;
408-};
409-
410-
411-/*
412- * bounce event - stored as variable size data
413- */
414-struct snd_seq_event_bounce {
415- int err;
416- struct snd_seq_event event;
417- /* external data follows here. */
418-};
419-
420-
421- /* system information */
422-struct snd_seq_system_info {
423- int queues; /* maximum queues count */
424- int clients; /* maximum clients count */
425- int ports; /* maximum ports per client */
426- int channels; /* maximum channels per port */
427- int cur_clients; /* current clients */
428- int cur_queues; /* current queues */
429- char reserved[24];
430-};
431-
432-
433- /* system running information */
434-struct snd_seq_running_info {
435- unsigned char client; /* client id */
436- unsigned char big_endian; /* 1 = big-endian */
437- unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
438- unsigned char pad; /* reserved */
439- unsigned char reserved[12];
440-};
441-
442-
443- /* known client numbers */
444-#define SNDRV_SEQ_CLIENT_SYSTEM 0
445- /* internal client numbers */
446-#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
447-#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
448-
449-
450- /* client types */
451-typedef int __bitwise snd_seq_client_type_t;
452-#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
453-#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
454-#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
455-
456- /* event filter flags */
457-#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
458-#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
459-#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
460-#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
461-
462-struct snd_seq_client_info {
463- int client; /* client number to inquire */
464- snd_seq_client_type_t type; /* client type */
465- char name[64]; /* client name */
466- unsigned int filter; /* filter flags */
467- unsigned char multicast_filter[8]; /* multicast filter bitmap */
468- unsigned char event_filter[32]; /* event filter bitmap */
469- int num_ports; /* RO: number of ports */
470- int event_lost; /* number of lost events */
471- int card; /* RO: card number[kernel] */
472- int pid; /* RO: pid[user] */
473- char reserved[56]; /* for future use */
474-};
475-
476-
477-/* client pool size */
478-struct snd_seq_client_pool {
479- int client; /* client number to inquire */
480- int output_pool; /* outgoing (write) pool size */
481- int input_pool; /* incoming (read) pool size */
482- int output_room; /* minimum free pool size for select/blocking mode */
483- int output_free; /* unused size */
484- int input_free; /* unused size */
485- char reserved[64];
486-};
487-
488-
489-/* Remove events by specified criteria */
490-
491-#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
492-#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
493-#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
494-#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
495-#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
496-#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
497-#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
498-#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
499-#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
500-#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
501-
502-struct snd_seq_remove_events {
503- unsigned int remove_mode; /* Flags that determine what gets removed */
504-
505- union snd_seq_timestamp time;
506-
507- unsigned char queue; /* Queue for REMOVE_DEST */
508- struct snd_seq_addr dest; /* Address for REMOVE_DEST */
509- unsigned char channel; /* Channel for REMOVE_DEST */
510-
511- int type; /* For REMOVE_EVENT_TYPE */
512- char tag; /* Tag for REMOVE_TAG */
513-
514- int reserved[10]; /* To allow for future binary compatibility */
515-
516-};
517-
518-
519- /* known port numbers */
520-#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
521-#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
522-
523- /* port capabilities (32 bits) */
524-#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
525-#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
526-
527-#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
528-#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
529-
530-#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
531-
532-#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
533-#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
534-#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
535-
536- /* port type */
537-#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
538-#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
539-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
540-#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
541-#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
542-#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
543-#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
544-
545-/* other standards...*/
546-#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
547-#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
548-#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
549-/*...*/
550-#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
551-#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
552-#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
553-#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
554-#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
555-
556-/* misc. conditioning flags */
557-#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
558-#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
559-#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
560-
561-struct snd_seq_port_info {
562- struct snd_seq_addr addr; /* client/port numbers */
563- char name[64]; /* port name */
564-
565- unsigned int capability; /* port capability bits */
566- unsigned int type; /* port type bits */
567- int midi_channels; /* channels per MIDI port */
568- int midi_voices; /* voices per MIDI port */
569- int synth_voices; /* voices per SYNTH port */
570-
571- int read_use; /* R/O: subscribers for output (from this port) */
572- int write_use; /* R/O: subscribers for input (to this port) */
573-
574- void *kernel; /* reserved for kernel use (must be NULL) */
575- unsigned int flags; /* misc. conditioning */
576- unsigned char time_queue; /* queue # for timestamping */
577- char reserved[59]; /* for future use */
578-};
579-
580-
581-/* queue flags */
582-#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
583-
584-/* queue information */
585-struct snd_seq_queue_info {
586- int queue; /* queue id */
587-
588- /*
589- * security settings, only owner of this queue can start/stop timer
590- * etc. if the queue is locked for other clients
591- */
592- int owner; /* client id for owner of the queue */
593- unsigned locked:1; /* timing queue locked for other queues */
594- char name[64]; /* name of this queue */
595- unsigned int flags; /* flags */
596- char reserved[60]; /* for future use */
597-
598-};
599-
600-/* queue info/status */
601-struct snd_seq_queue_status {
602- int queue; /* queue id */
603- int events; /* read-only - queue size */
604- snd_seq_tick_time_t tick; /* current tick */
605- struct snd_seq_real_time time; /* current time */
606- int running; /* running state of queue */
607- int flags; /* various flags */
608- char reserved[64]; /* for the future */
609-};
610-
611-
612-/* queue tempo */
613-struct snd_seq_queue_tempo {
614- int queue; /* sequencer queue */
615- unsigned int tempo; /* current tempo, us/tick */
616- int ppq; /* time resolution, ticks/quarter */
617- unsigned int skew_value; /* queue skew */
618- unsigned int skew_base; /* queue skew base */
619- char reserved[24]; /* for the future */
620-};
621-
622-
623-/* sequencer timer sources */
624-#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
625-#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
626-#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
627-
628-/* queue timer info */
629-struct snd_seq_queue_timer {
630- int queue; /* sequencer queue */
631- int type; /* source timer type */
632- union {
633- struct {
634- struct snd_timer_id id; /* ALSA's timer ID */
635- unsigned int resolution; /* resolution in Hz */
636- } alsa;
637- } u;
638- char reserved[64]; /* for the future use */
639-};
640-
641-
642-struct snd_seq_queue_client {
643- int queue; /* sequencer queue */
644- int client; /* sequencer client */
645- int used; /* queue is used with this client
646- (must be set for accepting events) */
647- /* per client watermarks */
648- char reserved[64]; /* for future use */
649-};
650-
651-
652-#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
653-#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
654-#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
655-
656-struct snd_seq_port_subscribe {
657- struct snd_seq_addr sender; /* sender address */
658- struct snd_seq_addr dest; /* destination address */
659- unsigned int voices; /* number of voices to be allocated (0 = don't care) */
660- unsigned int flags; /* modes */
661- unsigned char queue; /* input time-stamp queue (optional) */
662- unsigned char pad[3]; /* reserved */
663- char reserved[64];
664-};
665-
666-/* type of query subscription */
667-#define SNDRV_SEQ_QUERY_SUBS_READ 0
668-#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
669-
670-struct snd_seq_query_subs {
671- struct snd_seq_addr root; /* client/port id to be searched */
672- int type; /* READ or WRITE */
673- int index; /* 0..N-1 */
674- int num_subs; /* R/O: number of subscriptions on this port */
675- struct snd_seq_addr addr; /* R/O: result */
676- unsigned char queue; /* R/O: result */
677- unsigned int flags; /* R/O: result */
678- char reserved[64]; /* for future use */
679-};
680-
681-
682-/*
683- * IOCTL commands
684- */
685-
686-#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
687-#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
688-#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
689-#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
690-
691-#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
692-#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
693-
694-#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
695-#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
696-#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
697-#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
698-
699-#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
700-#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
701-
702-#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
703-#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
704-#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
705-#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
706-#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
707-#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
708-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
709-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
710-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
711-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
712-#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
713-#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
714-#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
715-#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
716-#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
717-#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
718-#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
719-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
720-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
721-
722-#endif /* _UAPI__SOUND_ASEQUENCER_H */
723+#include <alsa/sound/uapi/asequencer.h>
724diff --git a/include/sound/asoc.h b/include/sound/asoc.h
725index a74ca232..185bba81 100644
726--- a/include/sound/asoc.h
727+++ b/include/sound/asoc.h
728@@ -1,633 +1 @@
729-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
730-/*
731- * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
732- *
733- * Copyright (C) 2012 Texas Instruments Inc.
734- * Copyright (C) 2015 Intel Corporation.
735- *
736- * This program is free software; you can redistribute it and/or modify
737- * it under the terms of the GNU General Public License version 2 as
738- * published by the Free Software Foundation.
739- *
740- * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
741- * algorithms, equalisers, DAIs, widgets etc.
742-*/
743-
744-#ifndef __LINUX_UAPI_SND_ASOC_H
745-#define __LINUX_UAPI_SND_ASOC_H
746-
747-#include <linux/types.h>
748-#include <sound/asound.h>
749-
750-/*
751- * Maximum number of channels topology kcontrol can represent.
752- */
753-#define SND_SOC_TPLG_MAX_CHAN 8
754-
755-/*
756- * Maximum number of PCM formats capability
757- */
758-#define SND_SOC_TPLG_MAX_FORMATS 16
759-
760-/*
761- * Maximum number of PCM stream configs
762- */
763-#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
764-
765-/*
766- * Maximum number of physical link's hardware configs
767- */
768-#define SND_SOC_TPLG_HW_CONFIG_MAX 8
769-
770-/* individual kcontrol info types - can be mixed with other types */
771-#define SND_SOC_TPLG_CTL_VOLSW 1
772-#define SND_SOC_TPLG_CTL_VOLSW_SX 2
773-#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
774-#define SND_SOC_TPLG_CTL_ENUM 4
775-#define SND_SOC_TPLG_CTL_BYTES 5
776-#define SND_SOC_TPLG_CTL_ENUM_VALUE 6
777-#define SND_SOC_TPLG_CTL_RANGE 7
778-#define SND_SOC_TPLG_CTL_STROBE 8
779-
780-
781-/* individual widget kcontrol info types - can be mixed with other types */
782-#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
783-#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
784-#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
785-#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
786-#define SND_SOC_TPLG_DAPM_CTL_PIN 68
787-
788-/* DAPM widget types - add new items to the end */
789-#define SND_SOC_TPLG_DAPM_INPUT 0
790-#define SND_SOC_TPLG_DAPM_OUTPUT 1
791-#define SND_SOC_TPLG_DAPM_MUX 2
792-#define SND_SOC_TPLG_DAPM_MIXER 3
793-#define SND_SOC_TPLG_DAPM_PGA 4
794-#define SND_SOC_TPLG_DAPM_OUT_DRV 5
795-#define SND_SOC_TPLG_DAPM_ADC 6
796-#define SND_SOC_TPLG_DAPM_DAC 7
797-#define SND_SOC_TPLG_DAPM_SWITCH 8
798-#define SND_SOC_TPLG_DAPM_PRE 9
799-#define SND_SOC_TPLG_DAPM_POST 10
800-#define SND_SOC_TPLG_DAPM_AIF_IN 11
801-#define SND_SOC_TPLG_DAPM_AIF_OUT 12
802-#define SND_SOC_TPLG_DAPM_DAI_IN 13
803-#define SND_SOC_TPLG_DAPM_DAI_OUT 14
804-#define SND_SOC_TPLG_DAPM_DAI_LINK 15
805-#define SND_SOC_TPLG_DAPM_BUFFER 16
806-#define SND_SOC_TPLG_DAPM_SCHEDULER 17
807-#define SND_SOC_TPLG_DAPM_EFFECT 18
808-#define SND_SOC_TPLG_DAPM_SIGGEN 19
809-#define SND_SOC_TPLG_DAPM_SRC 20
810-#define SND_SOC_TPLG_DAPM_ASRC 21
811-#define SND_SOC_TPLG_DAPM_ENCODER 22
812-#define SND_SOC_TPLG_DAPM_DECODER 23
813-#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
814-
815-/* Header magic number and string sizes */
816-#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
817-
818-/* string sizes */
819-#define SND_SOC_TPLG_NUM_TEXTS 16
820-
821-/* ABI version */
822-#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
823-#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
824-
825-/* Max size of TLV data */
826-#define SND_SOC_TPLG_TLV_SIZE 32
827-
828-/*
829- * File and Block header data types.
830- * Add new generic and vendor types to end of list.
831- * Generic types are handled by the core whilst vendors types are passed
832- * to the component drivers for handling.
833- */
834-#define SND_SOC_TPLG_TYPE_MIXER 1
835-#define SND_SOC_TPLG_TYPE_BYTES 2
836-#define SND_SOC_TPLG_TYPE_ENUM 3
837-#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
838-#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
839-#define SND_SOC_TPLG_TYPE_DAI_LINK 6
840-#define SND_SOC_TPLG_TYPE_PCM 7
841-#define SND_SOC_TPLG_TYPE_MANIFEST 8
842-#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
843-#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
844-#define SND_SOC_TPLG_TYPE_PDATA 11
845-#define SND_SOC_TPLG_TYPE_DAI 12
846-#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
847-
848-/* vendor block IDs - please add new vendor types to end */
849-#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
850-#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
851-#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
852-#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
853-
854-#define SND_SOC_TPLG_STREAM_PLAYBACK 0
855-#define SND_SOC_TPLG_STREAM_CAPTURE 1
856-
857-/* vendor tuple types */
858-#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
859-#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
860-#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
861-#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
862-#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
863-#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
864-
865-/* DAI flags */
866-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
867-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
868-#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
869-
870-/* DAI clock gating */
871-#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
872-#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
873-#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
874-
875-/* DAI mclk_direction */
876-#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
877-#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
878-
879-/* DAI physical PCM data formats.
880- * Add new formats to the end of the list.
881- */
882-#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
883-#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
884-#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
885-#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
886-#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
887-#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
888-#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
889-
890-/* left and right justified also known as MSB and LSB respectively */
891-#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
892-#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
893-
894-/* DAI link flags */
895-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
896-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
897-#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
898-#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
899-
900-/* DAI topology BCLK parameter
901- * For the backwards capability, by default codec is bclk master
902- */
903-#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */
904-#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */
905-
906-/* DAI topology FSYNC parameter
907- * For the backwards capability, by default codec is fsync master
908- */
909-#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */
910-#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */
911-
912-/*
913- * Block Header.
914- * This header precedes all object and object arrays below.
915- */
916-struct snd_soc_tplg_hdr {
917- __le32 magic; /* magic number */
918- __le32 abi; /* ABI version */
919- __le32 version; /* optional vendor specific version details */
920- __le32 type; /* SND_SOC_TPLG_TYPE_ */
921- __le32 size; /* size of this structure */
922- __le32 vendor_type; /* optional vendor specific type info */
923- __le32 payload_size; /* data bytes, excluding this header */
924- __le32 index; /* identifier for block */
925- __le32 count; /* number of elements in block */
926-} __attribute__((packed));
927-
928-/* vendor tuple for uuid */
929-struct snd_soc_tplg_vendor_uuid_elem {
930- __le32 token;
931- char uuid[16];
932-} __attribute__((packed));
933-
934-/* vendor tuple for a bool/byte/short/word value */
935-struct snd_soc_tplg_vendor_value_elem {
936- __le32 token;
937- __le32 value;
938-} __attribute__((packed));
939-
940-/* vendor tuple for string */
941-struct snd_soc_tplg_vendor_string_elem {
942- __le32 token;
943- char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
944-} __attribute__((packed));
945-
946-struct snd_soc_tplg_vendor_array {
947- __le32 size; /* size in bytes of the array, including all elements */
948- __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
949- __le32 num_elems; /* number of elements in array */
950- union {
951- struct snd_soc_tplg_vendor_uuid_elem uuid[0];
952- struct snd_soc_tplg_vendor_value_elem value[0];
953- struct snd_soc_tplg_vendor_string_elem string[0];
954- };
955-} __attribute__((packed));
956-
957-/*
958- * Private data.
959- * All topology objects may have private data that can be used by the driver or
960- * firmware. Core will ignore this data.
961- */
962-struct snd_soc_tplg_private {
963- __le32 size; /* in bytes of private data */
964- union {
965- char data[0];
966- struct snd_soc_tplg_vendor_array array[0];
967- };
968-} __attribute__((packed));
969-
970-/*
971- * Kcontrol TLV data.
972- */
973-struct snd_soc_tplg_tlv_dbscale {
974- __le32 min;
975- __le32 step;
976- __le32 mute;
977-} __attribute__((packed));
978-
979-struct snd_soc_tplg_ctl_tlv {
980- __le32 size; /* in bytes of this structure */
981- __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
982- union {
983- __le32 data[SND_SOC_TPLG_TLV_SIZE];
984- struct snd_soc_tplg_tlv_dbscale scale;
985- };
986-} __attribute__((packed));
987-
988-/*
989- * Kcontrol channel data
990- */
991-struct snd_soc_tplg_channel {
992- __le32 size; /* in bytes of this structure */
993- __le32 reg;
994- __le32 shift;
995- __le32 id; /* ID maps to Left, Right, LFE etc */
996-} __attribute__((packed));
997-
998-/*
999- * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
1000- * Kcontrol ops need get/put/info.
1001- * Bytes ext ops need get/put.
1002- */
1003-struct snd_soc_tplg_io_ops {
1004- __le32 get;
1005- __le32 put;
1006- __le32 info;
1007-} __attribute__((packed));
1008-
1009-/*
1010- * kcontrol header
1011- */
1012-struct snd_soc_tplg_ctl_hdr {
1013- __le32 size; /* in bytes of this structure */
1014- __le32 type;
1015- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1016- __le32 access;
1017- struct snd_soc_tplg_io_ops ops;
1018- struct snd_soc_tplg_ctl_tlv tlv;
1019-} __attribute__((packed));
1020-
1021-/*
1022- * Stream Capabilities
1023- */
1024-struct snd_soc_tplg_stream_caps {
1025- __le32 size; /* in bytes of this structure */
1026- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1027- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
1028- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
1029- __le32 rate_min; /* min rate */
1030- __le32 rate_max; /* max rate */
1031- __le32 channels_min; /* min channels */
1032- __le32 channels_max; /* max channels */
1033- __le32 periods_min; /* min number of periods */
1034- __le32 periods_max; /* max number of periods */
1035- __le32 period_size_min; /* min period size bytes */
1036- __le32 period_size_max; /* max period size bytes */
1037- __le32 buffer_size_min; /* min buffer size bytes */
1038- __le32 buffer_size_max; /* max buffer size bytes */
1039- __le32 sig_bits; /* number of bits of content */
1040-} __attribute__((packed));
1041-
1042-/*
1043- * FE or BE Stream configuration supported by SW/FW
1044- */
1045-struct snd_soc_tplg_stream {
1046- __le32 size; /* in bytes of this structure */
1047- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
1048- __le64 format; /* SNDRV_PCM_FMTBIT_* */
1049- __le32 rate; /* SNDRV_PCM_RATE_* */
1050- __le32 period_bytes; /* size of period in bytes */
1051- __le32 buffer_bytes; /* size of buffer in bytes */
1052- __le32 channels; /* channels */
1053-} __attribute__((packed));
1054-
1055-
1056-/*
1057- * Describes a physical link's runtime supported hardware config,
1058- * i.e. hardware audio formats.
1059- */
1060-struct snd_soc_tplg_hw_config {
1061- __le32 size; /* in bytes of this structure */
1062- __le32 id; /* unique ID - - used to match */
1063- __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
1064- __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
1065- __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
1066- __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
1067- __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */
1068- __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */
1069- __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
1070- __le16 reserved; /* for 32bit alignment */
1071- __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
1072- __le32 bclk_rate; /* BCLK freqency in Hz */
1073- __le32 fsync_rate; /* frame clock in Hz */
1074- __le32 tdm_slots; /* number of TDM slots in use */
1075- __le32 tdm_slot_width; /* width in bits for each slot */
1076- __le32 tx_slots; /* bit mask for active Tx slots */
1077- __le32 rx_slots; /* bit mask for active Rx slots */
1078- __le32 tx_channels; /* number of Tx channels */
1079- __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
1080- __le32 rx_channels; /* number of Rx channels */
1081- __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
1082-} __attribute__((packed));
1083-
1084-/*
1085- * Manifest. List totals for each payload type. Not used in parsing, but will
1086- * be passed to the component driver before any other objects in order for any
1087- * global component resource allocations.
1088- *
1089- * File block representation for manifest :-
1090- * +-----------------------------------+----+
1091- * | struct snd_soc_tplg_hdr | 1 |
1092- * +-----------------------------------+----+
1093- * | struct snd_soc_tplg_manifest | 1 |
1094- * +-----------------------------------+----+
1095- */
1096-struct snd_soc_tplg_manifest {
1097- __le32 size; /* in bytes of this structure */
1098- __le32 control_elems; /* number of control elements */
1099- __le32 widget_elems; /* number of widget elements */
1100- __le32 graph_elems; /* number of graph elements */
1101- __le32 pcm_elems; /* number of PCM elements */
1102- __le32 dai_link_elems; /* number of DAI link elements */
1103- __le32 dai_elems; /* number of physical DAI elements */
1104- __le32 reserved[20]; /* reserved for new ABI element types */
1105- struct snd_soc_tplg_private priv;
1106-} __attribute__((packed));
1107-
1108-/*
1109- * Mixer kcontrol.
1110- *
1111- * File block representation for mixer kcontrol :-
1112- * +-----------------------------------+----+
1113- * | struct snd_soc_tplg_hdr | 1 |
1114- * +-----------------------------------+----+
1115- * | struct snd_soc_tplg_mixer_control | N |
1116- * +-----------------------------------+----+
1117- */
1118-struct snd_soc_tplg_mixer_control {
1119- struct snd_soc_tplg_ctl_hdr hdr;
1120- __le32 size; /* in bytes of this structure */
1121- __le32 min;
1122- __le32 max;
1123- __le32 platform_max;
1124- __le32 invert;
1125- __le32 num_channels;
1126- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
1127- struct snd_soc_tplg_private priv;
1128-} __attribute__((packed));
1129-
1130-/*
1131- * Enumerated kcontrol
1132- *
1133- * File block representation for enum kcontrol :-
1134- * +-----------------------------------+----+
1135- * | struct snd_soc_tplg_hdr | 1 |
1136- * +-----------------------------------+----+
1137- * | struct snd_soc_tplg_enum_control | N |
1138- * +-----------------------------------+----+
1139- */
1140-struct snd_soc_tplg_enum_control {
1141- struct snd_soc_tplg_ctl_hdr hdr;
1142- __le32 size; /* in bytes of this structure */
1143- __le32 num_channels;
1144- struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
1145- __le32 items;
1146- __le32 mask;
1147- __le32 count;
1148- char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1149- __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
1150- struct snd_soc_tplg_private priv;
1151-} __attribute__((packed));
1152-
1153-/*
1154- * Bytes kcontrol
1155- *
1156- * File block representation for bytes kcontrol :-
1157- * +-----------------------------------+----+
1158- * | struct snd_soc_tplg_hdr | 1 |
1159- * +-----------------------------------+----+
1160- * | struct snd_soc_tplg_bytes_control | N |
1161- * +-----------------------------------+----+
1162- */
1163-struct snd_soc_tplg_bytes_control {
1164- struct snd_soc_tplg_ctl_hdr hdr;
1165- __le32 size; /* in bytes of this structure */
1166- __le32 max;
1167- __le32 mask;
1168- __le32 base;
1169- __le32 num_regs;
1170- struct snd_soc_tplg_io_ops ext_ops;
1171- struct snd_soc_tplg_private priv;
1172-} __attribute__((packed));
1173-
1174-/*
1175- * DAPM Graph Element
1176- *
1177- * File block representation for DAPM graph elements :-
1178- * +-------------------------------------+----+
1179- * | struct snd_soc_tplg_hdr | 1 |
1180- * +-------------------------------------+----+
1181- * | struct snd_soc_tplg_dapm_graph_elem | N |
1182- * +-------------------------------------+----+
1183- */
1184-struct snd_soc_tplg_dapm_graph_elem {
1185- char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1186- char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1187- char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1188-} __attribute__((packed));
1189-
1190-/*
1191- * DAPM Widget.
1192- *
1193- * File block representation for DAPM widget :-
1194- * +-------------------------------------+-----+
1195- * | struct snd_soc_tplg_hdr | 1 |
1196- * +-------------------------------------+-----+
1197- * | struct snd_soc_tplg_dapm_widget | N |
1198- * +-------------------------------------+-----+
1199- * | struct snd_soc_tplg_enum_control | 0|1 |
1200- * | struct snd_soc_tplg_mixer_control | 0|N |
1201- * +-------------------------------------+-----+
1202- *
1203- * Optional enum or mixer control can be appended to the end of each widget
1204- * in the block.
1205- */
1206-struct snd_soc_tplg_dapm_widget {
1207- __le32 size; /* in bytes of this structure */
1208- __le32 id; /* SND_SOC_DAPM_CTL */
1209- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1210- char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1211-
1212- __le32 reg; /* negative reg = no direct dapm */
1213- __le32 shift; /* bits to shift */
1214- __le32 mask; /* non-shifted mask */
1215- __le32 subseq; /* sort within widget type */
1216- __le32 invert; /* invert the power bit */
1217- __le32 ignore_suspend; /* kept enabled over suspend */
1218- __le16 event_flags;
1219- __le16 event_type;
1220- __le32 num_kcontrols;
1221- struct snd_soc_tplg_private priv;
1222- /*
1223- * kcontrols that relate to this widget
1224- * follow here after widget private data
1225- */
1226-} __attribute__((packed));
1227-
1228-
1229-/*
1230- * Describes SW/FW specific features of PCM (FE DAI & DAI link).
1231- *
1232- * File block representation for PCM :-
1233- * +-----------------------------------+-----+
1234- * | struct snd_soc_tplg_hdr | 1 |
1235- * +-----------------------------------+-----+
1236- * | struct snd_soc_tplg_pcm | N |
1237- * +-----------------------------------+-----+
1238- */
1239-struct snd_soc_tplg_pcm {
1240- __le32 size; /* in bytes of this structure */
1241- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1242- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1243- __le32 pcm_id; /* unique ID - used to match with DAI link */
1244- __le32 dai_id; /* unique ID - used to match */
1245- __le32 playback; /* supports playback mode */
1246- __le32 capture; /* supports capture mode */
1247- __le32 compress; /* 1 = compressed; 0 = PCM */
1248- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
1249- __le32 num_streams; /* number of streams */
1250- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
1251- __le32 flag_mask; /* bitmask of flags to configure */
1252- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
1253- struct snd_soc_tplg_private priv;
1254-} __attribute__((packed));
1255-
1256-
1257-/*
1258- * Describes the physical link runtime supported configs or params
1259- *
1260- * File block representation for physical link config :-
1261- * +-----------------------------------+-----+
1262- * | struct snd_soc_tplg_hdr | 1 |
1263- * +-----------------------------------+-----+
1264- * | struct snd_soc_tplg_link_config | N |
1265- * +-----------------------------------+-----+
1266- */
1267-struct snd_soc_tplg_link_config {
1268- __le32 size; /* in bytes of this structure */
1269- __le32 id; /* unique ID - used to match */
1270- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
1271- char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
1272- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
1273- __le32 num_streams; /* number of streams */
1274- struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
1275- __le32 num_hw_configs; /* number of hw configs */
1276- __le32 default_hw_config_id; /* default hw config ID for init */
1277- __le32 flag_mask; /* bitmask of flags to configure */
1278- __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
1279- struct snd_soc_tplg_private priv;
1280-} __attribute__((packed));
1281-
1282-/*
1283- * Describes SW/FW specific features of physical DAI.
1284- * It can be used to configure backend DAIs for DPCM.
1285- *
1286- * File block representation for physical DAI :-
1287- * +-----------------------------------+-----+
1288- * | struct snd_soc_tplg_hdr | 1 |
1289- * +-----------------------------------+-----+
1290- * | struct snd_soc_tplg_dai | N |
1291- * +-----------------------------------+-----+
1292- */
1293-struct snd_soc_tplg_dai {
1294- __le32 size; /* in bytes of this structure */
1295- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
1296- __le32 dai_id; /* unique ID - used to match */
1297- __le32 playback; /* supports playback mode */
1298- __le32 capture; /* supports capture mode */
1299- struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
1300- __le32 flag_mask; /* bitmask of flags to configure */
1301- __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
1302- struct snd_soc_tplg_private priv;
1303-} __attribute__((packed));
1304-
1305-/*
1306- * Old version of ABI structs, supported for backward compatibility.
1307- */
1308-
1309-/* Manifest v4 */
1310-struct snd_soc_tplg_manifest_v4 {
1311- __le32 size; /* in bytes of this structure */
1312- __le32 control_elems; /* number of control elements */
1313- __le32 widget_elems; /* number of widget elements */
1314- __le32 graph_elems; /* number of graph elements */
1315- __le32 pcm_elems; /* number of PCM elements */
1316- __le32 dai_link_elems; /* number of DAI link elements */
1317- struct snd_soc_tplg_private priv;
1318-} __packed;
1319-
1320-/* Stream Capabilities v4 */
1321-struct snd_soc_tplg_stream_caps_v4 {
1322- __le32 size; /* in bytes of this structure */
1323- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1324- __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
1325- __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
1326- __le32 rate_min; /* min rate */
1327- __le32 rate_max; /* max rate */
1328- __le32 channels_min; /* min channels */
1329- __le32 channels_max; /* max channels */
1330- __le32 periods_min; /* min number of periods */
1331- __le32 periods_max; /* max number of periods */
1332- __le32 period_size_min; /* min period size bytes */
1333- __le32 period_size_max; /* max period size bytes */
1334- __le32 buffer_size_min; /* min buffer size bytes */
1335- __le32 buffer_size_max; /* max buffer size bytes */
1336-} __packed;
1337-
1338-/* PCM v4 */
1339-struct snd_soc_tplg_pcm_v4 {
1340- __le32 size; /* in bytes of this structure */
1341- char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1342- char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
1343- __le32 pcm_id; /* unique ID - used to match with DAI link */
1344- __le32 dai_id; /* unique ID - used to match */
1345- __le32 playback; /* supports playback mode */
1346- __le32 capture; /* supports capture mode */
1347- __le32 compress; /* 1 = compressed; 0 = PCM */
1348- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
1349- __le32 num_streams; /* number of streams */
1350- struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
1351-} __packed;
1352-
1353-/* Physical link config v4 */
1354-struct snd_soc_tplg_link_config_v4 {
1355- __le32 size; /* in bytes of this structure */
1356- __le32 id; /* unique ID - used to match */
1357- struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
1358- __le32 num_streams; /* number of streams */
1359-} __packed;
1360-
1361-#endif
1362+#include <alsa/sound/uapi/asoc.h>
1363diff --git a/include/sound/asound.h b/include/sound/asound.h
1364index df1153ce..3be4d850 100644
1365--- a/include/sound/asound.h
1366+++ b/include/sound/asound.h
1367@@ -1,1038 +1 @@
1368-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
1369-/*
1370- * Advanced Linux Sound Architecture - ALSA - Driver
1371- * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
1372- * Abramo Bagnara <abramo@alsa-project.org>
1373- *
1374- *
1375- * This program is free software; you can redistribute it and/or modify
1376- * it under the terms of the GNU General Public License as published by
1377- * the Free Software Foundation; either version 2 of the License, or
1378- * (at your option) any later version.
1379- *
1380- * This program is distributed in the hope that it will be useful,
1381- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1382- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1383- * GNU General Public License for more details.
1384- *
1385- * You should have received a copy of the GNU General Public License
1386- * along with this program; if not, write to the Free Software
1387- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1388- *
1389- */
1390-
1391-#ifndef _UAPI__SOUND_ASOUND_H
1392-#define _UAPI__SOUND_ASOUND_H
1393-
1394-#if defined(__KERNEL__) || defined(__linux__)
1395-#include <linux/types.h>
1396-#else
1397-#include <sys/ioctl.h>
1398-#endif
1399-
1400-#ifndef __KERNEL__
1401-#include <stdlib.h>
1402-#include <time.h>
1403-#endif
1404-
1405-/*
1406- * protocol version
1407- */
1408-
1409-#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
1410-#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
1411-#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
1412-#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
1413-#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
1414- (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
1415- (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
1416- SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
1417-
1418-/****************************************************************************
1419- * *
1420- * Digital audio interface *
1421- * *
1422- ****************************************************************************/
1423-
1424-struct snd_aes_iec958 {
1425- unsigned char status[24]; /* AES/IEC958 channel status bits */
1426- unsigned char subcode[147]; /* AES/IEC958 subcode bits */
1427- unsigned char pad; /* nothing */
1428- unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
1429-};
1430-
1431-/****************************************************************************
1432- * *
1433- * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
1434- * *
1435- ****************************************************************************/
1436-
1437-struct snd_cea_861_aud_if {
1438- unsigned char db1_ct_cc; /* coding type and channel count */
1439- unsigned char db2_sf_ss; /* sample frequency and size */
1440- unsigned char db3; /* not used, all zeros */
1441- unsigned char db4_ca; /* channel allocation code */
1442- unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
1443-};
1444-
1445-/****************************************************************************
1446- * *
1447- * Section for driver hardware dependent interface - /dev/snd/hw? *
1448- * *
1449- ****************************************************************************/
1450-
1451-#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
1452-
1453-enum {
1454- SNDRV_HWDEP_IFACE_OPL2 = 0,
1455- SNDRV_HWDEP_IFACE_OPL3,
1456- SNDRV_HWDEP_IFACE_OPL4,
1457- SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
1458- SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
1459- SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
1460- SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
1461- SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
1462- SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
1463- SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
1464- SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
1465- SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
1466- SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
1467- SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
1468- SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
1469- SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
1470- SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
1471- SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
1472- SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
1473- SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */
1474- SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */
1475- SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */
1476- SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
1477- SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
1478- SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */
1479- SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */
1480- SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */
1481-
1482- /* Don't forget to change the following: */
1483- SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
1484-};
1485-
1486-struct snd_hwdep_info {
1487- unsigned int device; /* WR: device number */
1488- int card; /* R: card number */
1489- unsigned char id[64]; /* ID (user selectable) */
1490- unsigned char name[80]; /* hwdep name */
1491- int iface; /* hwdep interface */
1492- unsigned char reserved[64]; /* reserved for future */
1493-};
1494-
1495-/* generic DSP loader */
1496-struct snd_hwdep_dsp_status {
1497- unsigned int version; /* R: driver-specific version */
1498- unsigned char id[32]; /* R: driver-specific ID string */
1499- unsigned int num_dsps; /* R: number of DSP images to transfer */
1500- unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
1501- unsigned int chip_ready; /* R: 1 = initialization finished */
1502- unsigned char reserved[16]; /* reserved for future use */
1503-};
1504-
1505-struct snd_hwdep_dsp_image {
1506- unsigned int index; /* W: DSP index */
1507- unsigned char name[64]; /* W: ID (e.g. file name) */
1508- unsigned char __user *image; /* W: binary image */
1509- size_t length; /* W: size of image in bytes */
1510- unsigned long driver_data; /* W: driver-specific data */
1511-};
1512-
1513-#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
1514-#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
1515-#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
1516-#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
1517-
1518-/*****************************************************************************
1519- * *
1520- * Digital Audio (PCM) interface - /dev/snd/pcm?? *
1521- * *
1522- *****************************************************************************/
1523-
1524-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
1525-
1526-typedef unsigned long snd_pcm_uframes_t;
1527-typedef signed long snd_pcm_sframes_t;
1528-
1529-enum {
1530- SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
1531- SNDRV_PCM_CLASS_MULTI, /* multichannel device */
1532- SNDRV_PCM_CLASS_MODEM, /* software modem class */
1533- SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
1534- /* Don't forget to change the following: */
1535- SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
1536-};
1537-
1538-enum {
1539- SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
1540- SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
1541- /* Don't forget to change the following: */
1542- SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
1543-};
1544-
1545-enum {
1546- SNDRV_PCM_STREAM_PLAYBACK = 0,
1547- SNDRV_PCM_STREAM_CAPTURE,
1548- SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
1549-};
1550-
1551-typedef int __bitwise snd_pcm_access_t;
1552-#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
1553-#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
1554-#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
1555-#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
1556-#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
1557-#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
1558-
1559-typedef int __bitwise snd_pcm_format_t;
1560-#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
1561-#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
1562-#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
1563-#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
1564-#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
1565-#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
1566-#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
1567-#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
1568-#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
1569-#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
1570-#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
1571-#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
1572-#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
1573-#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
1574-#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 */
1575-#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 */
1576-#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 */
1577-#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 */
1578-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
1579-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
1580-#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
1581-#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
1582-#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
1583-#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
1584-#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
1585-#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
1586-#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
1587-#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
1588-#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
1589-/* gap in the numbering for a future standard linear format */
1590-#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
1591-#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
1592-#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
1593-#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
1594-#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
1595-#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
1596-#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
1597-#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
1598-#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
1599-#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
1600-#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
1601-#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
1602-#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
1603-#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
1604-#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
1605-#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
1606-#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
1607-#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
1608-#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
1609-#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
1610-#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
1611-#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
1612-#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
1613-#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
1614-
1615-#ifdef SNDRV_LITTLE_ENDIAN
1616-#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
1617-#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
1618-#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
1619-#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
1620-#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
1621-#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
1622-#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
1623-#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
1624-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
1625-#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE
1626-#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE
1627-#endif
1628-#ifdef SNDRV_BIG_ENDIAN
1629-#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
1630-#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
1631-#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
1632-#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
1633-#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
1634-#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
1635-#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
1636-#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
1637-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
1638-#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE
1639-#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
1640-#endif
1641-
1642-typedef int __bitwise snd_pcm_subformat_t;
1643-#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
1644-#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
1645-
1646-#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
1647-#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
1648-#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
1649-#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
1650-#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
1651-#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
1652-#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
1653-#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
1654-#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
1655-#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
1656-#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
1657-#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
1658-#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
1659-#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
1660-#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
1661-#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
1662-#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */
1663-#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */
1664-#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
1665-#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
1666-#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
1667-
1668-#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
1669-#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
1670-
1671-
1672-
1673-typedef int __bitwise snd_pcm_state_t;
1674-#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
1675-#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
1676-#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
1677-#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
1678-#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
1679-#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
1680-#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
1681-#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
1682-#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
1683-#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
1684-
1685-enum {
1686- SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
1687- SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
1688- SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
1689-};
1690-
1691-union snd_pcm_sync_id {
1692- unsigned char id[16];
1693- unsigned short id16[8];
1694- unsigned int id32[4];
1695-};
1696-
1697-struct snd_pcm_info {
1698- unsigned int device; /* RO/WR (control): device number */
1699- unsigned int subdevice; /* RO/WR (control): subdevice number */
1700- int stream; /* RO/WR (control): stream direction */
1701- int card; /* R: card number */
1702- unsigned char id[64]; /* ID (user selectable) */
1703- unsigned char name[80]; /* name of this device */
1704- unsigned char subname[32]; /* subdevice name */
1705- int dev_class; /* SNDRV_PCM_CLASS_* */
1706- int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
1707- unsigned int subdevices_count;
1708- unsigned int subdevices_avail;
1709- union snd_pcm_sync_id sync; /* hardware synchronization ID */
1710- unsigned char reserved[64]; /* reserved for future... */
1711-};
1712-
1713-typedef int snd_pcm_hw_param_t;
1714-#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
1715-#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
1716-#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
1717-#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
1718-#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
1719-
1720-#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
1721-#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
1722-#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
1723-#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
1724-#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
1725- * interrupts in us
1726- */
1727-#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
1728- * interrupts
1729- */
1730-#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
1731- * interrupts
1732- */
1733-#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
1734- * buffer
1735- */
1736-#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
1737- * in us
1738- */
1739-#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
1740-#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
1741-#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
1742-#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
1743-#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
1744-
1745-#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
1746-#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
1747-#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
1748-
1749-struct snd_interval {
1750- unsigned int min, max;
1751- unsigned int openmin:1,
1752- openmax:1,
1753- integer:1,
1754- empty:1;
1755-};
1756-
1757-#define SNDRV_MASK_MAX 256
1758-
1759-struct snd_mask {
1760- __u32 bits[(SNDRV_MASK_MAX+31)/32];
1761-};
1762-
1763-struct snd_pcm_hw_params {
1764- unsigned int flags;
1765- struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
1766- SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
1767- struct snd_mask mres[5]; /* reserved masks */
1768- struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
1769- SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
1770- struct snd_interval ires[9]; /* reserved intervals */
1771- unsigned int rmask; /* W: requested masks */
1772- unsigned int cmask; /* R: changed masks */
1773- unsigned int info; /* R: Info flags for returned setup */
1774- unsigned int msbits; /* R: used most significant bits */
1775- unsigned int rate_num; /* R: rate numerator */
1776- unsigned int rate_den; /* R: rate denominator */
1777- snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
1778- unsigned char reserved[64]; /* reserved for future */
1779-};
1780-
1781-enum {
1782- SNDRV_PCM_TSTAMP_NONE = 0,
1783- SNDRV_PCM_TSTAMP_ENABLE,
1784- SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
1785-};
1786-
1787-struct snd_pcm_sw_params {
1788- int tstamp_mode; /* timestamp mode */
1789- unsigned int period_step;
1790- unsigned int sleep_min; /* min ticks to sleep */
1791- snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
1792- snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
1793- snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
1794- snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
1795- snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
1796- snd_pcm_uframes_t silence_size; /* silence block size */
1797- snd_pcm_uframes_t boundary; /* pointers wrap point */
1798- unsigned int proto; /* protocol version */
1799- unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
1800- unsigned char reserved[56]; /* reserved for future */
1801-};
1802-
1803-struct snd_pcm_channel_info {
1804- unsigned int channel;
1805- __kernel_off_t offset; /* mmap offset */
1806- unsigned int first; /* offset to first sample in bits */
1807- unsigned int step; /* samples distance in bits */
1808-};
1809-
1810-enum {
1811- /*
1812- * first definition for backwards compatibility only,
1813- * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
1814- */
1815- SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
1816-
1817- /* timestamp definitions */
1818- SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */
1819- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */
1820- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */
1821- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */
1822- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
1823- SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
1824-};
1825-
1826-struct snd_pcm_status {
1827- snd_pcm_state_t state; /* stream state */
1828- struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
1829- struct timespec tstamp; /* reference timestamp */
1830- snd_pcm_uframes_t appl_ptr; /* appl ptr */
1831- snd_pcm_uframes_t hw_ptr; /* hw ptr */
1832- snd_pcm_sframes_t delay; /* current delay in frames */
1833- snd_pcm_uframes_t avail; /* number of frames available */
1834- snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
1835- snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
1836- snd_pcm_state_t suspended_state; /* suspended stream state */
1837- __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
1838- struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */
1839- struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */
1840- __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
1841- unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
1842-};
1843-
1844-struct snd_pcm_mmap_status {
1845- snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
1846- int pad1; /* Needed for 64 bit alignment */
1847- snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
1848- struct timespec tstamp; /* Timestamp */
1849- snd_pcm_state_t suspended_state; /* RO: suspended stream state */
1850- struct timespec audio_tstamp; /* from sample counter or wall clock */
1851-};
1852-
1853-struct snd_pcm_mmap_control {
1854- snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
1855- snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
1856-};
1857-
1858-#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
1859-#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
1860-#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
1861-
1862-struct snd_pcm_sync_ptr {
1863- unsigned int flags;
1864- union {
1865- struct snd_pcm_mmap_status status;
1866- unsigned char reserved[64];
1867- } s;
1868- union {
1869- struct snd_pcm_mmap_control control;
1870- unsigned char reserved[64];
1871- } c;
1872-};
1873-
1874-struct snd_xferi {
1875- snd_pcm_sframes_t result;
1876- void __user *buf;
1877- snd_pcm_uframes_t frames;
1878-};
1879-
1880-struct snd_xfern {
1881- snd_pcm_sframes_t result;
1882- void __user * __user *bufs;
1883- snd_pcm_uframes_t frames;
1884-};
1885-
1886-enum {
1887- SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
1888- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
1889- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
1890- SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
1891-};
1892-
1893-/* channel positions */
1894-enum {
1895- SNDRV_CHMAP_UNKNOWN = 0,
1896- SNDRV_CHMAP_NA, /* N/A, silent */
1897- SNDRV_CHMAP_MONO, /* mono stream */
1898- /* this follows the alsa-lib mixer channel value + 3 */
1899- SNDRV_CHMAP_FL, /* front left */
1900- SNDRV_CHMAP_FR, /* front right */
1901- SNDRV_CHMAP_RL, /* rear left */
1902- SNDRV_CHMAP_RR, /* rear right */
1903- SNDRV_CHMAP_FC, /* front center */
1904- SNDRV_CHMAP_LFE, /* LFE */
1905- SNDRV_CHMAP_SL, /* side left */
1906- SNDRV_CHMAP_SR, /* side right */
1907- SNDRV_CHMAP_RC, /* rear center */
1908- /* new definitions */
1909- SNDRV_CHMAP_FLC, /* front left center */
1910- SNDRV_CHMAP_FRC, /* front right center */
1911- SNDRV_CHMAP_RLC, /* rear left center */
1912- SNDRV_CHMAP_RRC, /* rear right center */
1913- SNDRV_CHMAP_FLW, /* front left wide */
1914- SNDRV_CHMAP_FRW, /* front right wide */
1915- SNDRV_CHMAP_FLH, /* front left high */
1916- SNDRV_CHMAP_FCH, /* front center high */
1917- SNDRV_CHMAP_FRH, /* front right high */
1918- SNDRV_CHMAP_TC, /* top center */
1919- SNDRV_CHMAP_TFL, /* top front left */
1920- SNDRV_CHMAP_TFR, /* top front right */
1921- SNDRV_CHMAP_TFC, /* top front center */
1922- SNDRV_CHMAP_TRL, /* top rear left */
1923- SNDRV_CHMAP_TRR, /* top rear right */
1924- SNDRV_CHMAP_TRC, /* top rear center */
1925- /* new definitions for UAC2 */
1926- SNDRV_CHMAP_TFLC, /* top front left center */
1927- SNDRV_CHMAP_TFRC, /* top front right center */
1928- SNDRV_CHMAP_TSL, /* top side left */
1929- SNDRV_CHMAP_TSR, /* top side right */
1930- SNDRV_CHMAP_LLFE, /* left LFE */
1931- SNDRV_CHMAP_RLFE, /* right LFE */
1932- SNDRV_CHMAP_BC, /* bottom center */
1933- SNDRV_CHMAP_BLC, /* bottom left center */
1934- SNDRV_CHMAP_BRC, /* bottom right center */
1935- SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
1936-};
1937-
1938-#define SNDRV_CHMAP_POSITION_MASK 0xffff
1939-#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
1940-#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
1941-
1942-#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
1943-#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
1944-#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
1945-#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
1946-#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int)
1947-#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
1948-#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
1949-#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
1950-#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
1951-#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
1952-#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
1953-#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
1954-#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
1955-#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
1956-#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
1957-#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
1958-#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
1959-#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
1960-#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
1961-#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
1962-#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
1963-#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
1964-#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
1965-#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
1966-#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
1967-#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
1968-#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
1969-#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
1970-#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
1971-#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
1972-#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
1973-
1974-/*****************************************************************************
1975- * *
1976- * MIDI v1.0 interface *
1977- * *
1978- *****************************************************************************/
1979-
1980-/*
1981- * Raw MIDI section - /dev/snd/midi??
1982- */
1983-
1984-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
1985-
1986-enum {
1987- SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
1988- SNDRV_RAWMIDI_STREAM_INPUT,
1989- SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
1990-};
1991-
1992-#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
1993-#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
1994-#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
1995-
1996-struct snd_rawmidi_info {
1997- unsigned int device; /* RO/WR (control): device number */
1998- unsigned int subdevice; /* RO/WR (control): subdevice number */
1999- int stream; /* WR: stream */
2000- int card; /* R: card number */
2001- unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
2002- unsigned char id[64]; /* ID (user selectable) */
2003- unsigned char name[80]; /* name of device */
2004- unsigned char subname[32]; /* name of active or selected subdevice */
2005- unsigned int subdevices_count;
2006- unsigned int subdevices_avail;
2007- unsigned char reserved[64]; /* reserved for future use */
2008-};
2009-
2010-struct snd_rawmidi_params {
2011- int stream;
2012- size_t buffer_size; /* queue size in bytes */
2013- size_t avail_min; /* minimum avail bytes for wakeup */
2014- unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
2015- unsigned char reserved[16]; /* reserved for future use */
2016-};
2017-
2018-struct snd_rawmidi_status {
2019- int stream;
2020- struct timespec tstamp; /* Timestamp */
2021- size_t avail; /* available bytes */
2022- size_t xruns; /* count of overruns since last status (in bytes) */
2023- unsigned char reserved[16]; /* reserved for future use */
2024-};
2025-
2026-#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
2027-#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
2028-#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
2029-#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
2030-#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
2031-#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
2032-
2033-/*
2034- * Timer section - /dev/snd/timer
2035- */
2036-
2037-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
2038-
2039-enum {
2040- SNDRV_TIMER_CLASS_NONE = -1,
2041- SNDRV_TIMER_CLASS_SLAVE = 0,
2042- SNDRV_TIMER_CLASS_GLOBAL,
2043- SNDRV_TIMER_CLASS_CARD,
2044- SNDRV_TIMER_CLASS_PCM,
2045- SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
2046-};
2047-
2048-/* slave timer classes */
2049-enum {
2050- SNDRV_TIMER_SCLASS_NONE = 0,
2051- SNDRV_TIMER_SCLASS_APPLICATION,
2052- SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
2053- SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
2054- SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
2055-};
2056-
2057-/* global timers (device member) */
2058-#define SNDRV_TIMER_GLOBAL_SYSTEM 0
2059-#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
2060-#define SNDRV_TIMER_GLOBAL_HPET 2
2061-#define SNDRV_TIMER_GLOBAL_HRTIMER 3
2062-
2063-/* info flags */
2064-#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
2065-
2066-struct snd_timer_id {
2067- int dev_class;
2068- int dev_sclass;
2069- int card;
2070- int device;
2071- int subdevice;
2072-};
2073-
2074-struct snd_timer_ginfo {
2075- struct snd_timer_id tid; /* requested timer ID */
2076- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
2077- int card; /* card number */
2078- unsigned char id[64]; /* timer identification */
2079- unsigned char name[80]; /* timer name */
2080- unsigned long reserved0; /* reserved for future use */
2081- unsigned long resolution; /* average period resolution in ns */
2082- unsigned long resolution_min; /* minimal period resolution in ns */
2083- unsigned long resolution_max; /* maximal period resolution in ns */
2084- unsigned int clients; /* active timer clients */
2085- unsigned char reserved[32];
2086-};
2087-
2088-struct snd_timer_gparams {
2089- struct snd_timer_id tid; /* requested timer ID */
2090- unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
2091- unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
2092- unsigned char reserved[32];
2093-};
2094-
2095-struct snd_timer_gstatus {
2096- struct snd_timer_id tid; /* requested timer ID */
2097- unsigned long resolution; /* current period resolution in ns */
2098- unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
2099- unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
2100- unsigned char reserved[32];
2101-};
2102-
2103-struct snd_timer_select {
2104- struct snd_timer_id id; /* bind to timer ID */
2105- unsigned char reserved[32]; /* reserved */
2106-};
2107-
2108-struct snd_timer_info {
2109- unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
2110- int card; /* card number */
2111- unsigned char id[64]; /* timer identificator */
2112- unsigned char name[80]; /* timer name */
2113- unsigned long reserved0; /* reserved for future use */
2114- unsigned long resolution; /* average period resolution in ns */
2115- unsigned char reserved[64]; /* reserved */
2116-};
2117-
2118-#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
2119-#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
2120-#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
2121-
2122-struct snd_timer_params {
2123- unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */
2124- unsigned int ticks; /* requested resolution in ticks */
2125- unsigned int queue_size; /* total size of queue (32-1024) */
2126- unsigned int reserved0; /* reserved, was: failure locations */
2127- unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
2128- unsigned char reserved[60]; /* reserved */
2129-};
2130-
2131-struct snd_timer_status {
2132- struct timespec tstamp; /* Timestamp - last update */
2133- unsigned int resolution; /* current period resolution in ns */
2134- unsigned int lost; /* counter of master tick lost */
2135- unsigned int overrun; /* count of read queue overruns */
2136- unsigned int queue; /* used queue size */
2137- unsigned char reserved[64]; /* reserved */
2138-};
2139-
2140-#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
2141-#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
2142-#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
2143-#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
2144-#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
2145-#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
2146-#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
2147-#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
2148-#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
2149-#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
2150-/* The following four ioctls are changed since 1.0.9 due to confliction */
2151-#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
2152-#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
2153-#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
2154-#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
2155-
2156-struct snd_timer_read {
2157- unsigned int resolution;
2158- unsigned int ticks;
2159-};
2160-
2161-enum {
2162- SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
2163- SNDRV_TIMER_EVENT_TICK, /* val = ticks */
2164- SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
2165- SNDRV_TIMER_EVENT_STOP, /* val = 0 */
2166- SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
2167- SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
2168- SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
2169- SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
2170- SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
2171- /* master timer events for slave timer instances */
2172- SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
2173- SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
2174- SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
2175- SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
2176- SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
2177- SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
2178-};
2179-
2180-struct snd_timer_tread {
2181- int event;
2182- struct timespec tstamp;
2183- unsigned int val;
2184-};
2185-
2186-/****************************************************************************
2187- * *
2188- * Section for driver control interface - /dev/snd/control? *
2189- * *
2190- ****************************************************************************/
2191-
2192-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
2193-
2194-struct snd_ctl_card_info {
2195- int card; /* card number */
2196- int pad; /* reserved for future (was type) */
2197- unsigned char id[16]; /* ID of card (user selectable) */
2198- unsigned char driver[16]; /* Driver name */
2199- unsigned char name[32]; /* Short name of soundcard */
2200- unsigned char longname[80]; /* name + info text about soundcard */
2201- unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
2202- unsigned char mixername[80]; /* visual mixer identification */
2203- unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
2204-};
2205-
2206-typedef int __bitwise snd_ctl_elem_type_t;
2207-#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
2208-#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
2209-#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
2210-#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
2211-#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
2212-#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
2213-#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
2214-#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
2215-
2216-typedef int __bitwise snd_ctl_elem_iface_t;
2217-#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
2218-#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
2219-#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
2220-#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
2221-#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
2222-#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
2223-#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
2224-#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
2225-
2226-#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
2227-#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
2228-#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
2229-#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
2230-#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
2231-#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
2232-#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
2233-#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
2234-#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
2235-#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
2236-#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
2237-#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
2238-#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
2239-#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
2240-/* bits 30 and 31 are obsoleted (for indirect access) */
2241-
2242-/* for further details see the ACPI and PCI power management specification */
2243-#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
2244-#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
2245-#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
2246-#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
2247-#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
2248-#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
2249-
2250-#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44
2251-
2252-struct snd_ctl_elem_id {
2253- unsigned int numid; /* numeric identifier, zero = invalid */
2254- snd_ctl_elem_iface_t iface; /* interface identifier */
2255- unsigned int device; /* device/client number */
2256- unsigned int subdevice; /* subdevice (substream) number */
2257- unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */
2258- unsigned int index; /* index of item */
2259-};
2260-
2261-struct snd_ctl_elem_list {
2262- unsigned int offset; /* W: first element ID to get */
2263- unsigned int space; /* W: count of element IDs to get */
2264- unsigned int used; /* R: count of element IDs set */
2265- unsigned int count; /* R: count of all elements */
2266- struct snd_ctl_elem_id __user *pids; /* R: IDs */
2267- unsigned char reserved[50];
2268-};
2269-
2270-struct snd_ctl_elem_info {
2271- struct snd_ctl_elem_id id; /* W: element ID */
2272- snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
2273- unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
2274- unsigned int count; /* count of values */
2275- __kernel_pid_t owner; /* owner's PID of this control */
2276- union {
2277- struct {
2278- long min; /* R: minimum value */
2279- long max; /* R: maximum value */
2280- long step; /* R: step (0 variable) */
2281- } integer;
2282- struct {
2283- long long min; /* R: minimum value */
2284- long long max; /* R: maximum value */
2285- long long step; /* R: step (0 variable) */
2286- } integer64;
2287- struct {
2288- unsigned int items; /* R: number of items */
2289- unsigned int item; /* W: item number */
2290- char name[64]; /* R: value name */
2291- __u64 names_ptr; /* W: names list (ELEM_ADD only) */
2292- unsigned int names_length;
2293- } enumerated;
2294- unsigned char reserved[128];
2295- } value;
2296- union {
2297- unsigned short d[4]; /* dimensions */
2298- unsigned short *d_ptr; /* indirect - obsoleted */
2299- } dimen;
2300- unsigned char reserved[64-4*sizeof(unsigned short)];
2301-};
2302-
2303-struct snd_ctl_elem_value {
2304- struct snd_ctl_elem_id id; /* W: element ID */
2305- unsigned int indirect: 1; /* W: indirect access - obsoleted */
2306- union {
2307- union {
2308- long value[128];
2309- long *value_ptr; /* obsoleted */
2310- } integer;
2311- union {
2312- long long value[64];
2313- long long *value_ptr; /* obsoleted */
2314- } integer64;
2315- union {
2316- unsigned int item[128];
2317- unsigned int *item_ptr; /* obsoleted */
2318- } enumerated;
2319- union {
2320- unsigned char data[512];
2321- unsigned char *data_ptr; /* obsoleted */
2322- } bytes;
2323- struct snd_aes_iec958 iec958;
2324- } value; /* RO */
2325- struct timespec tstamp;
2326- unsigned char reserved[128-sizeof(struct timespec)];
2327-};
2328-
2329-struct snd_ctl_tlv {
2330- unsigned int numid; /* control element numeric identification */
2331- unsigned int length; /* in bytes aligned to 4 */
2332- unsigned int tlv[0]; /* first TLV */
2333-};
2334-
2335-#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
2336-#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
2337-#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
2338-#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
2339-#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
2340-#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
2341-#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
2342-#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
2343-#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
2344-#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
2345-#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
2346-#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
2347-#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
2348-#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
2349-#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
2350-#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
2351-#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
2352-#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
2353-#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
2354-#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
2355-#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
2356-#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
2357-#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
2358-#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
2359-#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
2360-
2361-/*
2362- * Read interface.
2363- */
2364-
2365-enum sndrv_ctl_event_type {
2366- SNDRV_CTL_EVENT_ELEM = 0,
2367- SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
2368-};
2369-
2370-#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
2371-#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
2372-#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
2373-#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
2374-#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
2375-
2376-struct snd_ctl_event {
2377- int type; /* event type - SNDRV_CTL_EVENT_* */
2378- union {
2379- struct {
2380- unsigned int mask;
2381- struct snd_ctl_elem_id id;
2382- } elem;
2383- unsigned char data8[60];
2384- } data;
2385-};
2386-
2387-/*
2388- * Control names
2389- */
2390-
2391-#define SNDRV_CTL_NAME_NONE ""
2392-#define SNDRV_CTL_NAME_PLAYBACK "Playback "
2393-#define SNDRV_CTL_NAME_CAPTURE "Capture "
2394-
2395-#define SNDRV_CTL_NAME_IEC958_NONE ""
2396-#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
2397-#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
2398-#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
2399-#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
2400-#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
2401-#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
2402-#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
2403-#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
2404-
2405-#endif /* _UAPI__SOUND_ASOUND_H */
2406+#include <alsa/sound/uapi/asound.h>
2407diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
2408index 8471f404..3e5da4d0 100644
2409--- a/include/sound/asound_fm.h
2410+++ b/include/sound/asound_fm.h
2411@@ -1,135 +1 @@
2412-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2413-#ifndef __SOUND_ASOUND_FM_H
2414-#define __SOUND_ASOUND_FM_H
2415-
2416-/*
2417- * Advanced Linux Sound Architecture - ALSA
2418- *
2419- * Interface file between ALSA driver & user space
2420- * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
2421- * 4Front Technologies
2422- *
2423- * Direct FM control
2424- *
2425- * This program is free software; you can redistribute it and/or modify
2426- * it under the terms of the GNU General Public License as published by
2427- * the Free Software Foundation; either version 2 of the License, or
2428- * (at your option) any later version.
2429- *
2430- * This program is distributed in the hope that it will be useful,
2431- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2432- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2433- * GNU General Public License for more details.
2434- *
2435- * You should have received a copy of the GNU General Public License
2436- * along with this program; if not, write to the Free Software
2437- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2438- *
2439- */
2440-
2441-#define SNDRV_DM_FM_MODE_OPL2 0x00
2442-#define SNDRV_DM_FM_MODE_OPL3 0x01
2443-
2444-struct snd_dm_fm_info {
2445- unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
2446- unsigned char rhythm; /* percussion mode flag */
2447-};
2448-
2449-/*
2450- * Data structure composing an FM "note" or sound event.
2451- */
2452-
2453-struct snd_dm_fm_voice {
2454- unsigned char op; /* operator cell (0 or 1) */
2455- unsigned char voice; /* FM voice (0 to 17) */
2456-
2457- unsigned char am; /* amplitude modulation */
2458- unsigned char vibrato; /* vibrato effect */
2459- unsigned char do_sustain; /* sustain phase */
2460- unsigned char kbd_scale; /* keyboard scaling */
2461- unsigned char harmonic; /* 4 bits: harmonic and multiplier */
2462- unsigned char scale_level; /* 2 bits: decrease output freq rises */
2463- unsigned char volume; /* 6 bits: volume */
2464-
2465- unsigned char attack; /* 4 bits: attack rate */
2466- unsigned char decay; /* 4 bits: decay rate */
2467- unsigned char sustain; /* 4 bits: sustain level */
2468- unsigned char release; /* 4 bits: release rate */
2469-
2470- unsigned char feedback; /* 3 bits: feedback for op0 */
2471- unsigned char connection; /* 0 for serial, 1 for parallel */
2472- unsigned char left; /* stereo left */
2473- unsigned char right; /* stereo right */
2474- unsigned char waveform; /* 3 bits: waveform shape */
2475-};
2476-
2477-/*
2478- * This describes an FM note by its voice, octave, frequency number (10bit)
2479- * and key on/off.
2480- */
2481-
2482-struct snd_dm_fm_note {
2483- unsigned char voice; /* 0-17 voice channel */
2484- unsigned char octave; /* 3 bits: what octave to play */
2485- unsigned int fnum; /* 10 bits: frequency number */
2486- unsigned char key_on; /* set for active, clear for silent */
2487-};
2488-
2489-/*
2490- * FM parameters that apply globally to all voices, and thus are not "notes"
2491- */
2492-
2493-struct snd_dm_fm_params {
2494- unsigned char am_depth; /* amplitude modulation depth (1=hi) */
2495- unsigned char vib_depth; /* vibrato depth (1=hi) */
2496- unsigned char kbd_split; /* keyboard split */
2497- unsigned char rhythm; /* percussion mode select */
2498-
2499- /* This block is the percussion instrument data */
2500- unsigned char bass;
2501- unsigned char snare;
2502- unsigned char tomtom;
2503- unsigned char cymbal;
2504- unsigned char hihat;
2505-};
2506-
2507-/*
2508- * FM mode ioctl settings
2509- */
2510-
2511-#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
2512-#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
2513-#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
2514-#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
2515-#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
2516-#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
2517-/* for OPL3 only */
2518-#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
2519-/* SBI patch management */
2520-#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
2521-
2522-#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
2523-#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
2524-#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
2525-#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
2526-#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
2527-#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
2528-
2529-/*
2530- * Patch Record - fixed size for write
2531- */
2532-
2533-#define FM_KEY_SBI "SBI\032"
2534-#define FM_KEY_2OP "2OP\032"
2535-#define FM_KEY_4OP "4OP\032"
2536-
2537-struct sbi_patch {
2538- unsigned char prog;
2539- unsigned char bank;
2540- char key[4];
2541- char name[25];
2542- char extension[7];
2543- unsigned char data[32];
2544-};
2545-
2546-#endif /* __SOUND_ASOUND_FM_H */
2547+#include <alsa/sound/uapi/asound_fm.h>
2548diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
2549index 042c5a6f..f06ecee5 100644
2550--- a/include/sound/emu10k1.h
2551+++ b/include/sound/emu10k1.h
2552@@ -1,381 +1,2 @@
2553-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2554-/*
2555- * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
2556- * Creative Labs, Inc.
2557- * Definitions for EMU10K1 (SB Live!) chips
2558- *
2559- *
2560- * This program is free software; you can redistribute it and/or modify
2561- * it under the terms of the GNU General Public License as published by
2562- * the Free Software Foundation; either version 2 of the License, or
2563- * (at your option) any later version.
2564- *
2565- * This program is distributed in the hope that it will be useful,
2566- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2567- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2568- * GNU General Public License for more details.
2569- *
2570- * You should have received a copy of the GNU General Public License
2571- * along with this program; if not, write to the Free Software
2572- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2573- *
2574- */
2575-#ifndef _UAPI__SOUND_EMU10K1_H
2576-#define _UAPI__SOUND_EMU10K1_H
2577-
2578-#include <linux/types.h>
2579-#include <sound/asound.h>
2580-
2581-/*
2582- * ---- FX8010 ----
2583- */
2584-
2585-#define EMU10K1_CARD_CREATIVE 0x00000000
2586-#define EMU10K1_CARD_EMUAPS 0x00000001
2587-
2588-#define EMU10K1_FX8010_PCM_COUNT 8
2589-
2590-/*
2591- * Following definition is copied from linux/types.h to support compiling
2592- * this header file in userspace since they are not generally available for
2593- * uapi headers.
2594- */
2595-#define __EMU10K1_DECLARE_BITMAP(name,bits) \
2596- unsigned long name[(bits) / (sizeof(unsigned long) * 8)]
2597-
2598-/* instruction set */
2599-#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
2600-#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
2601-#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
2602-#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
2603-#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
2604-#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
2605-#define iACC3 0x06 /* R = A + X + Y ; saturation */
2606-#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
2607-#define iANDXOR 0x08 /* R = (A & X) ^ Y */
2608-#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
2609-#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
2610-#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
2611-#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
2612-#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
2613-#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
2614-#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
2615-
2616-/* GPRs */
2617-#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
2618-#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
2619-#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
2620-#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
2621- /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
2622-
2623-#define C_00000000 0x40
2624-#define C_00000001 0x41
2625-#define C_00000002 0x42
2626-#define C_00000003 0x43
2627-#define C_00000004 0x44
2628-#define C_00000008 0x45
2629-#define C_00000010 0x46
2630-#define C_00000020 0x47
2631-#define C_00000100 0x48
2632-#define C_00010000 0x49
2633-#define C_00080000 0x4a
2634-#define C_10000000 0x4b
2635-#define C_20000000 0x4c
2636-#define C_40000000 0x4d
2637-#define C_80000000 0x4e
2638-#define C_7fffffff 0x4f
2639-#define C_ffffffff 0x50
2640-#define C_fffffffe 0x51
2641-#define C_c0000000 0x52
2642-#define C_4f1bbcdc 0x53
2643-#define C_5a7ef9db 0x54
2644-#define C_00100000 0x55 /* ?? */
2645-#define GPR_ACCU 0x56 /* ACCUM, accumulator */
2646-#define GPR_COND 0x57 /* CCR, condition register */
2647-#define GPR_NOISE0 0x58 /* noise source */
2648-#define GPR_NOISE1 0x59 /* noise source */
2649-#define GPR_IRQ 0x5a /* IRQ register */
2650-#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
2651-#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
2652-#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
2653-#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
2654-#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
2655-#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
2656-
2657-#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
2658-#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
2659-#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
2660-#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
2661-#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
2662-#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
2663-
2664-#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */
2665-#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */
2666-#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
2667-#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */
2668-#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
2669-#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
2670-#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
2671-#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
2672-#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
2673-#define A_GPR(x) (A_FXGPREGBASE + (x))
2674-
2675-/* cc_reg constants */
2676-#define CC_REG_NORMALIZED C_00000001
2677-#define CC_REG_BORROW C_00000002
2678-#define CC_REG_MINUS C_00000004
2679-#define CC_REG_ZERO C_00000008
2680-#define CC_REG_SATURATE C_00000010
2681-#define CC_REG_NONZERO C_00000100
2682-
2683-/* FX buses */
2684-#define FXBUS_PCM_LEFT 0x00
2685-#define FXBUS_PCM_RIGHT 0x01
2686-#define FXBUS_PCM_LEFT_REAR 0x02
2687-#define FXBUS_PCM_RIGHT_REAR 0x03
2688-#define FXBUS_MIDI_LEFT 0x04
2689-#define FXBUS_MIDI_RIGHT 0x05
2690-#define FXBUS_PCM_CENTER 0x06
2691-#define FXBUS_PCM_LFE 0x07
2692-#define FXBUS_PCM_LEFT_FRONT 0x08
2693-#define FXBUS_PCM_RIGHT_FRONT 0x09
2694-#define FXBUS_MIDI_REVERB 0x0c
2695-#define FXBUS_MIDI_CHORUS 0x0d
2696-#define FXBUS_PCM_LEFT_SIDE 0x0e
2697-#define FXBUS_PCM_RIGHT_SIDE 0x0f
2698-#define FXBUS_PT_LEFT 0x14
2699-#define FXBUS_PT_RIGHT 0x15
2700-
2701-/* Inputs */
2702-#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
2703-#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
2704-#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
2705-#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
2706-#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
2707-#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
2708-#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
2709-#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
2710-#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
2711-#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
2712-#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
2713-#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
2714-#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
2715-#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
2716-
2717-/* Outputs */
2718-#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
2719-#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
2720-#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
2721-#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
2722-#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
2723-#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
2724-#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
2725-#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
2726-#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
2727-#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
2728-#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
2729-#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
2730-#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
2731-#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
2732-#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
2733-#define EXTOUT_ACENTER 0x11 /* Analog Center */
2734-#define EXTOUT_ALFE 0x12 /* Analog LFE */
2735-
2736-/* Audigy Inputs */
2737-#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
2738-#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
2739-#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
2740-#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
2741-#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
2742-#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
2743-#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
2744-#define A_EXTIN_LINE2_R 0x09 /* right */
2745-#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
2746-#define A_EXTIN_ADC_R 0x0b /* right */
2747-#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
2748-#define A_EXTIN_AUX2_R 0x0d /* - right */
2749-
2750-/* Audigiy Outputs */
2751-#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
2752-#define A_EXTOUT_FRONT_R 0x01 /* right */
2753-#define A_EXTOUT_CENTER 0x02 /* digital front center */
2754-#define A_EXTOUT_LFE 0x03 /* digital front lfe */
2755-#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
2756-#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
2757-#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
2758-#define A_EXTOUT_REAR_R 0x07 /* right */
2759-#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
2760-#define A_EXTOUT_AFRONT_R 0x09 /* right */
2761-#define A_EXTOUT_ACENTER 0x0a /* analog center */
2762-#define A_EXTOUT_ALFE 0x0b /* analog LFE */
2763-#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
2764-#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
2765-#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
2766-#define A_EXTOUT_AREAR_R 0x0f /* right */
2767-#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
2768-#define A_EXTOUT_AC97_R 0x11 /* right */
2769-#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
2770-#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
2771-#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
2772-
2773-/* Audigy constants */
2774-#define A_C_00000000 0xc0
2775-#define A_C_00000001 0xc1
2776-#define A_C_00000002 0xc2
2777-#define A_C_00000003 0xc3
2778-#define A_C_00000004 0xc4
2779-#define A_C_00000008 0xc5
2780-#define A_C_00000010 0xc6
2781-#define A_C_00000020 0xc7
2782-#define A_C_00000100 0xc8
2783-#define A_C_00010000 0xc9
2784-#define A_C_00000800 0xca
2785-#define A_C_10000000 0xcb
2786-#define A_C_20000000 0xcc
2787-#define A_C_40000000 0xcd
2788-#define A_C_80000000 0xce
2789-#define A_C_7fffffff 0xcf
2790-#define A_C_ffffffff 0xd0
2791-#define A_C_fffffffe 0xd1
2792-#define A_C_c0000000 0xd2
2793-#define A_C_4f1bbcdc 0xd3
2794-#define A_C_5a7ef9db 0xd4
2795-#define A_C_00100000 0xd5
2796-#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
2797-#define A_GPR_COND 0xd7 /* CCR, condition register */
2798-#define A_GPR_NOISE0 0xd8 /* noise source */
2799-#define A_GPR_NOISE1 0xd9 /* noise source */
2800-#define A_GPR_IRQ 0xda /* IRQ register */
2801-#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
2802-#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
2803-
2804-/* definitions for debug register */
2805-#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
2806-#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
2807-#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
2808-#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
2809-#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
2810-#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
2811-#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
2812-
2813-/* tank memory address line */
2814-#ifndef __KERNEL__
2815-#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
2816-#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
2817-#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
2818-#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
2819-#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
2820-#endif
2821-
2822-struct snd_emu10k1_fx8010_info {
2823- unsigned int internal_tram_size; /* in samples */
2824- unsigned int external_tram_size; /* in samples */
2825- char fxbus_names[16][32]; /* names of FXBUSes */
2826- char extin_names[16][32]; /* names of external inputs */
2827- char extout_names[32][32]; /* names of external outputs */
2828- unsigned int gpr_controls; /* count of GPR controls */
2829-};
2830-
2831-#define EMU10K1_GPR_TRANSLATION_NONE 0
2832-#define EMU10K1_GPR_TRANSLATION_TABLE100 1
2833-#define EMU10K1_GPR_TRANSLATION_BASS 2
2834-#define EMU10K1_GPR_TRANSLATION_TREBLE 3
2835-#define EMU10K1_GPR_TRANSLATION_ONOFF 4
2836-
2837-struct snd_emu10k1_fx8010_control_gpr {
2838- struct snd_ctl_elem_id id; /* full control ID definition */
2839- unsigned int vcount; /* visible count */
2840- unsigned int count; /* count of GPR (1..16) */
2841- unsigned short gpr[32]; /* GPR number(s) */
2842- unsigned int value[32]; /* initial values */
2843- unsigned int min; /* minimum range */
2844- unsigned int max; /* maximum range */
2845- unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
2846- const unsigned int *tlv;
2847-};
2848-
2849-/* old ABI without TLV support */
2850-struct snd_emu10k1_fx8010_control_old_gpr {
2851- struct snd_ctl_elem_id id;
2852- unsigned int vcount;
2853- unsigned int count;
2854- unsigned short gpr[32];
2855- unsigned int value[32];
2856- unsigned int min;
2857- unsigned int max;
2858- unsigned int translation;
2859-};
2860-
2861-struct snd_emu10k1_fx8010_code {
2862- char name[128];
2863-
2864- __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
2865- __u32 __user *gpr_map; /* initializers */
2866-
2867- unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
2868- struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
2869-
2870- unsigned int gpr_del_control_count; /* count of GPR controls to remove */
2871- struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
2872-
2873- unsigned int gpr_list_control_count; /* count of GPR controls to list */
2874- unsigned int gpr_list_control_total; /* total count of GPR controls */
2875- struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
2876-
2877- __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
2878- __u32 __user *tram_data_map; /* data initializers */
2879- __u32 __user *tram_addr_map; /* map initializers */
2880-
2881- __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
2882- __u32 __user *code; /* one instruction - 64 bits */
2883-};
2884-
2885-struct snd_emu10k1_fx8010_tram {
2886- unsigned int address; /* 31.bit == 1 -> external TRAM */
2887- unsigned int size; /* size in samples (4 bytes) */
2888- unsigned int *samples; /* pointer to samples (20-bit) */
2889- /* NULL->clear memory */
2890-};
2891-
2892-struct snd_emu10k1_fx8010_pcm_rec {
2893- unsigned int substream; /* substream number */
2894- unsigned int res1; /* reserved */
2895- unsigned int channels; /* 16-bit channels count, zero = remove this substream */
2896- unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
2897- unsigned int buffer_size; /* count of buffered samples */
2898- unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
2899- unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
2900- unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
2901- unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
2902- unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
2903- unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
2904- unsigned char pad; /* reserved */
2905- unsigned char etram[32]; /* external TRAM address & data (one per channel) */
2906- unsigned int res2; /* reserved */
2907-};
2908-
2909-#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
2910-
2911-#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
2912-#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
2913-#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
2914-#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
2915-#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
2916-#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
2917-#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
2918-#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
2919-#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
2920-#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
2921-#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
2922-#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
2923-#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
2924-#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
2925-
2926-/* typedefs for compatibility to user-space */
2927-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
2928-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
2929-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
2930-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
2931-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
2932-
2933-#endif /* _UAPI__SOUND_EMU10K1_H */
2934+#include <alsa/sound/type_compat.h>
2935+#include <alsa/sound/uapi/emu10k1.h>
2936diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
2937index 5dc0c3db..78fb745b 100644
2938--- a/include/sound/hdsp.h
2939+++ b/include/sound/hdsp.h
2940@@ -1,111 +1,2 @@
2941-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2942-#ifndef __SOUND_HDSP_H
2943-#define __SOUND_HDSP_H
2944-
2945-/*
2946- * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
2947- *
2948- * This program is free software; you can redistribute it and/or modify
2949- * it under the terms of the GNU General Public License as published by
2950- * the Free Software Foundation; either version 2 of the License, or
2951- * (at your option) any later version.
2952- *
2953- * This program is distributed in the hope that it will be useful,
2954- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2955- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2956- * GNU General Public License for more details.
2957- *
2958- * You should have received a copy of the GNU General Public License
2959- * along with this program; if not, write to the Free Software
2960- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2961- */
2962-
2963-#include <linux/types.h>
2964-
2965-#define HDSP_MATRIX_MIXER_SIZE 2048
2966-
2967-enum HDSP_IO_Type {
2968- Digiface,
2969- Multiface,
2970- H9652,
2971- H9632,
2972- RPM,
2973- Undefined,
2974-};
2975-
2976-struct hdsp_peak_rms {
2977- __u32 input_peaks[26];
2978- __u32 playback_peaks[26];
2979- __u32 output_peaks[28];
2980- __u64 input_rms[26];
2981- __u64 playback_rms[26];
2982- /* These are only used for H96xx cards */
2983- __u64 output_rms[26];
2984-};
2985-
2986-#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
2987-
2988-struct hdsp_config_info {
2989- unsigned char pref_sync_ref;
2990- unsigned char wordclock_sync_check;
2991- unsigned char spdif_sync_check;
2992- unsigned char adatsync_sync_check;
2993- unsigned char adat_sync_check[3];
2994- unsigned char spdif_in;
2995- unsigned char spdif_out;
2996- unsigned char spdif_professional;
2997- unsigned char spdif_emphasis;
2998- unsigned char spdif_nonaudio;
2999- unsigned int spdif_sample_rate;
3000- unsigned int system_sample_rate;
3001- unsigned int autosync_sample_rate;
3002- unsigned char system_clock_mode;
3003- unsigned char clock_source;
3004- unsigned char autosync_ref;
3005- unsigned char line_out;
3006- unsigned char passthru;
3007- unsigned char da_gain;
3008- unsigned char ad_gain;
3009- unsigned char phone_gain;
3010- unsigned char xlr_breakout_cable;
3011- unsigned char analog_extension_board;
3012-};
3013-
3014-#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
3015-
3016-struct hdsp_firmware {
3017- void __user *firmware_data; /* 24413 x 4 bytes */
3018-};
3019-
3020-#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
3021-
3022-struct hdsp_version {
3023- enum HDSP_IO_Type io_type;
3024- unsigned short firmware_rev;
3025-};
3026-
3027-#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
3028-
3029-struct hdsp_mixer {
3030- unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
3031-};
3032-
3033-#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
3034-
3035-struct hdsp_9632_aeb {
3036- int aebi;
3037- int aebo;
3038-};
3039-
3040-#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
3041-
3042-/* typedefs for compatibility to user-space */
3043-typedef enum HDSP_IO_Type HDSP_IO_Type;
3044-typedef struct hdsp_peak_rms hdsp_peak_rms_t;
3045-typedef struct hdsp_config_info hdsp_config_info_t;
3046-typedef struct hdsp_firmware hdsp_firmware_t;
3047-typedef struct hdsp_version hdsp_version_t;
3048-typedef struct hdsp_mixer hdsp_mixer_t;
3049-typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
3050-
3051-#endif /* __SOUND_HDSP_H */
3052+#include <alsa/sound/type_compat.h>
3053+#include <alsa/sound/uapi/hdsp.h>
3054diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
3055index a38f3f79..af6d19ed 100644
3056--- a/include/sound/hdspm.h
3057+++ b/include/sound/hdspm.h
3058@@ -1,232 +1,2 @@
3059-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3060-#ifndef __SOUND_HDSPM_H
3061-#define __SOUND_HDSPM_H
3062-/*
3063- * Copyright (C) 2003 Winfried Ritsch (IEM)
3064- * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
3065- *
3066- *
3067- * This program is free software; you can redistribute it and/or modify
3068- * it under the terms of the GNU General Public License as published by
3069- * the Free Software Foundation; either version 2 of the License, or
3070- * (at your option) any later version.
3071- *
3072- * This program is distributed in the hope that it will be useful,
3073- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3074- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3075- * GNU General Public License for more details.
3076- *
3077- * You should have received a copy of the GNU General Public License
3078- * along with this program; if not, write to the Free Software
3079- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3080- */
3081-
3082-#include <linux/types.h>
3083-
3084-/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
3085-#define HDSPM_MAX_CHANNELS 64
3086-
3087-enum hdspm_io_type {
3088- MADI,
3089- MADIface,
3090- AIO,
3091- AES32,
3092- RayDAT
3093-};
3094-
3095-enum hdspm_speed {
3096- ss,
3097- ds,
3098- qs
3099-};
3100-
3101-/* -------------------- IOCTL Peak/RMS Meters -------------------- */
3102-
3103-struct hdspm_peak_rms {
3104- __u32 input_peaks[64];
3105- __u32 playback_peaks[64];
3106- __u32 output_peaks[64];
3107-
3108- __u64 input_rms[64];
3109- __u64 playback_rms[64];
3110- __u64 output_rms[64];
3111-
3112- __u8 speed; /* enum {ss, ds, qs} */
3113- int status2;
3114-};
3115-
3116-#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
3117- _IOR('H', 0x42, struct hdspm_peak_rms)
3118-
3119-/* ------------ CONFIG block IOCTL ---------------------- */
3120-
3121-struct hdspm_config {
3122- unsigned char pref_sync_ref;
3123- unsigned char wordclock_sync_check;
3124- unsigned char madi_sync_check;
3125- unsigned int system_sample_rate;
3126- unsigned int autosync_sample_rate;
3127- unsigned char system_clock_mode;
3128- unsigned char clock_source;
3129- unsigned char autosync_ref;
3130- unsigned char line_out;
3131- unsigned int passthru;
3132- unsigned int analog_out;
3133-};
3134-
3135-#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
3136- _IOR('H', 0x41, struct hdspm_config)
3137-
3138-/*
3139- * If there's a TCO (TimeCode Option) board installed,
3140- * there are further options and status data available.
3141- * The hdspm_ltc structure contains the current SMPTE
3142- * timecode and some status information and can be
3143- * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
3144- * hdspm_status struct.
3145- */
3146-
3147-enum hdspm_ltc_format {
3148- format_invalid,
3149- fps_24,
3150- fps_25,
3151- fps_2997,
3152- fps_30
3153-};
3154-
3155-enum hdspm_ltc_frame {
3156- frame_invalid,
3157- drop_frame,
3158- full_frame
3159-};
3160-
3161-enum hdspm_ltc_input_format {
3162- ntsc,
3163- pal,
3164- no_video
3165-};
3166-
3167-struct hdspm_ltc {
3168- unsigned int ltc;
3169-
3170- enum hdspm_ltc_format format;
3171- enum hdspm_ltc_frame frame;
3172- enum hdspm_ltc_input_format input_format;
3173-};
3174-
3175-#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
3176-
3177-/*
3178- * The status data reflects the device's current state
3179- * as determined by the card's configuration and
3180- * connection status.
3181- */
3182-
3183-enum hdspm_sync {
3184- hdspm_sync_no_lock = 0,
3185- hdspm_sync_lock = 1,
3186- hdspm_sync_sync = 2
3187-};
3188-
3189-enum hdspm_madi_input {
3190- hdspm_input_optical = 0,
3191- hdspm_input_coax = 1
3192-};
3193-
3194-enum hdspm_madi_channel_format {
3195- hdspm_format_ch_64 = 0,
3196- hdspm_format_ch_56 = 1
3197-};
3198-
3199-enum hdspm_madi_frame_format {
3200- hdspm_frame_48 = 0,
3201- hdspm_frame_96 = 1
3202-};
3203-
3204-enum hdspm_syncsource {
3205- syncsource_wc = 0,
3206- syncsource_madi = 1,
3207- syncsource_tco = 2,
3208- syncsource_sync = 3,
3209- syncsource_none = 4
3210-};
3211-
3212-struct hdspm_status {
3213- __u8 card_type; /* enum hdspm_io_type */
3214- enum hdspm_syncsource autosync_source;
3215-
3216- __u64 card_clock;
3217- __u32 master_period;
3218-
3219- union {
3220- struct {
3221- __u8 sync_wc; /* enum hdspm_sync */
3222- __u8 sync_madi; /* enum hdspm_sync */
3223- __u8 sync_tco; /* enum hdspm_sync */
3224- __u8 sync_in; /* enum hdspm_sync */
3225- __u8 madi_input; /* enum hdspm_madi_input */
3226- __u8 channel_format; /* enum hdspm_madi_channel_format */
3227- __u8 frame_format; /* enum hdspm_madi_frame_format */
3228- } madi;
3229- } card_specific;
3230-};
3231-
3232-#define SNDRV_HDSPM_IOCTL_GET_STATUS \
3233- _IOR('H', 0x47, struct hdspm_status)
3234-
3235-/*
3236- * Get information about the card and its add-ons.
3237- */
3238-
3239-#define HDSPM_ADDON_TCO 1
3240-
3241-struct hdspm_version {
3242- __u8 card_type; /* enum hdspm_io_type */
3243- char cardname[20];
3244- unsigned int serial;
3245- unsigned short firmware_rev;
3246- int addons;
3247-};
3248-
3249-#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
3250-
3251-/* ------------- get Matrix Mixer IOCTL --------------- */
3252-
3253-/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
3254- * 32768 Bytes
3255- */
3256-
3257-/* organisation is 64 channelfader in a continuous memory block */
3258-/* equivalent to hardware definition, maybe for future feature of mmap of
3259- * them
3260- */
3261-/* each of 64 outputs has 64 infader and 64 outfader:
3262- Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
3263-
3264-#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
3265-
3266-struct hdspm_channelfader {
3267- unsigned int in[HDSPM_MIXER_CHANNELS];
3268- unsigned int pb[HDSPM_MIXER_CHANNELS];
3269-};
3270-
3271-struct hdspm_mixer {
3272- struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
3273-};
3274-
3275-struct hdspm_mixer_ioctl {
3276- struct hdspm_mixer *mixer;
3277-};
3278-
3279-/* use indirect access due to the limit of ioctl bit size */
3280-#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
3281-
3282-/* typedefs for compatibility to user-space */
3283-typedef struct hdspm_peak_rms hdspm_peak_rms_t;
3284-typedef struct hdspm_config_info hdspm_config_info_t;
3285-typedef struct hdspm_version hdspm_version_t;
3286-typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
3287-typedef struct hdspm_mixer hdspm_mixer_t;
3288-
3289-
3290-#endif
3291+#include <alsa/sound/type_compat.h>
3292+#include <alsa/sound/uapi/hdspm.h>
3293diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
3294index e6485148..24121fcb 100644
3295--- a/include/sound/sb16_csp.h
3296+++ b/include/sound/sb16_csp.h
3297@@ -1,123 +1 @@
3298-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3299-/*
3300- * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
3301- * Takashi Iwai <tiwai@suse.de>
3302- *
3303- * SB16ASP/AWE32 CSP control
3304- *
3305- * This program is free software; you can redistribute it and/or modify
3306- * it under the terms of the GNU General Public License as published by
3307- * the Free Software Foundation; either version 2 of the License, or
3308- * (at your option) any later version.
3309- *
3310- * This program is distributed in the hope that it will be useful,
3311- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3312- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3313- * GNU General Public License for more details.
3314- *
3315- * You should have received a copy of the GNU General Public License
3316- * along with this program; if not, write to the Free Software
3317- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3318- *
3319- */
3320-#ifndef _UAPI__SOUND_SB16_CSP_H
3321-#define _UAPI__SOUND_SB16_CSP_H
3322-
3323-
3324-/* CSP modes */
3325-#define SNDRV_SB_CSP_MODE_NONE 0x00
3326-#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
3327-#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
3328-#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
3329-
3330-/* CSP load flags */
3331-#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
3332-#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
3333-
3334-/* CSP sample width */
3335-#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
3336-#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
3337-
3338-/* CSP channels */
3339-#define SNDRV_SB_CSP_MONO 0x01
3340-#define SNDRV_SB_CSP_STEREO 0x02
3341-
3342-/* CSP rates */
3343-#define SNDRV_SB_CSP_RATE_8000 0x01
3344-#define SNDRV_SB_CSP_RATE_11025 0x02
3345-#define SNDRV_SB_CSP_RATE_22050 0x04
3346-#define SNDRV_SB_CSP_RATE_44100 0x08
3347-#define SNDRV_SB_CSP_RATE_ALL 0x0f
3348-
3349-/* CSP running state */
3350-#define SNDRV_SB_CSP_ST_IDLE 0x00
3351-#define SNDRV_SB_CSP_ST_LOADED 0x01
3352-#define SNDRV_SB_CSP_ST_RUNNING 0x02
3353-#define SNDRV_SB_CSP_ST_PAUSED 0x04
3354-#define SNDRV_SB_CSP_ST_AUTO 0x08
3355-#define SNDRV_SB_CSP_ST_QSOUND 0x10
3356-
3357-/* maximum QSound value (180 degrees right) */
3358-#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
3359-
3360-/* maximum microcode RIFF file size */
3361-#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
3362-
3363-/* microcode header */
3364-struct snd_sb_csp_mc_header {
3365- char codec_name[16]; /* id name of codec */
3366- unsigned short func_req; /* requested function */
3367-};
3368-
3369-/* microcode to be loaded */
3370-struct snd_sb_csp_microcode {
3371- struct snd_sb_csp_mc_header info;
3372- unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
3373-};
3374-
3375-/* start CSP with sample_width in mono/stereo */
3376-struct snd_sb_csp_start {
3377- int sample_width; /* sample width, look above */
3378- int channels; /* channels, look above */
3379-};
3380-
3381-/* CSP information */
3382-struct snd_sb_csp_info {
3383- char codec_name[16]; /* id name of codec */
3384- unsigned short func_nr; /* function number */
3385- unsigned int acc_format; /* accepted PCM formats */
3386- unsigned short acc_channels; /* accepted channels */
3387- unsigned short acc_width; /* accepted sample width */
3388- unsigned short acc_rates; /* accepted sample rates */
3389- unsigned short csp_mode; /* CSP mode, see above */
3390- unsigned short run_channels; /* current channels */
3391- unsigned short run_width; /* current sample width */
3392- unsigned short version; /* version id: 0x10 - 0x1f */
3393- unsigned short state; /* state bits */
3394-};
3395-
3396-/* HWDEP controls */
3397-/* get CSP information */
3398-#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
3399-/* load microcode to CSP */
3400-/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
3401- * defined for some architectures like MIPS, and it leads to build errors.
3402- * (x86 and co have 14-bit size, thus it's valid, though.)
3403- * As a workaround for skipping the size-limit check, here we don't use the
3404- * normal _IOW() macro but _IOC() with the manual argument.
3405- */
3406-#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
3407- _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
3408-/* unload microcode from CSP */
3409-#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
3410-/* start CSP */
3411-#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
3412-/* stop CSP */
3413-#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
3414-/* pause CSP and DMA transfer */
3415-#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
3416-/* restart CSP and DMA transfer */
3417-#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
3418-
3419-
3420-#endif /* _UAPI__SOUND_SB16_CSP_H */
3421+#include <alsa/sound/uapi/sb16_csp.h>
3422diff --git a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h
3423index c6653ebf..23b48d33 100644
3424--- a/include/sound/sscape_ioctl.h
3425+++ b/include/sound/sscape_ioctl.h
3426@@ -1,21 +1 @@
3427-#ifndef SSCAPE_IOCTL_H
3428-#define SSCAPE_IOCTL_H
3429-
3430-
3431-struct sscape_bootblock
3432-{
3433- unsigned char code[256];
3434- unsigned version;
3435-};
3436-
3437-#define SSCAPE_MICROCODE_SIZE 65536
3438-
3439-struct sscape_microcode
3440-{
3441- unsigned char *code;
3442-};
3443-
3444-#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
3445-#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
3446-
3447-#endif
3448+#include <alsa/sound/uapi/sscape_ioctl.h>
3449diff --git a/include/sound/tlv.h b/include/sound/tlv.h
3450index 7d6d65f6..e435a5fc 100644
3451--- a/include/sound/tlv.h
3452+++ b/include/sound/tlv.h
3453@@ -1,117 +1 @@
3454-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3455-/*
3456- * This program is free software; you can redistribute it and/or modify
3457- * it under the terms of the GNU General Public License as published by
3458- * the Free Software Foundation; either version 2 of the License, or
3459- * (at your option) any later version.
3460- *
3461- * This program is distributed in the hope that it will be useful,
3462- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3463- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3464- * GNU General Public License for more details.
3465- */
3466-
3467-#ifndef __UAPI_SOUND_TLV_H
3468-#define __UAPI_SOUND_TLV_H
3469-
3470-#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
3471-#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
3472-#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
3473-#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
3474-#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
3475-#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
3476-
3477-/*
3478- * channel-mapping TLV items
3479- * TLV length must match with num_channels
3480- */
3481-#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
3482-#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
3483-#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
3484-
3485-/*
3486- * TLV structure is right behind the struct snd_ctl_tlv:
3487- * unsigned int type - see SNDRV_CTL_TLVT_*
3488- * unsigned int length
3489- * .... data aligned to sizeof(unsigned int), use
3490- * block_length = (length + (sizeof(unsigned int) - 1)) &
3491- * ~(sizeof(unsigned int) - 1)) ....
3492- */
3493-#define SNDRV_CTL_TLVD_ITEM(type, ...) \
3494- (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
3495-#define SNDRV_CTL_TLVD_LENGTH(...) \
3496- ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
3497-
3498-/* Accessor offsets for TLV data items */
3499-#define SNDRV_CTL_TLVO_TYPE 0
3500-#define SNDRV_CTL_TLVO_LEN 1
3501-
3502-#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
3503- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
3504-#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
3505- unsigned int name[] = { \
3506- SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
3507- }
3508-
3509-#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff
3510-#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000
3511-#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
3512- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
3513- (min), \
3514- ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
3515- ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
3516-#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
3517- unsigned int name[] = { \
3518- SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
3519- }
3520-
3521-/* Accessor offsets for min, mute and step items in dB scale type TLV */
3522-#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2
3523-#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3
3524-
3525-/* dB scale specified with min/max values instead of step */
3526-#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
3527- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
3528-#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
3529- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
3530-#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
3531- unsigned int name[] = { \
3532- SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
3533- }
3534-#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
3535- unsigned int name[] = { \
3536- SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
3537- }
3538-
3539-/* Accessor offsets for min, max items in db-minmax types of TLV. */
3540-#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2
3541-#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3
3542-
3543-/* linear volume between min_dB and max_dB (.01dB unit) */
3544-#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
3545- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
3546-#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
3547- unsigned int name[] = { \
3548- SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
3549- }
3550-
3551-/* Accessor offsets for min, max items in db-linear type of TLV. */
3552-#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2
3553-#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3
3554-
3555-/* dB range container:
3556- * Items in dB range container must be ordered by their values and by their
3557- * dB values. This implies that larger values must correspond with larger
3558- * dB values (which is also required for all other mixer controls).
3559- */
3560-/* Each item is: <min> <max> <TLV> */
3561-#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
3562- SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
3563-#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
3564- unsigned int name[] = { \
3565- SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
3566- }
3567-
3568-#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999
3569-
3570-#endif
3571+#include <alsa/sound/uapi/tlv.h>
3572diff --git a/include/sound/type_compat.h b/include/sound/type_compat.h
3573index e973ff31..d4790c1f 100644
3574--- a/include/sound/type_compat.h
3575+++ b/include/sound/type_compat.h
3576@@ -3,6 +3,9 @@
3577
3578 #ifndef DOC_HIDDEN
3579 #include <stdint.h>
3580+#ifdef __linux__
3581+#include <linux/types.h>
3582+#else
3583 typedef uint8_t __u8;
3584 typedef uint16_t __u16;
3585 typedef uint32_t __u32;
3586@@ -37,6 +40,16 @@ typedef int32_t __s32;
3587 #define __be32 __u32
3588 #define __be16 __u16
3589 #define __be8 __u8
3590+#endif
3591+
3592+#ifndef __user
3593+#define __user
3594+#endif
3595+
3596+#ifndef __packed
3597+#define __packed __attribute__((__packed__))
3598+#endif
3599+
3600 #endif /* DOC_HIDDEN */
3601
3602 #endif /* __TYPE_COMPAT_H */
3603diff --git a/include/sound/uapi/Makefile.am b/include/sound/uapi/Makefile.am
3604new file mode 100644
3605index 00000000..99197108
3606--- /dev/null
3607+++ b/include/sound/uapi/Makefile.am
3608@@ -0,0 +1,6 @@
3609+alsasounduapiincludedir = ${includedir}/alsa/sound/uapi
3610+
3611+alsasounduapiinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \
3612+ sscape_ioctl.h emu10k1.h asoc.h tlv.h
3613+
3614+noinst_HEADERS = asound.h asequencer.h
3615diff --git a/include/sound/uapi/asequencer.h b/include/sound/uapi/asequencer.h
3616new file mode 100644
3617index 00000000..a75e14ed
3618--- /dev/null
3619+++ b/include/sound/uapi/asequencer.h
3620@@ -0,0 +1,612 @@
3621+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3622+/*
3623+ * Main header file for the ALSA sequencer
3624+ * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
3625+ * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
3626+ *
3627+ *
3628+ * This program is free software; you can redistribute it and/or modify
3629+ * it under the terms of the GNU General Public License as published by
3630+ * the Free Software Foundation; either version 2 of the License, or
3631+ * (at your option) any later version.
3632+ *
3633+ * This program is distributed in the hope that it will be useful,
3634+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3635+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3636+ * GNU General Public License for more details.
3637+ *
3638+ * You should have received a copy of the GNU General Public License
3639+ * along with this program; if not, write to the Free Software
3640+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3641+ *
3642+ */
3643+#ifndef _UAPI__SOUND_ASEQUENCER_H
3644+#define _UAPI__SOUND_ASEQUENCER_H
3645+
3646+#include <sound/asound.h>
3647+
3648+/** version of the sequencer */
3649+#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
3650+
3651+/**
3652+ * definition of sequencer event types
3653+ */
3654+
3655+/** system messages
3656+ * event data type = #snd_seq_result
3657+ */
3658+#define SNDRV_SEQ_EVENT_SYSTEM 0
3659+#define SNDRV_SEQ_EVENT_RESULT 1
3660+
3661+/** note messages (channel specific)
3662+ * event data type = #snd_seq_ev_note
3663+ */
3664+#define SNDRV_SEQ_EVENT_NOTE 5
3665+#define SNDRV_SEQ_EVENT_NOTEON 6
3666+#define SNDRV_SEQ_EVENT_NOTEOFF 7
3667+#define SNDRV_SEQ_EVENT_KEYPRESS 8
3668+
3669+/** control messages (channel specific)
3670+ * event data type = #snd_seq_ev_ctrl
3671+ */
3672+#define SNDRV_SEQ_EVENT_CONTROLLER 10
3673+#define SNDRV_SEQ_EVENT_PGMCHANGE 11
3674+#define SNDRV_SEQ_EVENT_CHANPRESS 12
3675+#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
3676+#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
3677+#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
3678+#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
3679+
3680+/** synchronisation messages
3681+ * event data type = #snd_seq_ev_ctrl
3682+ */
3683+#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
3684+#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
3685+#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
3686+#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
3687+#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
3688+
3689+/** timer messages
3690+ * event data type = snd_seq_ev_queue_control
3691+ */
3692+#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
3693+#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
3694+#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
3695+#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
3696+#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
3697+#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
3698+#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
3699+#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
3700+#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
3701+
3702+/** others
3703+ * event data type = none
3704+ */
3705+#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
3706+#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
3707+#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
3708+
3709+/** echo back, kernel private messages
3710+ * event data type = any type
3711+ */
3712+#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
3713+#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
3714+
3715+/** system status messages (broadcast for subscribers)
3716+ * event data type = snd_seq_addr
3717+ */
3718+#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
3719+#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
3720+#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
3721+#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
3722+#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
3723+#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
3724+
3725+/** port connection changes
3726+ * event data type = snd_seq_connect
3727+ */
3728+#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
3729+#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
3730+
3731+/* 70-89: synthesizer events - obsoleted */
3732+
3733+/** user-defined events with fixed length
3734+ * event data type = any
3735+ */
3736+#define SNDRV_SEQ_EVENT_USR0 90
3737+#define SNDRV_SEQ_EVENT_USR1 91
3738+#define SNDRV_SEQ_EVENT_USR2 92
3739+#define SNDRV_SEQ_EVENT_USR3 93
3740+#define SNDRV_SEQ_EVENT_USR4 94
3741+#define SNDRV_SEQ_EVENT_USR5 95
3742+#define SNDRV_SEQ_EVENT_USR6 96
3743+#define SNDRV_SEQ_EVENT_USR7 97
3744+#define SNDRV_SEQ_EVENT_USR8 98
3745+#define SNDRV_SEQ_EVENT_USR9 99
3746+
3747+/* 100-118: instrument layer - obsoleted */
3748+/* 119-129: reserved */
3749+
3750+/* 130-139: variable length events
3751+ * event data type = snd_seq_ev_ext
3752+ * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
3753+ */
3754+#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
3755+#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
3756+/* 132-134: reserved */
3757+#define SNDRV_SEQ_EVENT_USR_VAR0 135
3758+#define SNDRV_SEQ_EVENT_USR_VAR1 136
3759+#define SNDRV_SEQ_EVENT_USR_VAR2 137
3760+#define SNDRV_SEQ_EVENT_USR_VAR3 138
3761+#define SNDRV_SEQ_EVENT_USR_VAR4 139
3762+
3763+/* 150-151: kernel events with quote - DO NOT use in user clients */
3764+#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
3765+#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
3766+
3767+/* 152-191: reserved */
3768+
3769+/* 192-254: hardware specific events */
3770+
3771+/* 255: special event */
3772+#define SNDRV_SEQ_EVENT_NONE 255
3773+
3774+
3775+typedef unsigned char snd_seq_event_type_t;
3776+
3777+/** event address */
3778+struct snd_seq_addr {
3779+ unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
3780+ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
3781+};
3782+
3783+/** port connection */
3784+struct snd_seq_connect {
3785+ struct snd_seq_addr sender;
3786+ struct snd_seq_addr dest;
3787+};
3788+
3789+
3790+#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
3791+#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
3792+#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
3793+#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
3794+
3795+ /* event mode flag - NOTE: only 8 bits available! */
3796+#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
3797+#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
3798+#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
3799+
3800+#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
3801+#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
3802+#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
3803+
3804+#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
3805+#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
3806+#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
3807+#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
3808+
3809+#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
3810+#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
3811+#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
3812+
3813+
3814+ /* note event */
3815+struct snd_seq_ev_note {
3816+ unsigned char channel;
3817+ unsigned char note;
3818+ unsigned char velocity;
3819+ unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
3820+ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
3821+};
3822+
3823+ /* controller event */
3824+struct snd_seq_ev_ctrl {
3825+ unsigned char channel;
3826+ unsigned char unused1, unused2, unused3; /* pad */
3827+ unsigned int param;
3828+ signed int value;
3829+};
3830+
3831+ /* generic set of bytes (12x8 bit) */
3832+struct snd_seq_ev_raw8 {
3833+ unsigned char d[12]; /* 8 bit value */
3834+};
3835+
3836+ /* generic set of integers (3x32 bit) */
3837+struct snd_seq_ev_raw32 {
3838+ unsigned int d[3]; /* 32 bit value */
3839+};
3840+
3841+ /* external stored data */
3842+struct snd_seq_ev_ext {
3843+ unsigned int len; /* length of data */
3844+ void *ptr; /* pointer to data (note: maybe 64-bit) */
3845+} __attribute__((packed));
3846+
3847+struct snd_seq_result {
3848+ int event; /* processed event type */
3849+ int result;
3850+};
3851+
3852+
3853+struct snd_seq_real_time {
3854+ unsigned int tv_sec; /* seconds */
3855+ unsigned int tv_nsec; /* nanoseconds */
3856+};
3857+
3858+typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
3859+
3860+union snd_seq_timestamp {
3861+ snd_seq_tick_time_t tick;
3862+ struct snd_seq_real_time time;
3863+};
3864+
3865+struct snd_seq_queue_skew {
3866+ unsigned int value;
3867+ unsigned int base;
3868+};
3869+
3870+ /* queue timer control */
3871+struct snd_seq_ev_queue_control {
3872+ unsigned char queue; /* affected queue */
3873+ unsigned char pad[3]; /* reserved */
3874+ union {
3875+ signed int value; /* affected value (e.g. tempo) */
3876+ union snd_seq_timestamp time; /* time */
3877+ unsigned int position; /* sync position */
3878+ struct snd_seq_queue_skew skew;
3879+ unsigned int d32[2];
3880+ unsigned char d8[8];
3881+ } param;
3882+};
3883+
3884+ /* quoted event - inside the kernel only */
3885+struct snd_seq_ev_quote {
3886+ struct snd_seq_addr origin; /* original sender */
3887+ unsigned short value; /* optional data */
3888+ struct snd_seq_event *event; /* quoted event */
3889+} __attribute__((packed));
3890+
3891+
3892+ /* sequencer event */
3893+struct snd_seq_event {
3894+ snd_seq_event_type_t type; /* event type */
3895+ unsigned char flags; /* event flags */
3896+ char tag;
3897+
3898+ unsigned char queue; /* schedule queue */
3899+ union snd_seq_timestamp time; /* schedule time */
3900+
3901+
3902+ struct snd_seq_addr source; /* source address */
3903+ struct snd_seq_addr dest; /* destination address */
3904+
3905+ union { /* event data... */
3906+ struct snd_seq_ev_note note;
3907+ struct snd_seq_ev_ctrl control;
3908+ struct snd_seq_ev_raw8 raw8;
3909+ struct snd_seq_ev_raw32 raw32;
3910+ struct snd_seq_ev_ext ext;
3911+ struct snd_seq_ev_queue_control queue;
3912+ union snd_seq_timestamp time;
3913+ struct snd_seq_addr addr;
3914+ struct snd_seq_connect connect;
3915+ struct snd_seq_result result;
3916+ struct snd_seq_ev_quote quote;
3917+ } data;
3918+};
3919+
3920+
3921+/*
3922+ * bounce event - stored as variable size data
3923+ */
3924+struct snd_seq_event_bounce {
3925+ int err;
3926+ struct snd_seq_event event;
3927+ /* external data follows here. */
3928+};
3929+
3930+
3931+ /* system information */
3932+struct snd_seq_system_info {
3933+ int queues; /* maximum queues count */
3934+ int clients; /* maximum clients count */
3935+ int ports; /* maximum ports per client */
3936+ int channels; /* maximum channels per port */
3937+ int cur_clients; /* current clients */
3938+ int cur_queues; /* current queues */
3939+ char reserved[24];
3940+};
3941+
3942+
3943+ /* system running information */
3944+struct snd_seq_running_info {
3945+ unsigned char client; /* client id */
3946+ unsigned char big_endian; /* 1 = big-endian */
3947+ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
3948+ unsigned char pad; /* reserved */
3949+ unsigned char reserved[12];
3950+};
3951+
3952+
3953+ /* known client numbers */
3954+#define SNDRV_SEQ_CLIENT_SYSTEM 0
3955+ /* internal client numbers */
3956+#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
3957+#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
3958+
3959+
3960+ /* client types */
3961+typedef int __bitwise snd_seq_client_type_t;
3962+#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
3963+#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
3964+#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
3965+
3966+ /* event filter flags */
3967+#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
3968+#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
3969+#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
3970+#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
3971+
3972+struct snd_seq_client_info {
3973+ int client; /* client number to inquire */
3974+ snd_seq_client_type_t type; /* client type */
3975+ char name[64]; /* client name */
3976+ unsigned int filter; /* filter flags */
3977+ unsigned char multicast_filter[8]; /* multicast filter bitmap */
3978+ unsigned char event_filter[32]; /* event filter bitmap */
3979+ int num_ports; /* RO: number of ports */
3980+ int event_lost; /* number of lost events */
3981+ int card; /* RO: card number[kernel] */
3982+ int pid; /* RO: pid[user] */
3983+ char reserved[56]; /* for future use */
3984+};
3985+
3986+
3987+/* client pool size */
3988+struct snd_seq_client_pool {
3989+ int client; /* client number to inquire */
3990+ int output_pool; /* outgoing (write) pool size */
3991+ int input_pool; /* incoming (read) pool size */
3992+ int output_room; /* minimum free pool size for select/blocking mode */
3993+ int output_free; /* unused size */
3994+ int input_free; /* unused size */
3995+ char reserved[64];
3996+};
3997+
3998+
3999+/* Remove events by specified criteria */
4000+
4001+#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
4002+#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
4003+#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
4004+#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
4005+#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
4006+#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
4007+#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
4008+#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
4009+#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
4010+#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
4011+
4012+struct snd_seq_remove_events {
4013+ unsigned int remove_mode; /* Flags that determine what gets removed */
4014+
4015+ union snd_seq_timestamp time;
4016+
4017+ unsigned char queue; /* Queue for REMOVE_DEST */
4018+ struct snd_seq_addr dest; /* Address for REMOVE_DEST */
4019+ unsigned char channel; /* Channel for REMOVE_DEST */
4020+
4021+ int type; /* For REMOVE_EVENT_TYPE */
4022+ char tag; /* Tag for REMOVE_TAG */
4023+
4024+ int reserved[10]; /* To allow for future binary compatibility */
4025+
4026+};
4027+
4028+
4029+ /* known port numbers */
4030+#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
4031+#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
4032+
4033+ /* port capabilities (32 bits) */
4034+#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
4035+#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
4036+
4037+#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
4038+#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
4039+
4040+#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
4041+
4042+#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
4043+#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
4044+#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
4045+
4046+ /* port type */
4047+#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
4048+#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
4049+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
4050+#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
4051+#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
4052+#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
4053+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
4054+
4055+/* other standards...*/
4056+#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
4057+#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
4058+#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
4059+/*...*/
4060+#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
4061+#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
4062+#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
4063+#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
4064+#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
4065+
4066+/* misc. conditioning flags */
4067+#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
4068+#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
4069+#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
4070+
4071+struct snd_seq_port_info {
4072+ struct snd_seq_addr addr; /* client/port numbers */
4073+ char name[64]; /* port name */
4074+
4075+ unsigned int capability; /* port capability bits */
4076+ unsigned int type; /* port type bits */
4077+ int midi_channels; /* channels per MIDI port */
4078+ int midi_voices; /* voices per MIDI port */
4079+ int synth_voices; /* voices per SYNTH port */
4080+
4081+ int read_use; /* R/O: subscribers for output (from this port) */
4082+ int write_use; /* R/O: subscribers for input (to this port) */
4083+
4084+ void *kernel; /* reserved for kernel use (must be NULL) */
4085+ unsigned int flags; /* misc. conditioning */
4086+ unsigned char time_queue; /* queue # for timestamping */
4087+ char reserved[59]; /* for future use */
4088+};
4089+
4090+
4091+/* queue flags */
4092+#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
4093+
4094+/* queue information */
4095+struct snd_seq_queue_info {
4096+ int queue; /* queue id */
4097+
4098+ /*
4099+ * security settings, only owner of this queue can start/stop timer
4100+ * etc. if the queue is locked for other clients
4101+ */
4102+ int owner; /* client id for owner of the queue */
4103+ unsigned locked:1; /* timing queue locked for other queues */
4104+ char name[64]; /* name of this queue */
4105+ unsigned int flags; /* flags */
4106+ char reserved[60]; /* for future use */
4107+
4108+};
4109+
4110+/* queue info/status */
4111+struct snd_seq_queue_status {
4112+ int queue; /* queue id */
4113+ int events; /* read-only - queue size */
4114+ snd_seq_tick_time_t tick; /* current tick */
4115+ struct snd_seq_real_time time; /* current time */
4116+ int running; /* running state of queue */
4117+ int flags; /* various flags */
4118+ char reserved[64]; /* for the future */
4119+};
4120+
4121+
4122+/* queue tempo */
4123+struct snd_seq_queue_tempo {
4124+ int queue; /* sequencer queue */
4125+ unsigned int tempo; /* current tempo, us/tick */
4126+ int ppq; /* time resolution, ticks/quarter */
4127+ unsigned int skew_value; /* queue skew */
4128+ unsigned int skew_base; /* queue skew base */
4129+ char reserved[24]; /* for the future */
4130+};
4131+
4132+
4133+/* sequencer timer sources */
4134+#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
4135+#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
4136+#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
4137+
4138+/* queue timer info */
4139+struct snd_seq_queue_timer {
4140+ int queue; /* sequencer queue */
4141+ int type; /* source timer type */
4142+ union {
4143+ struct {
4144+ struct snd_timer_id id; /* ALSA's timer ID */
4145+ unsigned int resolution; /* resolution in Hz */
4146+ } alsa;
4147+ } u;
4148+ char reserved[64]; /* for the future use */
4149+};
4150+
4151+
4152+struct snd_seq_queue_client {
4153+ int queue; /* sequencer queue */
4154+ int client; /* sequencer client */
4155+ int used; /* queue is used with this client
4156+ (must be set for accepting events) */
4157+ /* per client watermarks */
4158+ char reserved[64]; /* for future use */
4159+};
4160+
4161+
4162+#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
4163+#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
4164+#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
4165+
4166+struct snd_seq_port_subscribe {
4167+ struct snd_seq_addr sender; /* sender address */
4168+ struct snd_seq_addr dest; /* destination address */
4169+ unsigned int voices; /* number of voices to be allocated (0 = don't care) */
4170+ unsigned int flags; /* modes */
4171+ unsigned char queue; /* input time-stamp queue (optional) */
4172+ unsigned char pad[3]; /* reserved */
4173+ char reserved[64];
4174+};
4175+
4176+/* type of query subscription */
4177+#define SNDRV_SEQ_QUERY_SUBS_READ 0
4178+#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
4179+
4180+struct snd_seq_query_subs {
4181+ struct snd_seq_addr root; /* client/port id to be searched */
4182+ int type; /* READ or WRITE */
4183+ int index; /* 0..N-1 */
4184+ int num_subs; /* R/O: number of subscriptions on this port */
4185+ struct snd_seq_addr addr; /* R/O: result */
4186+ unsigned char queue; /* R/O: result */
4187+ unsigned int flags; /* R/O: result */
4188+ char reserved[64]; /* for future use */
4189+};
4190+
4191+
4192+/*
4193+ * IOCTL commands
4194+ */
4195+
4196+#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
4197+#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
4198+#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
4199+#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
4200+
4201+#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
4202+#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
4203+
4204+#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
4205+#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
4206+#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
4207+#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
4208+
4209+#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
4210+#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
4211+
4212+#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
4213+#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
4214+#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
4215+#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
4216+#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
4217+#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
4218+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
4219+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
4220+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
4221+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
4222+#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
4223+#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
4224+#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
4225+#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
4226+#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
4227+#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
4228+#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
4229+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
4230+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
4231+
4232+#endif /* _UAPI__SOUND_ASEQUENCER_H */
4233diff --git a/include/sound/uapi/asoc.h b/include/sound/uapi/asoc.h
4234new file mode 100644
4235index 00000000..a74ca232
4236--- /dev/null
4237+++ b/include/sound/uapi/asoc.h
4238@@ -0,0 +1,633 @@
4239+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
4240+/*
4241+ * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
4242+ *
4243+ * Copyright (C) 2012 Texas Instruments Inc.
4244+ * Copyright (C) 2015 Intel Corporation.
4245+ *
4246+ * This program is free software; you can redistribute it and/or modify
4247+ * it under the terms of the GNU General Public License version 2 as
4248+ * published by the Free Software Foundation.
4249+ *
4250+ * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
4251+ * algorithms, equalisers, DAIs, widgets etc.
4252+*/
4253+
4254+#ifndef __LINUX_UAPI_SND_ASOC_H
4255+#define __LINUX_UAPI_SND_ASOC_H
4256+
4257+#include <linux/types.h>
4258+#include <sound/asound.h>
4259+
4260+/*
4261+ * Maximum number of channels topology kcontrol can represent.
4262+ */
4263+#define SND_SOC_TPLG_MAX_CHAN 8
4264+
4265+/*
4266+ * Maximum number of PCM formats capability
4267+ */
4268+#define SND_SOC_TPLG_MAX_FORMATS 16
4269+
4270+/*
4271+ * Maximum number of PCM stream configs
4272+ */
4273+#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
4274+
4275+/*
4276+ * Maximum number of physical link's hardware configs
4277+ */
4278+#define SND_SOC_TPLG_HW_CONFIG_MAX 8
4279+
4280+/* individual kcontrol info types - can be mixed with other types */
4281+#define SND_SOC_TPLG_CTL_VOLSW 1
4282+#define SND_SOC_TPLG_CTL_VOLSW_SX 2
4283+#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
4284+#define SND_SOC_TPLG_CTL_ENUM 4
4285+#define SND_SOC_TPLG_CTL_BYTES 5
4286+#define SND_SOC_TPLG_CTL_ENUM_VALUE 6
4287+#define SND_SOC_TPLG_CTL_RANGE 7
4288+#define SND_SOC_TPLG_CTL_STROBE 8
4289+
4290+
4291+/* individual widget kcontrol info types - can be mixed with other types */
4292+#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
4293+#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
4294+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
4295+#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
4296+#define SND_SOC_TPLG_DAPM_CTL_PIN 68
4297+
4298+/* DAPM widget types - add new items to the end */
4299+#define SND_SOC_TPLG_DAPM_INPUT 0
4300+#define SND_SOC_TPLG_DAPM_OUTPUT 1
4301+#define SND_SOC_TPLG_DAPM_MUX 2
4302+#define SND_SOC_TPLG_DAPM_MIXER 3
4303+#define SND_SOC_TPLG_DAPM_PGA 4
4304+#define SND_SOC_TPLG_DAPM_OUT_DRV 5
4305+#define SND_SOC_TPLG_DAPM_ADC 6
4306+#define SND_SOC_TPLG_DAPM_DAC 7
4307+#define SND_SOC_TPLG_DAPM_SWITCH 8
4308+#define SND_SOC_TPLG_DAPM_PRE 9
4309+#define SND_SOC_TPLG_DAPM_POST 10
4310+#define SND_SOC_TPLG_DAPM_AIF_IN 11
4311+#define SND_SOC_TPLG_DAPM_AIF_OUT 12
4312+#define SND_SOC_TPLG_DAPM_DAI_IN 13
4313+#define SND_SOC_TPLG_DAPM_DAI_OUT 14
4314+#define SND_SOC_TPLG_DAPM_DAI_LINK 15
4315+#define SND_SOC_TPLG_DAPM_BUFFER 16
4316+#define SND_SOC_TPLG_DAPM_SCHEDULER 17
4317+#define SND_SOC_TPLG_DAPM_EFFECT 18
4318+#define SND_SOC_TPLG_DAPM_SIGGEN 19
4319+#define SND_SOC_TPLG_DAPM_SRC 20
4320+#define SND_SOC_TPLG_DAPM_ASRC 21
4321+#define SND_SOC_TPLG_DAPM_ENCODER 22
4322+#define SND_SOC_TPLG_DAPM_DECODER 23
4323+#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
4324+
4325+/* Header magic number and string sizes */
4326+#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
4327+
4328+/* string sizes */
4329+#define SND_SOC_TPLG_NUM_TEXTS 16
4330+
4331+/* ABI version */
4332+#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
4333+#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
4334+
4335+/* Max size of TLV data */
4336+#define SND_SOC_TPLG_TLV_SIZE 32
4337+
4338+/*
4339+ * File and Block header data types.
4340+ * Add new generic and vendor types to end of list.
4341+ * Generic types are handled by the core whilst vendors types are passed
4342+ * to the component drivers for handling.
4343+ */
4344+#define SND_SOC_TPLG_TYPE_MIXER 1
4345+#define SND_SOC_TPLG_TYPE_BYTES 2
4346+#define SND_SOC_TPLG_TYPE_ENUM 3
4347+#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
4348+#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
4349+#define SND_SOC_TPLG_TYPE_DAI_LINK 6
4350+#define SND_SOC_TPLG_TYPE_PCM 7
4351+#define SND_SOC_TPLG_TYPE_MANIFEST 8
4352+#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
4353+#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
4354+#define SND_SOC_TPLG_TYPE_PDATA 11
4355+#define SND_SOC_TPLG_TYPE_DAI 12
4356+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
4357+
4358+/* vendor block IDs - please add new vendor types to end */
4359+#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
4360+#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
4361+#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
4362+#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
4363+
4364+#define SND_SOC_TPLG_STREAM_PLAYBACK 0
4365+#define SND_SOC_TPLG_STREAM_CAPTURE 1
4366+
4367+/* vendor tuple types */
4368+#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
4369+#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
4370+#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
4371+#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
4372+#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
4373+#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
4374+
4375+/* DAI flags */
4376+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
4377+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
4378+#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
4379+
4380+/* DAI clock gating */
4381+#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
4382+#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
4383+#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
4384+
4385+/* DAI mclk_direction */
4386+#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
4387+#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
4388+
4389+/* DAI physical PCM data formats.
4390+ * Add new formats to the end of the list.
4391+ */
4392+#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
4393+#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
4394+#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
4395+#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
4396+#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
4397+#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
4398+#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
4399+
4400+/* left and right justified also known as MSB and LSB respectively */
4401+#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
4402+#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
4403+
4404+/* DAI link flags */
4405+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
4406+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
4407+#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
4408+#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
4409+
4410+/* DAI topology BCLK parameter
4411+ * For the backwards capability, by default codec is bclk master
4412+ */
4413+#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */
4414+#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */
4415+
4416+/* DAI topology FSYNC parameter
4417+ * For the backwards capability, by default codec is fsync master
4418+ */
4419+#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */
4420+#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */
4421+
4422+/*
4423+ * Block Header.
4424+ * This header precedes all object and object arrays below.
4425+ */
4426+struct snd_soc_tplg_hdr {
4427+ __le32 magic; /* magic number */
4428+ __le32 abi; /* ABI version */
4429+ __le32 version; /* optional vendor specific version details */
4430+ __le32 type; /* SND_SOC_TPLG_TYPE_ */
4431+ __le32 size; /* size of this structure */
4432+ __le32 vendor_type; /* optional vendor specific type info */
4433+ __le32 payload_size; /* data bytes, excluding this header */
4434+ __le32 index; /* identifier for block */
4435+ __le32 count; /* number of elements in block */
4436+} __attribute__((packed));
4437+
4438+/* vendor tuple for uuid */
4439+struct snd_soc_tplg_vendor_uuid_elem {
4440+ __le32 token;
4441+ char uuid[16];
4442+} __attribute__((packed));
4443+
4444+/* vendor tuple for a bool/byte/short/word value */
4445+struct snd_soc_tplg_vendor_value_elem {
4446+ __le32 token;
4447+ __le32 value;
4448+} __attribute__((packed));
4449+
4450+/* vendor tuple for string */
4451+struct snd_soc_tplg_vendor_string_elem {
4452+ __le32 token;
4453+ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4454+} __attribute__((packed));
4455+
4456+struct snd_soc_tplg_vendor_array {
4457+ __le32 size; /* size in bytes of the array, including all elements */
4458+ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
4459+ __le32 num_elems; /* number of elements in array */
4460+ union {
4461+ struct snd_soc_tplg_vendor_uuid_elem uuid[0];
4462+ struct snd_soc_tplg_vendor_value_elem value[0];
4463+ struct snd_soc_tplg_vendor_string_elem string[0];
4464+ };
4465+} __attribute__((packed));
4466+
4467+/*
4468+ * Private data.
4469+ * All topology objects may have private data that can be used by the driver or
4470+ * firmware. Core will ignore this data.
4471+ */
4472+struct snd_soc_tplg_private {
4473+ __le32 size; /* in bytes of private data */
4474+ union {
4475+ char data[0];
4476+ struct snd_soc_tplg_vendor_array array[0];
4477+ };
4478+} __attribute__((packed));
4479+
4480+/*
4481+ * Kcontrol TLV data.
4482+ */
4483+struct snd_soc_tplg_tlv_dbscale {
4484+ __le32 min;
4485+ __le32 step;
4486+ __le32 mute;
4487+} __attribute__((packed));
4488+
4489+struct snd_soc_tplg_ctl_tlv {
4490+ __le32 size; /* in bytes of this structure */
4491+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
4492+ union {
4493+ __le32 data[SND_SOC_TPLG_TLV_SIZE];
4494+ struct snd_soc_tplg_tlv_dbscale scale;
4495+ };
4496+} __attribute__((packed));
4497+
4498+/*
4499+ * Kcontrol channel data
4500+ */
4501+struct snd_soc_tplg_channel {
4502+ __le32 size; /* in bytes of this structure */
4503+ __le32 reg;
4504+ __le32 shift;
4505+ __le32 id; /* ID maps to Left, Right, LFE etc */
4506+} __attribute__((packed));
4507+
4508+/*
4509+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
4510+ * Kcontrol ops need get/put/info.
4511+ * Bytes ext ops need get/put.
4512+ */
4513+struct snd_soc_tplg_io_ops {
4514+ __le32 get;
4515+ __le32 put;
4516+ __le32 info;
4517+} __attribute__((packed));
4518+
4519+/*
4520+ * kcontrol header
4521+ */
4522+struct snd_soc_tplg_ctl_hdr {
4523+ __le32 size; /* in bytes of this structure */
4524+ __le32 type;
4525+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4526+ __le32 access;
4527+ struct snd_soc_tplg_io_ops ops;
4528+ struct snd_soc_tplg_ctl_tlv tlv;
4529+} __attribute__((packed));
4530+
4531+/*
4532+ * Stream Capabilities
4533+ */
4534+struct snd_soc_tplg_stream_caps {
4535+ __le32 size; /* in bytes of this structure */
4536+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4537+ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
4538+ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
4539+ __le32 rate_min; /* min rate */
4540+ __le32 rate_max; /* max rate */
4541+ __le32 channels_min; /* min channels */
4542+ __le32 channels_max; /* max channels */
4543+ __le32 periods_min; /* min number of periods */
4544+ __le32 periods_max; /* max number of periods */
4545+ __le32 period_size_min; /* min period size bytes */
4546+ __le32 period_size_max; /* max period size bytes */
4547+ __le32 buffer_size_min; /* min buffer size bytes */
4548+ __le32 buffer_size_max; /* max buffer size bytes */
4549+ __le32 sig_bits; /* number of bits of content */
4550+} __attribute__((packed));
4551+
4552+/*
4553+ * FE or BE Stream configuration supported by SW/FW
4554+ */
4555+struct snd_soc_tplg_stream {
4556+ __le32 size; /* in bytes of this structure */
4557+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
4558+ __le64 format; /* SNDRV_PCM_FMTBIT_* */
4559+ __le32 rate; /* SNDRV_PCM_RATE_* */
4560+ __le32 period_bytes; /* size of period in bytes */
4561+ __le32 buffer_bytes; /* size of buffer in bytes */
4562+ __le32 channels; /* channels */
4563+} __attribute__((packed));
4564+
4565+
4566+/*
4567+ * Describes a physical link's runtime supported hardware config,
4568+ * i.e. hardware audio formats.
4569+ */
4570+struct snd_soc_tplg_hw_config {
4571+ __le32 size; /* in bytes of this structure */
4572+ __le32 id; /* unique ID - - used to match */
4573+ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
4574+ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
4575+ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
4576+ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
4577+ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */
4578+ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */
4579+ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
4580+ __le16 reserved; /* for 32bit alignment */
4581+ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
4582+ __le32 bclk_rate; /* BCLK freqency in Hz */
4583+ __le32 fsync_rate; /* frame clock in Hz */
4584+ __le32 tdm_slots; /* number of TDM slots in use */
4585+ __le32 tdm_slot_width; /* width in bits for each slot */
4586+ __le32 tx_slots; /* bit mask for active Tx slots */
4587+ __le32 rx_slots; /* bit mask for active Rx slots */
4588+ __le32 tx_channels; /* number of Tx channels */
4589+ __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
4590+ __le32 rx_channels; /* number of Rx channels */
4591+ __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
4592+} __attribute__((packed));
4593+
4594+/*
4595+ * Manifest. List totals for each payload type. Not used in parsing, but will
4596+ * be passed to the component driver before any other objects in order for any
4597+ * global component resource allocations.
4598+ *
4599+ * File block representation for manifest :-
4600+ * +-----------------------------------+----+
4601+ * | struct snd_soc_tplg_hdr | 1 |
4602+ * +-----------------------------------+----+
4603+ * | struct snd_soc_tplg_manifest | 1 |
4604+ * +-----------------------------------+----+
4605+ */
4606+struct snd_soc_tplg_manifest {
4607+ __le32 size; /* in bytes of this structure */
4608+ __le32 control_elems; /* number of control elements */
4609+ __le32 widget_elems; /* number of widget elements */
4610+ __le32 graph_elems; /* number of graph elements */
4611+ __le32 pcm_elems; /* number of PCM elements */
4612+ __le32 dai_link_elems; /* number of DAI link elements */
4613+ __le32 dai_elems; /* number of physical DAI elements */
4614+ __le32 reserved[20]; /* reserved for new ABI element types */
4615+ struct snd_soc_tplg_private priv;
4616+} __attribute__((packed));
4617+
4618+/*
4619+ * Mixer kcontrol.
4620+ *
4621+ * File block representation for mixer kcontrol :-
4622+ * +-----------------------------------+----+
4623+ * | struct snd_soc_tplg_hdr | 1 |
4624+ * +-----------------------------------+----+
4625+ * | struct snd_soc_tplg_mixer_control | N |
4626+ * +-----------------------------------+----+
4627+ */
4628+struct snd_soc_tplg_mixer_control {
4629+ struct snd_soc_tplg_ctl_hdr hdr;
4630+ __le32 size; /* in bytes of this structure */
4631+ __le32 min;
4632+ __le32 max;
4633+ __le32 platform_max;
4634+ __le32 invert;
4635+ __le32 num_channels;
4636+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
4637+ struct snd_soc_tplg_private priv;
4638+} __attribute__((packed));
4639+
4640+/*
4641+ * Enumerated kcontrol
4642+ *
4643+ * File block representation for enum kcontrol :-
4644+ * +-----------------------------------+----+
4645+ * | struct snd_soc_tplg_hdr | 1 |
4646+ * +-----------------------------------+----+
4647+ * | struct snd_soc_tplg_enum_control | N |
4648+ * +-----------------------------------+----+
4649+ */
4650+struct snd_soc_tplg_enum_control {
4651+ struct snd_soc_tplg_ctl_hdr hdr;
4652+ __le32 size; /* in bytes of this structure */
4653+ __le32 num_channels;
4654+ struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
4655+ __le32 items;
4656+ __le32 mask;
4657+ __le32 count;
4658+ char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4659+ __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
4660+ struct snd_soc_tplg_private priv;
4661+} __attribute__((packed));
4662+
4663+/*
4664+ * Bytes kcontrol
4665+ *
4666+ * File block representation for bytes kcontrol :-
4667+ * +-----------------------------------+----+
4668+ * | struct snd_soc_tplg_hdr | 1 |
4669+ * +-----------------------------------+----+
4670+ * | struct snd_soc_tplg_bytes_control | N |
4671+ * +-----------------------------------+----+
4672+ */
4673+struct snd_soc_tplg_bytes_control {
4674+ struct snd_soc_tplg_ctl_hdr hdr;
4675+ __le32 size; /* in bytes of this structure */
4676+ __le32 max;
4677+ __le32 mask;
4678+ __le32 base;
4679+ __le32 num_regs;
4680+ struct snd_soc_tplg_io_ops ext_ops;
4681+ struct snd_soc_tplg_private priv;
4682+} __attribute__((packed));
4683+
4684+/*
4685+ * DAPM Graph Element
4686+ *
4687+ * File block representation for DAPM graph elements :-
4688+ * +-------------------------------------+----+
4689+ * | struct snd_soc_tplg_hdr | 1 |
4690+ * +-------------------------------------+----+
4691+ * | struct snd_soc_tplg_dapm_graph_elem | N |
4692+ * +-------------------------------------+----+
4693+ */
4694+struct snd_soc_tplg_dapm_graph_elem {
4695+ char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4696+ char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4697+ char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4698+} __attribute__((packed));
4699+
4700+/*
4701+ * DAPM Widget.
4702+ *
4703+ * File block representation for DAPM widget :-
4704+ * +-------------------------------------+-----+
4705+ * | struct snd_soc_tplg_hdr | 1 |
4706+ * +-------------------------------------+-----+
4707+ * | struct snd_soc_tplg_dapm_widget | N |
4708+ * +-------------------------------------+-----+
4709+ * | struct snd_soc_tplg_enum_control | 0|1 |
4710+ * | struct snd_soc_tplg_mixer_control | 0|N |
4711+ * +-------------------------------------+-----+
4712+ *
4713+ * Optional enum or mixer control can be appended to the end of each widget
4714+ * in the block.
4715+ */
4716+struct snd_soc_tplg_dapm_widget {
4717+ __le32 size; /* in bytes of this structure */
4718+ __le32 id; /* SND_SOC_DAPM_CTL */
4719+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4720+ char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4721+
4722+ __le32 reg; /* negative reg = no direct dapm */
4723+ __le32 shift; /* bits to shift */
4724+ __le32 mask; /* non-shifted mask */
4725+ __le32 subseq; /* sort within widget type */
4726+ __le32 invert; /* invert the power bit */
4727+ __le32 ignore_suspend; /* kept enabled over suspend */
4728+ __le16 event_flags;
4729+ __le16 event_type;
4730+ __le32 num_kcontrols;
4731+ struct snd_soc_tplg_private priv;
4732+ /*
4733+ * kcontrols that relate to this widget
4734+ * follow here after widget private data
4735+ */
4736+} __attribute__((packed));
4737+
4738+
4739+/*
4740+ * Describes SW/FW specific features of PCM (FE DAI & DAI link).
4741+ *
4742+ * File block representation for PCM :-
4743+ * +-----------------------------------+-----+
4744+ * | struct snd_soc_tplg_hdr | 1 |
4745+ * +-----------------------------------+-----+
4746+ * | struct snd_soc_tplg_pcm | N |
4747+ * +-----------------------------------+-----+
4748+ */
4749+struct snd_soc_tplg_pcm {
4750+ __le32 size; /* in bytes of this structure */
4751+ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4752+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4753+ __le32 pcm_id; /* unique ID - used to match with DAI link */
4754+ __le32 dai_id; /* unique ID - used to match */
4755+ __le32 playback; /* supports playback mode */
4756+ __le32 capture; /* supports capture mode */
4757+ __le32 compress; /* 1 = compressed; 0 = PCM */
4758+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
4759+ __le32 num_streams; /* number of streams */
4760+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
4761+ __le32 flag_mask; /* bitmask of flags to configure */
4762+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
4763+ struct snd_soc_tplg_private priv;
4764+} __attribute__((packed));
4765+
4766+
4767+/*
4768+ * Describes the physical link runtime supported configs or params
4769+ *
4770+ * File block representation for physical link config :-
4771+ * +-----------------------------------+-----+
4772+ * | struct snd_soc_tplg_hdr | 1 |
4773+ * +-----------------------------------+-----+
4774+ * | struct snd_soc_tplg_link_config | N |
4775+ * +-----------------------------------+-----+
4776+ */
4777+struct snd_soc_tplg_link_config {
4778+ __le32 size; /* in bytes of this structure */
4779+ __le32 id; /* unique ID - used to match */
4780+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
4781+ char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
4782+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
4783+ __le32 num_streams; /* number of streams */
4784+ struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
4785+ __le32 num_hw_configs; /* number of hw configs */
4786+ __le32 default_hw_config_id; /* default hw config ID for init */
4787+ __le32 flag_mask; /* bitmask of flags to configure */
4788+ __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
4789+ struct snd_soc_tplg_private priv;
4790+} __attribute__((packed));
4791+
4792+/*
4793+ * Describes SW/FW specific features of physical DAI.
4794+ * It can be used to configure backend DAIs for DPCM.
4795+ *
4796+ * File block representation for physical DAI :-
4797+ * +-----------------------------------+-----+
4798+ * | struct snd_soc_tplg_hdr | 1 |
4799+ * +-----------------------------------+-----+
4800+ * | struct snd_soc_tplg_dai | N |
4801+ * +-----------------------------------+-----+
4802+ */
4803+struct snd_soc_tplg_dai {
4804+ __le32 size; /* in bytes of this structure */
4805+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
4806+ __le32 dai_id; /* unique ID - used to match */
4807+ __le32 playback; /* supports playback mode */
4808+ __le32 capture; /* supports capture mode */
4809+ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
4810+ __le32 flag_mask; /* bitmask of flags to configure */
4811+ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
4812+ struct snd_soc_tplg_private priv;
4813+} __attribute__((packed));
4814+
4815+/*
4816+ * Old version of ABI structs, supported for backward compatibility.
4817+ */
4818+
4819+/* Manifest v4 */
4820+struct snd_soc_tplg_manifest_v4 {
4821+ __le32 size; /* in bytes of this structure */
4822+ __le32 control_elems; /* number of control elements */
4823+ __le32 widget_elems; /* number of widget elements */
4824+ __le32 graph_elems; /* number of graph elements */
4825+ __le32 pcm_elems; /* number of PCM elements */
4826+ __le32 dai_link_elems; /* number of DAI link elements */
4827+ struct snd_soc_tplg_private priv;
4828+} __packed;
4829+
4830+/* Stream Capabilities v4 */
4831+struct snd_soc_tplg_stream_caps_v4 {
4832+ __le32 size; /* in bytes of this structure */
4833+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4834+ __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
4835+ __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
4836+ __le32 rate_min; /* min rate */
4837+ __le32 rate_max; /* max rate */
4838+ __le32 channels_min; /* min channels */
4839+ __le32 channels_max; /* max channels */
4840+ __le32 periods_min; /* min number of periods */
4841+ __le32 periods_max; /* max number of periods */
4842+ __le32 period_size_min; /* min period size bytes */
4843+ __le32 period_size_max; /* max period size bytes */
4844+ __le32 buffer_size_min; /* min buffer size bytes */
4845+ __le32 buffer_size_max; /* max buffer size bytes */
4846+} __packed;
4847+
4848+/* PCM v4 */
4849+struct snd_soc_tplg_pcm_v4 {
4850+ __le32 size; /* in bytes of this structure */
4851+ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4852+ char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
4853+ __le32 pcm_id; /* unique ID - used to match with DAI link */
4854+ __le32 dai_id; /* unique ID - used to match */
4855+ __le32 playback; /* supports playback mode */
4856+ __le32 capture; /* supports capture mode */
4857+ __le32 compress; /* 1 = compressed; 0 = PCM */
4858+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
4859+ __le32 num_streams; /* number of streams */
4860+ struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
4861+} __packed;
4862+
4863+/* Physical link config v4 */
4864+struct snd_soc_tplg_link_config_v4 {
4865+ __le32 size; /* in bytes of this structure */
4866+ __le32 id; /* unique ID - used to match */
4867+ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
4868+ __le32 num_streams; /* number of streams */
4869+} __packed;
4870+
4871+#endif
4872diff --git a/include/sound/uapi/asound.h b/include/sound/uapi/asound.h
4873new file mode 100644
4874index 00000000..df1153ce
4875--- /dev/null
4876+++ b/include/sound/uapi/asound.h
4877@@ -0,0 +1,1038 @@
4878+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
4879+/*
4880+ * Advanced Linux Sound Architecture - ALSA - Driver
4881+ * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
4882+ * Abramo Bagnara <abramo@alsa-project.org>
4883+ *
4884+ *
4885+ * This program is free software; you can redistribute it and/or modify
4886+ * it under the terms of the GNU General Public License as published by
4887+ * the Free Software Foundation; either version 2 of the License, or
4888+ * (at your option) any later version.
4889+ *
4890+ * This program is distributed in the hope that it will be useful,
4891+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4892+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4893+ * GNU General Public License for more details.
4894+ *
4895+ * You should have received a copy of the GNU General Public License
4896+ * along with this program; if not, write to the Free Software
4897+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4898+ *
4899+ */
4900+
4901+#ifndef _UAPI__SOUND_ASOUND_H
4902+#define _UAPI__SOUND_ASOUND_H
4903+
4904+#if defined(__KERNEL__) || defined(__linux__)
4905+#include <linux/types.h>
4906+#else
4907+#include <sys/ioctl.h>
4908+#endif
4909+
4910+#ifndef __KERNEL__
4911+#include <stdlib.h>
4912+#include <time.h>
4913+#endif
4914+
4915+/*
4916+ * protocol version
4917+ */
4918+
4919+#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
4920+#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
4921+#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
4922+#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
4923+#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
4924+ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
4925+ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
4926+ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
4927+
4928+/****************************************************************************
4929+ * *
4930+ * Digital audio interface *
4931+ * *
4932+ ****************************************************************************/
4933+
4934+struct snd_aes_iec958 {
4935+ unsigned char status[24]; /* AES/IEC958 channel status bits */
4936+ unsigned char subcode[147]; /* AES/IEC958 subcode bits */
4937+ unsigned char pad; /* nothing */
4938+ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
4939+};
4940+
4941+/****************************************************************************
4942+ * *
4943+ * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
4944+ * *
4945+ ****************************************************************************/
4946+
4947+struct snd_cea_861_aud_if {
4948+ unsigned char db1_ct_cc; /* coding type and channel count */
4949+ unsigned char db2_sf_ss; /* sample frequency and size */
4950+ unsigned char db3; /* not used, all zeros */
4951+ unsigned char db4_ca; /* channel allocation code */
4952+ unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
4953+};
4954+
4955+/****************************************************************************
4956+ * *
4957+ * Section for driver hardware dependent interface - /dev/snd/hw? *
4958+ * *
4959+ ****************************************************************************/
4960+
4961+#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
4962+
4963+enum {
4964+ SNDRV_HWDEP_IFACE_OPL2 = 0,
4965+ SNDRV_HWDEP_IFACE_OPL3,
4966+ SNDRV_HWDEP_IFACE_OPL4,
4967+ SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
4968+ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
4969+ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
4970+ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
4971+ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
4972+ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
4973+ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
4974+ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
4975+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
4976+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
4977+ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
4978+ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
4979+ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
4980+ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
4981+ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
4982+ SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
4983+ SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */
4984+ SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */
4985+ SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */
4986+ SNDRV_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
4987+ SNDRV_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
4988+ SNDRV_HWDEP_IFACE_LINE6, /* Line6 USB processors */
4989+ SNDRV_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */
4990+ SNDRV_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */
4991+
4992+ /* Don't forget to change the following: */
4993+ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_FIREFACE
4994+};
4995+
4996+struct snd_hwdep_info {
4997+ unsigned int device; /* WR: device number */
4998+ int card; /* R: card number */
4999+ unsigned char id[64]; /* ID (user selectable) */
5000+ unsigned char name[80]; /* hwdep name */
5001+ int iface; /* hwdep interface */
5002+ unsigned char reserved[64]; /* reserved for future */
5003+};
5004+
5005+/* generic DSP loader */
5006+struct snd_hwdep_dsp_status {
5007+ unsigned int version; /* R: driver-specific version */
5008+ unsigned char id[32]; /* R: driver-specific ID string */
5009+ unsigned int num_dsps; /* R: number of DSP images to transfer */
5010+ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
5011+ unsigned int chip_ready; /* R: 1 = initialization finished */
5012+ unsigned char reserved[16]; /* reserved for future use */
5013+};
5014+
5015+struct snd_hwdep_dsp_image {
5016+ unsigned int index; /* W: DSP index */
5017+ unsigned char name[64]; /* W: ID (e.g. file name) */
5018+ unsigned char __user *image; /* W: binary image */
5019+ size_t length; /* W: size of image in bytes */
5020+ unsigned long driver_data; /* W: driver-specific data */
5021+};
5022+
5023+#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
5024+#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
5025+#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
5026+#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
5027+
5028+/*****************************************************************************
5029+ * *
5030+ * Digital Audio (PCM) interface - /dev/snd/pcm?? *
5031+ * *
5032+ *****************************************************************************/
5033+
5034+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
5035+
5036+typedef unsigned long snd_pcm_uframes_t;
5037+typedef signed long snd_pcm_sframes_t;
5038+
5039+enum {
5040+ SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
5041+ SNDRV_PCM_CLASS_MULTI, /* multichannel device */
5042+ SNDRV_PCM_CLASS_MODEM, /* software modem class */
5043+ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
5044+ /* Don't forget to change the following: */
5045+ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
5046+};
5047+
5048+enum {
5049+ SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
5050+ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
5051+ /* Don't forget to change the following: */
5052+ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
5053+};
5054+
5055+enum {
5056+ SNDRV_PCM_STREAM_PLAYBACK = 0,
5057+ SNDRV_PCM_STREAM_CAPTURE,
5058+ SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
5059+};
5060+
5061+typedef int __bitwise snd_pcm_access_t;
5062+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
5063+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
5064+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
5065+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
5066+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
5067+#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
5068+
5069+typedef int __bitwise snd_pcm_format_t;
5070+#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
5071+#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
5072+#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
5073+#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
5074+#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
5075+#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
5076+#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
5077+#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
5078+#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
5079+#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
5080+#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
5081+#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
5082+#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
5083+#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
5084+#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 */
5085+#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 */
5086+#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 */
5087+#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 */
5088+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
5089+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
5090+#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
5091+#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
5092+#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
5093+#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
5094+#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
5095+#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
5096+#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
5097+#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
5098+#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
5099+/* gap in the numbering for a future standard linear format */
5100+#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
5101+#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
5102+#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
5103+#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
5104+#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
5105+#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
5106+#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
5107+#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
5108+#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
5109+#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
5110+#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
5111+#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
5112+#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
5113+#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
5114+#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
5115+#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
5116+#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
5117+#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
5118+#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
5119+#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
5120+#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
5121+#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
5122+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
5123+#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
5124+
5125+#ifdef SNDRV_LITTLE_ENDIAN
5126+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
5127+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
5128+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
5129+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
5130+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
5131+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
5132+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
5133+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
5134+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
5135+#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_LE
5136+#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_LE
5137+#endif
5138+#ifdef SNDRV_BIG_ENDIAN
5139+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
5140+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
5141+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
5142+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
5143+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
5144+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
5145+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
5146+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
5147+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
5148+#define SNDRV_PCM_FORMAT_S20 SNDRV_PCM_FORMAT_S20_BE
5149+#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
5150+#endif
5151+
5152+typedef int __bitwise snd_pcm_subformat_t;
5153+#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
5154+#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
5155+
5156+#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
5157+#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
5158+#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
5159+#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
5160+#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
5161+#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
5162+#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
5163+#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
5164+#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
5165+#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
5166+#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
5167+#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
5168+#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
5169+#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
5170+#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
5171+#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
5172+#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */
5173+#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */
5174+#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
5175+#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
5176+#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
5177+
5178+#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
5179+#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
5180+
5181+
5182+
5183+typedef int __bitwise snd_pcm_state_t;
5184+#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
5185+#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
5186+#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
5187+#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
5188+#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
5189+#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
5190+#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
5191+#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
5192+#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
5193+#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
5194+
5195+enum {
5196+ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
5197+ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
5198+ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
5199+};
5200+
5201+union snd_pcm_sync_id {
5202+ unsigned char id[16];
5203+ unsigned short id16[8];
5204+ unsigned int id32[4];
5205+};
5206+
5207+struct snd_pcm_info {
5208+ unsigned int device; /* RO/WR (control): device number */
5209+ unsigned int subdevice; /* RO/WR (control): subdevice number */
5210+ int stream; /* RO/WR (control): stream direction */
5211+ int card; /* R: card number */
5212+ unsigned char id[64]; /* ID (user selectable) */
5213+ unsigned char name[80]; /* name of this device */
5214+ unsigned char subname[32]; /* subdevice name */
5215+ int dev_class; /* SNDRV_PCM_CLASS_* */
5216+ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
5217+ unsigned int subdevices_count;
5218+ unsigned int subdevices_avail;
5219+ union snd_pcm_sync_id sync; /* hardware synchronization ID */
5220+ unsigned char reserved[64]; /* reserved for future... */
5221+};
5222+
5223+typedef int snd_pcm_hw_param_t;
5224+#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
5225+#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
5226+#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
5227+#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
5228+#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
5229+
5230+#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
5231+#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
5232+#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
5233+#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
5234+#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
5235+ * interrupts in us
5236+ */
5237+#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
5238+ * interrupts
5239+ */
5240+#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
5241+ * interrupts
5242+ */
5243+#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
5244+ * buffer
5245+ */
5246+#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
5247+ * in us
5248+ */
5249+#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
5250+#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
5251+#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
5252+#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
5253+#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
5254+
5255+#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
5256+#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
5257+#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
5258+
5259+struct snd_interval {
5260+ unsigned int min, max;
5261+ unsigned int openmin:1,
5262+ openmax:1,
5263+ integer:1,
5264+ empty:1;
5265+};
5266+
5267+#define SNDRV_MASK_MAX 256
5268+
5269+struct snd_mask {
5270+ __u32 bits[(SNDRV_MASK_MAX+31)/32];
5271+};
5272+
5273+struct snd_pcm_hw_params {
5274+ unsigned int flags;
5275+ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
5276+ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
5277+ struct snd_mask mres[5]; /* reserved masks */
5278+ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
5279+ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
5280+ struct snd_interval ires[9]; /* reserved intervals */
5281+ unsigned int rmask; /* W: requested masks */
5282+ unsigned int cmask; /* R: changed masks */
5283+ unsigned int info; /* R: Info flags for returned setup */
5284+ unsigned int msbits; /* R: used most significant bits */
5285+ unsigned int rate_num; /* R: rate numerator */
5286+ unsigned int rate_den; /* R: rate denominator */
5287+ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
5288+ unsigned char reserved[64]; /* reserved for future */
5289+};
5290+
5291+enum {
5292+ SNDRV_PCM_TSTAMP_NONE = 0,
5293+ SNDRV_PCM_TSTAMP_ENABLE,
5294+ SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
5295+};
5296+
5297+struct snd_pcm_sw_params {
5298+ int tstamp_mode; /* timestamp mode */
5299+ unsigned int period_step;
5300+ unsigned int sleep_min; /* min ticks to sleep */
5301+ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
5302+ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
5303+ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
5304+ snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
5305+ snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
5306+ snd_pcm_uframes_t silence_size; /* silence block size */
5307+ snd_pcm_uframes_t boundary; /* pointers wrap point */
5308+ unsigned int proto; /* protocol version */
5309+ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
5310+ unsigned char reserved[56]; /* reserved for future */
5311+};
5312+
5313+struct snd_pcm_channel_info {
5314+ unsigned int channel;
5315+ __kernel_off_t offset; /* mmap offset */
5316+ unsigned int first; /* offset to first sample in bits */
5317+ unsigned int step; /* samples distance in bits */
5318+};
5319+
5320+enum {
5321+ /*
5322+ * first definition for backwards compatibility only,
5323+ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
5324+ */
5325+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
5326+
5327+ /* timestamp definitions */
5328+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */
5329+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */
5330+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */
5331+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */
5332+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
5333+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
5334+};
5335+
5336+struct snd_pcm_status {
5337+ snd_pcm_state_t state; /* stream state */
5338+ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
5339+ struct timespec tstamp; /* reference timestamp */
5340+ snd_pcm_uframes_t appl_ptr; /* appl ptr */
5341+ snd_pcm_uframes_t hw_ptr; /* hw ptr */
5342+ snd_pcm_sframes_t delay; /* current delay in frames */
5343+ snd_pcm_uframes_t avail; /* number of frames available */
5344+ snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
5345+ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
5346+ snd_pcm_state_t suspended_state; /* suspended stream state */
5347+ __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
5348+ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */
5349+ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */
5350+ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
5351+ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
5352+};
5353+
5354+struct snd_pcm_mmap_status {
5355+ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
5356+ int pad1; /* Needed for 64 bit alignment */
5357+ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
5358+ struct timespec tstamp; /* Timestamp */
5359+ snd_pcm_state_t suspended_state; /* RO: suspended stream state */
5360+ struct timespec audio_tstamp; /* from sample counter or wall clock */
5361+};
5362+
5363+struct snd_pcm_mmap_control {
5364+ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
5365+ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
5366+};
5367+
5368+#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
5369+#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
5370+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
5371+
5372+struct snd_pcm_sync_ptr {
5373+ unsigned int flags;
5374+ union {
5375+ struct snd_pcm_mmap_status status;
5376+ unsigned char reserved[64];
5377+ } s;
5378+ union {
5379+ struct snd_pcm_mmap_control control;
5380+ unsigned char reserved[64];
5381+ } c;
5382+};
5383+
5384+struct snd_xferi {
5385+ snd_pcm_sframes_t result;
5386+ void __user *buf;
5387+ snd_pcm_uframes_t frames;
5388+};
5389+
5390+struct snd_xfern {
5391+ snd_pcm_sframes_t result;
5392+ void __user * __user *bufs;
5393+ snd_pcm_uframes_t frames;
5394+};
5395+
5396+enum {
5397+ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
5398+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
5399+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
5400+ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
5401+};
5402+
5403+/* channel positions */
5404+enum {
5405+ SNDRV_CHMAP_UNKNOWN = 0,
5406+ SNDRV_CHMAP_NA, /* N/A, silent */
5407+ SNDRV_CHMAP_MONO, /* mono stream */
5408+ /* this follows the alsa-lib mixer channel value + 3 */
5409+ SNDRV_CHMAP_FL, /* front left */
5410+ SNDRV_CHMAP_FR, /* front right */
5411+ SNDRV_CHMAP_RL, /* rear left */
5412+ SNDRV_CHMAP_RR, /* rear right */
5413+ SNDRV_CHMAP_FC, /* front center */
5414+ SNDRV_CHMAP_LFE, /* LFE */
5415+ SNDRV_CHMAP_SL, /* side left */
5416+ SNDRV_CHMAP_SR, /* side right */
5417+ SNDRV_CHMAP_RC, /* rear center */
5418+ /* new definitions */
5419+ SNDRV_CHMAP_FLC, /* front left center */
5420+ SNDRV_CHMAP_FRC, /* front right center */
5421+ SNDRV_CHMAP_RLC, /* rear left center */
5422+ SNDRV_CHMAP_RRC, /* rear right center */
5423+ SNDRV_CHMAP_FLW, /* front left wide */
5424+ SNDRV_CHMAP_FRW, /* front right wide */
5425+ SNDRV_CHMAP_FLH, /* front left high */
5426+ SNDRV_CHMAP_FCH, /* front center high */
5427+ SNDRV_CHMAP_FRH, /* front right high */
5428+ SNDRV_CHMAP_TC, /* top center */
5429+ SNDRV_CHMAP_TFL, /* top front left */
5430+ SNDRV_CHMAP_TFR, /* top front right */
5431+ SNDRV_CHMAP_TFC, /* top front center */
5432+ SNDRV_CHMAP_TRL, /* top rear left */
5433+ SNDRV_CHMAP_TRR, /* top rear right */
5434+ SNDRV_CHMAP_TRC, /* top rear center */
5435+ /* new definitions for UAC2 */
5436+ SNDRV_CHMAP_TFLC, /* top front left center */
5437+ SNDRV_CHMAP_TFRC, /* top front right center */
5438+ SNDRV_CHMAP_TSL, /* top side left */
5439+ SNDRV_CHMAP_TSR, /* top side right */
5440+ SNDRV_CHMAP_LLFE, /* left LFE */
5441+ SNDRV_CHMAP_RLFE, /* right LFE */
5442+ SNDRV_CHMAP_BC, /* bottom center */
5443+ SNDRV_CHMAP_BLC, /* bottom left center */
5444+ SNDRV_CHMAP_BRC, /* bottom right center */
5445+ SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
5446+};
5447+
5448+#define SNDRV_CHMAP_POSITION_MASK 0xffff
5449+#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
5450+#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
5451+
5452+#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
5453+#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
5454+#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
5455+#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
5456+#define SNDRV_PCM_IOCTL_USER_PVERSION _IOW('A', 0x04, int)
5457+#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
5458+#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
5459+#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
5460+#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
5461+#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
5462+#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
5463+#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
5464+#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
5465+#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
5466+#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
5467+#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
5468+#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
5469+#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
5470+#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
5471+#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
5472+#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
5473+#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
5474+#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
5475+#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
5476+#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
5477+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
5478+#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
5479+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
5480+#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
5481+#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
5482+#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
5483+
5484+/*****************************************************************************
5485+ * *
5486+ * MIDI v1.0 interface *
5487+ * *
5488+ *****************************************************************************/
5489+
5490+/*
5491+ * Raw MIDI section - /dev/snd/midi??
5492+ */
5493+
5494+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
5495+
5496+enum {
5497+ SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
5498+ SNDRV_RAWMIDI_STREAM_INPUT,
5499+ SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
5500+};
5501+
5502+#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
5503+#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
5504+#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
5505+
5506+struct snd_rawmidi_info {
5507+ unsigned int device; /* RO/WR (control): device number */
5508+ unsigned int subdevice; /* RO/WR (control): subdevice number */
5509+ int stream; /* WR: stream */
5510+ int card; /* R: card number */
5511+ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
5512+ unsigned char id[64]; /* ID (user selectable) */
5513+ unsigned char name[80]; /* name of device */
5514+ unsigned char subname[32]; /* name of active or selected subdevice */
5515+ unsigned int subdevices_count;
5516+ unsigned int subdevices_avail;
5517+ unsigned char reserved[64]; /* reserved for future use */
5518+};
5519+
5520+struct snd_rawmidi_params {
5521+ int stream;
5522+ size_t buffer_size; /* queue size in bytes */
5523+ size_t avail_min; /* minimum avail bytes for wakeup */
5524+ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
5525+ unsigned char reserved[16]; /* reserved for future use */
5526+};
5527+
5528+struct snd_rawmidi_status {
5529+ int stream;
5530+ struct timespec tstamp; /* Timestamp */
5531+ size_t avail; /* available bytes */
5532+ size_t xruns; /* count of overruns since last status (in bytes) */
5533+ unsigned char reserved[16]; /* reserved for future use */
5534+};
5535+
5536+#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
5537+#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
5538+#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
5539+#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
5540+#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
5541+#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
5542+
5543+/*
5544+ * Timer section - /dev/snd/timer
5545+ */
5546+
5547+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
5548+
5549+enum {
5550+ SNDRV_TIMER_CLASS_NONE = -1,
5551+ SNDRV_TIMER_CLASS_SLAVE = 0,
5552+ SNDRV_TIMER_CLASS_GLOBAL,
5553+ SNDRV_TIMER_CLASS_CARD,
5554+ SNDRV_TIMER_CLASS_PCM,
5555+ SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
5556+};
5557+
5558+/* slave timer classes */
5559+enum {
5560+ SNDRV_TIMER_SCLASS_NONE = 0,
5561+ SNDRV_TIMER_SCLASS_APPLICATION,
5562+ SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
5563+ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
5564+ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
5565+};
5566+
5567+/* global timers (device member) */
5568+#define SNDRV_TIMER_GLOBAL_SYSTEM 0
5569+#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
5570+#define SNDRV_TIMER_GLOBAL_HPET 2
5571+#define SNDRV_TIMER_GLOBAL_HRTIMER 3
5572+
5573+/* info flags */
5574+#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
5575+
5576+struct snd_timer_id {
5577+ int dev_class;
5578+ int dev_sclass;
5579+ int card;
5580+ int device;
5581+ int subdevice;
5582+};
5583+
5584+struct snd_timer_ginfo {
5585+ struct snd_timer_id tid; /* requested timer ID */
5586+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
5587+ int card; /* card number */
5588+ unsigned char id[64]; /* timer identification */
5589+ unsigned char name[80]; /* timer name */
5590+ unsigned long reserved0; /* reserved for future use */
5591+ unsigned long resolution; /* average period resolution in ns */
5592+ unsigned long resolution_min; /* minimal period resolution in ns */
5593+ unsigned long resolution_max; /* maximal period resolution in ns */
5594+ unsigned int clients; /* active timer clients */
5595+ unsigned char reserved[32];
5596+};
5597+
5598+struct snd_timer_gparams {
5599+ struct snd_timer_id tid; /* requested timer ID */
5600+ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
5601+ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
5602+ unsigned char reserved[32];
5603+};
5604+
5605+struct snd_timer_gstatus {
5606+ struct snd_timer_id tid; /* requested timer ID */
5607+ unsigned long resolution; /* current period resolution in ns */
5608+ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
5609+ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
5610+ unsigned char reserved[32];
5611+};
5612+
5613+struct snd_timer_select {
5614+ struct snd_timer_id id; /* bind to timer ID */
5615+ unsigned char reserved[32]; /* reserved */
5616+};
5617+
5618+struct snd_timer_info {
5619+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
5620+ int card; /* card number */
5621+ unsigned char id[64]; /* timer identificator */
5622+ unsigned char name[80]; /* timer name */
5623+ unsigned long reserved0; /* reserved for future use */
5624+ unsigned long resolution; /* average period resolution in ns */
5625+ unsigned char reserved[64]; /* reserved */
5626+};
5627+
5628+#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
5629+#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
5630+#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
5631+
5632+struct snd_timer_params {
5633+ unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */
5634+ unsigned int ticks; /* requested resolution in ticks */
5635+ unsigned int queue_size; /* total size of queue (32-1024) */
5636+ unsigned int reserved0; /* reserved, was: failure locations */
5637+ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
5638+ unsigned char reserved[60]; /* reserved */
5639+};
5640+
5641+struct snd_timer_status {
5642+ struct timespec tstamp; /* Timestamp - last update */
5643+ unsigned int resolution; /* current period resolution in ns */
5644+ unsigned int lost; /* counter of master tick lost */
5645+ unsigned int overrun; /* count of read queue overruns */
5646+ unsigned int queue; /* used queue size */
5647+ unsigned char reserved[64]; /* reserved */
5648+};
5649+
5650+#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
5651+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
5652+#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
5653+#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
5654+#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
5655+#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
5656+#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
5657+#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
5658+#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
5659+#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
5660+/* The following four ioctls are changed since 1.0.9 due to confliction */
5661+#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
5662+#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
5663+#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
5664+#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
5665+
5666+struct snd_timer_read {
5667+ unsigned int resolution;
5668+ unsigned int ticks;
5669+};
5670+
5671+enum {
5672+ SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
5673+ SNDRV_TIMER_EVENT_TICK, /* val = ticks */
5674+ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
5675+ SNDRV_TIMER_EVENT_STOP, /* val = 0 */
5676+ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
5677+ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
5678+ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
5679+ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
5680+ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
5681+ /* master timer events for slave timer instances */
5682+ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
5683+ SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
5684+ SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
5685+ SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
5686+ SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
5687+ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
5688+};
5689+
5690+struct snd_timer_tread {
5691+ int event;
5692+ struct timespec tstamp;
5693+ unsigned int val;
5694+};
5695+
5696+/****************************************************************************
5697+ * *
5698+ * Section for driver control interface - /dev/snd/control? *
5699+ * *
5700+ ****************************************************************************/
5701+
5702+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
5703+
5704+struct snd_ctl_card_info {
5705+ int card; /* card number */
5706+ int pad; /* reserved for future (was type) */
5707+ unsigned char id[16]; /* ID of card (user selectable) */
5708+ unsigned char driver[16]; /* Driver name */
5709+ unsigned char name[32]; /* Short name of soundcard */
5710+ unsigned char longname[80]; /* name + info text about soundcard */
5711+ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
5712+ unsigned char mixername[80]; /* visual mixer identification */
5713+ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
5714+};
5715+
5716+typedef int __bitwise snd_ctl_elem_type_t;
5717+#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
5718+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
5719+#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
5720+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
5721+#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
5722+#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
5723+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
5724+#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
5725+
5726+typedef int __bitwise snd_ctl_elem_iface_t;
5727+#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
5728+#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
5729+#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
5730+#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
5731+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
5732+#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
5733+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
5734+#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
5735+
5736+#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
5737+#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
5738+#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
5739+#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
5740+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
5741+#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
5742+#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
5743+#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
5744+#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
5745+#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
5746+#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
5747+#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
5748+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
5749+#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
5750+/* bits 30 and 31 are obsoleted (for indirect access) */
5751+
5752+/* for further details see the ACPI and PCI power management specification */
5753+#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
5754+#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
5755+#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
5756+#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
5757+#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
5758+#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
5759+
5760+#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44
5761+
5762+struct snd_ctl_elem_id {
5763+ unsigned int numid; /* numeric identifier, zero = invalid */
5764+ snd_ctl_elem_iface_t iface; /* interface identifier */
5765+ unsigned int device; /* device/client number */
5766+ unsigned int subdevice; /* subdevice (substream) number */
5767+ unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */
5768+ unsigned int index; /* index of item */
5769+};
5770+
5771+struct snd_ctl_elem_list {
5772+ unsigned int offset; /* W: first element ID to get */
5773+ unsigned int space; /* W: count of element IDs to get */
5774+ unsigned int used; /* R: count of element IDs set */
5775+ unsigned int count; /* R: count of all elements */
5776+ struct snd_ctl_elem_id __user *pids; /* R: IDs */
5777+ unsigned char reserved[50];
5778+};
5779+
5780+struct snd_ctl_elem_info {
5781+ struct snd_ctl_elem_id id; /* W: element ID */
5782+ snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
5783+ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
5784+ unsigned int count; /* count of values */
5785+ __kernel_pid_t owner; /* owner's PID of this control */
5786+ union {
5787+ struct {
5788+ long min; /* R: minimum value */
5789+ long max; /* R: maximum value */
5790+ long step; /* R: step (0 variable) */
5791+ } integer;
5792+ struct {
5793+ long long min; /* R: minimum value */
5794+ long long max; /* R: maximum value */
5795+ long long step; /* R: step (0 variable) */
5796+ } integer64;
5797+ struct {
5798+ unsigned int items; /* R: number of items */
5799+ unsigned int item; /* W: item number */
5800+ char name[64]; /* R: value name */
5801+ __u64 names_ptr; /* W: names list (ELEM_ADD only) */
5802+ unsigned int names_length;
5803+ } enumerated;
5804+ unsigned char reserved[128];
5805+ } value;
5806+ union {
5807+ unsigned short d[4]; /* dimensions */
5808+ unsigned short *d_ptr; /* indirect - obsoleted */
5809+ } dimen;
5810+ unsigned char reserved[64-4*sizeof(unsigned short)];
5811+};
5812+
5813+struct snd_ctl_elem_value {
5814+ struct snd_ctl_elem_id id; /* W: element ID */
5815+ unsigned int indirect: 1; /* W: indirect access - obsoleted */
5816+ union {
5817+ union {
5818+ long value[128];
5819+ long *value_ptr; /* obsoleted */
5820+ } integer;
5821+ union {
5822+ long long value[64];
5823+ long long *value_ptr; /* obsoleted */
5824+ } integer64;
5825+ union {
5826+ unsigned int item[128];
5827+ unsigned int *item_ptr; /* obsoleted */
5828+ } enumerated;
5829+ union {
5830+ unsigned char data[512];
5831+ unsigned char *data_ptr; /* obsoleted */
5832+ } bytes;
5833+ struct snd_aes_iec958 iec958;
5834+ } value; /* RO */
5835+ struct timespec tstamp;
5836+ unsigned char reserved[128-sizeof(struct timespec)];
5837+};
5838+
5839+struct snd_ctl_tlv {
5840+ unsigned int numid; /* control element numeric identification */
5841+ unsigned int length; /* in bytes aligned to 4 */
5842+ unsigned int tlv[0]; /* first TLV */
5843+};
5844+
5845+#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
5846+#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
5847+#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
5848+#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
5849+#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
5850+#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
5851+#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
5852+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
5853+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
5854+#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
5855+#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
5856+#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
5857+#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
5858+#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
5859+#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
5860+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
5861+#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
5862+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
5863+#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
5864+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
5865+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
5866+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
5867+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
5868+#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
5869+#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
5870+
5871+/*
5872+ * Read interface.
5873+ */
5874+
5875+enum sndrv_ctl_event_type {
5876+ SNDRV_CTL_EVENT_ELEM = 0,
5877+ SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
5878+};
5879+
5880+#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
5881+#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
5882+#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
5883+#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
5884+#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
5885+
5886+struct snd_ctl_event {
5887+ int type; /* event type - SNDRV_CTL_EVENT_* */
5888+ union {
5889+ struct {
5890+ unsigned int mask;
5891+ struct snd_ctl_elem_id id;
5892+ } elem;
5893+ unsigned char data8[60];
5894+ } data;
5895+};
5896+
5897+/*
5898+ * Control names
5899+ */
5900+
5901+#define SNDRV_CTL_NAME_NONE ""
5902+#define SNDRV_CTL_NAME_PLAYBACK "Playback "
5903+#define SNDRV_CTL_NAME_CAPTURE "Capture "
5904+
5905+#define SNDRV_CTL_NAME_IEC958_NONE ""
5906+#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
5907+#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
5908+#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
5909+#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
5910+#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
5911+#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
5912+#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
5913+#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
5914+
5915+#endif /* _UAPI__SOUND_ASOUND_H */
5916diff --git a/include/sound/uapi/asound_fm.h b/include/sound/uapi/asound_fm.h
5917new file mode 100644
5918index 00000000..8471f404
5919--- /dev/null
5920+++ b/include/sound/uapi/asound_fm.h
5921@@ -0,0 +1,135 @@
5922+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
5923+#ifndef __SOUND_ASOUND_FM_H
5924+#define __SOUND_ASOUND_FM_H
5925+
5926+/*
5927+ * Advanced Linux Sound Architecture - ALSA
5928+ *
5929+ * Interface file between ALSA driver & user space
5930+ * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
5931+ * 4Front Technologies
5932+ *
5933+ * Direct FM control
5934+ *
5935+ * This program is free software; you can redistribute it and/or modify
5936+ * it under the terms of the GNU General Public License as published by
5937+ * the Free Software Foundation; either version 2 of the License, or
5938+ * (at your option) any later version.
5939+ *
5940+ * This program is distributed in the hope that it will be useful,
5941+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
5942+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5943+ * GNU General Public License for more details.
5944+ *
5945+ * You should have received a copy of the GNU General Public License
5946+ * along with this program; if not, write to the Free Software
5947+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5948+ *
5949+ */
5950+
5951+#define SNDRV_DM_FM_MODE_OPL2 0x00
5952+#define SNDRV_DM_FM_MODE_OPL3 0x01
5953+
5954+struct snd_dm_fm_info {
5955+ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
5956+ unsigned char rhythm; /* percussion mode flag */
5957+};
5958+
5959+/*
5960+ * Data structure composing an FM "note" or sound event.
5961+ */
5962+
5963+struct snd_dm_fm_voice {
5964+ unsigned char op; /* operator cell (0 or 1) */
5965+ unsigned char voice; /* FM voice (0 to 17) */
5966+
5967+ unsigned char am; /* amplitude modulation */
5968+ unsigned char vibrato; /* vibrato effect */
5969+ unsigned char do_sustain; /* sustain phase */
5970+ unsigned char kbd_scale; /* keyboard scaling */
5971+ unsigned char harmonic; /* 4 bits: harmonic and multiplier */
5972+ unsigned char scale_level; /* 2 bits: decrease output freq rises */
5973+ unsigned char volume; /* 6 bits: volume */
5974+
5975+ unsigned char attack; /* 4 bits: attack rate */
5976+ unsigned char decay; /* 4 bits: decay rate */
5977+ unsigned char sustain; /* 4 bits: sustain level */
5978+ unsigned char release; /* 4 bits: release rate */
5979+
5980+ unsigned char feedback; /* 3 bits: feedback for op0 */
5981+ unsigned char connection; /* 0 for serial, 1 for parallel */
5982+ unsigned char left; /* stereo left */
5983+ unsigned char right; /* stereo right */
5984+ unsigned char waveform; /* 3 bits: waveform shape */
5985+};
5986+
5987+/*
5988+ * This describes an FM note by its voice, octave, frequency number (10bit)
5989+ * and key on/off.
5990+ */
5991+
5992+struct snd_dm_fm_note {
5993+ unsigned char voice; /* 0-17 voice channel */
5994+ unsigned char octave; /* 3 bits: what octave to play */
5995+ unsigned int fnum; /* 10 bits: frequency number */
5996+ unsigned char key_on; /* set for active, clear for silent */
5997+};
5998+
5999+/*
6000+ * FM parameters that apply globally to all voices, and thus are not "notes"
6001+ */
6002+
6003+struct snd_dm_fm_params {
6004+ unsigned char am_depth; /* amplitude modulation depth (1=hi) */
6005+ unsigned char vib_depth; /* vibrato depth (1=hi) */
6006+ unsigned char kbd_split; /* keyboard split */
6007+ unsigned char rhythm; /* percussion mode select */
6008+
6009+ /* This block is the percussion instrument data */
6010+ unsigned char bass;
6011+ unsigned char snare;
6012+ unsigned char tomtom;
6013+ unsigned char cymbal;
6014+ unsigned char hihat;
6015+};
6016+
6017+/*
6018+ * FM mode ioctl settings
6019+ */
6020+
6021+#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
6022+#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
6023+#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
6024+#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
6025+#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
6026+#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
6027+/* for OPL3 only */
6028+#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
6029+/* SBI patch management */
6030+#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
6031+
6032+#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
6033+#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
6034+#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
6035+#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
6036+#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
6037+#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
6038+
6039+/*
6040+ * Patch Record - fixed size for write
6041+ */
6042+
6043+#define FM_KEY_SBI "SBI\032"
6044+#define FM_KEY_2OP "2OP\032"
6045+#define FM_KEY_4OP "4OP\032"
6046+
6047+struct sbi_patch {
6048+ unsigned char prog;
6049+ unsigned char bank;
6050+ char key[4];
6051+ char name[25];
6052+ char extension[7];
6053+ unsigned char data[32];
6054+};
6055+
6056+#endif /* __SOUND_ASOUND_FM_H */
6057diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h
6058new file mode 100644
6059index 00000000..c1150e4d
6060--- /dev/null
6061+++ b/include/sound/uapi/emu10k1.h
6062@@ -0,0 +1,395 @@
6063+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6064+/*
6065+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
6066+ * Creative Labs, Inc.
6067+ * Definitions for EMU10K1 (SB Live!) chips
6068+ *
6069+ *
6070+ * This program is free software; you can redistribute it and/or modify
6071+ * it under the terms of the GNU General Public License as published by
6072+ * the Free Software Foundation; either version 2 of the License, or
6073+ * (at your option) any later version.
6074+ *
6075+ * This program is distributed in the hope that it will be useful,
6076+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6077+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6078+ * GNU General Public License for more details.
6079+ *
6080+ * You should have received a copy of the GNU General Public License
6081+ * along with this program; if not, write to the Free Software
6082+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6083+ *
6084+ */
6085+#ifndef _UAPI__SOUND_EMU10K1_H
6086+#define _UAPI__SOUND_EMU10K1_H
6087+
6088+/*
6089+ * ---- FX8010 ----
6090+ */
6091+
6092+#define EMU10K1_CARD_CREATIVE 0x00000000
6093+#define EMU10K1_CARD_EMUAPS 0x00000001
6094+
6095+#define EMU10K1_FX8010_PCM_COUNT 8
6096+
6097+/*
6098+ * Following definition is copied from linux/types.h to support compiling
6099+ * this header file in userspace since they are not generally available for
6100+ * uapi headers.
6101+ */
6102+#define __EMU10K1_DECLARE_BITMAP(name,bits) \
6103+ unsigned long name[(bits) / (sizeof(unsigned long) * 8)]
6104+
6105+/* instruction set */
6106+#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
6107+#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
6108+#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
6109+#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
6110+#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
6111+#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
6112+#define iACC3 0x06 /* R = A + X + Y ; saturation */
6113+#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
6114+#define iANDXOR 0x08 /* R = (A & X) ^ Y */
6115+#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
6116+#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
6117+#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
6118+#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
6119+#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
6120+#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
6121+#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
6122+
6123+/* GPRs */
6124+#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
6125+#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
6126+#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
6127+#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
6128+ /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
6129+
6130+#define C_00000000 0x40
6131+#define C_00000001 0x41
6132+#define C_00000002 0x42
6133+#define C_00000003 0x43
6134+#define C_00000004 0x44
6135+#define C_00000008 0x45
6136+#define C_00000010 0x46
6137+#define C_00000020 0x47
6138+#define C_00000100 0x48
6139+#define C_00010000 0x49
6140+#define C_00080000 0x4a
6141+#define C_10000000 0x4b
6142+#define C_20000000 0x4c
6143+#define C_40000000 0x4d
6144+#define C_80000000 0x4e
6145+#define C_7fffffff 0x4f
6146+#define C_ffffffff 0x50
6147+#define C_fffffffe 0x51
6148+#define C_c0000000 0x52
6149+#define C_4f1bbcdc 0x53
6150+#define C_5a7ef9db 0x54
6151+#define C_00100000 0x55 /* ?? */
6152+#define GPR_ACCU 0x56 /* ACCUM, accumulator */
6153+#define GPR_COND 0x57 /* CCR, condition register */
6154+#define GPR_NOISE0 0x58 /* noise source */
6155+#define GPR_NOISE1 0x59 /* noise source */
6156+#define GPR_IRQ 0x5a /* IRQ register */
6157+#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
6158+#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
6159+#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
6160+#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
6161+#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
6162+#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
6163+
6164+#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
6165+#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
6166+#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
6167+#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
6168+#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
6169+#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
6170+
6171+#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */
6172+#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */
6173+#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
6174+#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */
6175+#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
6176+#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
6177+#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
6178+#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
6179+#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
6180+#define A_GPR(x) (A_FXGPREGBASE + (x))
6181+
6182+/* cc_reg constants */
6183+#define CC_REG_NORMALIZED C_00000001
6184+#define CC_REG_BORROW C_00000002
6185+#define CC_REG_MINUS C_00000004
6186+#define CC_REG_ZERO C_00000008
6187+#define CC_REG_SATURATE C_00000010
6188+#define CC_REG_NONZERO C_00000100
6189+
6190+/* FX buses */
6191+#define FXBUS_PCM_LEFT 0x00
6192+#define FXBUS_PCM_RIGHT 0x01
6193+#define FXBUS_PCM_LEFT_REAR 0x02
6194+#define FXBUS_PCM_RIGHT_REAR 0x03
6195+#define FXBUS_MIDI_LEFT 0x04
6196+#define FXBUS_MIDI_RIGHT 0x05
6197+#define FXBUS_PCM_CENTER 0x06
6198+#define FXBUS_PCM_LFE 0x07
6199+#define FXBUS_PCM_LEFT_FRONT 0x08
6200+#define FXBUS_PCM_RIGHT_FRONT 0x09
6201+#define FXBUS_MIDI_REVERB 0x0c
6202+#define FXBUS_MIDI_CHORUS 0x0d
6203+#define FXBUS_PCM_LEFT_SIDE 0x0e
6204+#define FXBUS_PCM_RIGHT_SIDE 0x0f
6205+#define FXBUS_PT_LEFT 0x14
6206+#define FXBUS_PT_RIGHT 0x15
6207+
6208+/* Inputs */
6209+#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
6210+#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
6211+#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
6212+#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
6213+#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
6214+#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
6215+#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
6216+#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
6217+#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
6218+#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
6219+#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
6220+#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
6221+#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
6222+#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
6223+
6224+/* Outputs */
6225+#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
6226+#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
6227+#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
6228+#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
6229+#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
6230+#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
6231+#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
6232+#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
6233+#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
6234+#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
6235+#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
6236+#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
6237+#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
6238+#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
6239+#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
6240+#define EXTOUT_ACENTER 0x11 /* Analog Center */
6241+#define EXTOUT_ALFE 0x12 /* Analog LFE */
6242+
6243+/* Audigy Inputs */
6244+#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
6245+#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
6246+#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
6247+#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
6248+#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
6249+#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
6250+#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
6251+#define A_EXTIN_LINE2_R 0x09 /* right */
6252+#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
6253+#define A_EXTIN_ADC_R 0x0b /* right */
6254+#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
6255+#define A_EXTIN_AUX2_R 0x0d /* - right */
6256+
6257+/* Audigiy Outputs */
6258+#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
6259+#define A_EXTOUT_FRONT_R 0x01 /* right */
6260+#define A_EXTOUT_CENTER 0x02 /* digital front center */
6261+#define A_EXTOUT_LFE 0x03 /* digital front lfe */
6262+#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
6263+#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
6264+#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
6265+#define A_EXTOUT_REAR_R 0x07 /* right */
6266+#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
6267+#define A_EXTOUT_AFRONT_R 0x09 /* right */
6268+#define A_EXTOUT_ACENTER 0x0a /* analog center */
6269+#define A_EXTOUT_ALFE 0x0b /* analog LFE */
6270+#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
6271+#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
6272+#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
6273+#define A_EXTOUT_AREAR_R 0x0f /* right */
6274+#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
6275+#define A_EXTOUT_AC97_R 0x11 /* right */
6276+#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
6277+#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
6278+#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
6279+
6280+/* Audigy constants */
6281+#define A_C_00000000 0xc0
6282+#define A_C_00000001 0xc1
6283+#define A_C_00000002 0xc2
6284+#define A_C_00000003 0xc3
6285+#define A_C_00000004 0xc4
6286+#define A_C_00000008 0xc5
6287+#define A_C_00000010 0xc6
6288+#define A_C_00000020 0xc7
6289+#define A_C_00000100 0xc8
6290+#define A_C_00010000 0xc9
6291+#define A_C_00000800 0xca
6292+#define A_C_10000000 0xcb
6293+#define A_C_20000000 0xcc
6294+#define A_C_40000000 0xcd
6295+#define A_C_80000000 0xce
6296+#define A_C_7fffffff 0xcf
6297+#define A_C_ffffffff 0xd0
6298+#define A_C_fffffffe 0xd1
6299+#define A_C_c0000000 0xd2
6300+#define A_C_4f1bbcdc 0xd3
6301+#define A_C_5a7ef9db 0xd4
6302+#define A_C_00100000 0xd5
6303+#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
6304+#define A_GPR_COND 0xd7 /* CCR, condition register */
6305+#define A_GPR_NOISE0 0xd8 /* noise source */
6306+#define A_GPR_NOISE1 0xd9 /* noise source */
6307+#define A_GPR_IRQ 0xda /* IRQ register */
6308+#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
6309+#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
6310+
6311+/* definitions for debug register */
6312+#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
6313+#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
6314+#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
6315+#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
6316+#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
6317+#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
6318+#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
6319+
6320+/* tank memory address line */
6321+#ifndef __KERNEL__
6322+#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
6323+#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
6324+#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
6325+#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
6326+#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
6327+#endif
6328+
6329+struct snd_emu10k1_fx8010_info {
6330+ unsigned int internal_tram_size; /* in samples */
6331+ unsigned int external_tram_size; /* in samples */
6332+ char fxbus_names[16][32]; /* names of FXBUSes */
6333+ char extin_names[16][32]; /* names of external inputs */
6334+ char extout_names[32][32]; /* names of external outputs */
6335+ unsigned int gpr_controls; /* count of GPR controls */
6336+};
6337+
6338+#define EMU10K1_GPR_TRANSLATION_NONE 0
6339+#define EMU10K1_GPR_TRANSLATION_TABLE100 1
6340+#define EMU10K1_GPR_TRANSLATION_BASS 2
6341+#define EMU10K1_GPR_TRANSLATION_TREBLE 3
6342+#define EMU10K1_GPR_TRANSLATION_ONOFF 4
6343+
6344+enum emu10k1_ctl_elem_iface {
6345+ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
6346+ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
6347+};
6348+
6349+struct emu10k1_ctl_elem_id {
6350+ unsigned int pad; /* don't use */
6351+ int iface; /* interface identifier */
6352+ unsigned int device; /* device/client number */
6353+ unsigned int subdevice; /* subdevice (substream) number */
6354+ unsigned char name[44]; /* ASCII name of item */
6355+ unsigned int index; /* index of item */
6356+};
6357+
6358+struct snd_emu10k1_fx8010_control_gpr {
6359+ struct emu10k1_ctl_elem_id id; /* full control ID definition */
6360+ unsigned int vcount; /* visible count */
6361+ unsigned int count; /* count of GPR (1..16) */
6362+ unsigned short gpr[32]; /* GPR number(s) */
6363+ unsigned int value[32]; /* initial values */
6364+ unsigned int min; /* minimum range */
6365+ unsigned int max; /* maximum range */
6366+ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
6367+ const unsigned int *tlv;
6368+};
6369+
6370+/* old ABI without TLV support */
6371+struct snd_emu10k1_fx8010_control_old_gpr {
6372+ struct emu10k1_ctl_elem_id id;
6373+ unsigned int vcount;
6374+ unsigned int count;
6375+ unsigned short gpr[32];
6376+ unsigned int value[32];
6377+ unsigned int min;
6378+ unsigned int max;
6379+ unsigned int translation;
6380+};
6381+
6382+struct snd_emu10k1_fx8010_code {
6383+ char name[128];
6384+
6385+ __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
6386+ __u32 *gpr_map; /* initializers */
6387+
6388+ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
6389+ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */
6390+
6391+ unsigned int gpr_del_control_count; /* count of GPR controls to remove */
6392+ struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */
6393+
6394+ unsigned int gpr_list_control_count; /* count of GPR controls to list */
6395+ unsigned int gpr_list_control_total; /* total count of GPR controls */
6396+ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */
6397+
6398+ __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
6399+ __u32 *tram_data_map; /* data initializers */
6400+ __u32 *tram_addr_map; /* map initializers */
6401+
6402+ __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
6403+ __u32 *code; /* one instruction - 64 bits */
6404+};
6405+
6406+struct snd_emu10k1_fx8010_tram {
6407+ unsigned int address; /* 31.bit == 1 -> external TRAM */
6408+ unsigned int size; /* size in samples (4 bytes) */
6409+ unsigned int *samples; /* pointer to samples (20-bit) */
6410+ /* NULL->clear memory */
6411+};
6412+
6413+struct snd_emu10k1_fx8010_pcm_rec {
6414+ unsigned int substream; /* substream number */
6415+ unsigned int res1; /* reserved */
6416+ unsigned int channels; /* 16-bit channels count, zero = remove this substream */
6417+ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
6418+ unsigned int buffer_size; /* count of buffered samples */
6419+ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
6420+ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
6421+ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
6422+ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
6423+ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
6424+ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
6425+ unsigned char pad; /* reserved */
6426+ unsigned char etram[32]; /* external TRAM address & data (one per channel) */
6427+ unsigned int res2; /* reserved */
6428+};
6429+
6430+#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
6431+
6432+#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
6433+#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
6434+#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
6435+#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
6436+#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
6437+#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
6438+#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
6439+#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
6440+#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
6441+#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
6442+#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
6443+#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
6444+#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
6445+#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
6446+
6447+#ifndef __KERNEL__
6448+/* typedefs for compatibility to user-space */
6449+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
6450+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
6451+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
6452+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
6453+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
6454+typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t;
6455+#endif
6456+
6457+#endif /* _UAPI__SOUND_EMU10K1_H */
6458diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h
6459new file mode 100644
6460index 00000000..88c92a3f
6461--- /dev/null
6462+++ b/include/sound/uapi/hdsp.h
6463@@ -0,0 +1,109 @@
6464+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6465+#ifndef __SOUND_HDSP_H
6466+#define __SOUND_HDSP_H
6467+
6468+/*
6469+ * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
6470+ *
6471+ * This program is free software; you can redistribute it and/or modify
6472+ * it under the terms of the GNU General Public License as published by
6473+ * the Free Software Foundation; either version 2 of the License, or
6474+ * (at your option) any later version.
6475+ *
6476+ * This program is distributed in the hope that it will be useful,
6477+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6478+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6479+ * GNU General Public License for more details.
6480+ *
6481+ * You should have received a copy of the GNU General Public License
6482+ * along with this program; if not, write to the Free Software
6483+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6484+ */
6485+
6486+#define HDSP_MATRIX_MIXER_SIZE 2048
6487+
6488+enum HDSP_IO_Type {
6489+ Digiface,
6490+ Multiface,
6491+ H9652,
6492+ H9632,
6493+ RPM,
6494+ Undefined,
6495+};
6496+
6497+struct hdsp_peak_rms {
6498+ __u32 input_peaks[26];
6499+ __u32 playback_peaks[26];
6500+ __u32 output_peaks[28];
6501+ __u64 input_rms[26];
6502+ __u64 playback_rms[26];
6503+ /* These are only used for H96xx cards */
6504+ __u64 output_rms[26];
6505+};
6506+
6507+#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
6508+
6509+struct hdsp_config_info {
6510+ unsigned char pref_sync_ref;
6511+ unsigned char wordclock_sync_check;
6512+ unsigned char spdif_sync_check;
6513+ unsigned char adatsync_sync_check;
6514+ unsigned char adat_sync_check[3];
6515+ unsigned char spdif_in;
6516+ unsigned char spdif_out;
6517+ unsigned char spdif_professional;
6518+ unsigned char spdif_emphasis;
6519+ unsigned char spdif_nonaudio;
6520+ unsigned int spdif_sample_rate;
6521+ unsigned int system_sample_rate;
6522+ unsigned int autosync_sample_rate;
6523+ unsigned char system_clock_mode;
6524+ unsigned char clock_source;
6525+ unsigned char autosync_ref;
6526+ unsigned char line_out;
6527+ unsigned char passthru;
6528+ unsigned char da_gain;
6529+ unsigned char ad_gain;
6530+ unsigned char phone_gain;
6531+ unsigned char xlr_breakout_cable;
6532+ unsigned char analog_extension_board;
6533+};
6534+
6535+#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
6536+
6537+struct hdsp_firmware {
6538+ void *firmware_data; /* 24413 x 4 bytes */
6539+};
6540+
6541+#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
6542+
6543+struct hdsp_version {
6544+ enum HDSP_IO_Type io_type;
6545+ unsigned short firmware_rev;
6546+};
6547+
6548+#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
6549+
6550+struct hdsp_mixer {
6551+ unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
6552+};
6553+
6554+#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
6555+
6556+struct hdsp_9632_aeb {
6557+ int aebi;
6558+ int aebo;
6559+};
6560+
6561+#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
6562+
6563+/* typedefs for compatibility to user-space */
6564+typedef enum HDSP_IO_Type HDSP_IO_Type;
6565+typedef struct hdsp_peak_rms hdsp_peak_rms_t;
6566+typedef struct hdsp_config_info hdsp_config_info_t;
6567+typedef struct hdsp_firmware hdsp_firmware_t;
6568+typedef struct hdsp_version hdsp_version_t;
6569+typedef struct hdsp_mixer hdsp_mixer_t;
6570+typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
6571+
6572+#endif /* __SOUND_HDSP_H */
6573diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h
6574new file mode 100644
6575index 00000000..2d91f90e
6576--- /dev/null
6577+++ b/include/sound/uapi/hdspm.h
6578@@ -0,0 +1,230 @@
6579+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6580+#ifndef __SOUND_HDSPM_H
6581+#define __SOUND_HDSPM_H
6582+/*
6583+ * Copyright (C) 2003 Winfried Ritsch (IEM)
6584+ * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
6585+ *
6586+ *
6587+ * This program is free software; you can redistribute it and/or modify
6588+ * it under the terms of the GNU General Public License as published by
6589+ * the Free Software Foundation; either version 2 of the License, or
6590+ * (at your option) any later version.
6591+ *
6592+ * This program is distributed in the hope that it will be useful,
6593+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6594+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6595+ * GNU General Public License for more details.
6596+ *
6597+ * You should have received a copy of the GNU General Public License
6598+ * along with this program; if not, write to the Free Software
6599+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6600+ */
6601+
6602+/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
6603+#define HDSPM_MAX_CHANNELS 64
6604+
6605+enum hdspm_io_type {
6606+ MADI,
6607+ MADIface,
6608+ AIO,
6609+ AES32,
6610+ RayDAT
6611+};
6612+
6613+enum hdspm_speed {
6614+ ss,
6615+ ds,
6616+ qs
6617+};
6618+
6619+/* -------------------- IOCTL Peak/RMS Meters -------------------- */
6620+
6621+struct hdspm_peak_rms {
6622+ __u32 input_peaks[64];
6623+ __u32 playback_peaks[64];
6624+ __u32 output_peaks[64];
6625+
6626+ __u64 input_rms[64];
6627+ __u64 playback_rms[64];
6628+ __u64 output_rms[64];
6629+
6630+ __u8 speed; /* enum {ss, ds, qs} */
6631+ int status2;
6632+};
6633+
6634+#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
6635+ _IOR('H', 0x42, struct hdspm_peak_rms)
6636+
6637+/* ------------ CONFIG block IOCTL ---------------------- */
6638+
6639+struct hdspm_config {
6640+ unsigned char pref_sync_ref;
6641+ unsigned char wordclock_sync_check;
6642+ unsigned char madi_sync_check;
6643+ unsigned int system_sample_rate;
6644+ unsigned int autosync_sample_rate;
6645+ unsigned char system_clock_mode;
6646+ unsigned char clock_source;
6647+ unsigned char autosync_ref;
6648+ unsigned char line_out;
6649+ unsigned int passthru;
6650+ unsigned int analog_out;
6651+};
6652+
6653+#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
6654+ _IOR('H', 0x41, struct hdspm_config)
6655+
6656+/*
6657+ * If there's a TCO (TimeCode Option) board installed,
6658+ * there are further options and status data available.
6659+ * The hdspm_ltc structure contains the current SMPTE
6660+ * timecode and some status information and can be
6661+ * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
6662+ * hdspm_status struct.
6663+ */
6664+
6665+enum hdspm_ltc_format {
6666+ format_invalid,
6667+ fps_24,
6668+ fps_25,
6669+ fps_2997,
6670+ fps_30
6671+};
6672+
6673+enum hdspm_ltc_frame {
6674+ frame_invalid,
6675+ drop_frame,
6676+ full_frame
6677+};
6678+
6679+enum hdspm_ltc_input_format {
6680+ ntsc,
6681+ pal,
6682+ no_video
6683+};
6684+
6685+struct hdspm_ltc {
6686+ unsigned int ltc;
6687+
6688+ enum hdspm_ltc_format format;
6689+ enum hdspm_ltc_frame frame;
6690+ enum hdspm_ltc_input_format input_format;
6691+};
6692+
6693+#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
6694+
6695+/*
6696+ * The status data reflects the device's current state
6697+ * as determined by the card's configuration and
6698+ * connection status.
6699+ */
6700+
6701+enum hdspm_sync {
6702+ hdspm_sync_no_lock = 0,
6703+ hdspm_sync_lock = 1,
6704+ hdspm_sync_sync = 2
6705+};
6706+
6707+enum hdspm_madi_input {
6708+ hdspm_input_optical = 0,
6709+ hdspm_input_coax = 1
6710+};
6711+
6712+enum hdspm_madi_channel_format {
6713+ hdspm_format_ch_64 = 0,
6714+ hdspm_format_ch_56 = 1
6715+};
6716+
6717+enum hdspm_madi_frame_format {
6718+ hdspm_frame_48 = 0,
6719+ hdspm_frame_96 = 1
6720+};
6721+
6722+enum hdspm_syncsource {
6723+ syncsource_wc = 0,
6724+ syncsource_madi = 1,
6725+ syncsource_tco = 2,
6726+ syncsource_sync = 3,
6727+ syncsource_none = 4
6728+};
6729+
6730+struct hdspm_status {
6731+ __u8 card_type; /* enum hdspm_io_type */
6732+ enum hdspm_syncsource autosync_source;
6733+
6734+ __u64 card_clock;
6735+ __u32 master_period;
6736+
6737+ union {
6738+ struct {
6739+ __u8 sync_wc; /* enum hdspm_sync */
6740+ __u8 sync_madi; /* enum hdspm_sync */
6741+ __u8 sync_tco; /* enum hdspm_sync */
6742+ __u8 sync_in; /* enum hdspm_sync */
6743+ __u8 madi_input; /* enum hdspm_madi_input */
6744+ __u8 channel_format; /* enum hdspm_madi_channel_format */
6745+ __u8 frame_format; /* enum hdspm_madi_frame_format */
6746+ } madi;
6747+ } card_specific;
6748+};
6749+
6750+#define SNDRV_HDSPM_IOCTL_GET_STATUS \
6751+ _IOR('H', 0x47, struct hdspm_status)
6752+
6753+/*
6754+ * Get information about the card and its add-ons.
6755+ */
6756+
6757+#define HDSPM_ADDON_TCO 1
6758+
6759+struct hdspm_version {
6760+ __u8 card_type; /* enum hdspm_io_type */
6761+ char cardname[20];
6762+ unsigned int serial;
6763+ unsigned short firmware_rev;
6764+ int addons;
6765+};
6766+
6767+#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
6768+
6769+/* ------------- get Matrix Mixer IOCTL --------------- */
6770+
6771+/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
6772+ * 32768 Bytes
6773+ */
6774+
6775+/* organisation is 64 channelfader in a continuous memory block */
6776+/* equivalent to hardware definition, maybe for future feature of mmap of
6777+ * them
6778+ */
6779+/* each of 64 outputs has 64 infader and 64 outfader:
6780+ Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
6781+
6782+#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
6783+
6784+struct hdspm_channelfader {
6785+ unsigned int in[HDSPM_MIXER_CHANNELS];
6786+ unsigned int pb[HDSPM_MIXER_CHANNELS];
6787+};
6788+
6789+struct hdspm_mixer {
6790+ struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
6791+};
6792+
6793+struct hdspm_mixer_ioctl {
6794+ struct hdspm_mixer *mixer;
6795+};
6796+
6797+/* use indirect access due to the limit of ioctl bit size */
6798+#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
6799+
6800+/* typedefs for compatibility to user-space */
6801+typedef struct hdspm_peak_rms hdspm_peak_rms_t;
6802+typedef struct hdspm_config_info hdspm_config_info_t;
6803+typedef struct hdspm_version hdspm_version_t;
6804+typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
6805+typedef struct hdspm_mixer hdspm_mixer_t;
6806+
6807+
6808+#endif
6809diff --git a/include/sound/uapi/sb16_csp.h b/include/sound/uapi/sb16_csp.h
6810new file mode 100644
6811index 00000000..e6485148
6812--- /dev/null
6813+++ b/include/sound/uapi/sb16_csp.h
6814@@ -0,0 +1,123 @@
6815+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6816+/*
6817+ * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
6818+ * Takashi Iwai <tiwai@suse.de>
6819+ *
6820+ * SB16ASP/AWE32 CSP control
6821+ *
6822+ * This program is free software; you can redistribute it and/or modify
6823+ * it under the terms of the GNU General Public License as published by
6824+ * the Free Software Foundation; either version 2 of the License, or
6825+ * (at your option) any later version.
6826+ *
6827+ * This program is distributed in the hope that it will be useful,
6828+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6829+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6830+ * GNU General Public License for more details.
6831+ *
6832+ * You should have received a copy of the GNU General Public License
6833+ * along with this program; if not, write to the Free Software
6834+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6835+ *
6836+ */
6837+#ifndef _UAPI__SOUND_SB16_CSP_H
6838+#define _UAPI__SOUND_SB16_CSP_H
6839+
6840+
6841+/* CSP modes */
6842+#define SNDRV_SB_CSP_MODE_NONE 0x00
6843+#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
6844+#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
6845+#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
6846+
6847+/* CSP load flags */
6848+#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
6849+#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
6850+
6851+/* CSP sample width */
6852+#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
6853+#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
6854+
6855+/* CSP channels */
6856+#define SNDRV_SB_CSP_MONO 0x01
6857+#define SNDRV_SB_CSP_STEREO 0x02
6858+
6859+/* CSP rates */
6860+#define SNDRV_SB_CSP_RATE_8000 0x01
6861+#define SNDRV_SB_CSP_RATE_11025 0x02
6862+#define SNDRV_SB_CSP_RATE_22050 0x04
6863+#define SNDRV_SB_CSP_RATE_44100 0x08
6864+#define SNDRV_SB_CSP_RATE_ALL 0x0f
6865+
6866+/* CSP running state */
6867+#define SNDRV_SB_CSP_ST_IDLE 0x00
6868+#define SNDRV_SB_CSP_ST_LOADED 0x01
6869+#define SNDRV_SB_CSP_ST_RUNNING 0x02
6870+#define SNDRV_SB_CSP_ST_PAUSED 0x04
6871+#define SNDRV_SB_CSP_ST_AUTO 0x08
6872+#define SNDRV_SB_CSP_ST_QSOUND 0x10
6873+
6874+/* maximum QSound value (180 degrees right) */
6875+#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
6876+
6877+/* maximum microcode RIFF file size */
6878+#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
6879+
6880+/* microcode header */
6881+struct snd_sb_csp_mc_header {
6882+ char codec_name[16]; /* id name of codec */
6883+ unsigned short func_req; /* requested function */
6884+};
6885+
6886+/* microcode to be loaded */
6887+struct snd_sb_csp_microcode {
6888+ struct snd_sb_csp_mc_header info;
6889+ unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
6890+};
6891+
6892+/* start CSP with sample_width in mono/stereo */
6893+struct snd_sb_csp_start {
6894+ int sample_width; /* sample width, look above */
6895+ int channels; /* channels, look above */
6896+};
6897+
6898+/* CSP information */
6899+struct snd_sb_csp_info {
6900+ char codec_name[16]; /* id name of codec */
6901+ unsigned short func_nr; /* function number */
6902+ unsigned int acc_format; /* accepted PCM formats */
6903+ unsigned short acc_channels; /* accepted channels */
6904+ unsigned short acc_width; /* accepted sample width */
6905+ unsigned short acc_rates; /* accepted sample rates */
6906+ unsigned short csp_mode; /* CSP mode, see above */
6907+ unsigned short run_channels; /* current channels */
6908+ unsigned short run_width; /* current sample width */
6909+ unsigned short version; /* version id: 0x10 - 0x1f */
6910+ unsigned short state; /* state bits */
6911+};
6912+
6913+/* HWDEP controls */
6914+/* get CSP information */
6915+#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
6916+/* load microcode to CSP */
6917+/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
6918+ * defined for some architectures like MIPS, and it leads to build errors.
6919+ * (x86 and co have 14-bit size, thus it's valid, though.)
6920+ * As a workaround for skipping the size-limit check, here we don't use the
6921+ * normal _IOW() macro but _IOC() with the manual argument.
6922+ */
6923+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
6924+ _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
6925+/* unload microcode from CSP */
6926+#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
6927+/* start CSP */
6928+#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
6929+/* stop CSP */
6930+#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
6931+/* pause CSP and DMA transfer */
6932+#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
6933+/* restart CSP and DMA transfer */
6934+#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
6935+
6936+
6937+#endif /* _UAPI__SOUND_SB16_CSP_H */
6938diff --git a/include/sound/uapi/sscape_ioctl.h b/include/sound/uapi/sscape_ioctl.h
6939new file mode 100644
6940index 00000000..c6653ebf
6941--- /dev/null
6942+++ b/include/sound/uapi/sscape_ioctl.h
6943@@ -0,0 +1,21 @@
6944+#ifndef SSCAPE_IOCTL_H
6945+#define SSCAPE_IOCTL_H
6946+
6947+
6948+struct sscape_bootblock
6949+{
6950+ unsigned char code[256];
6951+ unsigned version;
6952+};
6953+
6954+#define SSCAPE_MICROCODE_SIZE 65536
6955+
6956+struct sscape_microcode
6957+{
6958+ unsigned char *code;
6959+};
6960+
6961+#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
6962+#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
6963+
6964+#endif
6965diff --git a/include/sound/uapi/tlv.h b/include/sound/uapi/tlv.h
6966new file mode 100644
6967index 00000000..7d6d65f6
6968--- /dev/null
6969+++ b/include/sound/uapi/tlv.h
6970@@ -0,0 +1,117 @@
6971+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
6972+/*
6973+ * This program is free software; you can redistribute it and/or modify
6974+ * it under the terms of the GNU General Public License as published by
6975+ * the Free Software Foundation; either version 2 of the License, or
6976+ * (at your option) any later version.
6977+ *
6978+ * This program is distributed in the hope that it will be useful,
6979+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
6980+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6981+ * GNU General Public License for more details.
6982+ */
6983+
6984+#ifndef __UAPI_SOUND_TLV_H
6985+#define __UAPI_SOUND_TLV_H
6986+
6987+#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
6988+#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
6989+#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
6990+#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
6991+#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
6992+#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
6993+
6994+/*
6995+ * channel-mapping TLV items
6996+ * TLV length must match with num_channels
6997+ */
6998+#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
6999+#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
7000+#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
7001+
7002+/*
7003+ * TLV structure is right behind the struct snd_ctl_tlv:
7004+ * unsigned int type - see SNDRV_CTL_TLVT_*
7005+ * unsigned int length
7006+ * .... data aligned to sizeof(unsigned int), use
7007+ * block_length = (length + (sizeof(unsigned int) - 1)) &
7008+ * ~(sizeof(unsigned int) - 1)) ....
7009+ */
7010+#define SNDRV_CTL_TLVD_ITEM(type, ...) \
7011+ (type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
7012+#define SNDRV_CTL_TLVD_LENGTH(...) \
7013+ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
7014+
7015+/* Accessor offsets for TLV data items */
7016+#define SNDRV_CTL_TLVO_TYPE 0
7017+#define SNDRV_CTL_TLVO_LEN 1
7018+
7019+#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
7020+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
7021+#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
7022+ unsigned int name[] = { \
7023+ SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
7024+ }
7025+
7026+#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff
7027+#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000
7028+#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
7029+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
7030+ (min), \
7031+ ((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
7032+ ((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
7033+#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
7034+ unsigned int name[] = { \
7035+ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
7036+ }
7037+
7038+/* Accessor offsets for min, mute and step items in dB scale type TLV */
7039+#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2
7040+#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3
7041+
7042+/* dB scale specified with min/max values instead of step */
7043+#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
7044+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
7045+#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
7046+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
7047+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
7048+ unsigned int name[] = { \
7049+ SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
7050+ }
7051+#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
7052+ unsigned int name[] = { \
7053+ SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
7054+ }
7055+
7056+/* Accessor offsets for min, max items in db-minmax types of TLV. */
7057+#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2
7058+#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3
7059+
7060+/* linear volume between min_dB and max_dB (.01dB unit) */
7061+#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
7062+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
7063+#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
7064+ unsigned int name[] = { \
7065+ SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
7066+ }
7067+
7068+/* Accessor offsets for min, max items in db-linear type of TLV. */
7069+#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2
7070+#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3
7071+
7072+/* dB range container:
7073+ * Items in dB range container must be ordered by their values and by their
7074+ * dB values. This implies that larger values must correspond with larger
7075+ * dB values (which is also required for all other mixer controls).
7076+ */
7077+/* Each item is: <min> <max> <TLV> */
7078+#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
7079+ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
7080+#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
7081+ unsigned int name[] = { \
7082+ SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
7083+ }
7084+
7085+#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999
7086+
7087+#endif
7088diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
7089index 11efce6d..101491a4 100644
7090--- a/src/topology/tplg_local.h
7091+++ b/src/topology/tplg_local.h
7092@@ -18,8 +18,7 @@
7093 #include "list.h"
7094 #include "topology.h"
7095
7096-#define __packed __attribute__((__packed__))
7097-
7098+#include <sound/type_compat.h>
7099 #include <sound/asound.h>
7100 #include <sound/asoc.h>
7101 #include <sound/tlv.h>
7102--
71032.20.1
7104
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0001-configure.ac-remove-an-unnecessary-libtool-fix.patch b/meta/recipes-multimedia/alsa/alsa-lib/0001-configure.ac-remove-an-unnecessary-libtool-fix.patch
deleted file mode 100644
index 4db4934fdc..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0001-configure.ac-remove-an-unnecessary-libtool-fix.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 01cd8cb6d594d7a12c67d21d689ebe0e347469c0 Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Fri, 20 Dec 2019 09:26:12 +0200
4Subject: [PATCH] configure.ac: remove an unnecessary libtool fix
5
6This code was added in commit 75d393a563efb578c79364a277087c6326267f52
7without explaining why. I assume it was a mistake, since it looks like
8the libtool problem should have gone away a long time ago. The referenced
9wiki page https://wiki.debian.org/RpathIssue says:
10
11 Since libtool 1.5.2 (released 2004-01-25), on Linux libtool no
12 longer sets RPATH for any directories in the dynamic linker search
13 path, so this should no longer be an issue unless upstream used a
14 really old version of libtool when creating their distribution
15 tarball.
16
17This code caused problems in OpenEmbedded, where the libtool script is
18named "x86_64-oe-linux-libtool" or similar rather than just "libtool",
19so the sed command failed with a file not found error. Rather than
20adapting the code to OpenEmbedded's peculiarities, it seems best to just
21remove the unnecessary code altogether.
22
23Upstream-Status: Submitted [https://github.com/alsa-project/alsa-lib/pull/19]
24Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
25---
26 configure.ac | 11 -----------
27 1 file changed, 11 deletions(-)
28
29diff --git a/configure.ac b/configure.ac
30index 119ef600..22a4a885 100644
31--- a/configure.ac
32+++ b/configure.ac
33@@ -764,14 +764,3 @@ test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
34 test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h
35 test "$build_seq" = "yes" && echo "#include <alsa/seq_midi_event.h>" >> include/asoundlib.h
36 cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h
37-
38-dnl Taken from https://wiki.debian.org/RpathIssue
39-case $host in
40- *-*-linux-gnu)
41- AC_MSG_RESULT([Fixing libtool for -rpath problems.])
42- sed < libtool > libtool-2 \
43- 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
44- mv libtool-2 libtool
45- chmod 755 libtool
46- ;;
47-esac
48--
492.20.1
50
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0001-uapi-Move-typedefs-from-uapi-to-sound.patch b/meta/recipes-multimedia/alsa/alsa-lib/0001-uapi-Move-typedefs-from-uapi-to-sound.patch
deleted file mode 100644
index c35a2c9d7c..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0001-uapi-Move-typedefs-from-uapi-to-sound.patch
+++ /dev/null
@@ -1,137 +0,0 @@
1From 59792f467b38d6a4c4dffdb30528f7fb03d23d96 Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Fri, 20 Dec 2019 17:12:37 +0100
4Subject: [PATCH] uapi: Move typedefs from uapi to sound/*
5
6For keeping uapi/*.h cleaner.
7
8Signed-off-by: Takashi Iwai <tiwai@suse.de>
9
10Upstream-Status: Backport
11
12Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
13---
14 include/sound/emu10k1.h | 9 +++++++++
15 include/sound/hdsp.h | 10 ++++++++++
16 include/sound/hdspm.h | 8 ++++++++
17 include/sound/sb16_csp.h | 4 ++++
18 include/sound/uapi/emu10k1.h | 10 ----------
19 include/sound/uapi/hdsp.h | 9 ---------
20 include/sound/uapi/hdspm.h | 8 --------
21 7 files changed, 31 insertions(+), 27 deletions(-)
22
23diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
24index f06ecee5..0832f95b 100644
25--- a/include/sound/emu10k1.h
26+++ b/include/sound/emu10k1.h
27@@ -1,2 +1,11 @@
28 #include <alsa/sound/type_compat.h>
29 #include <alsa/sound/uapi/emu10k1.h>
30+#ifndef __emu10k1_type_defined
31+#define __emu10k1_type_defined
32+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
33+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
34+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
35+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
36+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
37+typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t;
38+#endif
39diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
40index 78fb745b..e8f93156 100644
41--- a/include/sound/hdsp.h
42+++ b/include/sound/hdsp.h
43@@ -1,2 +1,12 @@
44 #include <alsa/sound/type_compat.h>
45 #include <alsa/sound/uapi/hdsp.h>
46+#ifndef __hdsp_type_defined
47+#define __hdsp_type_defined
48+typedef enum HDSP_IO_Type HDSP_IO_Type;
49+typedef struct hdsp_peak_rms hdsp_peak_rms_t;
50+typedef struct hdsp_config_info hdsp_config_info_t;
51+typedef struct hdsp_firmware hdsp_firmware_t;
52+typedef struct hdsp_version hdsp_version_t;
53+typedef struct hdsp_mixer hdsp_mixer_t;
54+typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
55+#endif
56diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
57index af6d19ed..d9095d9f 100644
58--- a/include/sound/hdspm.h
59+++ b/include/sound/hdspm.h
60@@ -1,2 +1,10 @@
61 #include <alsa/sound/type_compat.h>
62 #include <alsa/sound/uapi/hdspm.h>
63+#ifndef __hdspm_type_defined
64+#define __hdspm_type_defined
65+typedef struct hdspm_peak_rms hdspm_peak_rms_t;
66+typedef struct hdspm_config_info hdspm_config_info_t;
67+typedef struct hdspm_version hdspm_version_t;
68+typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
69+typedef struct hdspm_mixer hdspm_mixer_t;
70+#endif
71diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
72index 24121fcb..fd02bc56 100644
73--- a/include/sound/sb16_csp.h
74+++ b/include/sound/sb16_csp.h
75@@ -1 +1,5 @@
76 #include <alsa/sound/uapi/sb16_csp.h>
77+#ifndef __sb16_csp_type_defined
78+#define __sb16_csp_type_defined
79+typedef struct snd_sb_csp_microcode snd_sb_csp_microcode_t;
80+#endif
81diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h
82index c1150e4d..6bcd76f6 100644
83--- a/include/sound/uapi/emu10k1.h
84+++ b/include/sound/uapi/emu10k1.h
85@@ -382,14 +382,4 @@ struct snd_emu10k1_fx8010_pcm_rec {
86 #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
87 #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
88
89-#ifndef __KERNEL__
90-/* typedefs for compatibility to user-space */
91-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
92-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
93-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
94-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
95-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
96-typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t;
97-#endif
98-
99 #endif /* _UAPI__SOUND_EMU10K1_H */
100diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h
101index 88c92a3f..7ac2d3f2 100644
102--- a/include/sound/uapi/hdsp.h
103+++ b/include/sound/uapi/hdsp.h
104@@ -97,13 +97,4 @@ struct hdsp_9632_aeb {
105
106 #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
107
108-/* typedefs for compatibility to user-space */
109-typedef enum HDSP_IO_Type HDSP_IO_Type;
110-typedef struct hdsp_peak_rms hdsp_peak_rms_t;
111-typedef struct hdsp_config_info hdsp_config_info_t;
112-typedef struct hdsp_firmware hdsp_firmware_t;
113-typedef struct hdsp_version hdsp_version_t;
114-typedef struct hdsp_mixer hdsp_mixer_t;
115-typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
116-
117 #endif /* __SOUND_HDSP_H */
118diff --git a/include/sound/uapi/hdspm.h b/include/sound/uapi/hdspm.h
119index 2d91f90e..3fbfd9dc 100644
120--- a/include/sound/uapi/hdspm.h
121+++ b/include/sound/uapi/hdspm.h
122@@ -219,12 +219,4 @@ struct hdspm_mixer_ioctl {
123 /* use indirect access due to the limit of ioctl bit size */
124 #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
125
126-/* typedefs for compatibility to user-space */
127-typedef struct hdspm_peak_rms hdspm_peak_rms_t;
128-typedef struct hdspm_config_info hdspm_config_info_t;
129-typedef struct hdspm_version hdspm_version_t;
130-typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
131-typedef struct hdspm_mixer hdspm_mixer_t;
132-
133-
134 #endif
135--
1362.20.1
137
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch b/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch
deleted file mode 100644
index 96dcd8abac..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 4b6fe372c68d1ff50e7c161cffadeb298734f49c Mon Sep 17 00:00:00 2001
2From: paulhsia <paulhsia@chromium.org>
3Date: Sat, 30 Nov 2019 03:35:30 +0800
4Subject: [PATCH 1/5] ucm: Use strncmp to avoid access-out-of-boundary
5
6If the length of the identifier is less than the length of the prefix,
7access-out-of-boundary will occur in memcmp().
8
9Signed-off-by: paulhsia <paulhsia@chromium.org>
10Signed-off-by: Jaroslav Kysela <perex@perex.cz>
11
12Upstream-Status: Backport
13Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
14---
15 src/ucm/main.c | 8 +++++---
16 1 file changed, 5 insertions(+), 3 deletions(-)
17
18diff --git a/src/ucm/main.c b/src/ucm/main.c
19index b0b6ffb3..252e50d9 100644
20--- a/src/ucm/main.c
21+++ b/src/ucm/main.c
22@@ -61,11 +61,13 @@ static int check_identifier(const char *identifier, const char *prefix)
23 {
24 int len;
25
26- if (strcmp(identifier, prefix) == 0)
27- return 1;
28 len = strlen(prefix);
29- if (memcmp(identifier, prefix, len) == 0 && identifier[len] == '/')
30+ if (strncmp(identifier, prefix, len) != 0)
31+ return 0;
32+
33+ if (identifier[len] == 0 || identifier[len] == '/')
34 return 1;
35+
36 return 0;
37 }
38
39--
402.20.1
41
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch b/meta/recipes-multimedia/alsa/alsa-lib/0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch
deleted file mode 100644
index 42973fb6d0..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 58f9dc9bd12a51efa12dbc67e200f4d85cd3da07 Mon Sep 17 00:00:00 2001
2From: Jaroslav Kysela <perex@perex.cz>
3Date: Fri, 29 Nov 2019 22:28:26 +0100
4Subject: [PATCH 2/5] ucm: return always at least NULL if no list is available
5 in snd_use_case_get_list()
6
7Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8
9Upstream-Status: Backport
10Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
11---
12 src/ucm/main.c | 8 ++++++--
13 1 file changed, 6 insertions(+), 2 deletions(-)
14
15diff --git a/src/ucm/main.c b/src/ucm/main.c
16index 252e50d9..b80db65f 100644
17--- a/src/ucm/main.c
18+++ b/src/ucm/main.c
19@@ -1160,8 +1160,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr,
20
21 modifier = find_modifier(uc_mgr, verb, name, 0);
22 if (modifier) {
23- if (modifier->dev_list.type != type)
24+ if (modifier->dev_list.type != type) {
25+ *list = NULL;
26 return 0;
27+ }
28 return get_list(&modifier->dev_list.list, list,
29 struct dev_list_node, list,
30 name);
31@@ -1169,8 +1171,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr,
32
33 device = find_device(uc_mgr, verb, name, 0);
34 if (device) {
35- if (device->dev_list.type != type)
36+ if (device->dev_list.type != type) {
37+ *list = NULL;
38 return 0;
39+ }
40 return get_list(&device->dev_list.list, list,
41 struct dev_list_node, list,
42 name);
43--
442.20.1
45
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0003-namehint-correct-the-args-check.patch b/meta/recipes-multimedia/alsa/alsa-lib/0003-namehint-correct-the-args-check.patch
deleted file mode 100644
index 82f8b2bd2a..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0003-namehint-correct-the-args-check.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 10f3401ce356a675e2440993457ee7c8c7e9fcf8 Mon Sep 17 00:00:00 2001
2From: Jaroslav Kysela <perex@perex.cz>
3Date: Sun, 1 Dec 2019 14:26:40 +0100
4Subject: [PATCH 3/5] namehint: correct the @args check
5
6BugLink: https://github.com/alsa-project/alsa-plugins/issues/3
7Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8
9Upstream-Status: Backport
10Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
11---
12 src/control/namehint.c | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15diff --git a/src/control/namehint.c b/src/control/namehint.c
16index 808df6b5..4927ef97 100644
17--- a/src/control/namehint.c
18+++ b/src/control/namehint.c
19@@ -348,6 +348,12 @@ static int try_config(snd_config_t *config,
20 goto __cleanup;
21 if (snd_config_search(res, "@args", &cfg) >= 0) {
22 snd_config_for_each(i, next, cfg) {
23+ /* skip the argument list */
24+ snd_config_get_id(snd_config_iterator_entry(i), &str);
25+ while (*str && *str >= '0' && *str <= '9') str++;
26+ if (*str == '\0')
27+ continue;
28+ /* the argument definition must have the default */
29 if (snd_config_search(snd_config_iterator_entry(i),
30 "default", NULL) < 0) {
31 err = -EINVAL;
32--
332.20.1
34
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0004-namehint-improve-the-previous-patch-check-the-return.patch b/meta/recipes-multimedia/alsa/alsa-lib/0004-namehint-improve-the-previous-patch-check-the-return.patch
deleted file mode 100644
index 98192f6e53..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0004-namehint-improve-the-previous-patch-check-the-return.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 1fa6664d5f0cc7d21edceba6695a4c28543c2cab Mon Sep 17 00:00:00 2001
2From: Jaroslav Kysela <perex@perex.cz>
3Date: Sun, 1 Dec 2019 14:30:54 +0100
4Subject: [PATCH 4/5] namehint: improve the previous patch (check the returned
5 value)
6
7Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8
9Upstream-Status: Backport
10Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
11---
12 src/control/namehint.c | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/src/control/namehint.c b/src/control/namehint.c
16index 4927ef97..60c48ae3 100644
17--- a/src/control/namehint.c
18+++ b/src/control/namehint.c
19@@ -349,7 +349,8 @@ static int try_config(snd_config_t *config,
20 if (snd_config_search(res, "@args", &cfg) >= 0) {
21 snd_config_for_each(i, next, cfg) {
22 /* skip the argument list */
23- snd_config_get_id(snd_config_iterator_entry(i), &str);
24+ if (snd_config_get_id(snd_config_iterator_entry(i), &str) < 0)
25+ continue;
26 while (*str && *str >= '0' && *str <= '9') str++;
27 if (*str == '\0')
28 continue;
29--
302.20.1
31
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0005-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch b/meta/recipes-multimedia/alsa/alsa-lib/0005-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch
deleted file mode 100644
index cbc0a4ceab..0000000000
--- a/meta/recipes-multimedia/alsa/alsa-lib/0005-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch
+++ /dev/null
@@ -1,86 +0,0 @@
1From 976f8f62238f0d837584adc7c31035bdb29b6d6f Mon Sep 17 00:00:00 2001
2From: Hans de Goede <hdegoede@redhat.com>
3Date: Tue, 3 Dec 2019 18:27:39 +0100
4Subject: [PATCH 5/5] ucm: Do not fail to parse configs on cards with an empty
5 CardComponents lists
6
7Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been
8moved over to UCM2, parsing them fails with:
9
10ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context!
11
12This completely breaks audio support on all Bay- and Cherry-Trail devices.
13
14This is caused by these non-SOF ASoC using cards having an empty
15CardComponents list. Which in itself is fine, but is rejected by
16the ucm_subs.c code. This commit changes the ucm_subs code to accept
17an empty string as a valid value for CardComponents restoring audio
18functionality on these boards.
19
20Signed-off-by: Hans de Goede <hdegoede@redhat.com>
21Signed-off-by: Jaroslav Kysela <perex@perex.cz>
22
23Upstream-Status: Backport
24Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
25---
26 src/ucm/ucm_subs.c | 20 ++++++++++++--------
27 1 file changed, 12 insertions(+), 8 deletions(-)
28
29diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c
30index 00afa9e3..90e395f0 100644
31--- a/src/ucm/ucm_subs.c
32+++ b/src/ucm/ucm_subs.c
33@@ -25,6 +25,7 @@
34 */
35
36 #include "ucm_local.h"
37+#include <stdbool.h>
38 #include <sys/stat.h>
39 #include <limits.h>
40
41@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
42 return strdup(path);
43 }
44
45-#define MATCH_VARIABLE(name, id, fcn) \
46+#define MATCH_VARIABLE(name, id, fcn, empty_ok) \
47 if (strncmp((name), (id), sizeof(id) - 1) == 0) { \
48 rval = fcn(uc_mgr); \
49 idsize = sizeof(id) - 1; \
50+ allow_empty = (empty_ok); \
51 goto __rval; \
52 }
53
54@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
55
56 while (*value) {
57 if (*value == '$' && *(value+1) == '{') {
58- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name);
59- MATCH_VARIABLE(value, "${CardId}", rval_card_id);
60- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver);
61- MATCH_VARIABLE(value, "${CardName}", rval_card_name);
62- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname);
63- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components);
64+ bool allow_empty = false;
65+
66+ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false);
67+ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false);
68+ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false);
69+ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false);
70+ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false);
71+ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true);
72 MATCH_VARIABLE2(value, "${env:", rval_env);
73 MATCH_VARIABLE2(value, "${sys:", rval_sysfs);
74 err = -EINVAL;
75@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
76 }
77 goto __error;
78 __rval:
79- if (rval == NULL || rval[0] == '\0') {
80+ if (rval == NULL || (!allow_empty && rval[0] == '\0')) {
81 free(rval);
82 strncpy(r, value, idsize);
83 r[idsize] = '\0';
84--
852.20.1
86
diff --git a/meta/recipes-multimedia/alsa/alsa-lib_1.2.1.2.bb b/meta/recipes-multimedia/alsa/alsa-lib_1.2.2.bb
index e2bc61fbe9..9a4082ff94 100644
--- a/meta/recipes-multimedia/alsa/alsa-lib_1.2.1.2.bb
+++ b/meta/recipes-multimedia/alsa/alsa-lib_1.2.2.bb
@@ -7,18 +7,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7 \
7 file://src/socket.c;md5=285675b45e83f571c6a957fe4ab79c93;beginline=9;endline=24 \ 7 file://src/socket.c;md5=285675b45e83f571c6a957fe4ab79c93;beginline=9;endline=24 \
8 " 8 "
9 9
10SRC_URI = "https://www.alsa-project.org/files/pub/lib/${BP}.tar.bz2 \ 10SRC_URI = "https://www.alsa-project.org/files/pub/lib/${BP}.tar.bz2"
11 file://0001-configure.ac-remove-an-unnecessary-libtool-fix.patch \ 11SRC_URI[md5sum] = "82cdc23a5233d5ed319d2cbc89af5ca5"
12 file://0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch \ 12SRC_URI[sha256sum] = "d8e853d8805574777bbe40937812ad1419c9ea7210e176f0def3e6ed255ab3ec"
13 file://0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch \
14 file://0003-namehint-correct-the-args-check.patch \
15 file://0004-namehint-improve-the-previous-patch-check-the-return.patch \
16 file://0005-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch \
17 file://0001-Fix-alsa-sound-.h-for-external-programs.patch \
18 file://0001-uapi-Move-typedefs-from-uapi-to-sound.patch \
19 "
20SRC_URI[md5sum] = "82ddd3698469beec147e4f4a67134ea0"
21SRC_URI[sha256sum] = "958e260e3673f1f6ff6b2d2c0df3fc2e469bea5b2957163ce96ce17f23e87943"
22 13
23inherit autotools pkgconfig 14inherit autotools pkgconfig
24 15