usb: gadget: midi2: Add configfs support
This patch adds the support of configfs to MIDI 2.0 function driver
for users to allow configuring the UMP Endpoint and Function Blocks
more flexibly. The configuration is in a tree form. The top-most
contains some card-level configurations. UMP Endpoints are defined in
subdirectories (ep.0, ep.1, etc) that contain Endpoint-specific
configurations such as ep_name, etc. And, UMP Function Blocks are
defined in the subdirectories (block.0, block.1, etc) under EP
subdirectory. As default, the driver creates a single UMP Endpoint
(ep.0) and a single Function Block (block.0) to work in a minimalistic
manner. User can modify those attributes freely to fit with the
demands.
When multiple Function Blocks are required, user can create another
directory as block.1, block.2, and so on (up to block.31). A block.*
directory can be deleted dynamically, too. A caveat is that the block
number has to be continuous.
Similarly, when multiple UMP Endpoints are required, user can create
another directory as ep.1, ep.2, up to ep.3.
Also, some driver behavior can be controlled in the card top-level
configs. e.g. you can pass process_ump=0 to disable the processing of
UMP Stream messages. This would be equivalent with the older MIDI 2.0
spec that doesn't support UMP v1.1 features.
The configfs interface checks upper- / lower-bound of input values,
and more sanity checks are performed at binding.
Attributes can't be changed any longer once when the instance is
linked to UDC.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230725062206.9674-3-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-25 06:22:01 +00:00
|
|
|
What: /config/usb-gadget/gadget/functions/midi2.name
|
|
|
|
Date: Jul 2023
|
|
|
|
KernelVersion: 6.6
|
|
|
|
Description:
|
|
|
|
The attributes:
|
|
|
|
|
|
|
|
============ ===============================================
|
|
|
|
process_ump Flag to process UMP Stream messages (0 or 1)
|
|
|
|
static_block Flag for static blocks (0 or 1)
|
|
|
|
iface_name MIDI interface name string
|
|
|
|
============ ===============================================
|
|
|
|
|
|
|
|
What: /config/usb-gadget/gadget/functions/midi2.name/ep.number
|
|
|
|
Date: Jul 2023
|
|
|
|
KernelVersion: 6.6
|
|
|
|
Description:
|
|
|
|
This group contains a UMP Endpoint configuration.
|
|
|
|
A new Endpoint starts from 0, and can be up to 3.
|
|
|
|
|
|
|
|
The attributes:
|
|
|
|
|
|
|
|
============= ===============================================
|
|
|
|
protocol_caps MIDI protocol capabilities (1, 2 or 3 for both)
|
|
|
|
protocol Default MIDI protocol (1 or 2)
|
|
|
|
ep_name UMP Endpoint name string
|
|
|
|
product_id Product ID string
|
|
|
|
manufacturer Manufacture ID (24 bit)
|
|
|
|
family Device family ID (16 bit)
|
|
|
|
model Device model ID (16 bit)
|
|
|
|
sw_revision Software Revision (32 bit)
|
|
|
|
============= ===============================================
|
|
|
|
|
|
|
|
What: /config/usb-gadget/gadget/functions/midi2.name/ep.number/block.number
|
|
|
|
Date: Jul 2023
|
|
|
|
KernelVersion: 6.6
|
|
|
|
Description:
|
|
|
|
This group contains a UMP Function Block configuration.
|
|
|
|
A new block starts from 0, and can be up to 31.
|
|
|
|
|
|
|
|
The attributes:
|
|
|
|
|
2023-07-25 06:22:06 +00:00
|
|
|
================= ==============================================
|
|
|
|
name Function Block name string
|
|
|
|
direction 1: input, 2: output, 3: bidirectional
|
|
|
|
first_group The first UMP Group number (0-15)
|
|
|
|
num_groups The number of groups in this FB (1-16)
|
|
|
|
midi1_first_group The first UMP Group number for MIDI 1.0 (0-15)
|
|
|
|
midi1_num_groups The number of groups for MIDI 1.0 (0-16)
|
|
|
|
ui_hint 0: unknown, 1: receiver, 2: sender, 3: both
|
|
|
|
midi_ci_verison Supported MIDI-CI version number (8 bit)
|
|
|
|
is_midi1 Legacy MIDI 1.0 device (0, 1 or 2)
|
|
|
|
sysex8_streams Max number of SysEx8 streams (8 bit)
|
|
|
|
active Active FB flag (0 or 1)
|
|
|
|
================= ==============================================
|