Skip to content

Commit 01dfa8e

Browse files
committed
ALSA: ump: Add info flag bit for static blocks
UMP v1.1 spec allows to inform whether the function blocks are static and not dynamically updated. Add a new flag bit to snd_ump_endpoint_info to reflect that attribute, too. The flag is set when a USB MIDI device is still in the old MIDI 2.0 without UMP 1.1 support. Then the driver falls back to GTBs, and they are supposed to be static-only. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6a8b480 commit 01dfa8e

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

include/uapi/sound/asound.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ struct snd_rawmidi_status {
780780
};
781781
#endif
782782

783+
/* UMP EP info flags */
784+
#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
785+
783786
/* UMP EP Protocol / JRTS capability bits */
784787
#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
785788
#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */

sound/core/ump.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ static void snd_ump_proc_read(struct snd_info_entry *entry,
490490
ump->info.sw_revision[2],
491491
ump->info.sw_revision[3]);
492492
}
493+
snd_iprintf(buffer, "Static Blocks: %s\n",
494+
(ump->info.flags & SNDRV_UMP_EP_INFO_STATIC_BLOCKS) ? "Yes" : "No");
493495
snd_iprintf(buffer, "Num Blocks: %d\n\n", ump->info.num_blocks);
494496

495497
list_for_each_entry(fb, &ump->block_list, list) {
@@ -608,6 +610,9 @@ static int ump_handle_ep_info_msg(struct snd_ump_endpoint *ump,
608610
ump->info.num_blocks = 1;
609611
}
610612

613+
if (buf->ep_info.static_function_block)
614+
ump->info.flags |= SNDRV_UMP_EP_INFO_STATIC_BLOCKS;
615+
611616
ump->info.protocol_caps = (buf->ep_info.protocol << 8) |
612617
buf->ep_info.jrts;
613618

@@ -708,6 +713,12 @@ static bool is_fb_info_updated(struct snd_ump_endpoint *ump,
708713
{
709714
char tmpbuf[offsetof(struct snd_ump_block_info, name)];
710715

716+
if (ump->info.flags & SNDRV_UMP_EP_INFO_STATIC_BLOCKS) {
717+
ump_info(ump, "Skipping static FB info update (blk#%d)\n",
718+
fb->info.block_id);
719+
return 0;
720+
}
721+
711722
memcpy(tmpbuf, &fb->info, sizeof(tmpbuf));
712723
fill_fb_info(ump, (struct snd_ump_block_info *)tmpbuf, buf);
713724
return memcmp(&fb->info, tmpbuf, sizeof(tmpbuf)) != 0;

sound/usb/midi2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ static int create_blocks_from_gtb(struct snd_usb_midi2_interface *umidi)
888888
/* Blocks have been already created? */
889889
if (rmidi->ump_parsed || rmidi->ump->info.num_blocks)
890890
continue;
891+
/* GTB is static-only */
892+
rmidi->ump->info.flags |= SNDRV_UMP_EP_INFO_STATIC_BLOCKS;
891893
/* loop over GTBs */
892894
for (dir = 0; dir < 2; dir++) {
893895
if (!rmidi->eps[dir])

0 commit comments

Comments
 (0)