18b645922STakashi Iwai // SPDX-License-Identifier: GPL-2.0+ 28b645922STakashi Iwai /* 38b645922STakashi Iwai * Utility definitions for MIDI 2.0 function 48b645922STakashi Iwai */ 58b645922STakashi Iwai 68b645922STakashi Iwai #ifndef U_MIDI2_H 78b645922STakashi Iwai #define U_MIDI2_H 88b645922STakashi Iwai 98b645922STakashi Iwai #include <linux/usb/composite.h> 108b645922STakashi Iwai #include <sound/asound.h> 118b645922STakashi Iwai 128b645922STakashi Iwai struct f_midi2_opts; 138b645922STakashi Iwai struct f_midi2_ep_opts; 148b645922STakashi Iwai struct f_midi2_block_opts; 158b645922STakashi Iwai 168b645922STakashi Iwai /* UMP Function Block info */ 178b645922STakashi Iwai struct f_midi2_block_info { 188b645922STakashi Iwai unsigned int direction; /* FB direction: 1-3 */ 198b645922STakashi Iwai unsigned int first_group; /* first UMP group: 0-15 */ 208b645922STakashi Iwai unsigned int num_groups; /* number of UMP groups: 1-16 */ 21*a85ff0dbSTakashi Iwai unsigned int midi1_first_group; /* first UMP group for MIDI 1.0 */ 22*a85ff0dbSTakashi Iwai unsigned int midi1_num_groups; /* number of UMP groups for MIDI 1.0 */ 238b645922STakashi Iwai unsigned int ui_hint; /* UI-hint: 0-3 */ 248b645922STakashi Iwai unsigned int midi_ci_version; /* MIDI-CI version: 0-255 */ 258b645922STakashi Iwai unsigned int sysex8_streams; /* number of sysex8 streams: 0-255 */ 268b645922STakashi Iwai unsigned int is_midi1; /* MIDI 1.0 port: 0-2 */ 278b645922STakashi Iwai bool active; /* FB active flag: bool */ 288b645922STakashi Iwai const char *name; /* FB name */ 298b645922STakashi Iwai }; 308b645922STakashi Iwai 318b645922STakashi Iwai /* UMP Endpoint info */ 328b645922STakashi Iwai struct f_midi2_ep_info { 338b645922STakashi Iwai unsigned int protocol_caps; /* protocol capabilities: 1-3 */ 348b645922STakashi Iwai unsigned int protocol; /* default protocol: 1-2 */ 358b645922STakashi Iwai unsigned int manufacturer; /* manufacturer id: 0-0xffffff */ 368b645922STakashi Iwai unsigned int family; /* device family id: 0-0xffff */ 378b645922STakashi Iwai unsigned int model; /* device model id: 0x-0xffff */ 388b645922STakashi Iwai unsigned int sw_revision; /* software revision: 32bit */ 398b645922STakashi Iwai 408b645922STakashi Iwai const char *ep_name; /* Endpoint name */ 418b645922STakashi Iwai const char *product_id; /* Product ID */ 428b645922STakashi Iwai }; 438b645922STakashi Iwai 448b645922STakashi Iwai struct f_midi2_card_info { 458b645922STakashi Iwai bool process_ump; /* process UMP stream: bool */ 468b645922STakashi Iwai bool static_block; /* static FBs: bool */ 478b645922STakashi Iwai unsigned int req_buf_size; /* request buffer size */ 488b645922STakashi Iwai unsigned int num_reqs; /* number of requests */ 498b645922STakashi Iwai const char *iface_name; /* interface name */ 508b645922STakashi Iwai }; 518b645922STakashi Iwai 528b645922STakashi Iwai struct f_midi2_block_opts { 538b645922STakashi Iwai struct config_group group; 548b645922STakashi Iwai unsigned int id; 558b645922STakashi Iwai struct f_midi2_block_info info; 568b645922STakashi Iwai struct f_midi2_ep_opts *ep; 578b645922STakashi Iwai }; 588b645922STakashi Iwai 598b645922STakashi Iwai struct f_midi2_ep_opts { 608b645922STakashi Iwai struct config_group group; 618b645922STakashi Iwai unsigned int index; 628b645922STakashi Iwai struct f_midi2_ep_info info; 638b645922STakashi Iwai struct f_midi2_block_opts *blks[SNDRV_UMP_MAX_BLOCKS]; 648b645922STakashi Iwai struct f_midi2_opts *opts; 658b645922STakashi Iwai }; 668b645922STakashi Iwai 678b645922STakashi Iwai #define MAX_UMP_EPS 4 688b645922STakashi Iwai #define MAX_CABLES 16 698b645922STakashi Iwai 708b645922STakashi Iwai struct f_midi2_opts { 718b645922STakashi Iwai struct usb_function_instance func_inst; 728b645922STakashi Iwai struct mutex lock; 738b645922STakashi Iwai int refcnt; 748b645922STakashi Iwai 758b645922STakashi Iwai struct f_midi2_card_info info; 768b645922STakashi Iwai 778b645922STakashi Iwai unsigned int num_eps; 788b645922STakashi Iwai struct f_midi2_ep_opts *eps[MAX_UMP_EPS]; 798b645922STakashi Iwai }; 808b645922STakashi Iwai 818b645922STakashi Iwai #endif /* U_MIDI2_H */ 82