1. 30 Jul, 2023 2 commits
  2. 27 Jul, 2023 31 commits
  3. 26 Jul, 2023 7 commits
    • Takashi Iwai's avatar
      usb: gadget: midi2: More flexible MIDI 1.0 configuration · a85ff0db
      Takashi Iwai authored
      This patch allows users to set up MIDI 1.0 ports more flexibly.
      Namely, instead of the fixed mapping only from FB 0, now multiple
      block definitions are applied to build up the MIDI 1.0 mapping.
      
      The each block config has midi1_first_group and midi1_num_groups
      attributes, and those specify which Groups are used for MIDI 1.0.
      Those fields must be within the UMP Groups defined in the block
      itself.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-8-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a85ff0db
    • Takashi Iwai's avatar
      usb: gadget: midi2: Add "Operation Mode" control · 1b437d2f
      Takashi Iwai authored
      Add a new ALSA control element to watch the current operation mode
      (MIDI 1.0 or MIDI 2.0).  It's a read-only control that reflects the
      current value of altsetting, and 0 means unused, 1 for MIDI 1.0
      (altset 0) and 2 for MIDI 2.0 (altset 1).
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-7-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b437d2f
    • Takashi Iwai's avatar
      usb: gadget: midi2: Add testing documentation · 8559caa9
      Takashi Iwai authored
      Describing brief testing of the new MIDI 2.0 function driver.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-6-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8559caa9
    • Takashi Iwai's avatar
      usb: gadget: midi2: MIDI 1.0 interface (altset 0) support · d6468be7
      Takashi Iwai authored
      This patch extends MIDI 2.0 function driver to add more proper support
      for MIDI 1.0 interface.  Before this patch, the driver only exposes
      the USB descriptor of a MIDI 1.0 interface in altset 0 while no actual
      I/O is running for it.  This patch enables the actual I/O for the
      altset 0; the backend UMP rawmidi is translated from/to the MIDI 1.0
      USB commands.
      
      For converting to USB MIDI 1.0 data protocol, a helper function is
      copied from the existing f_midi driver, in addition to a few other UMP
      Core helper functions.  For the MIDI 1.0 OUT (that is, input for
      gadget), the incoming USB MIDI 1.0 packet is translated to UMP packets
      via UMP Core helper, and tossed to the attached UMP rawmidi.  It's a
      relatively straightforward.  OTOH, for MIDI 1.0 IN (i.e. output for
      gadget), it's a bit more complex: we need to convert a source UMP
      packet once to the standard MIDI 1.0 byte stream, and convert it again
      to USB MIDI 1.0 packets, then send them out.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-5-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6468be7
    • Takashi Iwai's avatar
      usb: gadget: midi2: Dynamically create MIDI 1.0 altset descriptors · 856fa444
      Takashi Iwai authored
      This patch extends MIDI 2.0 function driver to deal with more MIDI1
      Jacks depending on the given Block configuration.
      
      For MIDI 1.0, we take the configuration given in Function Block 0, and
      create MIDI Jacks and Endpoints depending on the definition there.
      That is, when more UMP Groups are defined in the Block 0, the
      corresponding MIDI1 Jacks will be created.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-4-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      856fa444
    • Takashi Iwai's avatar
      usb: gadget: midi2: Add configfs support · 29ee7a4d
      Takashi Iwai authored
      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: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-3-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      29ee7a4d
    • Takashi Iwai's avatar
      usb: gadget: Add support for USB MIDI 2.0 function driver · 8b645922
      Takashi Iwai authored
      This patch adds the support for USB MIDI 2.0 gadget function driver.
      The driver emulates a USB MIDI 2.0 interface with one or more UMP
      Endpoints, where each of UMP Endpoint is a pair of MIDI Endpoints for
      handling MIDI 2.0 UMP packets.  When the function driver is bound, the
      driver creates an ALSA card object with UMP rawmidi devices.  This is
      a kind of loop-back where the incoming and upcoming UMP packets
      from/to the MIDI 2.0 UMP Endpoints are transferred as-is.  In
      addition, legacy (MIDI 1.0) rawmidi devices are created, so that
      legacy applications can work in the gadget side, too.
      
      When a USB MIDI 2.0 gadget interface appears, the connected host can
      use it with the snd-usb-audio driver where MIDI 2.0 support is
      enabled.  Both gadget and connected hosts will have the similar UMP
      Endpoint and Function Block (or Group Terminal Block) information.
      Slight differences are the direction and UI-hint bits; it's due to the
      nature of gadget driver, and the input/output direction is swapped in
      both sides (the input for gadget is the output for host, and vice
      versa).
      
      The driver supports the brand-new UMP v1.1 feature, including the UMP
      Stream message handling for providing UMP Endpoint and Function Block
      information as well as dealing with the MIDI protocol switch.  The
      driver responds to UMP Stream messages by itself.  OTOH, MIDI-CI
      message handling isn't implemented in the kernel driver; it should be
      processed in the user-space through the loopback UMP device.
      
      As of this patch, the whole configuration is fixed, providing only one
      bidirectional UMP Endpoint containing a single FB/GTB with a single
      UMP Group.  The configuration will be dynamically changeable in the
      following patches.
      
      The traditional MIDI 1.0 is still provided in the altset 0 (which is
      mandatory per spec).  But it's only about the configuration, and no
      actual I/O will be running for the altset 0 as of this patch.  The
      proper support MIDI 1.0 altset will follow in later patches, too.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20230725062206.9674-2-tiwai@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b645922