Skip to content

topology2: add WebRTC HPF/AGC capture chaining, HDA AEC, and PTL targets - #11426

Draft
lgirdwood wants to merge 7 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-pr2
Draft

lgirdwood wants to merge 7 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-pr2

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Follow-up topology2 improvements for the WebRTC audio processing module suite (#11044, #11419):

  1. topology2: add missing direction attribute to capture pipelines

    • Add explicit direction "capture" to the pipeline."1" scheduler widget in dai-copier-eqiir-module-copier-capture.conf, host-gateway-capture.conf, and webrtc-{aec,ns,ns2}-capture.conf so the pipeline widget direction matches the enclosing capture pipeline class.
  2. topology2: cavs-mixin-mixout-hda: add WebRTC AEC capture support

    • Add an optional AEC_PROCESSING flag to cavs-mixin-mixout-hda.conf that inserts webrtc-aec.3.1 between module-copier.4.2 and host-copier.0.capture on the analog capture path, and register sof-hda-generic-webrtc-aec in development/tplg-targets.cmake.
  3. topology2: wire webrtc-hpf and webrtc-agc into capture and add PTL

    • Chain webrtc-hpf and webrtc-agc into webrtc-ns-capture.conf (dai-copier -> webrtc-hpf -> webrtc-vad -> webrtc-ns -> webrtc-agc -> host-copier) and add webrtc-hpf pre-filtering ahead of webrtc-ns2 in webrtc-ns2-capture.conf.
    • Add Panther Lake (PTL / ACE 3.0) development topology targets sof-ptl-nocodec-webrtc-{ns,ns2,aec} in development/tplg-targets.cmake.

Add explicit direction "capture" to the pipeline."1" scheduler widget in
dai-copier-eqiir-module-copier-capture.conf, host-gateway-capture.conf,
and webrtc-{aec,ns,ns2}-capture.conf so the pipeline widget direction
matches the enclosing capture pipeline class.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add AEC_PROCESSING support to cavs-mixin-mixout-hda.conf to insert
webrtc-aec.3.1 into the HDA analog capture path (module-copier.4.2 ->
webrtc-aec.3.1 -> host-copier.0.capture) with runtime ALSA switch
controls ('Pre Mixer Analog Capture AEC Switch' and
'Pre Mixer Analog Capture AEC Suppression Switch').

Register the sof-hda-generic-webrtc-aec development topology target in
tplg-targets.cmake.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Instantiate webrtc-hpf (DC/<80 Hz removal) and webrtc-agc (digital gain
control and saturation limiter) in webrtc-ns-capture.conf alongside
webrtc-vad and webrtc-ns to form the complete WebRTC voice
pre-processing chain.

Add PTL nocodec topology targets (sof-ptl-nocodec-webrtc-{ns,aec,ns2})
in tplg-targets.cmake alongside the existing TGL targets.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

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.

🟡 Changes recommended

The HDA AEC lacks a playback-reference input needed to cancel speaker echo, and its default suppression control name exceeds ALSA topology’s 43-byte name limit.

2 open issues
What changed in this PR

This PR extends topology2’s WebRTC capture processing and adds development targets for HDA and Panther Lake.

Changes:

  • Sets explicit capture direction on five pipeline scheduler widgets.
  • Adds HPF and AGC stages to the existing VAD/NS capture chain.
  • Adds an optional HDA AEC capture path and registers HDA AEC and PTL WebRTC targets.
File Description
tools/​topology/​topology2/​include/​pipelines/​cavs/​webrtc-ns2-capture.conf Sets capture scheduler direction.
tools/​topology/​topology2/​include/​pipelines/​cavs/​webrtc-ns-capture.conf Adds HPF/AGC widgets and routes; sets capture direction.
tools/​topology/​topology2/​include/​pipelines/​cavs/​webrtc-aec-capture.conf Sets capture scheduler direction.
tools/​topology/​topology2/​include/​pipelines/​cavs/​host-gateway-capture.conf Sets capture scheduler direction.
tools/​topology/​topology2/​include/​pipelines/​cavs/​dai-copier-eqiir-module-copier-capture.conf Sets capture scheduler direction.
tools/​topology/​topology2/​development/​tplg-targets.cmake Registers PTL NS, NS2, and AEC targets plus HDA AEC.
tools/​topology/​topology2/​development/​cavs-nocodec-webrtc-ns.conf Updates comments and diagram for the expanded capture chain.
tools/​topology/​topology2/​cavs-mixin-mixout-hda.conf Adds optional AEC widget, controls, and analog capture routing.

Review effort: Balanced

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the monolithic topology support, can we also look at adding these modules as feature or function topologies.

Fix WebRTC LLEXT runtime linking and multi-pipeline AEC streaming on
hardware (Panther Lake / ACE 3.0):

1. Compile external static libraries (AECm, NS, RNNoise, libfvad) with
   -fno-pic -fno-pie -mlongcalls -mtext-section-literals -DNDEBUG when
   building relocatable Xtensa LLEXTs so GCC emits R_XTENSA_32 literal
   relocations instead of unresolved internal R_XTENSA_PLT entries.
2. Check both LLEXT_MODULE and Zephyr's LL_EXTENSION_BUILD in the
   WebRTC shim files, export notifier_event for webrtc_vad, and provide
   soft-float math shims in webrtc_ns-shims.c.
3. Set init_config = "1" in webrtc_aec.toml and guard input_pins access
   in webrtc_aec_prepare().
4. Re-resolve mic and playback-reference sources in webrtc_aec_process()
   when playback starts/stops dynamically while capture is active, and
   drop excess reference frames to prevent ring-buffer backpressure.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Address review feedback on HDA WebRTC AEC topology:

1. Tap the analog playback pipeline after drc.2.1 via module-copier.2.2
   (1 input pin, 2 output pins) and route pin 1 to the HDA analog
   playback DAI copier and pin 2 to webrtc-aec.3.1 input pin 1 so the
   AEC receives the speaker playback reference stream.
2. Shorten the AEC mixer control names from 'Pre Mixer $ANALOG_CAPTURE_PCM
   AEC [Suppression] Switch' (47 bytes) to '$ANALOG_CAPTURE_PCM AEC
   [Suppression] Switch' (<= 37 bytes) to fit within the 44-byte ALSA
   control name limit.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add modular feature and function topology fragments for the WebRTC
audio processing chain (HPF -> NS/NS2/AEC -> AGC + VAD):

- platform/intel/dmic1-webrtc.conf: function topology fragment for
  DMIC PCM 1 capture with WebRTC processing (WEBRTC_FUNCTION).
- dmic-webrtc-feature.conf: standalone DMIC feature topology wrapper
  (sof-dmic-2ch-webrtc-ns, sof-dmic-2ch-webrtc-ns2).
- platform/intel/sdw-dmic-webrtc-feature.conf: SoundWire SDCA microphone
  feature fragment (sof-sdca-mic-id4-webrtc-ns,
  sof-sdca-mic-id4-webrtc-ns2).
- platform/intel/sdw-jack-webrtc-feature.conf: SoundWire SDCA jack
  feature fragment with playback echo-reference tap for AEC
  (sof-sdca-jack-id0-webrtc-ns, sof-sdca-jack-id0-webrtc-aec).
- Wire WEBRTC_FUNCTION into cavs-sdw.conf and dmic-generic.conf and add
  development targets including sof-ptl-dmic-2ch-id2-webrtc-ns.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood

Copy link
Copy Markdown
Member Author

@lgirdwood Added modular WebRTC feature and function topologies in commit 199d63076 (topology2: add WebRTC feature and function topologies for DMIC/SDW):

  • Function topology fragment:
    • tools/topology/topology2/platform/intel/dmic1-webrtc.conf: DMIC PCM 1 capture function fragment (WEBRTC_FUNCTION="ns" | "ns2", wiring dai-copier.DMIC -> module-copier -> webrtc-hpf -> webrtc-ns/ns2 -> webrtc-agc -> webrtc-vad -> host-copier), wired into cavs-sdw.conf and platform/intel/dmic-generic.conf via WEBRTC_FUNCTION.
  • Feature topology wrappers:
    • tools/topology/topology2/dmic-webrtc-feature.conf: standalone DMIC feature topologies (sof-dmic-2ch-webrtc-ns, sof-dmic-2ch-webrtc-ns2).
    • tools/topology/topology2/platform/intel/sdw-dmic-webrtc-feature.conf: SoundWire SDCA microphone feature topologies (sof-sdca-mic-id4-webrtc-ns, sof-sdca-mic-id4-webrtc-ns2).
    • tools/topology/topology2/platform/intel/sdw-jack-webrtc-feature.conf: SoundWire SDCA jack feature topologies (sof-sdca-jack-id0-webrtc-ns, sof-sdca-jack-id0-webrtc-aec with playback echo-reference tap from module-copier.1.2).
    • Composite development target sof-ptl-dmic-2ch-id2-webrtc-ns in development/tplg-targets.cmake.

All 14 WebRTC topologies compile cleanly with alsatplg and pass tplg_validate.py with 0 errors. Also tested the updated firmware, LLEXTs, and sof-hda-generic-webrtc-aec.tplg on damsel-fly (PTL / ACE 3.0) across capture-only, playback-only, simultaneous playback+capture (2-source AEC), and dynamic mid-stream playback start/stop.

Mark the soft-float math shims in webrtc_ns-shims.c and
webrtc_ns2-shims.c with __attribute__((weak)) and compile them
unconditionally so monolithic builds (e.g. CAVS 2.5 / TGL where
CONFIG_LIBRARY_MANAGER=n) link cleanly without requiring an external
libm or causing duplicate symbol collisions when both NS and NS2 are
built in.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
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.

3 participants