[RFC] ASoC: Intel: Use sof_sdw as default sdw machine driver#5408
[RFC] ASoC: Intel: Use sof_sdw as default sdw machine driver#5408bardliao wants to merge 4 commits intothesofproject:topic/sof-devfrom
Conversation
Currently, we use predefined snd_soc_acpi_link_adr tables to match the link adr from ACPI table to select the machine driver and the topology. However, with the mechanism, we need to create the snd_soc_acpi_link_adr table for each audio config. The sof_sdw machine driver is used by almost all Intel platforms with SOF and we can load required topology file dynamically today. In other words, we can use sof_sdw machine driver as the default machine driver for Intel SOF SoundWire codecs and no need to create snd_soc_acpi_link_adr table for every new audio configs. To achieve it, we need to edit the link adr data to match the data from the ACPI table.. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Currently, the SoundWire codec adr and endpoint mapping information is defined separately for each platform. However, the mapping is codec related only. Adding it in a header file allow machine driver to get the mapping without knowing the platform information. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The sof_sdw_get_tplg_files function is a callback of snd_soc_acpi_mach. Export it and let it can be set by other modules. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Get the required machine date aka SoundWire codec adr from the acpi table. And select the default SoundWire machine driver if no SoundWire machine driver is selected. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the default SoundWire machine driver setup for Intel and AMD platforms by utilizing the sof_sdw machine driver and adjusting the ACPI structures accordingly. Key changes include adding a new helper function for ACPI address device lookup, updating pointer types with explicit casts to match modified header definitions, and exposing the topology function via EXPORT_SYMBOL_GPL.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sound/soc/sof/intel/hda.c | Adds the find_acpi_adr_device() helper and updates SDW machine selection logic |
| sound/soc/sof/amd/acp-common.c | Updates pointer casts for mach_params.links to match header changes |
| sound/soc/intel/common/sof-function-topology-lib.c | Exports sof_sdw_get_tplg_files for broader kernel usage |
| sound/soc/amd/ps/pci-ps.c | Adjusts mach_params.links assignment with explicit cast |
| include/sound/soc-acpi.h | Removes const qualifiers from several struct fields to allow runtime modifications |
| include/linux/soundwire/sdw_peripherals.h | Introduces static definitions for endpoints and support_adr array |
| } | ||
| if (mach && mach->link_mask) { | ||
| mach->mach_params.links = mach->links; | ||
| mach->mach_params.links = (struct snd_soc_acpi_link_adr *)mach->links; |
There was a problem hiding this comment.
The cast from 'mach->links' to a non-const pointer bypasses const-correctness; verify that modifications to mach_params.links are intentional and safe.
| u8 num_endpoints; | ||
| const struct snd_soc_acpi_endpoint *endpoints; | ||
| const char *name_prefix; | ||
| char *name_prefix; |
There was a problem hiding this comment.
Changing 'name_prefix' from a const type to mutable may lead to unintended modifications—ensure this change is required for the runtime formatting logic.
| char *name_prefix; | |
| const char *name_prefix; |
| struct snd_soc_acpi_link_adr { | ||
| const u32 mask; | ||
| const u32 num_adr; | ||
| u32 mask; |
There was a problem hiding this comment.
Removing the const qualifier from 'mask' in the snd_soc_acpi_link_adr structure allows modification; confirm that this change does not compromise the expected immutability of the value.
| u32 mask; | |
| const u32 mask; |
Get the ACPI sdw link adr and create the acpi mach to use the sof_sdw machine driver as the default sdw machine driver. And we don't need to create new items in the acpi mach table for enabling new audio configs.