Skip to content

ASoC: get sdw dmic number for Intel platforms#5843

Open
bardliao wants to merge 2 commits into
thesofproject:topic/sof-devfrom
bardliao:sdca-mic-num
Open

ASoC: get sdw dmic number for Intel platforms#5843
bardliao wants to merge 2 commits into
thesofproject:topic/sof-devfrom
bardliao:sdca-mic-num

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

The topology needs to set the DMIC channel number according to the number of transducers connected to the codec. This information can be provided via the DAI link name for proper topology selection.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for deriving the SoundWire DMIC channel/transducer count from SDCA firmware-described entities and appending that count to Intel SOF SoundWire DAI link names, enabling more precise topology selection based on connected microphone transducers.

Changes:

  • Add sdca_get_mic_count() to parse SDCA Function entity metadata and return a microphone transducer count.
  • Update Intel SOF SoundWire machine driver to query SDCA SmartMic functions and suffix the DAI link name with -<N>ch.
  • Expose the new helper via include/sound/sdca.h and import the SDCA symbol namespace in the machine driver.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
sound/soc/sdca/sdca_functions.c Adds sdca_get_mic_count() to parse SDCA entity properties and extract microphone transducer count.
sound/soc/intel/boards/sof_sdw.c Appends SDCA-derived mic channel count to SoundWire capture link name for topology matching; adds SDCA namespace import.
include/sound/sdca.h Exposes sdca_get_mic_count() in the public SDCA header.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sound/soc/intel/boards/sof_sdw.c
Comment thread sound/soc/sdca/sdca_functions.c
Comment on lines +218 to +239
num_entities = fwnode_property_count_u32(function_node,
"mipi-sdca-entity-id-list");
if (num_entities <= 0) {
dev_err(&slave->dev,
"%pfwP: no entity list found for function type %u\n",
function_node, function->type);
return -EINVAL;
}

entity_list = kcalloc(num_entities, sizeof(*entity_list), GFP_KERNEL);
if (!entity_list)
return -ENOMEM;

ret = fwnode_property_read_u32_array(function_node,
"mipi-sdca-entity-id-list",
entity_list, num_entities);
if (ret) {
dev_err(&slave->dev,
"%pfwP: failed to read entity id list for function type %u: %d\n",
function_node, function->type, ret);
return -EINVAL;
}
Comment thread include/sound/sdca.h Outdated
#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)

void sdca_lookup_functions(struct sdw_slave *slave);
int sdca_get_mic_count(struct sdw_slave *slave, struct sdca_function_desc *function);
Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread sound/soc/sdca/sdca_functions.c
Comment thread sound/soc/sdca/sdca_functions.c
Comment thread sound/soc/sdca/sdca_functions.c Outdated
Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Comment thread include/sound/sdca.h
Comment on lines 65 to 69
void sdca_lookup_functions(struct sdw_slave *slave);
int sdca_get_mic_count(struct sdw_slave *slave, struct sdca_function_desc *function);
void sdca_lookup_swft(struct sdw_slave *slave);
void sdca_lookup_interface_revision(struct sdw_slave *slave);
bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
Copilot AI review requested due to automatic review settings July 15, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

dev_info(&slave->dev,
"SDCA function %s entity %s: mipi-sdca-terminal-type=%#x mipi-sdca-terminal-transducer-count=%u\n",
function->name, entity_label, terminal_type, transducer_count);
break;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Won't fwnode_handle_put(entity_node); be called after break?

Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Comment thread include/sound/sdca.h Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread sound/soc/sdca/sdca_functions.c Outdated
Comment thread sound/soc/sdca/sdca_functions.c Outdated
Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread sound/soc/sdca/sdca_functions.c Outdated
Comment thread sound/soc/intel/boards/sof_sdw.c
Comment thread sound/soc/intel/boards/sof_sdw.c
We can get how many mic transducers are connected to the codec.
The information will be used for selecting the topology with proper dmic
channel number.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copilot AI review requested due to automatic review settings July 15, 2026 12:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Comment on lines +1047 to +1053
peripheral = sof_sdw_get_peripheral_by_codec_name(sof_end->codec_name);
if (!peripheral) {
/* Component might not be registered yet; keep default link name */
dev_dbg(dev, "peripheral not available for codec %s\n",
sof_end->codec_name);
continue;
}
Comment thread sound/soc/intel/boards/sof_sdw.c Outdated
Comment on lines +1059 to +1061
sdw_mic_num = sdca_get_mic_count(peripheral, &peripheral->sdca_data.function[k]);
dev_dbg(dev, "%s mic num %d\n", sof_end->codec_name, sdw_mic_num);
if (sdw_mic_num > 0 && !strstr(name, "ch")) {
The commit get the sdca sdw dmic number form the
mipi-sdca-cluster-channel-id property.
The dai link name will be used to select the function topology with a
proper dmic channel number.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copilot AI review requested due to automatic review settings July 15, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +1048 to +1057
peripheral = sof_sdw_get_peripheral_by_codec_name(codec_name);
if (!peripheral) {
/*
* asoc_sdw_parse_sdw_endpoints() is already checked
* peripheral is not NULL, so this should never happen.
*/
dev_err(dev, "Can't get peripheral for codec %s\n",
sof_end->codec_name);
return -EINVAL;
}
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