From eacd9c7f1d3ab8381a99b98b36652b5cf6ae8387 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 21 Jun 2023 13:02:40 +0200
Subject: [PATCH] ALSA: ump: Add no_process_stream flag
Git-commit: eacd9c7f1d3ab8381a99b98b36652b5cf6ae8387
Patch-mainline: v6.5-rc1
References: jsc#PED-6045 jsc#PED-6036 jsc#PED-6104 jsc#PED-6114 jsc#PED-6067 jsc#PED-6123
This is another preliminary patch for USB MIDI 2.0 gadget driver.
Add a new flag, no_process_stream, to snd_ump for suppressing the UMP
Stream message handling in UMP core.
Link: https://lore.kernel.org/r/20230621110241.4751-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/sound/ump.h | 1 +
sound/core/ump.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/sound/ump.h b/include/sound/ump.h
index 3c7e67475676..2f6a9944c6ef 100644
--- a/include/sound/ump.h
+++ b/include/sound/ump.h
@@ -28,6 +28,7 @@ struct snd_ump_endpoint {
u32 stream_wait_for; /* expected stream message status */
bool stream_finished; /* set when message has been processed */
bool parsed; /* UMP / FB parse finished? */
+ bool no_process_stream; /* suppress UMP stream messages handling */
wait_queue_head_t stream_wait;
struct snd_rawmidi_file stream_rfile;
diff --git a/sound/core/ump.c b/sound/core/ump.c
index 4150b9c0b35b..5e73c9cf5919 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -854,6 +854,10 @@ static void ump_handle_stream_msg(struct snd_ump_endpoint *ump,
unsigned int status;
int ret;
+ /* UMP stream message suppressed (for gadget UMP)? */
+ if (ump->no_process_stream)
+ return;
+
BUILD_BUG_ON(sizeof(*msg) != 16);
ump_dbg(ump, "Stream msg: %08x %08x %08x %08x\n",
buf[0], buf[1], buf[2], buf[3]);
--
2.35.3