Skip to content

Commit 28e898f

Browse files
committed
tools include UAPI: Sync the sound/asound.h copy with the kernel sources
Picking the changes from: 01dfa8e ("ALSA: ump: Add info flag bit for static blocks") e375b8a ("ALSA: ump: Add more attributes to UMP EP and FB info") 30fc139 ("ALSA: ump: Add ioctls to inquiry UMP EP and Block info via control API") 127ae6f ("ALSA: rawmidi: Skip UMP devices at SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE") e3a8a5b ("ALSA: rawmidi: UMP support") a4bb75c ("ALSA: uapi: pcm: control the filling of the silence samples for drain") That harvests some new ioctls: $ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh > before.ctl $ tools/perf/trace/beauty/sndrv_pcm_ioctl.sh > before.pcm $ cp include/uapi/sound/asound.h tools/include/uapi/sound/asound.h $ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh > after.ctl $ tools/perf/trace/beauty/sndrv_pcm_ioctl.sh > after.pcm $ diff -u before.ctl after.ctl --- before.ctl 2023-07-14 10:17:00.319591889 -0300 +++ after.ctl 2023-07-14 10:17:24.668248373 -0300 @@ -22,6 +22,9 @@ [0x40] = "RAWMIDI_NEXT_DEVICE", [0x41] = "RAWMIDI_INFO", [0x42] = "RAWMIDI_PREFER_SUBDEVICE", + [0x43] = "UMP_NEXT_DEVICE", + [0x44] = "UMP_ENDPOINT_INFO", + [0x45] = "UMP_BLOCK_INFO", [0xd0] = "POWER", [0xd1] = "POWER_STATE", }; $ diff -u before.pcm after.pcm $ Now those will be decoded when they appear, see a system wide 'perf trace' session example here: # perf trace -e ioctl --max-events=10 0.000 ( 0.010 ms): gnome-shell/2240 ioctl(fd: 9, cmd: DRM_MODE_RMFB, arg: 0x7ffc0041d54c) = 0 2.444 ( 0.005 ms): wireplumber/2304 ioctl(fd: 47, cmd: TIOCOUTQ, arg: 0x7f16e9afea24) = 0 2.452 ( 0.002 ms): wireplumber/2304 ioctl(fd: 47, cmd: TIOCOUTQ, arg: 0x7f16e9afea24) = 0 11.348 ( 0.010 ms): gnome-shell/2240 ioctl(fd: 14, cmd: DRM_I915_IRQ_WAIT, arg: 0x7ffc0041ccf0) = 0 11.406 ( 0.037 ms): gnome-shel:cs0/2259 ioctl(fd: 14, cmd: DRM_I915_IRQ_EMIT, arg: 0x7f3cf69fdc60) = 0 11.476 ( 0.009 ms): gnome-shell/2240 ioctl(fd: 9, cmd: DRM_MODE_ADDFB2, arg: 0x7ffc0041ce50) = 0 11.497 ( 0.019 ms): gnome-shell/2240 ioctl(fd: 9, cmd: DRM_MODE_ATOMIC, arg: 0x7ffc0041cdf0) = 0 12.481 ( 0.020 ms): firefox:cs0/3651 ioctl(fd: 40, cmd: DRM_I915_IRQ_EMIT, arg: 0x7f1c365fea60) = 0 12.529 ( 0.009 ms): firefox:cs0/3651 ioctl(fd: 40, cmd: DRM_I915_IRQ_EMIT, arg: 0x7f1c365feab0) = 0 12.624 ( 0.018 ms): firefox:cs0/3651 ioctl(fd: 40, cmd: DRM_I915_IRQ_EMIT, arg: 0x7f1c365fea30) = 0 # Silencing these perf build warnings: Warning: Kernel ABI header differences: diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 7b86159 commit 28e898f

File tree

1 file changed

+79
-2
lines changed

1 file changed

+79
-2
lines changed

tools/include/uapi/sound/asound.h

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ typedef int __bitwise snd_pcm_subformat_t;
274274
#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
275275
#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
276276
#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
277+
#define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */
277278
#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
278279
#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
279280
#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
@@ -383,6 +384,9 @@ typedef int snd_pcm_hw_param_t;
383384
#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
384385
#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
385386
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
387+
#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress drain with the filling
388+
* of the silence samples
389+
*/
386390

387391
struct snd_interval {
388392
unsigned int min, max;
@@ -708,7 +712,7 @@ enum {
708712
* Raw MIDI section - /dev/snd/midi??
709713
*/
710714

711-
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)
715+
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
712716

713717
enum {
714718
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@@ -719,6 +723,7 @@ enum {
719723
#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
720724
#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
721725
#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
726+
#define SNDRV_RAWMIDI_INFO_UMP 0x00000008
722727

723728
struct snd_rawmidi_info {
724729
unsigned int device; /* RO/WR (control): device number */
@@ -779,13 +784,82 @@ struct snd_rawmidi_status {
779784
};
780785
#endif
781786

787+
/* UMP EP info flags */
788+
#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
789+
790+
/* UMP EP Protocol / JRTS capability bits */
791+
#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
792+
#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */
793+
#define SNDRV_UMP_EP_INFO_PROTO_MIDI2 0x0200 /* MIDI 2.0 */
794+
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
795+
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX 0x0001 /* JRTS Transmit */
796+
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 /* JRTS Receive */
797+
798+
/* UMP Endpoint information */
799+
struct snd_ump_endpoint_info {
800+
int card; /* card number */
801+
int device; /* device number */
802+
unsigned int flags; /* additional info */
803+
unsigned int protocol_caps; /* protocol capabilities */
804+
unsigned int protocol; /* current protocol */
805+
unsigned int num_blocks; /* # of function blocks */
806+
unsigned short version; /* UMP major/minor version */
807+
unsigned short family_id; /* MIDI device family ID */
808+
unsigned short model_id; /* MIDI family model ID */
809+
unsigned int manufacturer_id; /* MIDI manufacturer ID */
810+
unsigned char sw_revision[4]; /* software revision */
811+
unsigned short padding;
812+
unsigned char name[128]; /* endpoint name string */
813+
unsigned char product_id[128]; /* unique product id string */
814+
unsigned char reserved[32];
815+
} __packed;
816+
817+
/* UMP direction */
818+
#define SNDRV_UMP_DIR_INPUT 0x01
819+
#define SNDRV_UMP_DIR_OUTPUT 0x02
820+
#define SNDRV_UMP_DIR_BIDIRECTION 0x03
821+
822+
/* UMP block info flags */
823+
#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */
824+
#define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */
825+
826+
/* UMP block user-interface hint */
827+
#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00
828+
#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01
829+
#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02
830+
#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03
831+
832+
/* UMP groups and blocks */
833+
#define SNDRV_UMP_MAX_GROUPS 16
834+
#define SNDRV_UMP_MAX_BLOCKS 32
835+
836+
/* UMP Block information */
837+
struct snd_ump_block_info {
838+
int card; /* card number */
839+
int device; /* device number */
840+
unsigned char block_id; /* block ID (R/W) */
841+
unsigned char direction; /* UMP direction */
842+
unsigned char active; /* Activeness */
843+
unsigned char first_group; /* first group ID */
844+
unsigned char num_groups; /* number of groups */
845+
unsigned char midi_ci_version; /* MIDI-CI support version */
846+
unsigned char sysex8_streams; /* max number of sysex8 streams */
847+
unsigned char ui_hint; /* user interface hint */
848+
unsigned int flags; /* various info flags */
849+
unsigned char name[128]; /* block name string */
850+
unsigned char reserved[32];
851+
} __packed;
852+
782853
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
783854
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
784855
#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
785856
#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
786857
#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
787858
#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
788859
#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
860+
/* Additional ioctls for UMP rawmidi devices */
861+
#define SNDRV_UMP_IOCTL_ENDPOINT_INFO _IOR('W', 0x40, struct snd_ump_endpoint_info)
862+
#define SNDRV_UMP_IOCTL_BLOCK_INFO _IOR('W', 0x41, struct snd_ump_block_info)
789863

790864
/*
791865
* Timer section - /dev/snd/timer
@@ -961,7 +1035,7 @@ struct snd_timer_tread {
9611035
* *
9621036
****************************************************************************/
9631037

964-
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
1038+
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
9651039

9661040
struct snd_ctl_card_info {
9671041
int card; /* card number */
@@ -1122,6 +1196,9 @@ struct snd_ctl_tlv {
11221196
#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
11231197
#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
11241198
#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
1199+
#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)
1200+
#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
1201+
#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO _IOWR('U', 0x45, struct snd_ump_block_info)
11251202
#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
11261203
#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
11271204

0 commit comments

Comments
 (0)