Skip to content
  1. Jun 05, 2023
  2. May 25, 2023
  3. May 24, 2023
  4. May 23, 2023
    • Takashi Iwai's avatar
      Merge branch 'topic/midi20' into for-next · 03a58514
      Takashi Iwai authored
      
      
      This is a (largish) patch set for adding the support of MIDI 2.0
      functionality, mainly targeted for USB devices.  MIDI 2.0 is a
      complete overhaul of the 40-years old MIDI 1.0.  Unlike MIDI 1.0 byte
      stream, MIDI 2.0 uses packets in 32bit words for Universal MIDI Packet
      (UMP) protocol.  It supports both MIDI 1.0 commands for compatibility
      and the extended MIDI 2.0 commands for higher resolutions and more
      functions.
      
      For supporting the UMP, the patch set extends the existing ALSA
      rawmidi and sequencer interfaces, and adds the USB MIDI 2.0 support to
      the standard USB-audio driver.
      
      The rawmidi for UMP has a different device name (/dev/snd/umpC*D*) and
      it reads/writes UMP packet data in 32bit CPU-native endianness.  For
      the old MIDI 1.0 applications, the legacy rawmidi interface is
      provided, too.
      
      As default, USB-audio driver will take the alternate setting for MIDI
      2.0 interface, and the compatibility with MIDI 1.0 is provided via the
      rawmidi common layer.  However, user may let the driver falling back
      to the old MIDI 1.0 interface by a module option, too.
      
      A UMP-capable rawmidi device can create the corresponding ALSA
      sequencer client(s) to support the UMP Endpoint and UMP Group
      connections.  As a nature of ALSA sequencer, arbitrary connections
      between clients/ports are allowed, and the ALSA sequencer core
      performs the automatic conversions for the connections between a new
      UMP sequencer client and a legacy MIDI 1.0 sequencer client.  It
      allows the existing application to use MIDI 2.0 devices without
      changes.
      
      The MIDI-CI, which is another major extension in MIDI 2.0, isn't
      covered by this patch set.  It would be implemented rather in
      user-space.
      
      Roughly speaking, the first half of this patch set is for extending
      the rawmidi and USB-audio, and the second half is for extending the
      ALSA sequencer interface.
      
      The patch set is based on 6.4-rc2 kernel, but all patches can be
      cleanly applicable on 6.2 and 6.3 kernels, too (while 6.1 and older
      kernels would need minor adjustment for uapi header changes).
      
      The updates for alsa-lib and alsa-utils will follow shortly later.
      
      The author thanks members of MIDI Association OS/API Working Group,
      especially Andrew Mee, for great helps for the initial design and
      debugging / testing the drivers.
      
      Link: https://lore.kernel.org/r/20230523075358.9672-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      03a58514
    • Oswald Buddenhagen's avatar
      ALSA: emu10k1: pass raw FX send config to snd_emu10k1_pcm_init_voice() · 7195fb46
      Oswald Buddenhagen authored
      
      
      ... instead of passing in a high-level mixer struct. Let the
      higher-level functions handle the differences between the voice types.
      
      Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
      Link: https://lore.kernel.org/r/20230523104612.198884-2-oswald.buddenhagen@gmx.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7195fb46
    • Oswald Buddenhagen's avatar
      ALSA: emu10k1: introduce higher-level voice manipulation functions · f5192e33
      Oswald Buddenhagen authored
      
      
      This adds snd_emu10k1_pcm_init_{voices,extra_voice}() and
      snd_emu10k1_playback_{un,}mute_voices() to slightly abstract by voice
      function and potential stereo property.
      
      Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
      Link: https://lore.kernel.org/r/20230523104612.198884-1-oswald.buddenhagen@gmx.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f5192e33
    • Takashi Iwai's avatar
      ALSA: docs: Add MIDI 2.0 documentation · 6b39e30d
      Takashi Iwai authored
      
      
      Add the brief document for describing the MIDI 2.0 implementation on
      Linux kernel.  Both rawmidi and sequencer API extensions are
      described.
      
      Acked-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-38-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6b39e30d
    • Takashi Iwai's avatar
      ALSA: seq: Add UMP group filter · d2b70607
      Takashi Iwai authored
      
      
      Add a new filter bitmap for UMP groups for reducing the unnecessary
      read/write when the client is connected to UMP EP seq port.
      
      The new group_filter field contains the bitmap for the groups, i.e.
      when the bit is set, the corresponding group is filtered out and
      the messages to that group won't be delivered.
      
      The filter bitmap consists of each bit of 1-based UMP Group number.
      The bit 0 is reserved for the future use.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-37-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d2b70607
    • Takashi Iwai's avatar
      ALSA: seq: Print UMP Endpoint and Block information in proc outputs · e85b9260
      Takashi Iwai authored
      
      
      This patch enhances the /proc/asound/seq/clients output to show a few
      more information about the assigned UMP Endpoint and Blocks.
      
      The "Groups" are shown in 1-based group number to align with the
      sequencer client name and port number.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-36-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e85b9260
    • Takashi Iwai's avatar
      ALSA: seq: Add ioctls for client UMP info query and setup · d2d247e3
      Takashi Iwai authored
      
      
      Add new ioctls for sequencer clients to query and set the UMP endpoint
      and block information.
      
      As a sequencer client corresponds to a UMP Endpoint, one UMP Endpoint
      information can be assigned at most to a single sequencer client while
      multiple UMP block infos can be assigned by passing the type with the
      offset of block id (i.e. type = block_id + 1).
      
      For the kernel client, only SNDRV_SEQ_IOCTL_GET_CLIENT_UMP_INFO is
      allowed.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-35-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d2d247e3
    • Takashi Iwai's avatar
      ALSA: seq: ump: Create UMP Endpoint port for broadcast · 4025f0e6
      Takashi Iwai authored
      
      
      Create a sequencer port for broadcasting the all group inputs at the
      port number 0.  This corresponds to a UMP Endpoint connection;
      application can read all UMP events from this port no matter which
      group the UMP packet belongs to.
      
      Unlike seq ports for other UMP groups, a UMP Endpoint port has no
      SND_SEQ_PORT_TYPE_MIDI_GENERIC bit, so that it won't be treated as a
      normal MIDI 1.0 device from legacy applications.
      
      The port is named as "MIDI 2.0" to align with representations on other
      operation systems.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-34-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4025f0e6
    • Takashi Iwai's avatar
      ALSA: seq: Bind UMP device · 81fd444a
      Takashi Iwai authored
      
      
      This patch introduces a new ALSA sequencer client for the kernel UMP
      object, snd-seq-ump-client.  It's a UMP version of snd-seq-midi
      driver, while this driver creates a sequencer client per UMP endpoint
      which contains (fixed) 16 ports.
      
      The UMP rawmidi device is opened in APPEND mode for output, so that
      multiple sequencer clients can share the same UMP endpoint, as well as
      the legacy UMP rawmidi devices that are opened in APPEND mode, too.
      For input, on the other hand, the incoming data is processed on the
      fly in the dedicated hook, hence it doesn't open a rawmidi device.
      
      The UMP packet group is updated upon delivery depending on the target
      sequencer port (which corresponds to the actual UMP group).
      
      Each sequencer port sets a new port type bit,
      SNDRV_SEQ_PORT_TYPE_MIDI_UMP, in addition to the other standard
      types for MIDI.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-33-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      81fd444a
    • Takashi Iwai's avatar
      ALSA: seq: Allow suppressing UMP conversions · 329ffe11
      Takashi Iwai authored
      
      
      A sequencer client like seq_dummy rather doesn't want to convert UMP
      events but receives / sends as is.  Add a new event filter flag to
      suppress the automatic UMP conversion and applies accordingly.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-32-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      329ffe11
    • Takashi Iwai's avatar
      ALSA: seq: Automatic conversion of UMP events · e9e02819
      Takashi Iwai authored
      
      
      This patch enables the automatic conversion of UMP events from/to the
      legacy ALSA sequencer MIDI events.  Also, as UMP itself has two
      different modes (MIDI 1.0 and MIDI 2.0), yet another converters
      between them are needed, too.  Namely, we have conversions between the
      legacy and UMP like:
        - seq legacy event -> seq UMP MIDI 1.0 event
        - seq legacy event -> seq UMP MIDI 2.0 event
        - seq UMP MIDI 1.0 event -> seq legacy event
        - seq UMP MIDI 2.0 event -> seq legacy event
      
      and the conversions between UMP MIDI 1.0 and 2.0 clients like:
        - seq UMP MIDI 1.0 event -> seq UMP MIDI 2.0 event
        - seq UMP MIDI 2.0 event -> seq UMP MIDI 1.0 event
      
      The translation is per best-effort; some MIDI 2.0 specific events are
      ignored when translated to MIDI 1.0.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-31-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e9e02819
    • Takashi Iwai's avatar
      ALSA: seq: Add UMP group number to snd_seq_port_info · a3ca3b30
      Takashi Iwai authored
      
      
      Add yet more new filed "ump_group" to snd_seq_port_info for specifying
      the associated UMP Group number for each sequencer port.  This will be
      referred in the upcoming automatic UMP conversion in sequencer core.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-30-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a3ca3b30
    • Takashi Iwai's avatar
      ALSA: seq: Add port direction to snd_seq_port_info · ff166a9d
      Takashi Iwai authored
      
      
      Add a new field "direction" to snd_seq_port_info for allowing a client
      to tell the expected direction of the port access.  A port might still
      allow subscriptions for read/write (e.g. for MIDI-CI) even if the
      primary usage of the port is a single direction (either input or
      output only).  This new "direction" field can help to indicate such
      cases.
      
      When the direction is unspecified at creating a port and the port has
      either read or write capability, the corresponding direction bits are
      set automatically as default.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-29-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ff166a9d
    • Takashi Iwai's avatar
      ALSA: seq: Support MIDI 2.0 UMP Endpoint port · 177ccf81
      Takashi Iwai authored
      
      
      This is an extension to ALSA sequencer infrastructure to support the
      MIDI 2.0 UMP Endpoint port.  It's a "catch-all" port that is supposed
      to be present for each UMP Endpoint.  When this port is read via
      subscription, it sends any events from all ports (UMP Groups) found in
      the same client.
      
      A UMP Endpoint port can be created with the new capability bit
      SNDRV_SEQ_PORT_CAP_UMP_ENDPOINT.  Although the port assignment isn't
      strictly defined, it should be the port number 0.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-28-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      177ccf81
    • Takashi Iwai's avatar
      ALSA: seq: Add port inactive flag · 74661932
      Takashi Iwai authored
      
      
      This extends the ALSA sequencer port capability bit to indicate the
      "inactive" flag.  When this flag is set, the port is essentially
      invisible, and doesn't appear in the port query ioctls, while the
      direct access and the connection to this port are still allowed.  The
      active/inactive state can be flipped dynamically, so that it can be
      visible at any time later.
      
      This feature is introduced basically for UMP; some UMP Groups in a UMP
      Block may be unassigned, hence those are practically invisible.  On
      ALSA sequencer, the corresponding sequencer ports will get this new
      "inactive" flag to indicate the invisible state.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-27-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      74661932
    • Takashi Iwai's avatar
      ALSA: seq: Add UMP support · 46397622
      Takashi Iwai authored
      
      
      Starting from this commit, we add the basic support of UMP (Universal
      MIDI Packet) events on ALSA sequencer infrastructure.  The biggest
      change here is that, for transferring UMP packets that are up to 128
      bits, we extend the data payload of ALSA sequencer event record when
      the client is declared to support for the new UMP events.
      
      A new event flag bit, SNDRV_SEQ_EVENT_UMP, is defined and it shall be
      set for the UMP packet events that have the larger payload of 128
      bits, defined as struct snd_seq_ump_event.
      
      For controlling the UMP feature enablement in kernel, a new Kconfig,
      CONFIG_SND_SEQ_UMP is introduced.  The extended event for UMP is
      available only when this Kconfig item is set.  Similarly, the size of
      the internal snd_seq_event_cell also increases (in 4 bytes) when the
      Kconfig item is set.  (But the size increase is effective only for
      32bit architectures; 64bit archs already have padding there.)
      Overall, when CONFIG_SND_SEQ_UMP isn't set, there is no change in the
      event and cell, keeping the old sizes.
      
      For applications that want to access the UMP packets, first of all, a
      sequencer client has to declare the user-protocol to match with the
      latest one via the new SNDRV_SEQ_IOCTL_USER_PVERSION; otherwise it's
      treated as if a legacy client without UMP support.
      
      Then the client can switch to the new UMP mode (MIDI 1.0 or MIDI 2.0)
      with a new field, midi_version, in snd_seq_client_info.  When switched
      to UMP mode (midi_version = 1 or 2), the client can write the UMP
      events with SNDRV_SEQ_EVENT_UMP flag.  For reads, the alignment size
      is changed from snd_seq_event (28 bytes) to snd_seq_ump_event (32
      bytes).  When a UMP sequencer event is delivered to a legacy sequencer
      client, it's ignored or handled as an error.
      
      Conceptually, ALSA sequencer client and port correspond to the UMP
      Endpoint and Group, respectively; each client may have multiple ports
      and each port has the fixed number (16) of channels, total up to 256
      channels.
      
      As of this commit, ALSA sequencer core just sends and receives the UMP
      events as-is from/to clients.  The automatic conversions between the
      legacy events and the new UMP events will be implemented in a later
      patch.
      
      Along with this commit, bump the sequencer protocol version to 1.0.3.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-26-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      46397622
    • Takashi Iwai's avatar
      ALSA: seq: Introduce SNDRV_SEQ_IOCTL_USER_PVERSION ioctl · afb72505
      Takashi Iwai authored
      
      
      For the future extension of ALSA sequencer ABI, introduce a new ioctl
      SNDRV_SEQ_IOCTL_USER_PVERSION.  This is similar like the ioctls used
      in PCM and other interfaces, for an application to specify its
      supporting ABI version.
      
      The use of this ioctl will be mandatory for the upcoming UMP support.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-25-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      afb72505
    • Takashi Iwai's avatar
      ALSA: seq: Prohibit creating ports with special numbers · 13599053
      Takashi Iwai authored
      
      
      Some port numbers are special, such as 254 for subscribers and 255 for
      broadcast.  Return error if application tries to create such a port.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-24-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      13599053
    • Takashi Iwai's avatar
      ALSA: seq: Check validity before creating a port object · 4f92eb79
      Takashi Iwai authored
      
      
      The client type and the port info validity check should be done before
      actually creating a port, instead of unnecessary create-and-scratch.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-23-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4f92eb79
    • Takashi Iwai's avatar
      ALSA: seq: Check the conflicting port at port creation · 7c3f0d3d
      Takashi Iwai authored
      
      
      We didn't check if a port with the given port number has been already
      present at creating a new port.  Check it and return -EBUSY properly
      if the port number conflicts.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-22-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7c3f0d3d
    • Takashi Iwai's avatar
      ALSA: seq: Drop dead code for the old broadcast support · 94c5b717
      Takashi Iwai authored
      
      
      The broadcast and multicast supports have been never enabled.
      Let's drop the dead code.
      
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20230523075358.9672-21-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      94c5b717