summaryrefslogtreecommitdiff
path: root/include/sound/ump.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-05-23 09:53:53 +0200
committerTakashi Iwai <tiwai@suse.de>2023-05-23 12:11:33 +0200
commit81fd444aa371261cd33f31d4ffd80faeeeab0cc9 (patch)
tree6a2a4eabc82533e6e1e93935f6ae93fb031fce27 /include/sound/ump.h
parent329ffe11a014834fdef9167c7ea24bd459829f86 (diff)
ALSA: seq: Bind UMP device
This patch introduces a new ALSA sequencer client for the kernel UMP object, snd-seq-ump-client. It's a UMP version of snd-seq-midi driver, while this driver creates a sequencer client per UMP endpoint which contains (fixed) 16 ports. The UMP rawmidi device is opened in APPEND mode for output, so that multiple sequencer clients can share the same UMP endpoint, as well as the legacy UMP rawmidi devices that are opened in APPEND mode, too. For input, on the other hand, the incoming data is processed on the fly in the dedicated hook, hence it doesn't open a rawmidi device. The UMP packet group is updated upon delivery depending on the target sequencer port (which corresponds to the actual UMP group). Each sequencer port sets a new port type bit, SNDRV_SEQ_PORT_TYPE_MIDI_UMP, in addition to the other standard types for MIDI. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-33-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/ump.h')
-rw-r--r--include/sound/ump.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/sound/ump.h b/include/sound/ump.h
index 45f4c9b673b5..e4fdf7cccf12 100644
--- a/include/sound/ump.h
+++ b/include/sound/ump.h
@@ -11,6 +11,7 @@ struct snd_ump_endpoint;
struct snd_ump_block;
struct snd_ump_ops;
struct ump_cvt_to_ump;
+struct snd_seq_ump_ops;
struct snd_ump_endpoint {
struct snd_rawmidi core; /* raw UMP access */
@@ -30,9 +31,9 @@ struct snd_ump_endpoint {
int input_buf_head;
int input_pending;
-#if IS_ENABLED(CONFIG_SND_UMP_LEGACY_RAWMIDI)
struct mutex open_mutex;
+#if IS_ENABLED(CONFIG_SND_UMP_LEGACY_RAWMIDI)
spinlock_t legacy_locks[2];
struct snd_rawmidi *legacy_rmidi;
struct snd_rawmidi_substream *legacy_substreams[2][SNDRV_UMP_MAX_GROUPS];
@@ -42,6 +43,12 @@ struct snd_ump_endpoint {
struct snd_rawmidi_file legacy_out_rfile;
struct ump_cvt_to_ump *out_cvts;
#endif
+
+#if IS_ENABLED(CONFIG_SND_SEQUENCER)
+ struct snd_seq_device *seq_dev;
+ const struct snd_seq_ump_ops *seq_ops;
+ void *seq_client;
+#endif
};
/* ops filled by UMP drivers */
@@ -52,6 +59,12 @@ struct snd_ump_ops {
void (*drain)(struct snd_ump_endpoint *ump, int dir);
};
+/* ops filled by sequencer binding */
+struct snd_seq_ump_ops {
+ void (*input_receive)(struct snd_ump_endpoint *ump,
+ const u32 *data, int words);
+};
+
struct snd_ump_block {
struct snd_ump_block_info info;
struct snd_ump_endpoint *ump;