Skip to content

Commit 8c65582

Browse files
committed
tools include UAPI: Sync sound/asound.h copy
Picking the changes from: 46b770f ("ALSA: uapi: Fix sparse warning") a103a39 ("ALSA: control: Fix incompatible protocol error") bd3eb4e ("ALSA: ctl: bump protocol version up to v2.1.0") ff16351 ("ALSA: ctl: remove dimen member from elem_info structure") 5422835 ("ALSA: ctl: remove unused macro for timestamping of elem_value") 7fd7d6c ("ALSA: uapi: Fix typos and header inclusion in asound.h") 1cfaef9 ("ALSA: bump uapi version numbers") 80fe743 ("ALSA: add new 32-bit layout for snd_pcm_mmap_status/control") 07094ae ("ALSA: Avoid using timespec for struct snd_timer_tread") d9e5582 ("ALSA: Avoid using timespec for struct snd_rawmidi_status") 3ddee7f ("ALSA: Avoid using timespec for struct snd_pcm_status") a4e7dd3 ("ALSA: Avoid using timespec for struct snd_ctl_elem_value") a07804c ("ALSA: Avoid using timespec for struct snd_timer_status") Which entails no changes in the tooling side. To silence this perf tools build warning: Warning: Kernel ABI header at 'tools/include/uapi/sound/asound.h' differs from latest version at 'include/uapi/sound/asound.h' diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h Cc: Adrian Hunter <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Ranjani Sridharan <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Takashi Sakamoto <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 47f8d94 commit 8c65582

File tree

1 file changed

+132
-23
lines changed

1 file changed

+132
-23
lines changed

tools/include/uapi/sound/asound.h

Lines changed: 132 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727
#if defined(__KERNEL__) || defined(__linux__)
2828
#include <linux/types.h>
29+
#include <asm/byteorder.h>
2930
#else
31+
#include <endian.h>
3032
#include <sys/ioctl.h>
3133
#endif
3234

@@ -154,7 +156,7 @@ struct snd_hwdep_dsp_image {
154156
* *
155157
*****************************************************************************/
156158

157-
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
159+
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
158160

159161
typedef unsigned long snd_pcm_uframes_t;
160162
typedef signed long snd_pcm_sframes_t;
@@ -301,7 +303,9 @@ typedef int __bitwise snd_pcm_subformat_t;
301303
#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
302304
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
303305

304-
306+
#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
307+
#define __SND_STRUCT_TIME64
308+
#endif
305309

306310
typedef int __bitwise snd_pcm_state_t;
307311
#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
@@ -317,8 +321,17 @@ typedef int __bitwise snd_pcm_state_t;
317321

318322
enum {
319323
SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
320-
SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
321-
SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
324+
SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
325+
SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
326+
SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
327+
SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
328+
#ifdef __SND_STRUCT_TIME64
329+
SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
330+
SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
331+
#else
332+
SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
333+
SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
334+
#endif
322335
};
323336

324337
union snd_pcm_sync_id {
@@ -456,8 +469,13 @@ enum {
456469
SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
457470
};
458471

472+
#ifndef __KERNEL__
473+
/* explicit padding avoids incompatibility between i386 and x86-64 */
474+
typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
475+
459476
struct snd_pcm_status {
460477
snd_pcm_state_t state; /* stream state */
478+
__time_pad pad1; /* align to timespec */
461479
struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
462480
struct timespec tstamp; /* reference timestamp */
463481
snd_pcm_uframes_t appl_ptr; /* appl ptr */
@@ -473,17 +491,48 @@ struct snd_pcm_status {
473491
__u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
474492
unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
475493
};
494+
#endif
495+
496+
/*
497+
* For mmap operations, we need the 64-bit layout, both for compat mode,
498+
* and for y2038 compatibility. For 64-bit applications, the two definitions
499+
* are identical, so we keep the traditional version.
500+
*/
501+
#ifdef __SND_STRUCT_TIME64
502+
#define __snd_pcm_mmap_status64 snd_pcm_mmap_status
503+
#define __snd_pcm_mmap_control64 snd_pcm_mmap_control
504+
#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
505+
#ifdef __KERNEL__
506+
#define __snd_timespec64 __kernel_timespec
507+
#else
508+
#define __snd_timespec64 timespec
509+
#endif
510+
struct __snd_timespec {
511+
__s32 tv_sec;
512+
__s32 tv_nsec;
513+
};
514+
#else
515+
#define __snd_pcm_mmap_status snd_pcm_mmap_status
516+
#define __snd_pcm_mmap_control snd_pcm_mmap_control
517+
#define __snd_pcm_sync_ptr snd_pcm_sync_ptr
518+
#define __snd_timespec timespec
519+
struct __snd_timespec64 {
520+
__s64 tv_sec;
521+
__s64 tv_nsec;
522+
};
476523

477-
struct snd_pcm_mmap_status {
524+
#endif
525+
526+
struct __snd_pcm_mmap_status {
478527
snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
479528
int pad1; /* Needed for 64 bit alignment */
480529
snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
481-
struct timespec tstamp; /* Timestamp */
530+
struct __snd_timespec tstamp; /* Timestamp */
482531
snd_pcm_state_t suspended_state; /* RO: suspended stream state */
483-
struct timespec audio_tstamp; /* from sample counter or wall clock */
532+
struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
484533
};
485534

486-
struct snd_pcm_mmap_control {
535+
struct __snd_pcm_mmap_control {
487536
snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
488537
snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
489538
};
@@ -492,14 +541,59 @@ struct snd_pcm_mmap_control {
492541
#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
493542
#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
494543

495-
struct snd_pcm_sync_ptr {
544+
struct __snd_pcm_sync_ptr {
496545
unsigned int flags;
497546
union {
498-
struct snd_pcm_mmap_status status;
547+
struct __snd_pcm_mmap_status status;
548+
unsigned char reserved[64];
549+
} s;
550+
union {
551+
struct __snd_pcm_mmap_control control;
552+
unsigned char reserved[64];
553+
} c;
554+
};
555+
556+
#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
557+
typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
558+
typedef char __pad_after_uframe[0];
559+
#endif
560+
561+
#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
562+
typedef char __pad_before_uframe[0];
563+
typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
564+
#endif
565+
566+
struct __snd_pcm_mmap_status64 {
567+
snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
568+
__u32 pad1; /* Needed for 64 bit alignment */
569+
__pad_before_uframe __pad1;
570+
snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
571+
__pad_after_uframe __pad2;
572+
struct __snd_timespec64 tstamp; /* Timestamp */
573+
snd_pcm_state_t suspended_state;/* RO: suspended stream state */
574+
__u32 pad3; /* Needed for 64 bit alignment */
575+
struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
576+
};
577+
578+
struct __snd_pcm_mmap_control64 {
579+
__pad_before_uframe __pad1;
580+
snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
581+
__pad_before_uframe __pad2;
582+
583+
__pad_before_uframe __pad3;
584+
snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
585+
__pad_after_uframe __pad4;
586+
};
587+
588+
struct __snd_pcm_sync_ptr64 {
589+
__u32 flags;
590+
__u32 pad1;
591+
union {
592+
struct __snd_pcm_mmap_status64 status;
499593
unsigned char reserved[64];
500594
} s;
501595
union {
502-
struct snd_pcm_mmap_control control;
596+
struct __snd_pcm_mmap_control64 control;
503597
unsigned char reserved[64];
504598
} c;
505599
};
@@ -584,6 +678,8 @@ enum {
584678
#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
585679
#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
586680
#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
681+
#define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
682+
#define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
587683
#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
588684
#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
589685
#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
@@ -614,7 +710,7 @@ enum {
614710
* Raw MIDI section - /dev/snd/midi??
615711
*/
616712

617-
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
713+
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
618714

619715
enum {
620716
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@@ -648,13 +744,16 @@ struct snd_rawmidi_params {
648744
unsigned char reserved[16]; /* reserved for future use */
649745
};
650746

747+
#ifndef __KERNEL__
651748
struct snd_rawmidi_status {
652749
int stream;
750+
__time_pad pad1;
653751
struct timespec tstamp; /* Timestamp */
654752
size_t avail; /* available bytes */
655753
size_t xruns; /* count of overruns since last status (in bytes) */
656754
unsigned char reserved[16]; /* reserved for future use */
657755
};
756+
#endif
658757

659758
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
660759
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
@@ -667,7 +766,7 @@ struct snd_rawmidi_status {
667766
* Timer section - /dev/snd/timer
668767
*/
669768

670-
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
769+
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
671770

672771
enum {
673772
SNDRV_TIMER_CLASS_NONE = -1,
@@ -761,6 +860,7 @@ struct snd_timer_params {
761860
unsigned char reserved[60]; /* reserved */
762861
};
763862

863+
#ifndef __KERNEL__
764864
struct snd_timer_status {
765865
struct timespec tstamp; /* Timestamp - last update */
766866
unsigned int resolution; /* current period resolution in ns */
@@ -769,10 +869,11 @@ struct snd_timer_status {
769869
unsigned int queue; /* used queue size */
770870
unsigned char reserved[64]; /* reserved */
771871
};
872+
#endif
772873

773874
#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
774875
#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
775-
#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
876+
#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
776877
#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
777878
#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
778879
#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
@@ -785,6 +886,15 @@ struct snd_timer_status {
785886
#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
786887
#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
787888
#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
889+
#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
890+
891+
#if __BITS_PER_LONG == 64
892+
#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
893+
#else
894+
#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
895+
SNDRV_TIMER_IOCTL_TREAD_OLD : \
896+
SNDRV_TIMER_IOCTL_TREAD64)
897+
#endif
788898

789899
struct snd_timer_read {
790900
unsigned int resolution;
@@ -810,19 +920,23 @@ enum {
810920
SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
811921
};
812922

923+
#ifndef __KERNEL__
813924
struct snd_timer_tread {
814925
int event;
926+
__time_pad pad1;
815927
struct timespec tstamp;
816928
unsigned int val;
929+
__time_pad pad2;
817930
};
931+
#endif
818932

819933
/****************************************************************************
820934
* *
821935
* Section for driver control interface - /dev/snd/control? *
822936
* *
823937
****************************************************************************/
824938

825-
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
939+
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
826940

827941
struct snd_ctl_card_info {
828942
int card; /* card number */
@@ -860,7 +974,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;
860974
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
861975
#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
862976
#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
863-
#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
977+
// (1 << 3) is unused.
864978
#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
865979
#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
866980
#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
@@ -926,11 +1040,7 @@ struct snd_ctl_elem_info {
9261040
} enumerated;
9271041
unsigned char reserved[128];
9281042
} value;
929-
union {
930-
unsigned short d[4]; /* dimensions */
931-
unsigned short *d_ptr; /* indirect - obsoleted */
932-
} dimen;
933-
unsigned char reserved[64-4*sizeof(unsigned short)];
1043+
unsigned char reserved[64];
9341044
};
9351045

9361046
struct snd_ctl_elem_value {
@@ -955,8 +1065,7 @@ struct snd_ctl_elem_value {
9551065
} bytes;
9561066
struct snd_aes_iec958 iec958;
9571067
} value; /* RO */
958-
struct timespec tstamp;
959-
unsigned char reserved[128-sizeof(struct timespec)];
1068+
unsigned char reserved[128];
9601069
};
9611070

9621071
struct snd_ctl_tlv {

0 commit comments

Comments
 (0)