mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 13:03:25 +01:00
ff49d1df79
This patch provides a basic support for USB MIDI 2.0. As of this patch, the driver creates a UMP device per MIDI I/O endpoints, which serves as a dumb terminal to read/write UMP streams. A new Kconfig CONFIG_SND_USB_AUDIO_MIDI_V2 manages whether to enable or disable the MIDI 2.0 support. Also, the driver provides a new module option, midi2_enable, to allow disabling the MIDI 2.0 at runtime, too. When MIDI 2.0 support is disabled, the driver tries to fall back to the already existing MIDI 1.0 device (each MIDI 2.0 device is supposed to provide the MIDI 1.0 interface at the altset 0). For now, the driver doesn't manage any MIDI-CI or other protocol setups by itself, but relies on the default protocol given via the group terminal block descriptors. The MIDI 1.0 messages on MIDI 2.0 device will be automatically converted in ALSA sequencer in a later patch. As of this commit, the driver accepts merely the rawmidi UMP accesses. The driver builds up the topology in the following way: - Create an object for each MIDI endpoint belonging to the USB interface - Find MIDI EP "pairs" that share the same GTB; note that MIDI EP is unidirectional, while UMP is (normally) bidirectional, so two MIDI EPs can form a single UMP EP - A UMP endpoint object is created for each I/O pair - For remaining "solo" MIDI EPs, create unidirectional UMP EPs - Finally, parse GTBs and fill the protocol bits on each UMP So the driver may support multiple UMP Endpoints in theory, although most devices are supposed to have a single UMP EP that can contain up to 16 groups -- which should be large enough. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#ifndef __USB_AUDIO_MIDI2_H
|
|
#define __USB_AUDIO_MIDI2_H
|
|
|
|
#include "midi.h"
|
|
|
|
#if IS_ENABLED(CONFIG_SND_USB_AUDIO_MIDI_V2)
|
|
int snd_usb_midi_v2_create(struct snd_usb_audio *chip,
|
|
struct usb_interface *iface,
|
|
const struct snd_usb_audio_quirk *quirk,
|
|
unsigned int usb_id);
|
|
void snd_usb_midi_v2_suspend_all(struct snd_usb_audio *chip);
|
|
void snd_usb_midi_v2_resume_all(struct snd_usb_audio *chip);
|
|
void snd_usb_midi_v2_disconnect_all(struct snd_usb_audio *chip);
|
|
void snd_usb_midi_v2_free_all(struct snd_usb_audio *chip);
|
|
#else /* CONFIG_SND_USB_AUDIO_MIDI_V2 */
|
|
/* fallback to MIDI 1.0 creation */
|
|
static inline int snd_usb_midi_v2_create(struct snd_usb_audio *chip,
|
|
struct usb_interface *iface,
|
|
const struct snd_usb_audio_quirk *quirk,
|
|
unsigned int usb_id)
|
|
{
|
|
return __snd_usbmidi_create(chip->card, iface, &chip->midi_list,
|
|
quirk, usb_id, &chip->num_rawmidis);
|
|
}
|
|
|
|
static inline void snd_usb_midi_v2_suspend_all(struct snd_usb_audio *chip) {}
|
|
static inline void snd_usb_midi_v2_resume_all(struct snd_usb_audio *chip) {}
|
|
static inline void snd_usb_midi_v2_disconnect_all(struct snd_usb_audio *chip) {}
|
|
static inline void snd_usb_midi_v2_free_all(struct snd_usb_audio *chip) {}
|
|
#endif /* CONFIG_SND_USB_AUDIO_MIDI_V2 */
|
|
|
|
#endif /* __USB_AUDIO_MIDI2_H */
|