Skip to content

topology2: add SDW echo reference function topologies#10600

Open
bardliao wants to merge 7 commits intothesofproject:mainfrom
bardliao:topology2-echo-ref-alternative
Open

topology2: add SDW echo reference function topologies#10600
bardliao wants to merge 7 commits intothesofproject:mainfrom
bardliao:topology2-echo-ref-alternative

Conversation

@bardliao
Copy link
Collaborator

@bardliao bardliao commented Mar 5, 2026

Add SoundWire echo reference function topologies. Those topologies can be connected to the base SoundWire jack/amp function topologies. Those with ref-dai suffix contain the Loopback_Virtual dai. The Loopback_Virtual dai should be created once and only once in the topology set. User can select the topology set by kernel module parameter.

bardliao added 7 commits March 5, 2026 15:11
This is a preparation commit for creating a stand alone echo reference topology.
module-copier.1.12 is used by the echo reference, but it is harmless to
create it and connect it to the no echo reference topology. And then we
can connect the echo reference pipeline to module-copier.1.12 is echo
reference is needed.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
This is a preparation commit for creating a stand alone echo reference topology.
module-copier.1.22 is used by the echo reference, but it is harmless to
create it and connect it to the no echo reference topology. And then we
can connect the echo reference pipeline to module-copier.1.22 is echo
reference is needed.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The spk echo refference pipeline ID 22 is the same as 2nd spk pipeline
ID. Follow the convention that route and pipeline index start from pcm
id * 10 to set it to 120.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The Loopback_Virtual DAI's pipeline ID should be either spk echo
reference pipeline or jack echo reference pipeline. Use macro to select
one of them.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Currently, we implement the echo reference pipeline, widgets, routes in
the SoundWire config files. It is hard to create a stand alone echo
reference topology for the function topology usages. This commit moves
the echo reference part from the original config file and include the
new echo reference in the original file.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
sdw-amp-echo-ref.conf and sdw-jack-echo-ref.conf are included in the
sdw-amp-generic.conf and sdw-jack-generic.conf if needed. But for the
function topology usages, we will create the jack/amp function topology
and the corresponding echo reference topology separately.
Move to cavs-sdw.conf allow us create he jack/amp function topology
and the corresponding echo reference topology separately

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Add SoundWire echo reference function topologies.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copy link
Contributor

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

Adds new SoundWire echo reference “function topology” fragments (jack/speaker) and optional Loopback_Virtual DAI support, intended to be selectable as part of topology sets.

Changes:

  • Add new SDCA generic build targets for amp/jack echo reference variants (including *-ref-dai).
  • Refactor jack/amp generic configs to always provide module-copier tap points and move echo-ref pipelines/PCMs into dedicated sdw-*-echo-ref.conf includes.
  • Update cavs-sdw.conf to conditionally include the new echo-ref fragments and to parameterize the Loopback_Virtual DAI pipeline index.

Reviewed changes

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

Show a summary per file
File Description
tools/topology/topology2/production/tplg-targets-sdca-generic.cmake Adds new SDCA targets for echo reference and echo-ref-dai variants.
tools/topology/topology2/platform/intel/sdw-jack-generic.conf Makes module-copier tap and routing unconditional for jack playback.
tools/topology/topology2/platform/intel/sdw-jack-echo-ref.conf New jack echo reference capture pipeline + PCM definition.
tools/topology/topology2/platform/intel/sdw-amp-generic.conf Makes module-copier tap and routing unconditional for speaker playback.
tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf New speaker echo reference capture pipeline + PCM definition.
tools/topology/topology2/cavs-sdw.conf Adds includes for new echo-ref fragments and adjusts Loopback_Virtual DAI index selection.

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

Comment on lines 757 to 799
@@ -783,36 +786,16 @@ IncludeByKey.PASSTHROUGH {
}
}
"false" {
IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK {
"true" {
IncludeByKey.USE_DAX {
"true" {
Object.Base.route [
{
source "dolby-dax.21.1"
sink "alh-copier.$SDW_SPK_STREAM.0"
}
]
}
"false" {
Object.Base.route [
{
source "drc.21.1"
sink "alh-copier.$SDW_SPK_STREAM.0"
}
]
}
}
Object.Base.route [
{
source "gain.21.1"
sink "module-copier.21.22"
}
"false" {
Object.Base.route [
{
source "gain.21.1"
sink "alh-copier.$SDW_SPK_STREAM.0"
}
]
{
source "module-copier.21.22"
sink "alh-copier.$SDW_SPK_STREAM.0"
}
}
]
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

This change routes speaker playback through module-copier.21.22 unconditionally for all non-passthrough configurations (previously the module-copier stage was gated by SDW_SPK_ECHO_REF). If echo reference is not enabled, this introduces an extra always-on component/copy stage with added DSP/memory cost. Consider keeping module-copier routing conditional (e.g., only when SDW_SPK_ECHO_REF and/or SDW_ECHO_REF_DAI are enabled) so the default speaker path remains as lightweight as before.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +37
SDW_AMP_FEEDBACK=false,SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"

"cavs-sdw\;sof-sdca-amp-ref-dai\;SDW_JACK=false,NUM_HDMIS=0,JACK_RATE=48000,\
SDW_AMP_FEEDBACK=false,SDW_ECHO_REF_DAI=true,SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The new sof-sdca-amp-ref* targets enable SDW_SPK_ECHO_REF but do not set NUM_SDW_AMP_LINKS. cavs-sdw.conf defaults NUM_SDW_AMP_LINKS=0, so platform/intel/sdw-amp-generic.conf (which defines module-copier.21.22 used by sdw-amp-echo-ref.conf) will not be included, likely resulting in an invalid/failed topology build. Set NUM_SDW_AMP_LINKS (and any required SDW_SPK_STREAM vars) for these targets, or make the echo-ref topology self-contained so it does not depend on sdw-amp-generic.conf being included.

Suggested change
SDW_AMP_FEEDBACK=false,SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"
"cavs-sdw\;sof-sdca-amp-ref-dai\;SDW_JACK=false,NUM_HDMIS=0,JACK_RATE=48000,\
SDW_AMP_FEEDBACK=false,SDW_ECHO_REF_DAI=true,SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"
SDW_AMP_FEEDBACK=false,NUM_SDW_AMP_LINKS=1,SDW_SPK_STREAM=Playback-SmartAmp,\
SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"
"cavs-sdw\;sof-sdca-amp-ref-dai\;SDW_JACK=false,NUM_HDMIS=0,JACK_RATE=48000,\
SDW_AMP_FEEDBACK=false,NUM_SDW_AMP_LINKS=1,SDW_SPK_STREAM=Playback-SmartAmp,\
SDW_ECHO_REF_DAI=true,SDW_SPK_ECHO_REF=true,SDW_SPK_ECHO_REF_PCM_ID=12"

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +40
"cavs-sdw\;sof-sdca-jack-ref-dai\;SDW_JACK=false,NUM_HDMIS=0,JACK_RATE=48000,\
SDW_ECHO_REF_DAI=true,SDW_JACK_ECHO_REF=true,SDW_JACK_ECHO_REF_PCM_ID=11"
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

sof-sdca-jack-ref-dai sets SDW_JACK=false but enables SDW_JACK_ECHO_REF. With SDW_JACK=false, cavs-sdw.conf will not include platform/intel/sdw-jack-generic.conf, so module-copier.1.12 (referenced by sdw-jack-echo-ref.conf) and the jack playback routing changes will be missing, likely making this topology invalid. Either keep SDW_JACK enabled for this target (and set the needed stream vars), or move the required module-copier/tap wiring into the echo-ref conf so it can stand alone.

Suggested change
"cavs-sdw\;sof-sdca-jack-ref-dai\;SDW_JACK=false,NUM_HDMIS=0,JACK_RATE=48000,\
SDW_ECHO_REF_DAI=true,SDW_JACK_ECHO_REF=true,SDW_JACK_ECHO_REF_PCM_ID=11"
"cavs-sdw\;sof-sdca-jack-ref-dai\;NUM_HDMIS=0,JACK_RATE=48000,\
SDW_ECHO_REF_DAI=true,SDW_JACK_ECHO_REF=true,SDW_JACK_ECHO_REF_PCM_ID=11,\
SDW_JACK_OUT_STREAM=Playback-SimpleJack,SDW_JACK_IN_STREAM=Capture-SimpleJack"

Copilot uses AI. Check for mistakes.
Comment on lines 677 to +690
IncludeByKey.PASSTHROUGH {
"false" {
IncludeByKey.SDW_JACK_ECHO_REF {
IncludeByKey.USE_DAX {
"true" {
IncludeByKey.USE_DAX {
"true" {
Object.Base.route [
{
source "dolby-dax.1.1"
sink "module-copier.1.12"
}
{
source "module-copier.1.12"
sink "alh-copier.$SDW_JACK_OUT_STREAM.0"
}
]
Object.Base.route [
{
source "dolby-dax.1.1"
sink "module-copier.1.12"
}
"false" {
Object.Base.route [
{
source "gain.1.1"
sink "module-copier.1.12"
}
{
source "module-copier.1.12"
sink "alh-copier.$SDW_JACK_OUT_STREAM.0"
}
]
{
source "module-copier.1.12"
sink "alh-copier.$SDW_JACK_OUT_STREAM.0"
}
}
]
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

This change makes the jack playback path always go through module-copier.1.12 (previously it was only inserted when SDW_JACK_ECHO_REF was enabled). That adds an always-on extra component/copy stage for all non-passthrough jack topologies, even when no echo reference is used. Consider reintroducing conditional routing (e.g., gate the module-copier stage on SDW_JACK_ECHO_REF and/or SDW_ECHO_REF_DAI) to avoid unnecessary DSP load and memory use in the default case.

Copilot uses AI. Check for mistakes.
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