Skip to content

Bluetooth: btintel, msft, sco, iso, l2cap: support SSP audio hardware offload - #6031

Draft
lgirdwood wants to merge 9 commits into
thesofproject:topic/sof-devfrom
lgirdwood:sof-bt
Draft

lgirdwood wants to merge 9 commits into
thesofproject:topic/sof-devfrom
lgirdwood:sof-bt

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

This series enables full Bluetooth SSP (SSP2-BT, Data_Path_ID = 0x01) hardware and Transparent-mode audio offload across HFP/eSCO (BTPROTO_SCO), LE Audio CIS/BIS (BTPROTO_ISO), and A2DP (BTPROTO_L2CAP) on Intel Bluetooth controllers paired with Sound Open Firmware (SOF) DSPs:

  1. Bluetooth: btintel: configure offload on operational boot (dc45683418df):
    • Calls btintel_configure_offload() when booting directly in operational firmware state (BTINTEL_IMG_OP) and sets HCI_OFFLOAD_CODECS_ENABLED so BT_CODEC socket discovery is active immediately.
  2. Bluetooth: sco: support Enhanced Accept Synchronous Connection (743e0b03a5c0):
    • Implements HCI_OP_ENHANCED_ACCEPT_SYNC_CONN (0x043e) and hci_accept_sync() so incoming eSCO/SCO connections on BT_CODEC-configured sockets configure the controller data path (0x0c83) and accept synchronous links over SSP2-BT instead of legacy HCI PCM.
  3. Bluetooth: btintel: enable DDC offload codecs and ACL/ISO paths (b1336bc95213):
    • Writes DDC 0x0130 (0x3f) and 0x0120 (0x0b) via 0xfc8b during btintel_configure_offload() so 0x100d / 0x100e expose SCO, LE Audio ISO, and A2DP offload capabilities, and configures SSP presets in btintel_get_codec_config_data().
  4. Bluetooth: iso, l2cap: support BT_CODEC offload and data path (198a7de7a83d):
    • Adds BT_CODEC getsockopt() / setsockopt() discovery and selection on BTPROTO_ISO (HCI_TRANSPORT_LE_CIS / LE_BIS) and BTPROTO_L2CAP (HCI_TRANSPORT_ACL), and updates hci_iso_setup_path() to configure 0x0c83 and 0x206e (HCI_LE_Setup_ISO_Data_Path) for offloaded ISO streams.
  5. Bluetooth: msft: support AVDTP A2DP hardware offload over SSP (c9028e599d53):
    • Implements Microsoft HCI vendor extension (0xfc1e) subcommands 0x07..0x0b (Avdtp_Capabilities_Configuration, Avdtp_Open, Avdtp_Start, Avdtp_Suspend, Avdtp_Close) when MSFT_FEATURE_MASK_AVDTP (BIT(10)) is advertised, registering offloaded SBC (0x00) and AAC (0x02) capabilities under HCI_TRANSPORT_ACL and managing stream lifecycle on BTPROTO_L2CAP sockets.
  6. Bluetooth: hci_conn, btintel: support u-law and A-law SCO offload (2e0ede4f3900):
    • Configures 8 kHz SSP preset 0x00 for 0x00 (G.711 u-law), 0x01 (G.711 A-law), 0x02 (CVSD), 0x03 (Transparent), and 0x04 (Linear PCM), and passes the selected coding format ID in hci_enhanced_setup_sync() and hci_enhanced_accept_sync().
  7. Bluetooth: hci_conn, iso, btintel: support LE CIS LC3 SSP offload (55bbf62a067b):
    • Configures 16 kHz SSP preset 0x01 for CIS_LINK/BIS_LINK, populates Bluetooth SIG LC3 LTV Codec_Specific_Configuration (Sampling_Frequency, Frame_Duration, Octets_Per_Codec_Frame) in hci_iso_setup_path() when offloading BT_CODEC_LC3 (0x06), and propagates BT_CODEC onto hcon->codec in iso_conn_ready() for CIS Peripheral offload.

Hardware Validation (Over-the-Air DSP-to-DSP SSP2-BT hw:0,20)

Validated bi-directionally (500 Hz TX on Wildcat Lake ladybird [ibt-1190-01a1-pci] ↔ 1000 Hz TX on Panther Lake damsel-fly [ibt-00a0-0041-pci] and Arrow Lake dragon-fly [BE200]):

# Transport Protocol / Codec ladybird RX FFT (1000 Hz TX) damsel-fly RX FFT (500 Hz TX) Status
1 A2DP (BTPROTO_L2CAP) Controller SBC (0x00) (48 kHz 2ch) 999.97 Hz (RMS 14119.6) 499.35 Hz (RMS 14135.0) PASS
2 A2DP (BTPROTO_L2CAP) Controller AAC (0x02) (48 kHz 2ch) 1000.08 Hz (RMS 13707.5) 500.57 Hz (RMS 13727.3) PASS
3 HFP/eSCO (BTPROTO_SCO) Controller mSBC (0x05) (16 kHz 1ch) 999.90 Hz (RMS 14142.7) 500.08 Hz (RMS 14123.5) PASS
4 HFP/eSCO (BTPROTO_SCO) Controller CVSD (0x02) (8 kHz 1ch) 1000.14 Hz (RMS 10833.2) 499.37 Hz (RMS 13668.5) PASS
5 HFP/eSCO (BTPROTO_SCO) Controller G.711 u-law (0x00) (8 kHz 1ch) 1000.00 Hz (RMS 14006.2) 499.86 Hz (RMS 14177.9) PASS
6 HFP/eSCO (BTPROTO_SCO) Controller G.711 A-law (0x01) (8 kHz 1ch) 1000.29 Hz (RMS 14098.8) 500.57 Hz (RMS 14261.1) PASS
7 HFP/eSCO (BTPROTO_SCO) Transparent (0x03) Raw PCM + SOF DSP (LC3, mSBC, G.722, aptX) 999.77..1000.45 Hz (RMS >14100) 499.86..500.08 Hz (RMS >14100) PASS
8 LE Audio CIS (BTPROTO_ISO) Controller LC3 (0x06) (16 kHz 1ch) 1000.03 Hz (RMS 15343.7) 499.89 Hz (RMS 15503.1) PASS

@lgirdwood lgirdwood changed the title Bluetooth: btintel, msft, sco, iso, l2cap: support SSP audio hardware offload (HFP/eSCO, LE Audio ISO, A2DP AVDTP) Bluetooth: btintel, msft, sco, iso, l2cap: support SSP audio hardware offload Nov 11, 2026
@lgirdwood
lgirdwood requested a balanced review from Copilot November 11, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@lgirdwood
lgirdwood requested a balanced review from Copilot November 13, 2026 14:12
@lgirdwood

Copy link
Copy Markdown
Member Author

@naveen-manohar fyi.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Audio offload can bypass connection and security setup on unconnected sockets, while concurrent codec changes can leave controller streams running without handles for cleanup.

8 open issues

Review effort: Balanced

Comment thread net/bluetooth/l2cap_sock.c Resolved
Comment thread net/bluetooth/l2cap_sock.c Resolved
Comment thread net/bluetooth/hci_conn.c Resolved
Comment thread net/bluetooth/hci_conn.c Resolved
Comment thread net/bluetooth/iso.c Resolved
Comment thread net/bluetooth/msft.c Resolved
Comment thread net/bluetooth/msft.c Resolved
Comment thread net/bluetooth/sco.c Resolved
Comment thread drivers/bluetooth/btintel.c Resolved
Comment thread include/net/bluetooth/bluetooth.h Resolved
Comment thread net/bluetooth/msft.c Resolved
When an Intel Bluetooth controller boots or reloads, offload callback
registration depends on the firmware state encountered in
btintel_bootloader_setup_tlv():

1. On a cold boot (ver->img_type != BTINTEL_IMG_OP), execution downloads
   operational firmware, loads DDC (btintel_load_ddc_config()), and calls
   btintel_configure_offload(hdev) to set hdev->get_data_path_id and
   hdev->get_codec_config_data.
2. On a warm reboot or PCIe/USB driver reload where the controller is
   already running operational firmware (ver->img_type == BTINTEL_IMG_OP),
   btintel_bootloader_setup_tlv() jumps straight to the finish: label,
   bypassing btintel_configure_offload(hdev).
3. Because hdev->get_data_path_id and hdev->get_codec_config_data remain
   NULL, subsequent BT_CODEC offload queries and configuration fail with
   -EOPNOTSUPP.

Move btintel_configure_offload(hdev) under the finish: label so offload
callbacks are registered on both cold boot and operational-firmware boot
paths.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Set HCI_OFFLOAD_CODECS_ENABLED in btintel_configure_offload() when
0xfc86 (HCI_Intel_Read_Offload_Use_Cases) reports supported offload use
cases (preset[0] & 0x03), so hci_dev_open_sync() queries the
controller's local offload codecs (0x100d / 0x100e) during adapter
initialization.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add HCI_OP_ENHANCED_ACCEPT_SYNC_CONN (0x043e) and hci_accept_sync()
so incoming eSCO/SCO connections on sockets configured with BT_CODEC
(data_path != 0) configure the controller data path (0x0c83) and
accept the synchronous connection over the offloaded PCM/SSP
transport instead of falling back to legacy
HCI_OP_ACCEPT_SYNC_CONN_REQ (0x0429).

Allow setting BT_CODEC on listening SCO sockets, propagate the
listening socket's codec settings onto conn in hci_conn_request_evt()
for non-deferred accepts as well as child sockets during
sco_sock_init(), and invoke hci_accept_sync() whenever an offloaded
data path is configured.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Enable DDC 0x0130 (0x3f: LC3, SCO, A2DP SBC/AAC, LE Audio vendor
codec, and controller delay reporting) and DDC 0x0120 (0x0b: SCO,
LE ISO, and A2DP offload use cases) via HCI_Intel_Write_DDC (0xfc8b)
during btintel_configure_offload() so
HCI_Read_Local_Supported_Codecs_v2 (0x100d) and
HCI_Read_Local_Supported_Codec_Capabilities (0x100e) report all
hardware offload codecs supported by operational firmware.

Extend btintel_get_codec_config_data() to configure 16 kHz SCO
presets (0x01) for non-CVSD SCO codecs and 48 kHz 16-bit stereo SSP
offload (preset 0x22) for ACL and LE CIS/BIS links.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add BT_CODEC getsockopt and setsockopt support to BTPROTO_ISO (for
HCI_TRANSPORT_LE_CIS and HCI_TRANSPORT_LE_BIS offload codecs such as
LC3 and vendor LE Audio codecs) and BTPROTO_L2CAP (for
HCI_TRANSPORT_ACL A2DP offload codecs such as Intel SBC 0x0002:0x0000
and AAC 0x0002:0x0002), and export hci_configure_datapath() for use
by L2CAP and ISO data path setup.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Update hci_iso_setup_path() to configure the controller data path
(0x0c83) via hci_configure_datapath() and pass the requested
data_path, codec ID, and vendor CID/VID to HCI_LE_Setup_ISO_Data_Path
(0x206e) when offload is enabled.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Implement Microsoft HCI vendor extension (0xfc1e) subcommands
0x07..0x0b (HCI_VS_MSFT_Avdtp_Capabilities_Configuration, Avdtp_Open,
Avdtp_Start, Avdtp_Suspend, and Avdtp_Close) when
MSFT_FEATURE_MASK_AVDTP (BIT(10)) is advertised by the controller.

During msft_do_open(), query subcommand 0x07 and register the
controller's offloaded AVDTP Media Codec Service Capabilities (SBC
0x00 and MPEG-2,4 AAC 0x02) into hdev->local_codecs under
HCI_TRANSPORT_ACL.

When setsockopt(SOL_BLUETOOTH, BT_CODEC) is called on a connected
BR/EDR ACL BTPROTO_L2CAP channel, serialize stream transitions under
chan->avdtp_lock, validate supplied SBC/AAC capability TLVs and AAC
bitrates (>= 128 kbps), invoke msft_avdtp_open() to open and start
hardware A2DP offload on the controller's SSP TDM interface, and
automatically close any active stream on disable or L2CAP release.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Configure 8 kHz SSP PCM preset 0x00 in btintel_get_codec_config_data()
for 8 kHz synchronous codecs (0x00 u-law, 0x01 A-law, 0x02 CVSD, 0x03
Transparent, and 0x04 Linear PCM) while keeping 16 kHz preset 0x01
for 0x05 mSBC.

Update hci_enhanced_setup_sync() and hci_enhanced_accept_sync() to
pass the requested over-the-air coding format ID for G.711 u-law
(0x00) and A-law (0x01) connections instead of hardcoding CVSD (0x02).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Support hardware LC3 offload over SSP for LE Audio CIS and BIS links:

- Validate and store user-supplied LC3 Codec_Specific_Configuration LTV
  capabilities from setsockopt(BT_CODEC) on iso_pi(sk) and hci_conn
  (checking Sampling_Frequency via btintel_get_codec_config_data()).
- Update btintel_lc3_freq_preset() to map LC3 Sampling_Frequency 16 kHz
  (0x03) to preset 0x01 and 48 kHz (0x08) to preset 0x22, rejecting
  unsupported rates with -EINVAL.
- Build direction-specific LC3 LTV configuration and QoS parameters for
  TX and RX paths (both ucast CIS and bcast BIS) in hci_iso_setup_path(),
  handling 75-octet 7.5 ms frames (48_1) cleanly when deriving defaults.
- Propagate listener codec configuration onto hci_conn before
  hci_iso_setup_path() runs in hci_le_cis_req_evt() and
  hci_le_big_sync_established_evt(), covering non-deferred CIS and BIG
  sync paths as well as BT_DEFER_SETUP and iso_conn_ready().

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