Skip to content

WIP: esp32p4: add ESP32-P4 platform support, declarative static topology, and hardware audio pipelines - #11194

Draft
lgirdwood wants to merge 40 commits into
thesofproject:mainfrom
lgirdwood:feature/esp32p4-sof-port
Draft

WIP: esp32p4: add ESP32-P4 platform support, declarative static topology, and hardware audio pipelines#11194
lgirdwood wants to merge 40 commits into
thesofproject:mainfrom
lgirdwood:feature/esp32p4-sof-port

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Sep 11, 2026

Copy link
Copy Markdown
Member

Summary

Needs, cleanup, patches squashing and split up.

This PR adds support for the Espressif ESP32-P4 SoC (Dual RISC-V HP Cores @ 400 MHz with single-precision hardware FPU and RISC-V SIMD/DSP extensions) to Sound Open Firmware (SOF), alongside a generic declarative static pipeline topology engine and hardware-verified audio processing pipelines.


Key Changes

1. Declarative Static Pipeline Topology Engine

  • Descriptor Specification (static_pipeline.h):
    • Replaces rigid procedural pipeline construction with declarative data structures (struct sof_static_topology, sof_static_pipeline_desc, sof_static_comp, sof_static_buffer, sof_static_route, sof_static_kcontrol, sof_static_pcm).
    • Expressive macro builders: SOF_STATIC_COMP_HOST, SOF_STATIC_COMP_MODULE, SOF_STATIC_COMP_DAI, SOF_STATIC_BUFFER, SOF_STATIC_ROUTE, SOF_STATIC_PCM, SOF_STATIC_KCONTROL_VOLUME, SOF_STATIC_KCONTROL_SWITCH, etc.
  • Generic Loader Engine (static_pipeline_loader.c):
    • Automatically walks topology trees, instantiates SOF pipelines, creates components via UUID/type registries, dispatches initial IPC coefficient blobs, allocates memory buffers, and connects routes.
    • Exposes runtime kcontrol management APIs (sof_static_kcontrol_get, sof_static_kcontrol_set, and UAC2 bridging).

2. ESP32-P4 Platform & Audio Pipelines

  • Dual Floating-Point Static Audio Pipelines:
    • Playback Pipeline (PCM 0): USB_PB (comp 1) $\rightarrow$ VOL_PB (comp 2) $\rightarrow$ EQ_PB (comp 3) $\rightarrow$ DRC_PB (comp 4) $\rightarrow$ DAI_PB (comp 5)
    • Capture Pipeline (PCM 1): DAI_CAP (comp 6) $\rightarrow$ TDFB_CAP (comp 7) $\rightarrow$ EQ_CAP (comp 8) $\rightarrow$ VOL_CAP (comp 9) $\rightarrow$ USB_CAP (comp 10)
    • 8 single-precision float stream buffers with 64-period GDMA circular buffering.
  • Hardware Acceleration & SIMD Optimizations:
    • RISC-V SIMD and custom DSP vector implementations for volume attenuation, block-accelerated biquad IIR filtering, branchless saturation, and FIR convolutions.
    • Native single-precision floating-point arithmetic utilizing the ESP32-P4 hardware FPU.
  • Dynamic Interface Switching & Digital Audio Modes:
    • I2S: Auto master/slave clock detection and pinmuxing.
    • PDM: High-performance PDM Rx/Tx streaming.
    • DMIC: DMIC Injector mode (Slave TX: clock input on GPIO 4, modulated bitstream output on GPIO 3 & 5) with master bus contention guards.
    • Bluetooth LE Audio: Pipeline endpoint and static routing with 7 runtime-selectable presets (LC3, LC3plus, LPCM across standard, high-quality, ultra-low-latency, and high-resolution modes).

3. Diagnostics & Interactive Serial Shell

  • Built-in sof interactive shell commands:
    • sof ctl <list|get|set>: Query and dynamically modify runtime kcontrol values (EQ bypass, DRC bypass, TDFB bypass, volume gain).
    • sof bt <format|status>: Inspect and select Bluetooth LE Audio presets dynamically.
    • sof status: Real-time pipeline state, active interface, clock mode, and module telemetry.

4. Manifest & Dependency Updates

  • Updated west.yml to track the required Zephyr DAI drivers and Espressif HAL forks for ESP32-P4 UAC2 and audio peripherals.

Hardware Verification & Benchmarks

All changes have been validated on physical ESP32-P4 hardware using the automated dual-board test bench (Pallas Master Tx and Ceres Slave Rx):

============================================================
             PRE-COMMIT VERIFICATION SUMMARY               
============================================================
  Mode   | Ch0 / Metric | Ch1 / Metric | Peak / Info   | Status
---------+--------------+--------------+---------------+------------
  I2S    | 93.88 dB     | 93.88 dB     | 1000.0 Hz     | PASS
  PDM    | 67.52 dB     | 82.46 dB     | 1000.0 Hz     | PASS
  DMIC   | 7.51 dB      | 8.09 dB      | 1000.0 Hz     | PASS
  BT     | 7/7 fmts     | 100% OTA     | 25988 pkts    | PASS
============================================================
[+] ALL PRE-COMMIT VERIFICATION TESTS PASSED.
  • Playback & Capture SNR: >93 dB in I2S mode, >82 dB in PDM mode.
  • DSP Overhead: ~21.7 MCPS (under 5.5% of a single 400 MHz core) for full float playback and capture processing chain.
  • Memory Footprint: 380.9 KB / 393.2 KB internal SRAM used, preserving 12.3 KB headroom with zero heap expansion during streaming.

Commits (40)

  • 09cfd5231 manifest: update zephyr and hal_espressif to point to lgirdwood forks
  • 518b0e66c audio: bt: add high-quality audio format presets, dynamic kcontrol, and shell format selector
  • 2127aa855 audio: bt: add ESP32-C6 Bluetooth LE Audio pipeline endpoint and static routing
  • 6a0f01381 platform: esp32p4: add DMIC Injector Switch kcontrol, shell commands, and mode switching
  • f6bde4ab2 platform: esp32p4: support dynamic period calculation, runtime interface switching, and diagnostics
  • 61c60eda4 platform: esp32p4: support S16_LE static pipeline, auto master/slave clocking, and 64-period GDMA
  • 264d7a754 audio: dai-zephyr & usb_audio: support multi-period burst copy, pre-buffering, and peek/consume
  • 5531c5bdc app: esp32p4: add Pallas and Ceres board identity, GDMA descriptors, and I2S pinmux
  • 2bb6f5a4a doc: esp32p4: document float and SIMD performance deltas per module
  • dda797eac platform: esp32p4: add static test pipeline with tone, level, and selector routing
  • a1dd7f574 pipeline: static_loader: support selector components, enum controls, and status guards
  • c9614e6a8 audio: selector: add float matrix processing and enum control support
  • e9136fd15 audio: level_multiplier: add float scaling and kcontrol volume support
  • 0d2016c22 audio: up_down_mixer: add ANSI C and RISC-V upmix and downmix routines
  • 27d09884d audio: asrc: implement float FIR filtering and 4-way unrolled ILP
  • f6e5a9e9e audio: tone: add single-precision float synthesis and format negotiation
  • c6823f002 audio: src: add single-precision float polyphase sample rate conversion
  • 536fb8037 audio: tdfb: add single-precision float beamformer acceleration
  • 137853a66 audio: mixer: add float stream mixing, muxing, and mixin/mixout support
  • 90dd786d9 audio: multiband_drc: add single-precision float multiband compressor
  • 16718e808 audio: crossover: add float Linkwitz-Riley 4th order processing
  • a704361ee audio: eq_fir: add single-precision float FIR filtering support
  • e723487f0 audio: dcblock: add single-precision float filter acceleration
  • 6e32bc2a6 audio: pcm_converter: optimize integer conversions and add float attenuation
  • 7dedd6332 math: add single-precision float FIR filtering routines
  • 2d12e8892 pipeline: introduce declarative static topology definition and loader
  • dd5c107da esp32p4: add capture pipeline controls, float TDFB support, and MCPS benchmarks
  • f873f4ac1 esp32p4: add native single-precision floating-point pipeline with hardware FPU acceleration
  • 0cb386193 esp32p4: add RISC-V SIMD / vector optimizations for volume module
  • fbf048768 esp32p4: add block-accelerated EQ IIR and branchless saturation on RISC-V
  • b40acefbf esp32p4: add RISC-V SIMD / DSP math optimizations for EQ and DRC
  • 9e3fe021a esp32p4: document static pipeline topology, ALSA controls, and MCPS performance in README
  • 1d549c80f esp32p4: fix static pipeline stream routing, IPC3 configs, and terminal buffer handling
  • 3246c8cb4 esp32p4: configure IPC4 base module config for static pipeline components
  • 820da78ae esp32p4: load default DSP configurations for EQ and DRC with runtime bypass
  • 113705677 esp32p4: export ALSA kcontrols for Playback EQ, DRC, Capture TDFB, and Capture EQ
  • c093cc3af esp32p4: enable periodic kernel timer and automatic binary creation
  • f62512799 esp32p4: configure deferred logging and system clock resolution
  • dad6817ff esp32p4: enable LL scheduler periodic logging and trigger pipeline on PRE_START
  • a75c7a38f esp32p4: add SOF static audio pipeline and ESP32-P4 platform support

… PRE_START

- Update pipeline trigger from COMP_TRIGGER_START to COMP_TRIGGER_PRE_START
  so pipeline task is properly registered with the LL scheduler timer domain.
- Implement platform IPC initialization for ESP32-P4 to handle pipeline task replies.
- Configure LL scheduler stats logging every 1s (1024ms) window and adjust log levels.
- Set CONFIG_LOG_MODE_DEFERRED=y with 8KB buffer and overflow drop mode
  so real-time and LL scheduler threads never block synchronously on UART I/O.
- Set CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 for exact integer cycle division
  against the 16MHz SYSTIMER hardware clock and 1ms LL scheduler intervals.
- Retain LL thread priority at -16 (cooperative, non-preemptible) and ensure
  logging and shell threads run at lowest preemptible priority.
- Set CONFIG_TICKLESS_KERNEL=n and CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
  for exact 1ms timer ticks matching the 16MHz hardware SYSTIMER.
- Set CONFIG_BUILD_OUTPUT_BIN=y to automatically trigger elf2image
  with --ram-only-header on west build.
…al buffer handling

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

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement RISC-V SIMD/DSP math routines mirroring Xtensa HiFi hotspots:
  * DRC: Horner's polynomial evaluations for log10_fixed, drc_lin2db_fixed,
    drc_log_fixed, drc_asin_fixed, drc_inv_fixed; fast knee_curveK, volume_gain,
    envelope tracking, and unrolled 4-sample output compression stage.
  * EQ: 4th-order cascaded biquad IIR DF1 (iir_df1_4th) and transposed DF2T
    (iir_df2t) with 64-bit MAC accumulators.
- Add CONFIG_FILTER_RISCV_SIMD and CONFIG_DRC_RISCV_SIMD Kconfig options.
- Add sof play <start|stop> shell command to control playback pipeline streaming.
- Update esp32p4 README with Generic C vs RISC-V SIMD MCPS benchmark comparison
  showing a 57.2% reduction in DRC computational overhead (18.93 vs 44.22 MCPS).

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

- Implement block processing in eq_iir_riscv.c with in-register biquad state
  variables, eliminating 98% of RAM load/store operations per block.
- Remove per-sample external C function call overhead in EQ IIR filtering.
- Implement branchless / predicted sat_clamp_q31 saturation across EQ & IIR math.
- Add CONFIG_EQ_IIR_RISCV_SIMD Kconfig option.
- Update esp32p4 README with updated MCPS benchmarks (Total Active DSP reduced
  to 73.27 MCPS / 22.2% reduction) and add TODO section for single-precision
  fast mode and Espressif RISC-V DSP SIMD extensions.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement contiguous interleaved stereo vector streaming in volume_riscv.c
  and volume_riscv_with_peakvol.c, replacing strided per-channel loops.
- Add branchless saturation and rounding for S16, S24, and S32 formats.
- Add CONFIG_VOLUME_RISCV_SIMD Kconfig choice option.
- Add sof vol <pb|cap> <dB> shell command for runtime volume attenuation.
- Update esp32p4 README with Volume SIMD architecture details.

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

- Enable native float execution (SOF_IPC_FRAME_FLOAT) across Volume, EQ IIR, and DRC modules.
- Implement pcm_converter float <-> integer conversions accelerated by ESP32-P4 RISC-V FPU (fmadd.s, fcvt.s.w, fcvt.w.s).
- Add float DF1 biquad math in iir_df1_float.h and coefficient conversion in iir_df1_float.c.
- Configure static pipeline intermediate stream buffers to 2048-byte float buffers with entry/exit conversion boundaries.
- Benchmark MCPS performance on target hardware: total full DSP chain reduced from 73.27 MCPS to 41.20 MCPS (43.8% reduction), utilizing only 10.3% of 400 MHz HP core.
- Update esp32p4 README with floating-point pipeline architecture and benchmark results.

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

- Add SOF_IPC_FRAME_FLOAT handling under CONFIG_FORMAT_FLOAT in TDFB.
- Implement sof_static_pipeline_set_capture_active() and sof_static_pipeline_set_tdfb_bypass().
- Add 'sof cap <start|stop>' command to ESP32 shell.
- Measure and document Capture MCPS performance and simultaneous Full-Duplex Playback + Capture load in esp32p4 README.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Add declarative static topology structures and builder macros in
  include/sof/audio/pipeline/static_pipeline.h.
- Implement generic topology loader engine in static_pipeline_loader.c
  to parse and instantiate static pipelines, components, routes, PCMs,
  and kcontrols.
- Migrate ESP32-P4 dual float playback & capture pipeline definition
  to src/platform/esp32p4/esp32p4_pipeline_def.c.
- Refactor sof_static_pipeline.c to delegate topology setup and control
  dispatch to the static topology loader.
- Add 'sof ctl <list|get|set>' commands to the debug shell to inspect
  and control static pipeline kcontrols at runtime.
- Update CMake build files and board Kconfig.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Add fir_float.h and fir_float.c providing fir_float() and dual-sample
  fir_float_2x() kernels with single-cycle fmadd.s FPU instructions.
- Fold Q1.15/Q2.30 normalization and out_shift directly into the float
  coefficients during initialization, eliminating runtime shifts.
- Optimize integer fir_generic.c with 2-way unrolled loops and 32-bit
  packed coefficient loads.

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

- Unroll integer conversion loops (s16_to_s24, s24_to_s16, s16_to_s32,
  s32_to_s16, s24_to_s32, s32_to_s24) by 4x and 8x for dual-issue RISC-V ILP.
- Add SOF_IPC_FRAME_FLOAT attenuation path in copier_generic.c.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement dcblock_generic_float() with single-cycle fmadd.s instructions.
- Add dcblock_float_default() to dcblock_fnmap supporting SOF_IPC_FRAME_FLOAT.
- Pre-scale fixed-point Q2.30 coefficients into float during setup.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement eq_fir_float() and dual-sample eq_fir_2x_float() kernels.
- Add eq_fir_setup_float() to convert and normalize coefficient blobs.
- Add SOF_IPC_FRAME_FLOAT support in set_fir_func() and IPC3 handlers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Add crossover_state_float and crossover_split_float supporting 2-way,
  3-way, and 4-way Linkwitz-Riley 4th-order (LR4) band splitting.
- Leverage iir_df1_float biquads with single-cycle fmadd.s instructions.
- Add crossover_float_default() and register in crossover_proc_fnmap.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement float crossover band splitting and emphasis/deemphasis filters.
- Add multiband_drc_float_process_drc() with native float delay buffering.
- Register multiband_drc_float_default() in multiband_drc_proc_fnmap.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement mix_n_float() with 4-way loop unrolling for stereo streams.
- Add mix_float() and mix_float_gain() in mixin_mixout_generic.c.
- Add SOF_IPC_FRAME_FLOAT mappings to mixer, mux, and mixin/mixout tables.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement tdfb_core_float() leveraging dual-sample fir_float_2x().
- Add tdfb_fir_float() with interleaved frame beamforming and direction updates.
- Convert fixed-point filter bank coefficients to float during tdfb_init_coef().

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement fir_filter_generic_float() with float FPU MAC operations.
- Implement src_polyphase_stage_cir_float() for polyphase filtering stages.
- Register SOF_IPC_FRAME_FLOAT in src_prepare_general() and src_copy_sxx().

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement tone_float_default() using native FPU normalized scaling.
- Add SOF_IPC_FRAME_FLOAT support in tone-ipc3.c and tone-ipc4.c.
- Enable dynamic channel and rate query from sink buffer stream.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement asrc_fir_filter_float() with 4-way unrolled native FPU MACs.
- Optimize integer asrc_fir_filter16() and asrc_fir_filter32() with 4-way
  unrolled loops targeting the dual-issue RISC-V pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Replace all 29 non-HiFi sof_panic(0) stubs with complete generic ANSI C
  and RISC-V upmix, downmix, and shift-copy implementations across all
  surround channel geometries (1, 2.0, 3.0, 4.0, 5.0, 5.1, and 7.1).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement level_multiplier_float() with 4-way unrolled FPU gain scaling.
- Optimize integer paths (s16, s24, s32) with 4-way loop unrolling.
- Add float gain tracking in level_multiplier_comp_data for runtime control.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Implement sel_float() and process_frame_float() with matrix coefficients.
- Provide safe fallback default configuration in selector_new().
- Support SOF_CTRL_CMD_ENUM in COMP_CMD_SET_VALUE and COMP_CMD_GET_VALUE.

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

- Add default configuration generator for selector components.
- Support SOF_STATIC_CTRL_ENUM in sof_static_kcontrol_set().
- Add sof_static_pipeline_trigger() for direct pipeline control.
- Guard trigger STOP operations against inactive pipelines to eliminate
  null pointer panics during early UAC2 terminal negotiation.
- Expand MAX_STATIC limits for pipelines, components, buffers, and controls.

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

- Define Pipeline 3 (TONE_TEST -> LEVEL_TEST -> SEL_TEST -> MIXER_PB).
- Register static kcontrols for Test Level Gain, Test Level Mute, and
  Test Selector Channel.
- Enable crossover, dcblock, multiband DRC, tone, level multiplier,
  selector, and mixer modules in board configuration.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
- Add section 3.4 to ESP32-P4 platform documentation detailing MCPS costs,
  cycle profiles, and percentage reductions for each accelerated module
  (eq_iir, drc, volume, eq_fir, tdfb, asrc, crossover, multiband_drc,
  tone, level_multiplier, selector, dcblock, mixer).

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

- Add board identity detection in usbd_init for Pallas (MAC ending in 0x17)
  and Ceres (MAC ending in 0x6C), assigning respective USB product strings.
- Set CONFIG_DMA_ESP32_MAX_DESCRIPTOR_NUM=64 for ring buffering.
- Enable bidirectional I2S0 BCK and WS pinmux in device tree overlay.
…uffering, and peek/consume

- Allow bursting up to 4 periods in dai_zephyr_multi_endpoint_copy on ESP32-P4
  to absorb host scheduling jitter and prevent DMA underruns/overruns.
- Fix audio stream converter direction for capture in set_new_local_buffer.
- Add 20ms pre-buffering in usb_audio to establish jitter margin before stream start.
- Implement peek and consume capture API to prevent data loss on USB send retries.
…clocking, and 64-period GDMA

- Detect board MAC in sof_static_pipelines_init to auto-configure Pallas (0x17)
  as clock master and Ceres (0x6C) as clock slave, switching DAI clock config.
- Route USB_PB -> VOL_PB -> DAI and DAI -> VOL_CAP -> USB_CAP with S16_LE
  stream formats and 65536 volume scale.
- Synchronize static kcontrol initialization on loader startup.
- Configure 64 DMA periods in zephyr/lib/dma.c for the ESP32-P4 GDMA driver.
…ace switching, and diagnostics

- Calculate host_period_bytes dynamically from sample rate, channels, and format
  in static pipeline reconfiguration instead of fixed period assumptions.
- Pass computed block_size dynamically when switching DAI mode at runtime.
- Update usb_audio to dynamically compute period_bytes and handle buffer chunks safely.
- Add sof regs, sof tone, and sof mute diagnostic shell commands.
- Size static pipeline buffers to 3072 bytes for high-resolution audio support.
… and mode switching

- Add static kcontrol ID 7 "DMIC Injector Switch" to dynamically toggle
  PDM DMIC Injector mode (Slave TX / external clock receiver).
- Implement sof_static_pipeline_set_dmic_injector() to reconfigure PDM DAI
  with DAI options = 1 (DMIC mode) and CBP_CFP clock polarity.
- Add sof dmic <enable|bypass> command and extend sof mode pdm to accept
  master, slave, or dmic.
- Increase shell stack size to 8192 to support complex command dispatch.
…ic routing

- Add Bluetooth LE Audio (BAP / LC3 @ 48kHz stereo) support utilizing the
  onboard ESP32-C6 co-processor via SDIO / GPIO 54 power control.
- Implement bt_audio component with zero-heap static ring buffers (10ms SDU).
- Implement bt_service to manage C6 power, scanning, and LE Audio broadcast.
- Extend sof_static_pipeline with dynamic 3-way endpoint routing:
  Route 0: USB <-> DAI (Default)
  Route 1: BT <-> DAI (DUT Audio Bridge)
  Route 2: USB <-> BT (PC to Bluetooth Broadcast)
- Add Kcontrols: ID 8 (BT Stream Switch), ID 9 (BT Stream Volume),
  ID 10 (Audio Endpoint Route).
- Add interactive shell commands: 'sof bt <status|broadcast|scan|power>'
  and 'sof route <usb_dai|bt_dai|usb_bt>'.
- Verified 100% pass on pre-commit loopback test suite (I2S: 93.88dB,
  PDM: 82.44dB, DMIC: 19.66dB).
- Add 'lgirdwood' remote (https://github.com/lgirdwood).
- Update 'zephyr' project to remote 'lgirdwood', branch 'feature/esp32p4-dai-port'.
- Whitelist and declare 'hal_espressif' project tracking 'lgirdwood/hal_espressif'
  on branch 'esp32p4-uac2' at 'modules/hal/espressif'.
@lgirdwood lgirdwood changed the title esp32p4: add ESP32-P4 platform support, declarative static topology, and hardware audio pipelines WIP: esp32p4: add ESP32-P4 platform support, declarative static topology, and hardware audio pipelines Sep 11, 2026
@lgirdwood
lgirdwood requested a lite review from Copilot September 11, 2026 16:14
Copilot stopped reviewing on behalf of lgirdwood due to an error September 11, 2026 16:34

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.

Note

Copilot was unable to run its full agentic suite in this review.

Pull request overview

This PR adds initial Espressif ESP32-P4 (Zephyr-only) platform support and extends SOF’s audio stack with RISC-V SIMD and FLOAT processing paths, along with USB UAC2 / BT audio plumbing for an ESP32-P4 sample app.

Changes:

  • Introduces ESP32-P4 platform sources/headers, Kconfig/CMake integration, and west manifest updates for Espressif HAL/Zephyr branches.
  • Adds RISC-V SIMD and FLOAT implementations across math/audio components (FIR/IIR/DRC/TDFB/EQ/volume/selector/etc.).
  • Adds static pipeline infrastructure and USB device initialization for an ESP32-P4 UAC2-focused application.

Reviewed changes

Copilot reviewed 145 out of 145 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
zephyr/sof_shell.c Fixes CONFIG_CROSS_CORE_STREAM conditional path for domain blocking in shell test.
zephyr/lib/dma.c Adds ESP32-P4 Zephyr DMA device entry from devicetree.
zephyr/lib/alloc.c Adds ESP32-P4 heap sizing/allocation path for Zephyr builds.
zephyr/include/sof/lib/dma.h Adds ESP32-specific DMA device capability bits.
zephyr/include/sof/lib/cpu.h Adjusts syscall gating to require CONFIG_USERSPACE and adds z_impl aliasing.
zephyr/CMakeLists.txt Adds ESP32-P4 build path, generated include dir, and Zephyr/full-app detection changes.
west.yml Switches Zephyr remote/revision and adds Espressif HAL project/remotes.
uuid-registry.txt Adds UUIDs for usb_audio and bt_audio components.
src/platform/esp32p4/platform.c Introduces ESP32-P4 platform init, IPC init/send, and FW_READY contents.
src/platform/esp32p4/lib/clk.c Adds basic platform clock table/init for ESP32-P4.
src/platform/esp32p4/lib/CMakeLists.txt Adds ESP32-P4 platform lib build file list.
src/platform/esp32p4/include/platform/trace/trace.h Adds ESP32-P4 trace header stub.
src/platform/esp32p4/include/platform/platform.h Adds ESP32-P4 platform constants and guards.
src/platform/esp32p4/include/platform/lib/pm_runtime.h Adds ESP32-P4 pm_runtime header stub.
src/platform/esp32p4/include/platform/lib/memory.h Adds ESP32-P4 memory constants and cache helper macros.
src/platform/esp32p4/include/platform/lib/mailbox.h Adds ESP32-P4 mailbox layout and stub SW register helpers.
src/platform/esp32p4/include/platform/lib/dma.h Defines ESP32-P4 DMAC count.
src/platform/esp32p4/include/platform/lib/dai.h Wires ESP32-P4 DAI to Zephyr DAI subsystem.
src/platform/esp32p4/include/platform/lib/clk.h Adds ESP32-P4 clock constants and platform_clock_init prototype.
src/platform/esp32p4/include/platform/drivers/interrupt.h Adds ESP32-P4 interrupt header stub.
src/platform/esp32p4/CMakeLists.txt Adds ESP32-P4 platform subdir build rules and sources.
src/platform/Kconfig Adds PLATFORM_ESP32P4 Kconfig option.
src/platform/CMakeLists.txt Adds ESP32-P4 platform directory selection.
src/math/iir_df2t_riscv.c Adds RISC-V SIMD DF2T IIR implementation.
src/math/iir_df1_riscv.c Adds RISC-V SIMD DF1 IIR implementation (incl 4th order).
src/math/iir_df1_float.c Adds float DF1 IIR coefficient/delay init helpers.
src/math/fir_generic.c Adds loop unrolling and enables generic FIR for RISC-V SIMD config.
src/math/fir_float.c Adds float FIR implementation and helpers.
src/math/Kconfig.simd Adds FILTER_RISCV_SIMD option.
src/math/Kconfig Adds FILTER_RISCV_SIMD option.
src/math/CMakeLists.txt Adds RISC-V/float math sources to build (FIR float, IIR riscv/float).
src/lib/dma.c Guards against NULL dma_info in sof_dma_get().
src/lib/dai.c Adds ESP32 DAI device list and type mapping.
src/ipc/ipc3/dai.c Adds ESP32 DAI handling for IPC3 DMA channel/config defaults.
src/include/user/debug_stream_slot.h Adds non-userspace fallback mapping for debug_stream_slot syscall.
src/include/sof/schedule/ll_schedule_domain.h Gates ll_schedule_domain syscalls on CONFIG_USERSPACE.
src/include/sof/schedule/dp_schedule.h Adds non-userspace fallbacks and gates syscalls on CONFIG_USERSPACE.
src/include/sof/math/iir_df2t_riscv.h Adds RISC-V DF2T inline wrappers for sample formats.
src/include/sof/math/iir_df2t.h Selects RISC-V DF2T header when enabled.
src/include/sof/math/iir_df1_riscv.h Adds RISC-V DF1 inline wrappers for sample formats.
src/include/sof/math/iir_df1_float.h Adds float DF1 IIR state and inline processing function.
src/include/sof/math/iir_df1.h Selects RISC-V DF1 header when enabled.
src/include/sof/math/fir_generic.h Enables FIR generic include for RISC-V SIMD config.
src/include/sof/math/fir_float.h Adds float FIR state/type API header.
src/include/sof/lib_manager.h Gates lib_manager syscalls on CONFIG_USERSPACE.
src/include/sof/lib/vregion.h Gates vregion syscalls include on CONFIG_USERSPACE.
src/include/sof/lib/dai-zephyr.h Adds non-userspace fallbacks and gates dai_get_device syscall on CONFIG_USERSPACE.
src/include/sof/ipc/msg.h Gates ipc syscalls on CONFIG_USERSPACE and adds non-userspace fallbacks.
src/include/sof/ipc/ipc_reply.h Gates reply syscall on CONFIG_USERSPACE.
src/include/sof/common.h Adds SOF_USE_RISCV_SIMD helper macros.
src/include/sof/audio/usb_audio.h Adds USB Audio component API/UUID header.
src/include/sof/audio/pipeline/static_pipeline.h Adds static topology/pipeline descriptor API.
src/include/sof/audio/pipeline/sof_static_pipeline.h Adds ESP32-P4 oriented static pipeline control/status API.
src/include/sof/audio/module_adapter/module/generic.h Gates syscalls on CONFIG_USERSPACE for full Zephyr app.
src/include/sof/audio/bt_service.h Adds BT service API header for static pipeline integration.
src/include/sof/audio/bt_audio.h Adds BT Audio component API/UUID header.
src/include/module/crossover/crossover_common.h Adds float crossover state and APIs.
src/include/ipc4/notification.h Gates IPC4 notification syscalls on CONFIG_USERSPACE.
src/include/ipc4/handler.h Gates IPC4 handler syscalls on CONFIG_USERSPACE.
src/include/ipc/dai.h Adds ESP32 I2S/PDM DAI types.
src/debug/CMakeLists.txt Adds ESP32 shell sources under CONFIG_SHELL.
src/audio/volume/volume_generic.c Adds FLOAT volume processing functions.
src/audio/volume/volume.c Adds FLOAT zero-crossing tracking function.
src/audio/volume/Kconfig.simd Adds RISC-V SIMD volume option and adjusts defaults.
src/audio/volume/CMakeLists.txt Selects RISC-V volume sources when enabled.
src/audio/tone/tone.h Adds FLOAT tone process prototype.
src/audio/tone/tone.c Adds FLOAT tone generator processing path.
src/audio/tone/tone-ipc4.c Makes tone IPC4 code compile for IPC3 and adds FLOAT format selection.
src/audio/tone/tone-ipc3.c Adds FLOAT support for IPC3 tone params.
src/audio/tone/Kconfig Loosens tone dependencies.
src/audio/tone/CMakeLists.txt Builds tone-ipc4.c unconditionally for non-llext builds.
src/audio/tdfb/tdfb_generic.c Adds FLOAT processing path for TDFB.
src/audio/tdfb/tdfb_comp.h Adds float FIR storage and fields for TDFB.
src/audio/tdfb/tdfb.c Wires FLOAT TDFB setup/init and improves fallback behavior without blob.
src/audio/src/src_ipc3.c Adds FLOAT support in SRC IPC3 prepare mapping.
src/audio/src/src_generic.c Adds FLOAT polyphase stage implementation.
src/audio/src/src_common.h Declares FLOAT SRC stage function.
src/audio/src/src_common.c Allows FLOAT frames for src_copy path.
src/audio/selector/selector_generic.c Adds FLOAT selector support and updates func table.
src/audio/selector/selector.c Adds defaults when no IPC data and implements enum set/get control.
src/audio/pipeline/CMakeLists.txt Adds ESP32-P4 static pipeline loader sources.
src/audio/mux/mux_generic.c Adds FLOAT mux/demux mapping.
src/audio/multiband_drc/multiband_drc_generic.c Adds FLOAT multiband DRC processing path and fnmaps.
src/audio/multiband_drc/multiband_drc.h Adds float state and crossover split pointer; unions with fixed state.
src/audio/multiband_drc/multiband_drc.c Adds float init/reset/setup paths for multiband DRC.
src/audio/module_adapter/module_adapter.c Adjusts copy behavior when sink endpoint is missing.
src/audio/mixin_mixout/mixin_mixout.c Allows FLOAT format through mixin prepare selection.
src/audio/mixer/mixer_generic.c Adds specialized fast path for 2-source mixing and adds FLOAT mixing.
src/audio/level_multiplier/level_multiplier.h Adds float gain storage for FLOAT path.
src/audio/level_multiplier/level_multiplier.c Initializes float gain in init/reset.
src/audio/level_multiplier/level_multiplier-ipc4.c Computes float gain on config update.
src/audio/level_multiplier/level_multiplier-generic.c Adds loop unrolling and implements FLOAT processing.
src/audio/eq_iir/eq_iir_ipc3.c Adds FLOAT support and switches log level to info for mode.
src/audio/eq_iir/eq_iir_generic.c Adds FLOAT setup/state storage and FLOAT processing function.
src/audio/eq_iir/eq_iir.h Adds float IIR state/alloc bookkeeping in component data.
src/audio/eq_iir/Kconfig.simd Adds EQ_IIR_RISCV_SIMD option.
src/audio/eq_iir/Kconfig Sources SIMD Kconfig for EQ IIR.
src/audio/eq_iir/CMakeLists.txt Selects RISC-V EQ IIR implementation based on config.
src/audio/eq_fir/eq_fir_ipc3.c Adds FLOAT format mapping for FIR selection.
src/audio/eq_fir/eq_fir_generic.c Adds FLOAT FIR processing functions and enables on RISC-V SIMD.
src/audio/eq_fir/eq_fir.h Adds float FIR storage and helper setters for FLOAT FIR.
src/audio/eq_fir/eq_fir.c Adds FLOAT setup path and float coefficient conversion/allocations.
src/audio/drc/drc_math_riscv.c Adds RISC-V SIMD DRC math implementation.
src/audio/drc/drc_math.h Adds RISC-V SIMD math helpers/definitions for DRC.
src/audio/drc/drc_generic.c Adds FLOAT support in detector/compress output and enables RISC-V SIMD gating.
src/audio/drc/drc.c Adjusts alignment, logs mode decisions, and passthrough behavior.
src/audio/drc/Kconfig.simd Adds DRC_RISCV_SIMD option.
src/audio/drc/CMakeLists.txt Adds RISC-V DRC sources to build.
src/audio/dcblock/dcblock_generic.c Adds FLOAT DC-block processing function.
src/audio/dcblock/dcblock.h Adds float state fields and float coefficients storage.
src/audio/dcblock/dcblock.c Initializes float coefficients in passthrough path and converts fixed->float coeffs.
src/audio/dai-zephyr.c Adds ESP32 DAI config mapping, adjusts copy burst behavior, and improves converter direction handling.
src/audio/crossover/crossover_generic.c Adds FLOAT crossover processing and fnmaps.
src/audio/crossover/crossover.h Adds float crossover processing helper and state union.
src/audio/crossover/crossover.c Adds float coefficient init paths and split func selection.
src/audio/copier/copier_generic.c Adds FLOAT attenuation handling.
src/audio/asrc/asrc_farrow_generic.c Adds unrolled FIR loops and introduces float FIR filtering.
src/audio/asrc/asrc_farrow.h Declares float FIR filter function.
src/audio/Kconfig Adds COMP_USB_AUDIO and COMP_BT_AUDIO toggles for ESP32-P4.
src/audio/CMakeLists.txt Builds usb_audio/bt_audio/bt_service sources when enabled.
scripts/cmake/uuid-registry.cmake Adds Python discovery and generated header dependency wiring.
scripts/cmake/misc.cmake Extends Zephyr detection macro to include full Zephyr application.
app/src/usbd_init.c Adds sample USB device stack initialization and descriptors for ESP32-P4.
app/src/sample_usbd.h Adds helper header for sample USB device stack setup/init.
app/src/main.c Adds ESP32-P4 startup for static pipelines, UAC2 device ops registration, USB init, and BT init.
app/boards/esp32p4_function_ev_board_esp32p4_hpcore.overlay Adds devicetree overlay for UAC2 card and ESP32 DAI nodes.
app/boards/esp32p4_function_ev_board_esp32p4_hpcore.conf Adds ESP32-P4 board configuration enabling modules, USB stack, and logging/shell.
app/Kconfig Imports Zephyr sample USB Kconfig and references Zephyr Kconfig for full app builds.
app/CMakeLists.txt Adds SOF as subdirectory, wires includes/libs, and adds USB init sources.
Kconfig.sof Always sources Zephyr logging Kconfig.
Suppressed comments (8)

zephyr/CMakeLists.txt:1

  • CONFIG_PLATFORM_ESP32P4 sets ARCH host, but ESP32-P4 is a RISC-V target. This will select arch/host/include for SOF headers and is very likely to break builds or silently use the wrong arch definitions. Set ARCH to the correct SOF arch (e.g., riscv) or avoid overriding ARCH here and instead derive the SOF arch include path from Zephyr’s actual target architecture.
    src/audio/selector/selector_generic.c:1
  • The FLOAT format entries in the IPC4 func_table are mapped to sel_s32le_* functions, which operate on integer PCM and will mis-handle float samples. Map SOF_IPC_FRAME_FLOAT to the float implementation (e.g., sel_float or a dedicated IPC4 float selector) so float routing/matrixing uses float arithmetic.
    src/audio/tone/tone.c:1
  • tone_float_default() only writes output samples inside if (!source) { ... }. If source is non-NULL and cd->mode is not TONE_MODE_PASSTHROUGH, the function commits bytes without initializing the sink buffer, which can produce garbage audio. Add an else path to either (a) consume/copy source to sink, (b) explicitly generate tone/silence while consuming source, or (c) return an error if this mode is unsupported with an input source.
    src/lib/dai.c:1
  • Both SOF_DAI_ESP32_I2S and SOF_DAI_ESP32_PDM are mapped to SOF_DMA_DEV_I2S, but this PR also introduces SOF_DMA_DEV_PDM. For PDM the DMA device bit should be SOF_DMA_DEV_PDM (or a combined mask if the platform truly shares the same DMA endpoint). Update SOF_DAI_ESP32_PDM to use the correct DMA dev bit to avoid incorrect DMAC selection/capability filtering.
    src/math/fir_generic.c:1
  • Loading 32 bits via *(const uint32_t *)coef from an int16_t * can violate alignment requirements on targets that trap unaligned accesses (common on embedded RISC-V configurations), and can also violate strict-aliasing rules. Use an unaligned-safe load (e.g., memcpy into uint32_t c32, or a project-provided UNALIGNED_GET() helper) and document/handle endianness explicitly.
    west.yml:1
  • Using a moving branch name for revision: makes builds non-reproducible (the manifest no longer pins an exact commit). Pin revision to a specific SHA (or an immutable tag) and, if needed, keep the branch name in a comment for discoverability.
    src/platform/esp32p4/platform.c:1
  • FW_READY version fields use placeholder .date/.time strings and .build = -1, which will make firmware version reporting incorrect and could break host-side expectations/tools. Populate these fields from the standard SOF version generation (e.g., values from sof_versions.h / build system date+time) and use a valid build number.
    src/platform/esp32p4/include/platform/lib/mailbox.h:1
  • These stub inline functions have named parameters but don’t reference them, which can trigger -Wunused-parameter warnings in builds that enable it. Consider explicitly marking parameters unused (e.g., ARG_UNUSED(offset);) or casting to void inside the function bodies.

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

Comment thread app/src/main.c
}
#else
int main(void)
int main(int argc, char *argv[])
Comment on lines +38 to +46
execute_process(
COMMAND
${PYTHON_EXECUTABLE} ${TOPDIR}/scripts/gen-uuid-reg.py
${TOPDIR}/uuid-registry.txt
${UUID_REG_H}
RESULT_VARIABLE uuid_res
ERROR_VARIABLE uuid_err
)
message(STATUS "gen-uuid-reg.py result: ${uuid_res}, error: ${uuid_err}")
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