Sync UAPI asound.h and asequencer.h with 6.12 kernel

The recent upstream kernel received a few features and extended /
cleaned up the asound.h and asequencer.h uapi files:
- ALSA: pcm: Introduce MSBITS subformat interface
- ALSA: pcm: clarify and fix default msbits value for all formats
- ALSA: pcm: reinvent the stream synchronization ID API
- ALSA: timer: Introduce virtual userspace-driven timers

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2024-08-20 14:27:13 +02:00
parent b154d9145f
commit f81236cf7e
2 changed files with 49 additions and 52 deletions

View file

@ -3,22 +3,6 @@
* Main header file for the ALSA sequencer * Main header file for the ALSA sequencer
* Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
* (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/ */
#ifndef __SOUND_ASEQUENCER_H #ifndef __SOUND_ASEQUENCER_H
#define __SOUND_ASEQUENCER_H #define __SOUND_ASEQUENCER_H
@ -619,7 +603,7 @@ struct snd_seq_client_ump_info {
int client; /* client number to inquire/set */ int client; /* client number to inquire/set */
int type; /* type to inquire/set */ int type; /* type to inquire/set */
unsigned char info[512]; /* info (either UMP ep or block info) */ unsigned char info[512]; /* info (either UMP ep or block info) */
} __packed; } __attribute__((packed));
/* /*
* IOCTL commands * IOCTL commands

View file

@ -3,22 +3,6 @@
* Advanced Linux Sound Architecture - ALSA - Driver * Advanced Linux Sound Architecture - ALSA - Driver
* Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
* Abramo Bagnara <abramo@alsa-project.org> * Abramo Bagnara <abramo@alsa-project.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/ */
#ifndef __SOUND_ASOUND_H #ifndef __SOUND_ASOUND_H
@ -28,7 +12,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#else #else
#include <sys/endian.h> #include <endian.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
@ -54,8 +38,10 @@
* * * *
****************************************************************************/ ****************************************************************************/
#define AES_IEC958_STATUS_SIZE 24
struct snd_aes_iec958 { struct snd_aes_iec958 {
unsigned char status[24]; /* AES/IEC958 channel status bits */ unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
unsigned char subcode[147]; /* AES/IEC958 subcode bits */ unsigned char subcode[147]; /* AES/IEC958 subcode bits */
unsigned char pad; /* nothing */ unsigned char pad; /* nothing */
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
@ -154,7 +140,7 @@ struct snd_hwdep_dsp_image {
* * * *
*****************************************************************************/ *****************************************************************************/
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15) #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 18)
typedef unsigned long snd_pcm_uframes_t; typedef unsigned long snd_pcm_uframes_t;
typedef signed long snd_pcm_sframes_t; typedef signed long snd_pcm_sframes_t;
@ -200,6 +186,11 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */ #define SNDRV_PCM_FORMAT_S24_BE ((snd_pcm_format_t) 7) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_LE ((snd_pcm_format_t) 8) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */ #define SNDRV_PCM_FORMAT_U24_BE ((snd_pcm_format_t) 9) /* low three bytes */
/*
* For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
* available bit count in most significant bit. It's for the case of so-called 'left-justified' or
* `right-padding` sample which has less width than 32 bit.
*/
#define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10) #define SNDRV_PCM_FORMAT_S32_LE ((snd_pcm_format_t) 10)
#define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11) #define SNDRV_PCM_FORMAT_S32_BE ((snd_pcm_format_t) 11)
#define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12) #define SNDRV_PCM_FORMAT_U32_LE ((snd_pcm_format_t) 12)
@ -301,7 +292,8 @@ typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */ #define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */ #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */ #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
#define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000 /* needs explicit sync of pointers and data */
#define SNDRV_PCM_INFO_NO_REWINDS 0x20000000 /* hardware can only support monotonic changes of appl_ptr */
#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
@ -340,7 +332,7 @@ union snd_pcm_sync_id {
unsigned char id[16]; unsigned char id[16];
unsigned short id16[8]; unsigned short id16[8];
unsigned int id32[4]; unsigned int id32[4];
}; } __attribute__((deprecated));
struct snd_pcm_info { struct snd_pcm_info {
unsigned int device; /* RO/WR (control): device number */ unsigned int device; /* RO/WR (control): device number */
@ -354,7 +346,7 @@ struct snd_pcm_info {
int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
unsigned int subdevices_count; unsigned int subdevices_count;
unsigned int subdevices_avail; unsigned int subdevices_avail;
union snd_pcm_sync_id sync; /* hardware synchronization ID */ unsigned char pad1[16]; /* was: hardware synchronization ID */
unsigned char reserved[64]; /* reserved for future... */ unsigned char reserved[64]; /* reserved for future... */
}; };
@ -393,8 +385,8 @@ typedef int snd_pcm_hw_param_t;
#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress the silence fill #define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling
* for draining * of the silence samples
*/ */
struct snd_interval { struct snd_interval {
@ -422,7 +414,7 @@ struct snd_pcm_hw_params {
unsigned int rmask; /* W: requested masks */ unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */ unsigned int cmask; /* R: changed masks */
unsigned int info; /* R: Info flags for returned setup */ unsigned int info; /* R: Info flags for returned setup */
unsigned int msbits; /* R: used most significant bits */ unsigned int msbits; /* R: used most significant bits (in sample bit-width) */
unsigned int rate_num; /* R: rate numerator */ unsigned int rate_num; /* R: rate numerator */
unsigned int rate_den; /* R: rate denominator */ unsigned int rate_den; /* R: rate denominator */
snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
@ -443,9 +435,14 @@ struct snd_pcm_sw_params {
snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ /*
snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ * The following two thresholds alleviate playback buffer underruns; when
snd_pcm_uframes_t silence_size; /* silence block size */ * hw_avail drops below the threshold, the respective action is triggered:
*/
snd_pcm_uframes_t stop_threshold; /* - stop playback */
snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */
snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary,
* fill played area with silence immediately */
snd_pcm_uframes_t boundary; /* pointers wrap point */ snd_pcm_uframes_t boundary; /* pointers wrap point */
unsigned int proto; /* protocol version */ unsigned int proto; /* protocol version */
unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
@ -578,7 +575,8 @@ struct __snd_pcm_mmap_status64 {
struct __snd_pcm_mmap_control64 { struct __snd_pcm_mmap_control64 {
__pad_before_uframe __pad1; __pad_before_uframe __pad1;
snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
__pad_before_uframe __pad2; __pad_before_uframe __pad2; // This should be __pad_after_uframe, but binary
// backwards compatibility constraints prevent a fix.
__pad_before_uframe __pad3; __pad_before_uframe __pad3;
snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
@ -760,7 +758,7 @@ struct snd_rawmidi_framing_tstamp {
__u32 tv_nsec; /* nanoseconds */ __u32 tv_nsec; /* nanoseconds */
__u64 tv_sec; /* seconds */ __u64 tv_sec; /* seconds */
__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH]; __u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
} __packed; } __attribute__((packed));
struct snd_rawmidi_params { struct snd_rawmidi_params {
int stream; int stream;
@ -808,7 +806,7 @@ struct snd_ump_endpoint_info {
unsigned char name[128]; /* endpoint name string */ unsigned char name[128]; /* endpoint name string */
unsigned char product_id[128]; /* unique product id string */ unsigned char product_id[128]; /* unique product id string */
unsigned char reserved[32]; unsigned char reserved[32];
} __packed; } __attribute__((packed));
/* UMP direction */ /* UMP direction */
#define SNDRV_UMP_DIR_INPUT 0x01 #define SNDRV_UMP_DIR_INPUT 0x01
@ -844,7 +842,7 @@ struct snd_ump_block_info {
unsigned int flags; /* various info flags */ unsigned int flags; /* various info flags */
unsigned char name[128]; /* block name string */ unsigned char name[128]; /* block name string */
unsigned char reserved[32]; unsigned char reserved[32];
} __packed; } __attribute__((packed));
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
@ -861,7 +859,7 @@ struct snd_ump_block_info {
* Timer section - /dev/snd/timer * Timer section - /dev/snd/timer
*/ */
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
enum { enum {
SNDRV_TIMER_CLASS_NONE = -1, SNDRV_TIMER_CLASS_NONE = -1,
@ -886,6 +884,7 @@ enum {
#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */ #define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
#define SNDRV_TIMER_GLOBAL_HPET 2 #define SNDRV_TIMER_GLOBAL_HPET 2
#define SNDRV_TIMER_GLOBAL_HRTIMER 3 #define SNDRV_TIMER_GLOBAL_HRTIMER 3
#define SNDRV_TIMER_GLOBAL_UDRIVEN 4
/* info flags */ /* info flags */
#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
@ -964,6 +963,18 @@ struct snd_timer_status {
unsigned char reserved[64]; /* reserved */ unsigned char reserved[64]; /* reserved */
}; };
/*
* This structure describes the userspace-driven timer. Such timers are purely virtual,
* and can only be triggered from software (for instance, by userspace application).
*/
struct snd_timer_uinfo {
/* To pretend being a normal timer, we need to know the resolution in ns. */
__u64 resolution;
int fd;
unsigned int id;
unsigned char reserved[16];
};
#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int) #define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
@ -980,6 +991,8 @@ struct snd_timer_status {
#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int) #define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
#define SNDRV_TIMER_IOCTL_CREATE _IOWR('T', 0xa5, struct snd_timer_uinfo)
#define SNDRV_TIMER_IOCTL_TRIGGER _IO('T', 0xa6)
#if __BITS_PER_LONG == 64 #if __BITS_PER_LONG == 64
#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD #define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
@ -1065,7 +1078,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
// (1 << 3) is unused. /* (1 << 3) is unused. */
#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
@ -1162,7 +1175,7 @@ struct snd_ctl_elem_value {
struct snd_ctl_tlv { struct snd_ctl_tlv {
unsigned int numid; /* control element numeric identification */ unsigned int numid; /* control element numeric identification */
unsigned int length; /* in bytes aligned to 4 */ unsigned int length; /* in bytes aligned to 4 */
unsigned int tlv[0]; /* first TLV */ unsigned int tlv[]; /* first TLV */
}; };
#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) #define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)