Repository navigation
WIP: teensy41: add PJRC Teensy 4.1 platform support, Audio PLL scheduling, S/PDIF loopback, and ARM Cortex-M7 SIMD optimizations - #11197
Draft
lgirdwood wants to merge 4 commits into
Conversation
Member
Author
|
@dbaluta ARM SIMD in here. |
Collaborator
|
Thanks @lgirdwood will have a look! |
Collaborator
|
@lgirdwood this looks very promising tested the ARM SIMD instructions on imx8mp with M7 core, looks like the load for simple volume pipeline decreased by at least 30%. Also, looking to borrow an RT to do some more testing. |
Extend IPC4 DAI gateway configuration to handle NXP i.MX digital audio interfaces: - dai_config_dma_channel: return channel 0 for SOF_DAI_IMX_* instead of failing with SOF_DMA_CHAN_INVALID (-EINVAL). - ipc_dai_data_config: set burst_elems = 2 for 32-bit stereo word transfers. - dai_init_llp_info: skip Intel mailbox linear link position (LLP) slot allocation for SOF_DAI_IMX_* interfaces. - include/ipc: define SOF_DAI_IMX_SPDIF and SOF_DAI_FMT_SPDIF with params struct. - lib/dai: map SOF_DAI_IMX_SPDIF and SOF_DAI_IMX_SAI to Zephyr DAI devices and DMA channels. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
… publishing - sof_static_topology_prepare_comps: skip components without attached buffer sources or sinks in bypass mode, and treat -ENOTCONN gracefully during prepare. - sof_static_topology_init: publish s_active_topo before Stage 7 (init_controls) so that kcontrol setter operations during default value initialization can reference the active topology instead of failing with -ENODEV (-19). - Reset s_active_topo to NULL on initialization failure unwinding. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…LL scheduling and UAC2 Add comprehensive platform support for PJRC Teensy 4.1 (NXP i.MX RT1062 Cortex-M7): - platform/teensy41: Audio PLL4 configuration (688.128 MHz), SAI1 MCLK (12.288 MHz), on-chip S/PDIF transceiver clock root (/4, /7 => 24.576 MHz), fast slew rate pinmux, static pipeline topology, and memory heap allocation. - app/boards/teensy41: add board overlay, Kconfig settings, and devicetree definitions for SAI1, S/PDIF transceiver (Pins 14 and 15 ALT3), and eDMA. - dai-zephyr: drive Low-Latency (LL) scheduling domain from Audio PLL via cyclic eDMA period completion interrupts (dai_zephyr_dma_period_cb). - zephyr_domain: suppress SysTick k_timer scheduling ticks when audio stream is actively driven by hardware audio domain clock. - usb_audio: replenish UAC2 capture double buffer on packet completion and handle burst multi-packet reads to prevent endpoint underflow/overflow. - syscalls: guard Zephyr syscall includes with CONFIG_USERSPACE for non-MMU architectures. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…agnostic tools - test_teensy_loopback.py: automated pre-commit hardware loopback test suite verifying SNR (>= 70.0 dB S/PDIF, >= 80.0 dB I2S), frequency accuracy, and zero dropped frames; includes two-pass ALSA device resolution and transient trimming. - teensy_diag.py: inspect real-time S/PDIF registers (SCR, SRPC, STC, SRFM, SIS, SIE), SAI1 registers, eDMA TCD descriptors, and SOF component states via USB request 0xFC. - teensy_flash.py: PJRC HalfKay USB HID flasher supporting automatic soft-reboot, multi-board targeting by USB port or serial, and direct hex programming. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
force-pushed
the
feature/teensy41-sof-port
branch
from
October 15, 2026 19:35
7ce7441 to
8e00e42
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WIP: patches need split/squashed, contains commit from other PRs too.
Work in progress: Adds support for the PJRC Teensy 4.1 development board (NXP i.MX RT1062 Cortex-M7 @ 600 MHz with single-precision FPU, Audio PLL4, and eDMA) running Sound Open Firmware (SOF) with Zephyr USB Audio Class 2.0 (UAC2), and introduces Phase 1 & Phase 2 of ARM Cortex-M7 SIMD & DSP optimizations across hot-path audio processing modules.
All changes have been validated on a dual-board physical hardware test fixture (Board A Master Tx$\to$ Board B Slave Rx) over S/PDIF hardware loopback, achieving 140.81 dB SNR with 0 dropped frames.
Key Changes
1. Platform Support (
platform/teensy41&app/boards/teensy41)0x10B1).SPDIF_SCR_TXFIFO_CTRL(0)) maintaining receiver PLL lock when idle.dai_zephyr_dma_period_cb) from cyclic eDMA wake the LL scheduling thread every 48 audio frames (1.000 ms).k_timerscheduling ticks while audio is active.2. ARM Cortex-M7 SIMD & DSP Acceleration Framework (
include/sof/audio/arm_simd.h)Provides Cortex-M DSP intrinsics and inline assembly primitives with generic portable fallbacks:
arm_smulbb,arm_smultt,arm_smlad,arm_smlald.arm_smlal,arm_smull.arm_qadd16.arm_qadd.arm_sat_s16,arm_sat_s24.arm_smmulr.arm_pkhbt,arm_pkhtb,arm_sxth.arm_clz.3. Audio Module Optimizations (Phase 1 & Phase 2)
volume&volume_with_peakvol:vmul.f32).math/iir_df1&math/iir_df2t:SMLAL(32x32eq_iir:drc&drc_math:CLZleading-zero normalization, Horner polynomial evaluation withSMMULR, and unrolled compressor loop.math/fir&audio/eq_fir:SMLAL64-bit MAC (fir_32x16).fir_32x16_2xcomputing 2 consecutive samples per step, halving delay-line load operations.eq_fir_arm.c.audio/mixer:arm_qadd16.arm_qadd, 24-bit saturation viaarm_sat_s24, and unrolled single-precision vector addition (vadd.f32).audio/mixin_mixout:arm_smulbb,arm_smmulr,vfma.f32).audio/dcblock:arm_smlal/SMULL) and hardware float (vfma.f32).audio/level_multiplier:arm_smulbb/arm_smultt+arm_pkhbt), fast S24/S32 scaling (arm_smmulr), and dual-issue float scaling.audio/pcm_converter:SOF_IPC_FRAME_S24_4LE.pcm_func_map) and IPC4 (pcm_func_vc_map).4. Diagnostic & Automated Pre-Commit Verification Tools (
scripts/)scripts/test_teensy_loopback.py: Automated pre-commit verification tool supporting S/PDIF (--interface spdif) and SAI1 I2S (--interface i2s) loopback testing with FFT spectrum analysis, SNR calculation, and frame drop detection.scripts/teensy_diag.py: Diagnostic tool decoding RT1062 S/PDIF (SCR, SRPC, STC, SRFM, SIS, SIE) and SAI1 registers.scripts/teensy_flash.py: HalfKay USB HID bootloader flashing tool with auto-detect and USB port targeting.Hardware Verification & Results
Verified on physical Teensy 4.1 hardware (Board A Master Tx$\to$ Board B Slave Rx over S/PDIF hardware transceiver):