Skip to content

topology2: sdw-dmic-generic: fix channel map/cfg regression - #11258

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-sdw-dmic-tplg-invalid-chmap
Open

kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-sdw-dmic-tplg-invalid-chmap

Conversation

@kv2019i

@kv2019i kv2019i commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

The IncludeByKey.SDW_DMIC_PCM_CHANNELS + nested Define pattern introduced to set SDW_DMIC_CHANNEL_CFG/SDW_DMIC_CHANNEL_MAP is broken: outer constants ($CHANNEL_CONFIG_STEREO, $CHANNEL_MAP_STEREO, etc.) evaluate to 0 inside a Define block nested within IncludeByKey, overwriting the correct defaults from input_audio_format.conf with zeroes.

Fix by removing the broken intermediate variable initialization entirely and replacing all uses of $SDW_DMIC_CHANNEL_CFG/$SDW_DMIC_CHANNEL_MAP in format blocks with direct IncludeByKey.SDW_DMIC_PCM_CHANNELS blocks using the correct constants. The 2-channel (stereo) case is handled by the existing defaults in input_audio_format.conf / output_audio_format.conf, so no explicit entry is needed for it.

This restores token1904 (in_ch_map) to 0xffffff10 and token1905 (in_ch_cfg) to 1 for the alh-copier.Capture-SmartMic.0 widget in ARL/MTL SDW DMIC topologies.

Fixes: 87dc581 ("topology2: sdw-dmic-generic: add multiple DMIC number support")
Link: thesofproject/linux#5960

The IncludeByKey.SDW_DMIC_PCM_CHANNELS + nested Define pattern introduced
to set SDW_DMIC_CHANNEL_CFG/SDW_DMIC_CHANNEL_MAP is broken: outer constants
($CHANNEL_CONFIG_STEREO, $CHANNEL_MAP_STEREO, etc.) evaluate to 0 inside a
Define block nested within IncludeByKey, overwriting the correct defaults from
input_audio_format.conf with zeroes.

Fix by removing the broken intermediate variable initialization entirely and
replacing all uses of $SDW_DMIC_CHANNEL_CFG/$SDW_DMIC_CHANNEL_MAP in format
blocks with direct IncludeByKey.SDW_DMIC_PCM_CHANNELS blocks using the correct
constants. The 2-channel (stereo) case is handled by the existing defaults in
input_audio_format.conf / output_audio_format.conf, so no explicit entry is
needed for it.

This restores token1904 (in_ch_map) to 0xffffff10 and token1905 (in_ch_cfg)
to 1 for the alh-copier.Capture-SmartMic.0 widget in ARL/MTL SDW DMIC
topologies.

Fixes: 87dc581 ("topology2: sdw-dmic-generic: add multiple DMIC number support")
Link: thesofproject/linux#5960
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i
kv2019i requested review from jsarha and ranj063 as code owners October 2, 2026 11:21
Copilot AI balanced review requested due to automatic review settings October 2, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The direct mappings are consistent, preserve stereo defaults, and address the reported regression.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes the SoundWire DMIC channel configuration regression affecting stereo capture.

Changes:

  • Removes broken nested Define channel-map initialization.
  • Applies channel-specific mappings directly while preserving stereo defaults.
File Description
tools/​topology/​topology2/​platform/​intel/​sdw-dmic-generic.conf Corrects channel configuration and maps for SDW DMIC formats.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kv2019i

kv2019i commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@bardliao @singalsu @ujfalusi Is there some alsa-utils/lib patch we are missing to support variable expansion in this kind of nested default sections? This PR is needed with the versions we use in CI (and which is used for releases), e.g. commits in sof/scripts/build-alsa-tools.sh .

"1" {
in_ch_cfg $CHANNEL_CONFIG_MONO
in_ch_map $CHANNEL_MAP_MONO
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kv2019i @ujfalusi Do we need the "2" case?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this handling the corner cases, i.e. stereo would be default ?

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, 1 open TBC

@kv2019i

kv2019i commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

Still looking at the possibility that newer alsatplg can support variable expansion like this. This definitely does not work with fixed alsa-lib version in SOF main. Additionally, recent alsa-lib has broken SOF topology2 build, so testing anything newer is not possible ATM -- filed #11263 for this.

I did test the last working alsa-lib commit (3c4b16a1f6e49aac20b1b9fe2a2eb333eaf3efb0) and with that, thesofproject/linux#5960 still occurs.

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.

5 participants