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

ASoC: soc_sdw_utils: skip the endpoint that doesn't present #5188

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

Commits on Sep 20, 2024

  1. ASoC/soundwire: remove sdw_slave_extended_id

    This structure is used to copy information from the 'sdw_slave'
    structures, it's better to create a flexible array of 'sdw_slave'
    pointers and directly access the information. This will also help
    access additional information stored in the 'sdw_slave' structure,
    such as an SDCA context.
    
    This patch does not add new functionality, it only modified how the
    information is retrieved.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    b9e2169 View commit details
    Browse the repository at this point in the history
  2. ASoC: SDCA: add initial module

    Add new module for SDCA (SoundWire Device Class for Audio) support.
    For now just add a parser to identify the SDCA revision and the
    function mask.
    
    Note that the SDCA definitions and related MIPI DisCo properties are
    defined only for ACPI platforms and extracted with _DSD helpers. There
    is currently no support for Device Tree in the specification, the
    'depends on ACPI' reflects this design limitation. This might change
    in a future revision of the specification but for SDCA 1.0 ACPI is the
    only supported type of platform firmware.
    
    The SDCA library is defined with static inline fallbacks, which will
    allow for unconditional addition of SDCA support in common parts of
    the code.
    
    The design follows a four-step process:
    
    1) Basic information related to Functions is extracted from MIPI DisCo
    tables and stored in the 'struct sdw_slave'. Devm_ based memory
    allocation is not allowed at this point prior to a driver probe, so we only
    store the function node, address and type.
    
    2) When a codec driver probes, it will register subdevices for each
    Function identified in phase 1)
    
    3) a driver will probe for each subdevice and addition parsing/memory
    allocation takes place at this level. devm_ based allocation is highly
    encouraged to make error handling manageable.
    
    4) Before the peripheral device becomes physically attached, register
    access is not permitted and the regmaps are cache-only. When
    peripheral device is enumerated, the bus level uses the
    'update_status' notification; after optional device-level
    initialization, the codec driver will notify each of the subdevices so
    that they can start interacting with the hardware.
    
    Note that the context extracted in 1) should be arguably be handled
    completely in the codec driver probe. That would however make it
    difficult to use the ACPI information for machine quirks, and
    e.g. select different machine driver and topologies as done for the
    RT712_VB handling later in the series. To make the implementation of
    quirks simpler, this patchset extracts a minimal amount of context
    (interface revision and number/type of Functions) before the codec
    driver probe, and stores this context in the scope of the 'struct
    sdw_slave'.
    
    The SDCA library can also be used in a vendor-specific driver without
    creating subdevices, e.g. to retrieve the 'initialization-table'
    values to write platform-specific values as needed.
    
    For more technical details, the SDCA specification is available for
    public downloads at https://www.mipi.org/mipi-sdca-v1-0-download
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    a790e8e View commit details
    Browse the repository at this point in the history
  3. soundwire: slave: lookup SDCA version and functions

    Use SDCA helpers to get the basic information and store it in the
    slave context. The information will be optionally be used in codec
    drivers to register sub-devices for each Function.
    
    When platforms are not based on ACPI the helpers do absolutely
    nothing.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    9d2136b View commit details
    Browse the repository at this point in the history
  4. ASoC: SDCA: add quirk function for RT712_VB match

    Add a generic match function for quirks, chances are we are going to
    have lots of those...
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    e1ef89d View commit details
    Browse the repository at this point in the history
  5. ASoC: rt712-sdca: detect the SMART_MIC function during the probe stage

    We shouldn't do any devm_ based allocation in the io_init(), this need
    to happen in the probe(). Luckily, we now have an SDCA helper to look
    in ACPI tables if a SMART_MIC function is exposed.
    
    FIXME: the registers are not well handled today, the regmap lists
    registers which are not really supported in all platforms. The regmap
    needs to throw an error if those registers are accessed without
    existing.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    6fe4220 View commit details
    Browse the repository at this point in the history
  6. ASoC: soc-acpi: introduce new 'machine check' callback

    The existing machine_quirk() returns a pointer to a soc_acpi_mach
    structure.
    For SoundWire/SDCA support, we need a slightly different
    functionality where a quirk function either validates or NACKs an
    initial selection, based on additional firmware/DMI information.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    328186f View commit details
    Browse the repository at this point in the history
  7. ASoC: sdw_utils: add SmartMic DAI for RT713 VB

    In theory the dailinks are created based on the number of endpoints
    reported in ACPI match tables, so it should harmless to add a new
    dailink: RT713 VA would not use it since it has only 2 endpoints.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    8c6785e View commit details
    Browse the repository at this point in the history
  8. ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper

    Add a filter to skip the RT172 VB configuration if a SmartMic Function
    is not found in the SDCA descriptors.
    
    If the ACPI information is incorrect this can only be quirked further
    with DMI information.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    56a701a View commit details
    Browse the repository at this point in the history
  9. ASoC: SOF: Intel: hda: use machine_check() for SoundWire

    Use the new machine_check() callback to select an alternate topology
    for RT712-VB devices.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    3dee942 View commit details
    Browse the repository at this point in the history
  10. ASoC: SDCA: add helpers to handle SDCA interrupt sources

    All existing SDCA codec drivers implement their own custom SDCA
    interrupt processing. The registers are standard, but actions
    resulting from an interrupt are specific, which really calls for a
    change in partitioning with common parts implemented once.
    
    In addition, SDCA functions may be supported by separate drivers, but
    the interrupt processing is handled at the SoundWire peripheral
    level. This means that SDCA function drivers need a new interface to
    register an interrupt source with the SDCA device interrupt handler,
    with the ability to provide a context to be used by a callback invoked
    in a standard hw-agnostic interrupt handler.
    
    Note: these helpers need to be in a dedicated module to avoid circular
    dependencies. The SoundWire bus code now relies on snd-soc-sdca, so we
    cannot call SoundWire bus functions from snd-soc-sdca. This is really
    annoying and maybe we have to split the SoundWire bus code from the
    slave probe code.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    477bc9a View commit details
    Browse the repository at this point in the history
  11. ASoC: rt711-sdca: use generic SDCA interrupt handler

    Rather than open-code, use the generic SDCA interrupt handler after
    registering the interrupt sources and callbacks.
    
    FIXME: Need to figure out what actions need to be taken for INT0 and
    INT8.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    9a3fdbc View commit details
    Browse the repository at this point in the history
  12. ASoC: rt712-sdca: use generic SDCA interrupt handler

    Rather than open-code, use the generic SDCA interrupt handler after
    registering the interrupt sources and callbacks.
    
    FIXME: Need to figure out what actions need to be taken for INT0 and
    INT8.
    
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    plbossart authored and bardliao committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    7a40aaf View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2024

  1. ASoC: soc_sdw_utils: skip the endpoint that doesn't present

    A codec endpoint may not be used. We could check the present SDCA
    functions to know if the endpoint is used or not. Skip the endpoint
    which is not used.
    
    Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
    bardliao committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    8cdf02c View commit details
    Browse the repository at this point in the history