Skip to content

audio: bt_codec, topology2: add BT Transparent DSP codecs and Deepbuffer Bluetooth (PCM 36) - #11444

Draft
lgirdwood wants to merge 6 commits into
thesofproject:mainfrom
lgirdwood:topic/sof-bt-transparent-codecs
Draft

lgirdwood wants to merge 6 commits into
thesofproject:mainfrom
lgirdwood:topic/sof-bt-transparent-codecs

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Depends on #11432 (stacked on topic/sof-bt-offload).

This series adds Sound Open Firmware (SOF) DSP Bluetooth Transparent mode (0x03) audio codec offload components (LC3, mSBC, G.722, SB4), Deepbuffer Bluetooth (PCM 36, D0i3) playback + S32_LE multi-stream mixing, asymmetric 8 / 16 kHz host ↔ 8 kHz SSP2-BT wire ACE 3.0 Panther Lake / Wildcat Lake feature topologies, and a comprehensive README.md hardware test guide:

  1. audio: bt_codec: add Bluetooth Transparent LC3, mSBC, G.722, SB4 (3c110530fd):
    • Imports Zephyr's Apache-2.0 liblc3 module (modules/lib/liblc3) in west.yml with freestanding lc3_math_shim.h (truncf/roundf included) and Clang soft-float (-fp) target flags when CONFIG_FPU=n.
    • Adds src/audio/bt_codec/ (CONFIG_COMP_BT_CODEC=y on ACE 3.0 ptl and wcl) providing four IPC4 processing modules supporting both 16 kHz wideband (120 PCM samples / 7.5 ms) and 8 kHz narrowband (60 PCM samples / 7.5 ms) in S16_LE and S32_LE (mod_zalloc/mod_free, init_config = "1", cache-line-aligned tables):
      • bt_lc3 (4c433301-b700-4a10-8000010203040501): Zephyr liblc3 7.5 ms encoder/decoder (8/16 kHz PCM ↔ 30-byte 32 kbps LC3 payload framed into 60 wire words with native liblc3 PLC on corrupted eSCO slots).
      • bt_msbc (4d534243-b700-4a10-8000010203040502): Bluetooth SIG HFP v1.8 / A2DP v1.3 standard-conforming mSBC encoder/decoder (80-tap Proto_8_80 8-subband polyphase filterbanks, LOUDNESS offset8 bitpool=26, table-driven CRC-8 0x1D, H2 header 0x01/0xad, 57-byte block).
      • bt_g722 (47373232-b700-4a10-8000010203040503): ITU-T Rec. G.722 standard-conforming 24-tap QMF + 2-pole/6-zero adaptive ADPCM encoder/decoder (Mode 1/2/3 raw + Mode-2 56 kbps framed over 64 kbps Transparent eSCO).
      • bt_sb4 (53423401-b700-4a10-8000010203040504): Experimental BSD-3-Clause 4-band 24-tap tree-QMF subband ADPCM encoder/decoder over Transparent eSCO.
    • Uses self-synchronizing 60-byte packet framing (0xA5 0x5A sync + sequence + payload + CRC-8 0x1D) over the 64 kbps (8 kHz 1ch S16_LE) SSP2-BT Transparent eSCO link for zero bit-slip DSP-to-DSP framing.
  2. topology2: bt-generic, ace3, hda-generic: add BT Transparent codecs and Deepbuffer (PCM 36) (0599c11f3b):
    • Adds BT_TRANSP_CODEC (lc3, msbc, g722, sb4) support in bt-generic.conf with asymmetric 8 / 16 kHz 1ch S16_LE/S32_LE host FE formats paired with fixed 8 kHz 1ch S16_LE on SSP2-BT (while preserving 8 / 16 / 48 kHz 1ch / 2ch when BT_TRANSP_CODEC is none), plus widget definitions in include/components/bt-{lc3,msbc,g722,sb4}.conf.
    • Adds platform/intel/bt-deep-buffer.conf (PCM 36: Deepbuffer Bluetooth, pipeline 204, 100 ms L2 SRAM host-copier DMA buffer, lp_mode = 1, playback_compatible_d0i3 = true) feeding a shared S32_LE mixout -> gain -> [bt_codec.1] -> SSP2.OUT DAI pipeline (201) alongside low-latency PCM 20 (pipeline 200), enabling both hardware D0i3 streaming (MTL_HDA_VS_D0I3C = 0x4) and concurrent stream mixing.
    • Builds dedicated ACE 3.0 Panther Lake & Wildcat Lake feature topologies:
      • sof-{ptl,wcl}-rt722-4ch-bt-{lc3,msbc,g722,sb4}.tplg
      • sof-{ptl,wcl}-ssp2-bt-id10-{lc3,msbc,g722,sb4}.tplg
      • sof-hda-generic-ace3-bt-{lc3,msbc,g722,sb4}.tplg
  3. doc: audio: bt_codec: add README and hardware test guide (3e9fbc698f):
    • Adds src/audio/bt_codec/README.md documenting architecture, Mermaid data flow, standard conformance, build/topology setup, BT_CODEC + BT_DEFER_SETUP socket helpers, and step-by-step commands to verify all Bluetooth audio offload protocols.

Validation

1. Standard Reference Codec Interoperability & Host Unit Suite

  • BlueZ libsbc.so.1 (SBC_MODE_MSBC) Interoperability: 44.49 dB SNR (SOF bt_msbc -> BlueZ libsbc), 44.63 dB SNR (BlueZ libsbc -> SOF bt_msbc).
  • FFmpeg libavcodec (adpcm_g722) Interoperability: 37.61 dB SNR bidirectional (64 kbps Mode 1), 29.01 dB SNR (SOF Framed 56 kbps Mode-2 -> FFmpeg).
  • Arbitrary Byte-Slip Framing Sync (0, 17, 43 byte shifts): Passed across both 16 kHz WB and 8 kHz NB for bt_lc3, bt_msbc, bt_g722, and bt_sb4; 64-byte cache-line alignment verified across all lookup/filterbank/CRC tables; 0 hardware FP0 instructions emitted under Xtensa Clang soft-float (CONFIG_FPU=n).

2. Over-the-Air DSP-to-DSP SSP2-BT Transparent 0x03 (ladybird WCL ↔ damsel-fly PTL)

# SOF DSP Codec Module Topology Variant (ladybird / damsel-fly) PCM 20 16 kHz WB Duplex (1000 Hz / 500 Hz) PCM 20 8 kHz NB (1000 Hz) PCM 36 16 kHz Deepbuffer (1000 Hz) Status
1 bt_lc3 (Zephyr liblc3) *-bt-lc3.tplg 1000.0 Hz (RMS 13298) / 500.0 Hz (RMS 13340) 1000.0 Hz (RMS 12801) 1000.0 Hz (RMS 13327) PASS
2 bt_msbc (Bluetooth SIG mSBC) *-bt-msbc.tplg 1000.0 Hz (RMS 12744) / 500.0 Hz (RMS 12729) 1000.0 Hz (RMS 12734) 1000.0 Hz (RMS 12734) PASS
3 bt_g722 (ITU-T Rec. G.722) *-bt-g722.tplg 1000.0 Hz (RMS 12679) / 500.0 Hz (RMS 12712) 1000.0 Hz (RMS 12736) 1000.0 Hz (RMS 12745) PASS
4 bt_sb4 (Experimental 4-band SB-ADPCM) *-bt-sb4.tplg 1000.0 Hz (RMS 12946) / 500.0 Hz (RMS 12215) 1000.0 Hz (RMS 12721) 1000.0 Hz (RMS 13007) PASS

3. Deepbuffer Bluetooth (PCM 36, D0i3 = 0x4) Audio, Mixing & 3-Way Power Benchmark (damsel-fly PTL → ladybird WCL)

  • Audio & Concurrent Mixing: Verified PCM 36 (>= 110 ms period constraint, D0I3C = 0x4 / HDA_PM_PG_STREAMING) across A2DP SBC (S16_LE 67.4 dB SNR, S32_LE 67.3 dB SNR), A2DP AAC-LC (71.8 dB SNR), eSCO mSBC (75.9 dB SNR), eSCO CVSD (23.3 dB SNR), LE Audio CIS LC3 (46.0 dB SNR), concurrent 440 Hz (PCM 36) + 1000 Hz (PCM 20) mixing (-6.0 & -6.0 dBFS), and all 4 SOF Transparent DSP codecs (bt_lc3, bt_msbc, bt_g722, bt_sb4).
  • 3-Way Steady-State Power (CH2 @ 19.96 V DC Wall Power + Intel RAPL package-0, Idle D3 = 8406.3 mW Wall / 1505.3 mW SoC Pkg):
    • 5-Case TX D0i3 Mean (Standalone SSP2, A2DP SBC, A2DP AAC-LC, HFP mSBC TX, SOF bt_lc3 TX): PCM 36 (D0i3) = 8459.1 mW Wall / 1558.6 mW SoC Pkg vs. PCM 20 (D0i0) = 8469.7 mW Wall / 1590.2 mW SoC Pkg (-10.6 mW Wall / -31.6 mW SoC Pkg additional savings from D0i3).
    • A2DP SBC TX (48 kHz 2ch): PCM 36 (D0i3) saves -112.6 mW Wall / -215.6 mW SoC Pkg vs. Legacy Host (D3).
    • A2DP AAC-LC TX (48 kHz 2ch): PCM 36 (D0i3) saves -62.8 mW Wall / -133.3 mW SoC Pkg vs. Legacy Host (D3).
    • SOF Transparent DSP bt_lc3 TX (live LC3 encode in D0i3): PCM 36 (D0i3) saves -128.4 mW Wall / -177.8 mW SoC Pkg vs. Legacy Host liblc3 (D3).

Enable rx_slots=3 alongside tx_slots=3 on the 48 kHz 2-channel SSP2-BT
hardware configuration (hw_config.3) so full-duplex 48 kHz Bluetooth
SSP offload streams can capture and play back simultaneously.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/sof-bt-transparent-codecs branch from 18e650d to 1713a8d Compare November 11, 2026 20:27
@lgirdwood lgirdwood changed the title audio: bt_codec, topology2: add Bluetooth Transparent LC3, mSBC, G.722, and aptX DSP codecs audio: bt_codec, topology2: add BT Transparent DSP codecs and Deepbuffer Bluetooth (PCM 36) Nov 13, 2026
@lgirdwood
lgirdwood requested a balanced review from Copilot November 13, 2026 14:24
@lgirdwood

Copy link
Copy Markdown
Member Author

@naveen-manohar fyi - 6 patches now.

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

Critical allocation and floating-point fault risks, bypassed 16 kHz codec processing, and non-interoperable mSBC, G.722, and aptX implementations remain unresolved.

6 open issues
What changed in this PR

Extends SOF’s SSP2 Bluetooth offload support from #11432 with Transparent-mode DSP codec modules and deep-buffer playback, plus topology integration and hardware testing documentation.

Changes:

  • Adds four codec modules, liblc3 integration, S32_LE processing, and PTL/WCL firmware registration.
  • Adds PCM 36 deep-buffer playback and shared mixing with PCM 20, with dedicated Bluetooth topology variants.
  • Documents topology IDs, build configuration, and hardware validation procedures.
File Description
west.yml Imports Zephyr’s liblc3 module.
uuid-registry.txt Registers four Bluetooth codec UUIDs.
tools/​topology/​topology2/​sof-hda-generic.conf Adds optional Bluetooth topology integration.
tools/​topology/​topology2/​README.md Documents Bluetooth PCM and pipeline IDs.
tools/​topology/​topology2/​production/​tplg-targets-hda-generic.cmake Adds HDA Bluetooth topology variants.
tools/​topology/​topology2/​production/​tplg-targets-ace3.cmake Adds PTL/WCL Bluetooth targets and aliases.
tools/​topology/​topology2/​platform/​intel/​bt-ssp-config.conf Enables stereo SSP capture slots.
tools/​topology/​topology2/​platform/​intel/​bt-generic.conf Integrates codecs and shared playback mixing.
tools/​topology/​topology2/​platform/​intel/​bt-default.conf Defines codec and deep-buffer defaults.
tools/​topology/​topology2/​platform/​intel/​bt-deep-buffer.conf Adds PCM 36 low-power playback.
tools/​topology/​topology2/​include/​formats/​bt_ssp_s16_output_audio_formats.conf Defines S16_LE wire formats.
tools/​topology/​topology2/​include/​formats/​bt_s32_output_audio_formats.conf Defines internal S32_LE output formats.
tools/​topology/​topology2/​include/​formats/​bt_s32_input_audio_formats.conf Defines internal S32_LE input formats.
tools/​topology/​topology2/​include/​formats/​bt_host_input_audio_formats.conf Defines supported host playback formats.
tools/​topology/​topology2/​include/​components/​bt-msbc.conf Defines the mSBC module widget.
tools/​topology/​topology2/​include/​components/​bt-lc3.conf Defines the LC3 module widget.
tools/​topology/​topology2/​include/​components/​bt-g722.conf Defines the G.722 module widget.
tools/​topology/​topology2/​include/​components/​bt-codec-formats.conf Shares codec widget format declarations.
tools/​topology/​topology2/​include/​components/​bt-aptx.conf Defines the aptX module widget.
tools/​topology/​topology2/​cavs-sdw.conf Imports Bluetooth codec and mixer classes.
tools/​rimage/​config/​wcl.toml.h Includes WCL codec manifest entries.
tools/​rimage/​config/​ptl.toml.h Includes PTL codec manifest entries.
src/​audio/​Kconfig Includes Bluetooth codec configuration.
src/​audio/​CMakeLists.txt Conditionally builds Bluetooth codecs.
src/​audio/​bt_codec/​README.md Adds architecture and hardware testing guidance.
src/​audio/​bt_codec/​lc3_math_shim.h Adds local floating-point math helpers.
src/​audio/​bt_codec/​Kconfig Defines the codec build option.
src/​audio/​bt_codec/​CMakeLists.txt Integrates codec and liblc3 sources.
src/​audio/​bt_codec/​bt_codec.toml Declares four IPC4 module entries.
src/​audio/​bt_codec/​bt_codec.c Implements module lifecycle and stream processing.
src/​audio/​bt_codec/​bt_codec_algos.h Implements codec algorithms and packet framing.
app/​boards/​intel_adsp_ace30_wcl.conf Enables Bluetooth codecs on WCL.
app/​boards/​intel_adsp_ace30_ptl.conf Enables Bluetooth codecs on PTL.
app/​boards/​intel_adsp_ace15_mtpm.conf Enables DMA FIFO partitioning on ACE1.5.

Review effort: Balanced

Comment thread src/audio/bt_codec/CMakeLists.txt Resolved
Comment thread src/audio/bt_codec/bt_codec.c Resolved
Comment thread src/audio/bt_codec/bt_codec.c Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved

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

We have some patches that alter previously introduces files and these can be squashed into the patch that introduces the new file.

Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec_algos.h Resolved
Comment thread src/audio/bt_codec/bt_codec.c Resolved
@lgirdwood
lgirdwood force-pushed the topic/sof-bt-transparent-codecs branch from b3defe4 to 5859b00 Compare November 13, 2026 17:20
Include SSP and Bluetooth offload definitions in sof-hda-generic.conf
when ADD_BT=true without altering existing non-BT topologies.

Add dedicated SSP2-BT offload topology targets (BT_PCM_ID=20,
BT_PCM_NAME=Bluetooth, ADD_BT=true) for ACE 1.5/2.0 and ACE 3.0 HDA
platforms (sof-hda-generic-ace1-bt, sof-hda-generic-ace3-bt,
sof-hda-generic-ace3-2ch-bt, sof-hda-generic-ace3-4ch-bt) as well as
ACE 3.0 / Wildcat Lake RT722 4ch SoundWire platforms
(sof-ptl-rt722-4ch-bt and sof-wcl-rt722-4ch-bt).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Enable CONFIG_DMA_DW_FIFO_PARTITION=y on ACE 1.5 (MTL/ARL-S) matching
CAVS 2.5 so dw_dma_setup() partitions the LP-GPDMA hardware FIFO
instead of leaving FIFO partition sizes at zero, preventing immediate
SSP2-BT GATEWAY_UNDERRUN_DETECTED errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add SOF DSP Bluetooth Transparent eSCO/SCO codec modules supporting both
16 kHz wideband (120 samples / 7.5 ms) and 8 kHz narrowband (60 samples /
7.5 ms) host PCM over a 64 kbps (8 kHz 1ch S16_LE) SSP2-BT wire link in
both S16_LE and S32_LE pipeline formats:

- bt_lc3: Bluetooth LC3-SWB/WB/NB wrapper backed by Zephyr's Apache-2.0
  liblc3 module (30-byte 32 kbps payload framed into 60 wire words per
  7.5 ms with native liblc3 PLC on corrupted eSCO slots), including a
  self-contained freestanding lc3_math_shim.h and Clang soft-float (-fp)
  target flags when CONFIG_FPU=n.
- bt_msbc: Bluetooth SIG HFP v1.8 / A2DP v1.3 standard-conforming mSBC
  codec (80-tap Proto_8_80 8-subband polyphase filterbanks, LOUDNESS
  offset8 bitpool=26 allocation, table-driven CRC-8, and H2 sync header).
- bt_g722: ITU-T Rec. G.722 standard-conforming 24-tap QMF subband ADPCM
  codec (2-pole / 6-zero adaptive predictor, Mode 1/2/3 raw and Mode-2
  56 kbps framed transport).
- bt_sb4: Experimental BSD-3-Clause 4-band 24-tap tree-QMF subband ADPCM
  codec over Transparent eSCO.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…nd Deepbuffer (PCM 36)

Add Bluetooth Transparent DSP codec topologies (lc3, msbc, g722, sb4) and
Deepbuffer Bluetooth playback offload (PCM 36, pipeline 204) alongside
low-latency Bluetooth (PCM 20) across ACE 3.0 SoundWire and HDA Generic:

- Configure asymmetric Transparent audio formats: 8/16 kHz mono S16_LE/
  S32_LE on the host FE pipelines paired with fixed 8 kHz mono S16_LE
  (64 kbps) on the SSP2-BT wire link, while preserving existing 8/16/48 kHz
  controller offload formats when BT_TRANSP_CODEC is 'none'.
- Add platform/intel/bt-deep-buffer.conf (100 ms L2 SRAM buffer, lp_mode=1,
  D0i3 compatible) feeding a shared S32_LE mixout -> gain -> [bt_codec.1]
  -> dai-copier (SSP2-BT) playback DAI pipeline.
- Generate -bt-{lc3,msbc,g722,sb4} production topologies for PTL, WCL, and
  HDA Generic ACE 3.0 targets.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Document the SOF Bluetooth offload topologies, DSP Transparent codecs
(bt_lc3, bt_msbc, bt_g722, bt_sb4), standard conformance, PCM 20
low-latency and PCM 36 deepbuffer ALSA pipelines, and end-to-end
over-the-air Linux BTPROTO_SCO (BT_CODEC / BT_DEFER_SETUP) test steps.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/sof-bt-transparent-codecs branch from 5859b00 to 3e9fbc6 Compare November 13, 2026 17:40
@lgirdwood

Copy link
Copy Markdown
Member Author

Addressed all review comments (including the top-level squashing note and all 11 inline threads — now resolved) and re-verified CI (43/43 passing):

  • Patch squashing (@lgirdwood): Squashed the bt_codec, S32_LE, topology2, Deepbuffer PCM 36, and documentation updates into three disjoint commits stacked on topology2, ace15: enable SSP2-BT hardware offload topologies and LP-GPDMA FIFO partition #11432 (0f0ed9acd):
    • 3c110530fe audio: bt_codec: add Bluetooth Transparent LC3, mSBC, G.722, SB4
    • 0599c11f39 topology2: bt-generic, ace3, hda-generic: add BT Transparent codecs and Deepbuffer (PCM 36)
    • 3e9fbc6982 doc: audio: bt_codec: add README and hardware test guide
  • Inline code & conformance fixes: Moved codec implementations from bt_codec_algos.h to bt_codec_algos.c, aligned constant tables with __aligned(PLATFORM_DCACHE_ALIGN), switched to sat_int16() and static inline bt_crc8_1d(), switched to mod_zalloc() / mod_free(), added Clang CONFIG_FPU=n soft-float (-fp) flags + freestanding truncf/roundf in lc3_math_shim.h, implemented distinct 8/16 kHz host ↔ 8 kHz wire formats, replaced bt_msbc / bt_g722 with standard-conforming implementations (verified against BlueZ libsbc and FFmpeg adpcm_g722), renamed bt_aptx to bt_sb4, and re-verified live OTA across ladybird (WCL) ↔ damsel-fly (PTL).

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