Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoundWire: start adding BPT/BRA support #4679

Draft
wants to merge 16 commits into
base: topic/sof-dev
Choose a base branch
from

Commits on Jan 24, 2024

  1. Documentation: driver: add SoundWire BRA description

    The Bulk Register Access protocol was left as a TODO topic since
    2018. It's time to document this protocol and the design of its Linux
    support.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    7f11656 View commit details
    Browse the repository at this point in the history
  2. soundwire: cadence: add BTP support for DP0

    The register definitions are missing a BULK_ENABLE bitfield which must
    be set for DP0.
    
    In addition, the existing mapping from PDI to Data Port is 1:1. That's
    fine for PCM streams which are by construction in one direction
    only. The BTP/BRA protocol is bidirectional and relies on DP0 only,
    which breaks the 1:1 mapping. DP0 MUST be mapped to both PDI0 and
    PDI1, with PDI1 taking care of the TX direction and PDI1 of the RX
    direction.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    5d00a54 View commit details
    Browse the repository at this point in the history
  3. soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter

    In the existing definition of sdw_stream_runtime, the 'type' member is
    never set and defaults to PCM. To prepare for the BPT/BRA support, we
    need to special-case streams and make use of the 'type'.
    
    No functional change for now, the implicit PCM type is now explicit.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    d4418b6 View commit details
    Browse the repository at this point in the history
  4. soundwire: extend sdw_stream_type to BPT

    BPT/BRA need to be special cased, i.e. there's no point in using the
    bandwidth allocation since the entire frame can be used.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    4db12ce View commit details
    Browse the repository at this point in the history
  5. soundwire: stream: special-case the bus compute_params() routine

    For BPT support, we want to allocate the entire audio payload and
    bypass the allocation based on PCM/PDM parameters.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    9243784 View commit details
    Browse the repository at this point in the history
  6. soundwire: stream: reuse existing code for BPT stream

    DP0 (Data Port 0) is very similar to regular data ports, with minor
    tweaks we can reuse the same code.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    bdf7ab0 View commit details
    Browse the repository at this point in the history
  7. soundwire: bus: add send_async/wait API for BPT protocol

    Add definitions and helpers for the BPT/BRA protocol. Peripheral
    drivers (aka ASoC codec drivers) can use this API to send bulk data
    such as firmware or tables. The design intent is however NOT to
    directly use this API but to rely on an intermediate regmap layer.
    
    The API is only available when no other audio streams have been
    allocated, and only one BTP/BRA stream is allowed per link.  To avoid
    the addition of yet another lock, the refcount tests are handled in
    the stream master_runtime alloc/free routines where the bus_lock is
    already held. Another benefit of this approach is that the same
    bus_lock is used to handle runtime and port linked lists, which
    reduces the potential for misaligned configurations.
    
    In addition to exclusion with audio streams, BPT transfers have a lot
    of overhead, specifically registers writes are needed to enable
    transport in DP0. Most DMAs don't handle too well very small data sets
    and they may have alignment limitations.
    
    The size and alignment requirements are for now not handled by the
    core but must be checked by platform-specific drivers.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    c010d8a View commit details
    Browse the repository at this point in the history
  8. soundwire: bus: add bpt_stream pointer

    Add a convenience pointer to the 'sdw_bus' structure. BPT is a
    dedicated stream which will typically not be handled by DAIs or
    dailinks. Since there's only one BPT stream per link, storing the
    pointer at the link level seems rather natural.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    d232a12 View commit details
    Browse the repository at this point in the history
  9. soundwire: cadence: add BTP/BRA helpers to format data

    The Cadence IP expects a specific format (detailed in the
    Documentation). Add helpers to copy the data into the DMA buffer.
    
    The crc8 table is for now only used by the Cadence driver. This table
    might be moved to a common module at a later point if needed by other
    controller implementations.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    cb4b02b View commit details
    Browse the repository at this point in the history
  10. soundwire: intel_auxdevice: add indirection for BPT send_async/wait

    Mirror abstraction added for master ops.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    f9e8ce4 View commit details
    Browse the repository at this point in the history
  11. ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA

    Add SoundWire BPT DMA helpers as a separate module to avoid circular
    dependencies.
    
    For now this assumes no link DMA, only coupled mode.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    af779a3 View commit details
    Browse the repository at this point in the history
  12. soundwire: intel: add BPT context definition

    This is needed to be shared between open/send_async/close.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    16d1dbd View commit details
    Browse the repository at this point in the history
  13. soundwire: intel_ace2x: add BPT send_async/wait callbacks

    Add support for BTP API using Cadence and hda-sdw-bpt helpers.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    21b61c2 View commit details
    Browse the repository at this point in the history
  14. soundwire: debugfs: add interface for BPT/BRA transfers

    Add code to show what codec drivers will need to do to enable BPT/BRA
    transfers. The only difference is to set the 'command_type' file to
    '1'. A zero-value will rely on regular read/write commands in Column0.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    9ab61c9 View commit details
    Browse the repository at this point in the history
  15. ASoC: rt711-sdca: add DP0 support

    DP0 is required for BPT/BRA transport.
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    afdfe60 View commit details
    Browse the repository at this point in the history
  16. ASoC: SOF: Intel: hda-sdw-bpt: add CHAIN_DMA support

    When the firmware is involved, the data can be transferred with a
    CHAIN_DMA on LNL+.
    
    The CHAIN_DMA needs to be programmed before the DMAs per the
    documentation. The states are not exactly symmetrical, on stop we must
    do a PAUSE and RESET.
    
    The FIFO size of 10ms was determined experimentally. With the minimum
    of 2ms, errors were reported by the codec, likely because of xruns.
    
    The code flow deals with the two TX and RX CHAIN_DMAs in symmetrical
    ways, i.e.
    alloc TX
    alloc RX
    enable TX
    enable RX
    disable RX
    disable TX
    free RX
    free TX
    
    Signed-off-by: Pierre-Louis Bossart <[email protected]>
    plbossart committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    3a9c2b9 View commit details
    Browse the repository at this point in the history