Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: ump: Add more attributes to UMP EP and FB info

Add a few more fields to snd_ump_endpoint_info and snd_ump_block_info
that are added in the new v1.1 spec. Those are filled by the UMP Stream
messages.

The rawmidi protocol version is bumped to 2.0.4 to indicate those
updates.

Also, update the proc outputs to show the newly introduced fields.

Link: https://lore.kernel.org/r/20230612081054.17200-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+48 -3
+15 -3
include/uapi/sound/asound.h
··· 708 708 * Raw MIDI section - /dev/snd/midi?? 709 709 */ 710 710 711 - #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 711 + #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) 712 712 713 713 enum { 714 714 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, ··· 797 797 unsigned int protocol; /* current protocol */ 798 798 unsigned int num_blocks; /* # of function blocks */ 799 799 unsigned short version; /* UMP major/minor version */ 800 - unsigned short padding[7]; 800 + unsigned short family_id; /* MIDI device family ID */ 801 + unsigned short model_id; /* MIDI family model ID */ 802 + unsigned int manufacturer_id; /* MIDI manufacturer ID */ 803 + unsigned char sw_revision[4]; /* software revision */ 804 + unsigned short padding; 801 805 unsigned char name[128]; /* endpoint name string */ 802 806 unsigned char product_id[128]; /* unique product id string */ 803 807 unsigned char reserved[32]; ··· 816 812 #define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */ 817 813 #define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */ 818 814 815 + /* UMP block user-interface hint */ 816 + #define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00 817 + #define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01 818 + #define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02 819 + #define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03 820 + 819 821 /* UMP groups and blocks */ 820 822 #define SNDRV_UMP_MAX_GROUPS 16 821 823 #define SNDRV_UMP_MAX_BLOCKS 32 ··· 835 825 unsigned char active; /* Activeness */ 836 826 unsigned char first_group; /* first group ID */ 837 827 unsigned char num_groups; /* number of groups */ 838 - unsigned char padding[3]; 828 + unsigned char midi_ci_version; /* MIDI-CI support version */ 829 + unsigned char sysex8_streams; /* max number of sysex8 streams */ 830 + unsigned char ui_hint; /* user interface hint */ 839 831 unsigned int flags; /* various info flags */ 840 832 unsigned char name[128]; /* block name string */ 841 833 unsigned char reserved[32];
+33
sound/core/ump.c
··· 448 448 } 449 449 } 450 450 451 + static const char *ump_ui_hint_string(int dir) 452 + { 453 + switch (dir) { 454 + case SNDRV_UMP_BLOCK_UI_HINT_RECEIVER: 455 + return "receiver"; 456 + case SNDRV_UMP_BLOCK_UI_HINT_SENDER: 457 + return "sender"; 458 + case SNDRV_UMP_BLOCK_UI_HINT_BOTH: 459 + return "both"; 460 + default: 461 + return "unknown"; 462 + } 463 + } 464 + 451 465 /* Additional proc file output */ 452 466 static void snd_ump_proc_read(struct snd_info_entry *entry, 453 467 struct snd_info_buffer *buffer) ··· 475 461 snd_iprintf(buffer, "UMP Version: 0x%04x\n", ump->info.version); 476 462 snd_iprintf(buffer, "Protocol Caps: 0x%08x\n", ump->info.protocol_caps); 477 463 snd_iprintf(buffer, "Protocol: 0x%08x\n", ump->info.protocol); 464 + if (ump->info.version) { 465 + snd_iprintf(buffer, "Manufacturer ID: 0x%08x\n", 466 + ump->info.manufacturer_id); 467 + snd_iprintf(buffer, "Family ID: 0x%04x\n", ump->info.family_id); 468 + snd_iprintf(buffer, "Model ID: 0x%04x\n", ump->info.model_id); 469 + snd_iprintf(buffer, "SW Revision: 0x%02x%02x%02x%02x\n", 470 + ump->info.sw_revision[0], 471 + ump->info.sw_revision[1], 472 + ump->info.sw_revision[2], 473 + ump->info.sw_revision[3]); 474 + } 478 475 snd_iprintf(buffer, "Num Blocks: %d\n\n", ump->info.num_blocks); 479 476 480 477 list_for_each_entry(fb, &ump->block_list, list) { ··· 501 476 snd_iprintf(buffer, " Is MIDI1: %s%s\n", 502 477 (fb->info.flags & SNDRV_UMP_BLOCK_IS_MIDI1) ? "Yes" : "No", 503 478 (fb->info.flags & SNDRV_UMP_BLOCK_IS_LOWSPEED) ? " (Low Speed)" : ""); 479 + if (ump->info.version) { 480 + snd_iprintf(buffer, " MIDI-CI Version: %d\n", 481 + fb->info.midi_ci_version); 482 + snd_iprintf(buffer, " Sysex8 Streams: %d\n", 483 + fb->info.sysex8_streams); 484 + snd_iprintf(buffer, " UI Hint: %s\n", 485 + ump_ui_hint_string(fb->info.ui_hint)); 486 + } 504 487 snd_iprintf(buffer, "\n"); 505 488 } 506 489 }