Skip to content

pipeline: introduce declarative static topology definition and loader - #11266

Merged
lgirdwood merged 7 commits into
thesofproject:mainfrom
lgirdwood:topic/static-pipeline-api
Oct 13, 2026
Merged

lgirdwood merged 7 commits into
thesofproject:mainfrom
lgirdwood:topic/static-pipeline-api

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Add support for declarative static audio pipelines in Sound Open Firmware.
In microcontroller, hostless, and standalone embedded environments (such as ESP32-P4/S3/C6, PJRC Teensy 4.1, Nordic nRF54, RP2350, smart speakers, and audio bridges), there is no dynamic IPC host driver (Linux ALSA/SoundWire or Windows) to construct topologies at runtime.

Key Additions & Features

  1. Declarative Topology Structures & Macros (<sof/audio/pipeline/static_pipeline.h>):

    • Full Doxygen API docblocks covering all structures, fields, enums, macros, and public APIs.
    • Comprehensive sample rate bitmasks (SOF_STATIC_RATE_*) aligned with SOF_RATE_* and format bitmasks (SOF_STATIC_FMT_*) aligned with enum sof_ipc_frame.
    • Concise constructor macros (SOF_STATIC_MODULE, SOF_STATIC_MODULE_RATE_CONV, SOF_STATIC_ENDPOINT_DAI, SOF_STATIC_ENDPOINT_USB) for clean declarative pipeline definition.
  2. Ops-Driven Decoupled Architecture:

    • Generic headers and loader engine have zero per-module logic or dependencies.
    • Audio processing modules define and self-register their static operations (struct sof_static_module_ops) providing .create, .apply_volume, .apply_switch, and .apply_enum callbacks directly in their own source files (SRC, ASRC, Volume/Gain, Level Multiplier, Selector, EQ IIR, DRC, and TDFB) using DECLARE_STATIC_MODULE_OPS().
  3. Generic Module Registry & Base IPC4 Config Synthesizer (static_pipeline_modules.c):

    • Generic ops registry with structured error logging on lookup failures.
    • Base IPC4 config synthesizer (sof_static_init_base_cfg) generating standard IPC4 base module configurations (struct ipc4_base_module_cfg) on behalf of the absent host, calculating IBS/OBS and channel mapping from declarative capabilities and periods.
  4. Dynamic Format & Rate Negotiation:

    • Dynamically resolves primary stream sample rates from topology descriptors, removing hardcoded defaults.
    • Supports sample rate converters (SRC/ASRC), up/down mixers, and format conversions with per-buffer rate/channel inheritance.
  5. Static Topology Loader Engine (static_pipeline_loader.c):

    • Instantiates native SOF pipelines, components, intermediate buffers, routes, and kcontrols directly at boot.
    • Component preparation and parameter negotiation to ensure all processing modules reach ready state prior to streaming.
    • Comprehensive inline comments on every code block explaining the action and rationale.
  6. Dedicated Pipeline Control & Trigger Safety:

    • Separate start/stop routines (sof_static_pipeline_start, sof_static_pipeline_stop).
    • Strict abort on pipeline_prepare() failure preventing triggers on uninitialized circular buffers.
    • UAC2 terminal dispatch routing directly to modular start/stop helpers.
    • Decoupled custom kcontrol callback handler for board- and platform-specific controls.
  7. Kconfig & Build Integration:

    • CONFIG_STATIC_PIPELINE Kconfig option and CMakeLists integration.
  8. Developer Documentation:

    • Comprehensive architectural guide, API references, and step-by-step tutorial with multi-rate SRC examples in src/audio/pipeline/README.md.

@lgirdwood
lgirdwood force-pushed the topic/static-pipeline-api branch from 2fc03a7 to 5c11182 Compare October 5, 2026 21:18

@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.

Lets split this patch into patch per feature. Need to LOG_ERR any errors and IPC3 support not needed

Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/level_multiplier/level_multiplier.c
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/README.md Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/static_pipeline_modules.c Outdated

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

It contains compilation failures plus multiple unsafe initialization, triggering, control, and format-handling defects.

16 open findings
What changed in this PR

Introduces declarative, boot-time audio topology construction for hostless SOF platforms.

Changes:

  • Adds static topology descriptors, module registry, loader, controls, and UAC2 integration.
  • Registers static operations for supported processing modules.
  • Adds configuration, build integration, and developer documentation.
File Description
src/​include/​sof/​audio/​pipeline/​static_pipeline.h Defines the public static topology API.
src/​include/​sof/​audio/​component.h Declares component-driver lookup.
src/​audio/​component.c Implements component-driver lookup.
src/​audio/​pipeline/​static_pipeline_loader.c Builds, configures, controls, and triggers static graphs.
src/​audio/​pipeline/​static_pipeline_modules.c Implements module registration and IPC4 config synthesis.
src/​audio/​pipeline/​static_pipeline_modules.h Declares internal module helpers.
src/​audio/​pipeline/​static_pipeline_uac2.c Bridges UAC2 controls and triggers.
src/​audio/​pipeline/​CMakeLists.txt Adds static pipeline sources.
src/​audio/​pipeline/​README.md Documents architecture and usage.
src/​audio/​Kconfig Adds feature and capacity options.
src/​audio/​volume/​volume.c Adds Volume and Gain operations.
src/​audio/​src/​src.c Adds SRC creation support.
src/​audio/​asrc/​asrc.c Adds ASRC creation support.
src/​audio/​selector/​selector.c Adds Selector creation and controls.
src/​audio/​level_multiplier/​level_multiplier.c Adds gain and switch controls.
src/​audio/​eq_iir/​eq_iir.c Adds EQ bypass control.
src/​audio/​drc/​drc.c Adds DRC enable control.
src/​audio/​tdfb/​tdfb.c Adds beamforming switch control.

🧠 Review effort: Balanced


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

Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/selector/selector.c Outdated
Comment thread src/audio/volume/volume.c
Comment thread src/audio/volume/volume.c
Comment thread src/audio/pipeline/static_pipeline_uac2.c Outdated
Comment thread src/audio/pipeline/static_pipeline_uac2.c
Comment thread src/audio/pipeline/static_pipeline_uac2.c
Comment thread src/audio/pipeline/static_pipeline_uac2.c Outdated
Comment thread src/audio/pipeline/README.md Outdated
Add a standard driver lookup API comp_driver_find() to search
registered component drivers by UUID (for audio processing modules)
or by driver type (for Host and DAI endpoints).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/static-pipeline-api branch from b0df45d to a9ed44c Compare October 11, 2026 12:46
@lgirdwood
lgirdwood marked this pull request as ready for review October 11, 2026 12:57
@intel-sofci

intel-sofci commented Oct 11, 2026 •

Copy link
Copy Markdown

PR 11266: test results

Run date: 2026-10-12 21:27 UTC

Tested commit: 2d670f719bf4c782f243e0cee03f6c2e470627c2

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

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.

🔵 Needs a closer look

Core endpoint configuration, trigger sequencing, format metadata, rate updates, and several module controls contain unresolved correctness issues.

22 open findings

And 2 more that still need to be addressed.

16 resolved since last review

🧠 Review effort: Balanced

Comment thread src/audio/asrc/asrc.c
Comment thread src/audio/level_multiplier/level_multiplier.c Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c Outdated
Comment thread src/audio/pipeline/static_pipeline_loader.c
Comment thread src/audio/pipeline/static_pipeline_loader.c
Comment thread src/audio/pipeline/static_pipeline_modules.c Outdated
Comment thread src/audio/pipeline/static_pipeline_uac2.c Outdated
Comment thread src/audio/selector/selector.c
Comment thread src/audio/tdfb/tdfb.c
Comment thread src/include/sof/audio/pipeline/static_pipeline.h
…d headers

Add <sof/audio/pipeline/static_pipeline.h> providing declarative
topology descriptors, capability bitmasks (rates and frame formats),
component constructor macros, ops-driven static module interface,
and public control and trigger APIs.

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

Add static_pipeline_modules.c and static_pipeline_modules.h providing
generic module operations registration, UUID lookup, and IPC4 base module
configuration synthesis. Contains purely generic infrastructure with zero
per-module logic and no IPC3 dependencies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Implement static_pipeline_loader.c to parse declarative static audio
topologies and instantiate native SOF pipelines, components, intermediate
buffers, routes, and kcontrols at boot.

Features:
- Purely IPC4 based architecture with no IPC3 dependencies
- Modular multi-stage initialization with explicit LOG_ERR on all failures
- Per-pipeline sample rate negotiation and tracking across pipelines,
  streams, and DAI/host endpoints
- Configurable tracking table limits via Kconfig (STATIC_PIPELINE_MAX_*)
  to support memory-constrained embedded devices
- Runtime kcontrol dispatch to registered module ops with error checking

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

Add static_pipeline_uac2.c providing translation between USB Audio Class 2.0
(UAC2) requests (8.8 dB volume representation, mute switches, streaming terminal
trigger events) and SOF static pipelines and kcontrols.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Register static module operations (struct sof_static_module_ops) across
core audio processing components (Volume, Gain, Level Multiplier, SRC,
ASRC, Selector, EQ IIR, DRC, and TDFB) for IPC4 static pipeline execution.
Includes explicit error logging on invalid module pointers or private data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add comprehensive documentation for the static audio pipeline subsystem
in src/audio/pipeline/README.md covering:
- Architectural motivations for microcontroller and hostless systems
- Core concepts and declarative topology structures
- Step-by-step tutorial with multi-rate SRC playback examples
- Ops-driven module interface and UAC2 integration
- Custom kcontrol handlers with named identifiers

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/static-pipeline-api branch from a9ed44c to 2d670f7 Compare October 12, 2026 20:59
@lgirdwood
lgirdwood merged commit d17fb01 into thesofproject:main Oct 13, 2026
46 checks passed
@lgirdwood
lgirdwood deleted the topic/static-pipeline-api branch October 13, 2026 12:23
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.

4 participants