• Charles Keepax's avatar
    ASoC: Intel: sof-sdw: Add new code for parsing the snd_soc_acpi structs · 27fd36ae
    Charles Keepax authored
    The current machine driver code has a lot of loops parsing through
    the ACPI structs (snd_soc_acpi_link_adr, snd_soc_acpi_adr_device,
    snd_soc_acpi_endpoint), this makes it hard to understand exactly
    what information is being extracted and for what purposes. As well
    as being slightly inefficient, as the same information is looked
    up multiple times. There are also some issues with the handling
    of multiple endpoints on a single device, only the first of the
    snd_soc_acpi_endpoint structures is currently fully processed by the
    driver. This means doing things like aggregating the second endpoint
    on a device with another device are not currently possible.
    
    Add new parsing code that will count the devices and endpoints, parse
    them into an intermediate datastructure, and then use that to create
    the DAI links. This patch does not actually utilise the results of
    the parsing, items will be moved across in the following patches.
    
    This parsing is based around two new structures which are temporarily
    allocated whilst parsing. Firstly, sof_sdw_endpoint, which represents
    a specific endpoint for audio on a device and is more or less directly
    equivalent to snd_soc_acpi_endpoint. Secondly, sof_sdw_dailink
    which represents a DAI link and contains a linked list of one or
    more sof_sdw_endpoints. A single trip through the snd_soc_acpi data
    structures is used to populate these.
    
    One important point to note here is the use of the num field in
    snd_soc_acpi_endpoint to address sof_sdw_dai_info array in the
    sof_sdw_codec_info struct. This expects a one to one mapping between
    endpoints on a device and dai infos. It would be fine for a specific
    system to not specify an endpoint for all of the dai infos available,
    but two endpoints mapping to the same dai info would make not sense.
    Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
    Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
    Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://msgid.link/r/20240326160429.13560-19-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    27fd36ae
sof_sdw.c 57.7 KB