From 768240790e90132fc1b43f4a1e5d85b06b1d86b2 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 24 Feb 2026 20:03:32 +0800 Subject: [PATCH 1/3] topology2: split echo reference part from sdw topologies 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. The commit also use macros to set the echo reference IDs to fix the issue that both the 2nd SoundWire amp and the echo reference use the same pipeline ID. Signed-off-by: Bard Liao --- .../platform/intel/sdw-amp-echo-ref.conf | 125 +++++++++++++ .../platform/intel/sdw-amp-generic.conf | 111 +----------- .../platform/intel/sdw-jack-echo-ref.conf | 167 ++++++++++++++++++ .../platform/intel/sdw-jack-generic.conf | 153 +--------------- 4 files changed, 294 insertions(+), 262 deletions(-) create mode 100644 tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf create mode 100644 tools/topology/topology2/platform/intel/sdw-jack-echo-ref.conf diff --git a/tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf b/tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf new file mode 100644 index 000000000000..7b75a233c7f4 --- /dev/null +++ b/tools/topology/topology2/platform/intel/sdw-amp-echo-ref.conf @@ -0,0 +1,125 @@ + +Define { + SDW_SPK_ECHO_REF_PCM_ID 12 + SDW_SPK_ECHO_REF_PIPELINE_ID 120 +} + +IncludeByKey.PASSTHROUGH { + "false" { + IncludeByKey.SDW_SPK_ECHO_REF { + "true" { + IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK { + "true" { + IncludeByKey.USE_DAX { + "true" { + Object.Base.route [ + { + source "dolby-dax.21.1" + sink "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + } + { + source "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + sink "alh-copier.$SDW_SPK_STREAM.0" + } + ] + } + "false" { + Object.Base.route [ + { + source "drc.21.1" + sink "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + } + { + source "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + sink "alh-copier.$SDW_SPK_STREAM.0" + } + ] + } + } + } + "false" { + Object.Base.route [ + { + source "gain.21.1" + sink "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + } + { + source "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + sink "alh-copier.$SDW_SPK_STREAM.0" + } + ] + } + } + } + } + } +} + +IncludeByKey.SDW_SPK_ECHO_REF { + "true" { + #module-copier ID should match SDW_SPK_ECHO_REF_PIPELINE_ID + Object.Widget.module-copier."120" { + index 21 + num_input_pins 1 + num_output_pins 2 + num_input_audio_formats 1 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] + } + + Object.Pipeline { + siggen-host-copier-capture [ + { + direction "capture" + index $SDW_SPK_ECHO_REF_PIPELINE_ID + Object.Widget.host-copier."1" { + stream_name "Speaker Echo Reference" + pcm_id $SDW_SPK_ECHO_REF_PCM_ID + } + Object.Widget.siggen."1" {} + } + ] + } + + Object.PCM.pcm [ + { + name "Speaker Echo Reference" + id $SDW_SPK_ECHO_REF_PCM_ID + direction "capture" + Object.Base.fe_dai.1 { + name "Speaker Echo Reference" + } + Object.PCM.pcm_caps.1 { + name "Speaker Echo Reference" + formats 'S16_LE,S24_LE,S32_LE' + } + } + ] + + Object.Base.route [ + { + source "alh-copier.Loopback_Virtual.25" + sink "siggen.$SDW_SPK_ECHO_REF_PIPELINE_ID.1" + } + { + source "module-copier.21.$SDW_SPK_ECHO_REF_PIPELINE_ID" + sink "siggen.$SDW_SPK_ECHO_REF_PIPELINE_ID.1" + } + { + source "siggen.$SDW_SPK_ECHO_REF_PIPELINE_ID.1" + sink "host-copier.$SDW_SPK_ECHO_REF_PCM_ID.capture" + } + ] + } # SDW_SPK_ECHO_REF true +} diff --git a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf index ae01992bcad1..cb885ab6fdc2 100644 --- a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf @@ -13,7 +13,6 @@ Define { AMP_FEEDBACK_CH_PER_LINK 2 SDW_AMP_FEEDBACK true AMP_PLAYBACK_NAME 'Speaker Playback' - SDW_SPK_ECHO_REF_PCM_ID 12 } # include deep buffer config if buffer size is in 1 - 1000 ms. @@ -738,50 +737,6 @@ Object.PCM.pcm [ IncludeByKey.PASSTHROUGH { "false" { IncludeByKey.SDW_SPK_ECHO_REF { - "true" { - IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK { - "true" { - IncludeByKey.USE_DAX { - "true" { - Object.Base.route [ - { - source "dolby-dax.21.1" - sink "module-copier.21.22" - } - { - source "module-copier.21.22" - sink "alh-copier.$SDW_SPK_STREAM.0" - } - ] - } - "false" { - Object.Base.route [ - { - source "drc.21.1" - sink "module-copier.21.22" - } - { - source "module-copier.21.22" - sink "alh-copier.$SDW_SPK_STREAM.0" - } - ] - } - } - } - "false" { - Object.Base.route [ - { - source "gain.21.1" - sink "module-copier.21.22" - } - { - source "module-copier.21.22" - sink "alh-copier.$SDW_SPK_STREAM.0" - } - ] - } - } - } "false" { IncludeByKey.SDW_SPK_ENHANCED_PLAYBACK { "true" { @@ -1047,69 +1002,5 @@ IncludeByKey.SDW_AMP_FEEDBACK { } IncludeByKey.SDW_SPK_ECHO_REF { - "true" { - Object.Widget.module-copier."22" { - index 21 - num_input_pins 1 - num_output_pins 2 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - - Object.Pipeline { - siggen-host-copier-capture [ - { - direction "capture" - index 22 - Object.Widget.host-copier."1" { - stream_name "Speaker Echo Reference" - pcm_id $SDW_SPK_ECHO_REF_PCM_ID - } - Object.Widget.siggen."1" {} - } - ] - } - - Object.PCM.pcm [ - { - name "Speaker Echo Reference" - id $SDW_SPK_ECHO_REF_PCM_ID - direction "capture" - Object.Base.fe_dai.1 { - name "Speaker Echo Reference" - } - Object.PCM.pcm_caps.1 { - name "Speaker Echo Reference" - formats 'S16_LE,S24_LE,S32_LE' - } - } - ] - - Object.Base.route [ - { - source "alh-copier.Loopback_Virtual.25" - sink "siggen.22.1" - } - { - source "module-copier.21.22" - sink "siggen.22.1" - } - { - source "siggen.22.1" - sink "host-copier.$SDW_SPK_ECHO_REF_PCM_ID.capture" - } - ] - } # SDW_SPK_ECHO_REF true + "true" "platform/intel/sdw-amp-echo-ref.conf" } diff --git a/tools/topology/topology2/platform/intel/sdw-jack-echo-ref.conf b/tools/topology/topology2/platform/intel/sdw-jack-echo-ref.conf new file mode 100644 index 000000000000..44dfa01d4f6e --- /dev/null +++ b/tools/topology/topology2/platform/intel/sdw-jack-echo-ref.conf @@ -0,0 +1,167 @@ + +Define { + SDW_JACK_ECHO_REF_PCM_ID 11 + SDW_JACK_ECHO_REF_PIPELINE_ID 110 +} + +IncludeByKey.PASSTHROUGH { + "false" { + IncludeByKey.SDW_JACK_ECHO_REF { + "true" { + IncludeByKey.USE_DAX { + "true" { + Object.Base.route [ + { + source "dolby-dax.1.1" + sink "module-copier.1.$SDW_JACK_ECHO_REF_PIPELINE_ID" + } + { + source "module-copier.1.$SDW_JACK_ECHO_REF_PIPELINE_ID" + sink "alh-copier.$SDW_JACK_OUT_STREAM.0" + } + ] + } + "false" { + Object.Base.route [ + { + source "gain.1.1" + sink "module-copier.1.$SDW_JACK_ECHO_REF_PIPELINE_ID" + } + { + source "module-copier.1.$SDW_JACK_ECHO_REF_PIPELINE_ID" + sink "alh-copier.$SDW_JACK_OUT_STREAM.0" + } + ] + } + } + } + } + } +} + +IncludeByKey.SDW_JACK_ECHO_REF { + "true" { + #module-copier ID should match SDW_JACK_ECHO_REF_PIPELINE_ID + Object.Widget.module-copier."110" { + index 1 + num_input_pins 1 + num_output_pins 2 + num_input_audio_formats 1 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_rate $JACK_RATE + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_rate $JACK_RATE + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] + } + + Object.Pipeline { + siggen-host-copier-capture [ + { + direction "capture" + index $SDW_JACK_ECHO_REF_PIPELINE_ID + Object.Widget.host-copier."1" { + stream_name "Jack Echo Reference" + pcm_id $SDW_JACK_ECHO_REF_PCM_ID + num_input_audio_formats 1 + Object.Base.input_audio_format [ + { + in_rate $JACK_RATE + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + num_output_audio_formats 3 + Object.Base.output_audio_format [ + { + out_rate $JACK_RATE + out_bit_depth 16 + out_valid_bit_depth 16 + } + { + out_rate $JACK_RATE + out_bit_depth 32 + out_valid_bit_depth 24 + } + { + out_rate $JACK_RATE + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] + } + Object.Widget.siggen."1" { + num_input_pins 1 + num_output_pins 1 + num_input_audio_formats 1 + num_output_audio_formats 1 + Object.Base.input_audio_format [ + { + in_rate $JACK_RATE + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_rate $JACK_RATE + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] + } + } + ] + } + + Object.PCM.pcm [ + { + name "Jack Echo Reference" + id $SDW_JACK_ECHO_REF_PCM_ID + direction "capture" + Object.Base.fe_dai.1 { + name "Jack Echo Reference" + } + Object.PCM.pcm_caps.1 { + name "Jack Echo Reference" + formats 'S16_LE,S24_LE,S32_LE' + } + IncludeByKey.JACK_RATE { + "48000" { + rates '48000' + } + "96000" { + rates '96000' + } + "192000" { + rates '192000' + } + } + } + ] + + Object.Base.route [ + { + source "alh-copier.Loopback_Virtual.25" + sink "siggen.$SDW_JACK_ECHO_REF_PIPELINE_ID.1" + } + { + source "module-copier.1.$SDW_JACK_ECHO_REF_PIPELINE_ID" + sink "siggen.$SDW_JACK_ECHO_REF_PIPELINE_ID.1" + } + { + source "siggen.$SDW_JACK_ECHO_REF_PIPELINE_ID.1" + sink "host-copier.$SDW_JACK_ECHO_REF_PCM_ID.capture" + } + ] + } # SDW_JACK_ECHO_REF true +} diff --git a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf index 27d54ba9843f..5c3a114fa0cc 100644 --- a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf @@ -11,7 +11,6 @@ Define { JACK_PLAYBACK_PCM_NAME "Jack Out" JACK_CAPTURE_PCM_NAME "Jack In" JACK_RATE 48000 - SDW_JACK_ECHO_REF_PCM_ID 11 } # @@ -656,34 +655,6 @@ Object.PCM.pcm [ IncludeByKey.PASSTHROUGH { "false" { IncludeByKey.SDW_JACK_ECHO_REF { - "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" - } - ] - } - "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" - } - ] - } - } - } "false" { IncludeByKey.USE_DAX { "true" { @@ -740,127 +711,5 @@ IncludeByKey.PASSTHROUGH { } IncludeByKey.SDW_JACK_ECHO_REF { - "true" { - Object.Widget.module-copier."12" { - index 1 - num_input_pins 1 - num_output_pins 2 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_rate $JACK_RATE - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_rate $JACK_RATE - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - - Object.Pipeline { - siggen-host-copier-capture [ - { - direction "capture" - index 12 - Object.Widget.host-copier."1" { - stream_name "Jack Echo Reference" - pcm_id $SDW_JACK_ECHO_REF_PCM_ID - num_input_audio_formats 1 - Object.Base.input_audio_format [ - { - in_rate $JACK_RATE - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - num_output_audio_formats 3 - Object.Base.output_audio_format [ - { - out_rate $JACK_RATE - out_bit_depth 16 - out_valid_bit_depth 16 - } - { - out_rate $JACK_RATE - out_bit_depth 32 - out_valid_bit_depth 24 - } - { - out_rate $JACK_RATE - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - Object.Widget.siggen."1" { - num_input_pins 1 - num_output_pins 1 - num_input_audio_formats 1 - num_output_audio_formats 1 - Object.Base.input_audio_format [ - { - in_rate $JACK_RATE - in_bit_depth 32 - in_valid_bit_depth 32 - } - ] - Object.Base.output_audio_format [ - { - out_rate $JACK_RATE - out_bit_depth 32 - out_valid_bit_depth 32 - } - ] - } - } - ] - } - - Object.PCM.pcm [ - { - name "Jack Echo Reference" - id $SDW_JACK_ECHO_REF_PCM_ID - direction "capture" - Object.Base.fe_dai.1 { - name "Jack Echo Reference" - } - Object.PCM.pcm_caps.1 { - name "Jack Echo Reference" - formats 'S16_LE,S24_LE,S32_LE' - } - IncludeByKey.JACK_RATE { - "48000" { - rates '48000' - } - "96000" { - rates '96000' - } - "192000" { - rates '192000' - } - } - } - ] - - Object.Base.route [ - { - source "alh-copier.Loopback_Virtual.25" - sink "siggen.12.1" - } - { - source "module-copier.1.12" - sink "siggen.12.1" - } - { - source "siggen.12.1" - sink "host-copier.$SDW_JACK_ECHO_REF_PCM_ID.capture" - } - ] - } # SDW_JACK_ECHO_REF true + "true" "platform/intel/sdw-jack-echo-ref.conf" } From 314a2580cbb57434474739d1a276d1d222fdcc5b Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 24 Feb 2026 21:12:16 +0800 Subject: [PATCH 2/3] topology2: cavs-sdw: include echo reference file if SDW_ECHO_REF_DAI is set 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. Therefore, we need to include the echo reference config files if SDW_ECHO_REF_DAI is set but sdw-jack/amp-generic.conf is not included. Signed-off-by: Bard Liao --- tools/topology/topology2/cavs-sdw.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/topology/topology2/cavs-sdw.conf b/tools/topology/topology2/cavs-sdw.conf index a4d9375f5ff2..2ba7febe63b6 100644 --- a/tools/topology/topology2/cavs-sdw.conf +++ b/tools/topology/topology2/cavs-sdw.conf @@ -167,6 +167,12 @@ IncludeByKey.SDW_ECHO_REF_DAI { ] } ] + IncludeByKey.NUM_SDW_AMP_LINKS { + "0" "platform/intel/sdw-amp-echo-ref.conf" + } + IncludeByKey.SDW_JACK { + "false" "platform/intel/sdw-jack-echo-ref.conf" + } } } From c3993b76b68e87e572ee40284c9a5d8535edddff Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 24 Feb 2026 16:30:21 +0800 Subject: [PATCH 3/3] topology2: add SDW echo reference function topologies Add SoundWire echo reference function topologies. Signed-off-by: Bard Liao --- .../production/tplg-targets-sdca-generic.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/topology/topology2/production/tplg-targets-sdca-generic.cmake b/tools/topology/topology2/production/tplg-targets-sdca-generic.cmake index 5327b23aaf4e..0eb16bc6b6d1 100644 --- a/tools/topology/topology2/production/tplg-targets-sdca-generic.cmake +++ b/tools/topology/topology2/production/tplg-targets-sdca-generic.cmake @@ -30,6 +30,18 @@ DEEP_BUF_SPK=true" "cavs-sdw\;sof-sdca-mic-id4\;SDW_JACK=false,SDW_DMIC=1,NUM_HDMIS=0,\ SDW_DMIC_STREAM=Capture-SmartMic" +"cavs-sdw\;sof-sdca-amp-ref\;SDW_JACK=false,NUM_HDMIS=0,SDW_ECHO_REF_DAI=true,\ +SDW_SPK_STREAM=Playback-SmartAmp,SDW_SPK_ECHO_REF=true,SDW_AMP_FEEDBACK=false,\ +JACK_RATE=48000" + +"cavs-sdw\;sof-sdca-jack-ref\;SDW_JACK=false,NUM_HDMIS=0,SDW_ECHO_REF_DAI=true,\ +SDW_JACK_OUT_STREAM=Playback-SimpleJack,SDW_JACK_ECHO_REF=true,JACK_RATE=48000,\ +SDW_AMP_FEEDBACK=false" + +"cavs-sdw\;sof-sdca-jack-amp-ref\;SDW_JACK=false,NUM_HDMIS=0,SDW_ECHO_REF_DAI=true,\ +SDW_JACK_OUT_STREAM=Playback-SimpleJack,SDW_SPK_STREAM=Playback-SmartAmp,\ +SDW_JACK_ECHO_REF=true,JACK_RATE=48000,SDW_SPK_ECHO_REF=true,SDW_AMP_FEEDBACK=false" + "cavs-sdw\;sof-hdmi-pcm5-id2\;SDW_JACK=false,HDMI1_ID=2,HDMI2_ID=3,HDMI3_ID=4" "cavs-sdw\;sof-hdmi-pcm5-id3\;SDW_JACK=false,HDMI1_ID=3,HDMI2_ID=4,HDMI3_ID=5" "cavs-sdw\;sof-hdmi-pcm5-id4\;SDW_JACK=false,HDMI1_ID=4,HDMI2_ID=5,HDMI3_ID=6"