18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __USBMIDI_H
38c2ecf20Sopenharmony_ci#define __USBMIDI_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/* maximum number of endpoints per interface */
68c2ecf20Sopenharmony_ci#define MIDI_MAX_ENDPOINTS 2
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* data for QUIRK_MIDI_FIXED_ENDPOINT */
98c2ecf20Sopenharmony_cistruct snd_usb_midi_endpoint_info {
108c2ecf20Sopenharmony_ci	int8_t   out_ep;	/* ep number, 0 autodetect */
118c2ecf20Sopenharmony_ci	uint8_t  out_interval;	/* interval for interrupt endpoints */
128c2ecf20Sopenharmony_ci	int8_t   in_ep;
138c2ecf20Sopenharmony_ci	uint8_t  in_interval;
148c2ecf20Sopenharmony_ci	uint16_t out_cables;	/* bitmask */
158c2ecf20Sopenharmony_ci	uint16_t in_cables;	/* bitmask */
168c2ecf20Sopenharmony_ci};
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_YAMAHA, data is NULL */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_MIDIMAN, data points to a snd_usb_midi_endpoint_info
218c2ecf20Sopenharmony_ci * structure (out_cables and in_cables only) */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* for QUIRK_COMPOSITE, data points to an array of snd_usb_audio_quirk
248c2ecf20Sopenharmony_ci * structures, terminated with .ifnum = -1 */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* for QUIRK_AUDIO_FIXED_ENDPOINT, data points to an audioformat structure */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* for QUIRK_IGNORE_INTERFACE, data is NULL */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_NOVATION and _RAW, data is NULL */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info
378c2ecf20Sopenharmony_ci * structure (out_cables and in_cables only) */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_CME, data is NULL */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* for QUIRK_MIDI_AKAI, data is NULL */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciint __snd_usbmidi_create(struct snd_card *card,
448c2ecf20Sopenharmony_ci			 struct usb_interface *iface,
458c2ecf20Sopenharmony_ci			 struct list_head *midi_list,
468c2ecf20Sopenharmony_ci			 const struct snd_usb_audio_quirk *quirk,
478c2ecf20Sopenharmony_ci			 unsigned int usb_id);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic inline int snd_usbmidi_create(struct snd_card *card,
508c2ecf20Sopenharmony_ci		       struct usb_interface *iface,
518c2ecf20Sopenharmony_ci		       struct list_head *midi_list,
528c2ecf20Sopenharmony_ci		       const struct snd_usb_audio_quirk *quirk)
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	return __snd_usbmidi_create(card, iface, midi_list, quirk, 0);
558c2ecf20Sopenharmony_ci}
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_civoid snd_usbmidi_input_stop(struct list_head *p);
588c2ecf20Sopenharmony_civoid snd_usbmidi_input_start(struct list_head *p);
598c2ecf20Sopenharmony_civoid snd_usbmidi_disconnect(struct list_head *p);
608c2ecf20Sopenharmony_civoid snd_usbmidi_suspend(struct list_head *p);
618c2ecf20Sopenharmony_civoid snd_usbmidi_resume(struct list_head *p);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#endif /* __USBMIDI_H */
64