Skip to content

[RFC] ASoC: Intel: Use sof_sdw as default sdw machine driver#5408

Closed
bardliao wants to merge 4 commits intothesofproject:topic/sof-devfrom
bardliao:use_sof_sdw_as_default_sdw_machine
Closed

[RFC] ASoC: Intel: Use sof_sdw as default sdw machine driver#5408
bardliao wants to merge 4 commits intothesofproject:topic/sof-devfrom
bardliao:use_sof_sdw_as_default_sdw_machine

Conversation

@bardliao
Copy link
Copy Markdown
Collaborator

@bardliao bardliao commented May 7, 2025

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.

bardliao added 4 commits May 7, 2025 18:22
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>
@bardliao bardliao requested review from Copilot, ranj063 and ujfalusi May 7, 2025 11:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Copilot AI May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cast from 'mach->links' to a non-const pointer bypasses const-correctness; verify that modifications to mach_params.links are intentional and safe.

Copilot uses AI. Check for mistakes.
u8 num_endpoints;
const struct snd_soc_acpi_endpoint *endpoints;
const char *name_prefix;
char *name_prefix;
Copy link

Copilot AI May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing 'name_prefix' from a const type to mutable may lead to unintended modifications—ensure this change is required for the runtime formatting logic.

Suggested change
char *name_prefix;
const char *name_prefix;

Copilot uses AI. Check for mistakes.
struct snd_soc_acpi_link_adr {
const u32 mask;
const u32 num_adr;
u32 mask;
Copy link

Copilot AI May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
u32 mask;
const u32 mask;

Copilot uses AI. Check for mistakes.
@bardliao bardliao closed this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants