From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 09/10] ALSA: ump: Add info flag bit for static blocks
Date: Mon, 12 Jun 2023 10:10:53 +0200 [thread overview]
Message-ID: <20230612081054.17200-10-tiwai@suse.de> (raw)
In-Reply-To: <20230612081054.17200-1-tiwai@suse.de>
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/uapi/sound/asound.h | 3 +++
sound/core/ump.c | 11 +++++++++++
sound/usb/midi2.c | 2 ++
3 files changed, 16 insertions(+)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 79ee48b2ed6d..4d1ac0797d56 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -780,6 +780,9 @@ struct snd_rawmidi_status {
};
#endif
+/* UMP EP info flags */
+#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
+
/* UMP EP Protocol / JRTS capability bits */
#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */
diff --git a/sound/core/ump.c b/sound/core/ump.c
index f364bb290d3a..a64dc2d8a129 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -490,6 +490,8 @@ static void snd_ump_proc_read(struct snd_info_entry *entry,
ump->info.sw_revision[2],
ump->info.sw_revision[3]);
}
+ snd_iprintf(buffer, "Static Blocks: %s\n",
+ (ump->info.flags & SNDRV_UMP_EP_INFO_STATIC_BLOCKS) ? "Yes" : "No");
snd_iprintf(buffer, "Num Blocks: %d\n\n", ump->info.num_blocks);
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,
ump->info.num_blocks = 1;
}
+ if (buf->ep_info.static_function_block)
+ ump->info.flags |= SNDRV_UMP_EP_INFO_STATIC_BLOCKS;
+
ump->info.protocol_caps = (buf->ep_info.protocol << 8) |
buf->ep_info.jrts;
@@ -708,6 +713,12 @@ static bool is_fb_info_updated(struct snd_ump_endpoint *ump,
{
char tmpbuf[offsetof(struct snd_ump_block_info, name)];
+ if (ump->info.flags & SNDRV_UMP_EP_INFO_STATIC_BLOCKS) {
+ ump_info(ump, "Skipping static FB info update (blk#%d)\n",
+ fb->info.block_id);
+ return 0;
+ }
+
memcpy(tmpbuf, &fb->info, sizeof(tmpbuf));
fill_fb_info(ump, (struct snd_ump_block_info *)tmpbuf, buf);
return memcmp(&fb->info, tmpbuf, sizeof(tmpbuf)) != 0;
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c
index 13fa1978267a..ee2835741479 100644
--- a/sound/usb/midi2.c
+++ b/sound/usb/midi2.c
@@ -888,6 +888,8 @@ static int create_blocks_from_gtb(struct snd_usb_midi2_interface *umidi)
/* Blocks have been already created? */
if (rmidi->ump_parsed || rmidi->ump->info.num_blocks)
continue;
+ /* GTB is static-only */
+ rmidi->ump->info.flags |= SNDRV_UMP_EP_INFO_STATIC_BLOCKS;
/* loop over GTBs */
for (dir = 0; dir < 2; dir++) {
if (!rmidi->eps[dir])
--
2.35.3
next prev parent reply other threads:[~2023-06-12 8:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 8:10 [PATCH 00/10] ALSA: Catch up MIDI 2.0 updates for UMP 1.1 Takashi Iwai
2023-06-12 8:10 ` [PATCH 01/10] ALSA: ump: Add more attributes to UMP EP and FB info Takashi Iwai
2023-06-12 8:10 ` [PATCH 02/10] ALSA: ump: Support UMP Endpoint and Function Block parsing Takashi Iwai
2023-06-12 8:10 ` [PATCH 03/10] ALSA: usb-audio: Parse UMP Endpoint and Function Blocks at first Takashi Iwai
2023-06-12 8:10 ` [PATCH 04/10] ALSA: usb-audio: Add midi2_ump_probe option Takashi Iwai
2023-06-12 8:10 ` [PATCH 05/10] ALSA: seq: ump: Handle groupless messages Takashi Iwai
2023-06-12 8:10 ` [PATCH 06/10] ALSA: seq: ump: Handle FB info update Takashi Iwai
2023-06-12 8:10 ` [PATCH 07/10] ALSA: seq: ump: Notify port changes to system port Takashi Iwai
2023-06-12 8:10 ` [PATCH 08/10] ALSA: seq: ump: Notify UMP protocol change to sequencer Takashi Iwai
2023-06-12 8:10 ` Takashi Iwai [this message]
2023-06-12 8:10 ` [PATCH 10/10] ALSA: docs: Update MIDI 2.0 documentation for UMP 1.1 enhancement Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230612081054.17200-10-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®