Commit graph zephyr/drivers/bluetooth
Author SHA1 Message Date
Gang Li
e822af63f6 drivers: bluetooth: HCI: Add missing byteorder.h include in silabs driver
The sys_le16_to_cpu() call added in hci_silabs_efr32.c requires
<zephyr/sys/byteorder.h> to be included.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2026-07-09 11:20:48 +01:00
Gang Li
f1027dab16 drivers: bluetooth: HCI: fix unaligned access in extended adv report
When processing LE Extended Advertising Report events in
is_hci_event_discardable(), the evt_type field of adv_info[0] may
reside at an unaligned address. This occurs because evt_data can
point to shared memory (e.g., IMU buffer) at an odd address, and
the evt_type (uint16_t) ends up at an odd offset after the packed
struct layout.

On Cortex-M33 with UNALIGN_TRP enabled, this causes a HardFault.

Use sys_le16_to_cpu() to read the evt_type field, which ensures
the compiler generates byte-level access (LDRB) for the packed
struct member, avoiding the unaligned LDRH instruction.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2026-07-09 08:00:26 +02:00
William Markezana
28f7ea4b49 soc: bflb: bl61x: add WiFi RF calibration and platform support
Extend bflb_rf_init() to support WiFi mode (WL_API_MODE_ALL) with
TX power targets and country code configuration when CONFIG_BFLB_WIFI
is enabled.

Add WiFi platform glue: MAC ISR wiring, task creation, low-power
stubs, wl80211 RTOS primitives (heap, RNG, timers), and the linker
section for WiFi shared RAM.

Introduce CONFIG_BFLB_BL61X_WL_RMEM_SIZE for PHY/RF retention memory
sizing.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-07-07 13:34:51 +02:00
Vincent Tardy
b50a9bdb8b drivers: bt: stm32wba: add CONFIG_BUILD_ONLY_NO_BLOBS to allow CI tests
Adds an option to enable CI tests without binary blobs.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-07-06 11:30:01 -04:00
Romain Jayles
1bcb3de8a6 soc: st: stm32wbax: add PM S2RAM support
Add STM32WBAx suspend-to-RAM support and hook the SoC-specific
implementation into the build when CONFIG_PM_S2RAM is enabled.

Select the custom S2RAM marking capability and add the STM32WBAx S2RAM
support source file.

Update the suspend-to-RAM path to clear the hardware standby flag as early
as possible after resume. Use standby_entered as a software indicator to
track whether standby was effectively entered and cleared, so resume
handling only restores radio state when needed.

Signed-off-by: Romain Jayles <romain.jayles@st.com>
2026-06-29 13:50:45 -05:00
Vincent Tardy
55d081e0e2 soc: stm32wbax: use static direct IRQ registration for radio irq
Replace runtime dynamic IRQ registration
with static direct IRQ registration.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-06-29 13:50:16 -05:00
Aleksandr Khromykh
6019ea7f95 bluetooth: hci: reduce logging messaging
Mesh uses legacy packets with extended advertiser.
Dropping of ext adv events is normal behavior.
However, mesh samples ara spammed these error messages
on some platforms.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-25 10:28:50 -07:00
Sreeram Tatapudi
b37f5e667a drivers: bluetooth: infineon: add diagnostics to HCI setup
Add error logging on the device-not-ready, HCI_RESET and firmware
download failure paths, and include the image size in the firmware
download debug message, to make bring-up failures easier to diagnose.

Assisted-by: Copilot:claude-opus-4.8
Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2026-06-22 18:05:12 -04:00
Josuah Demangeon
c963cd0686 drivers: bluetooth: hci_bflb: make use of configdefault
Default overrides in Kconfig can makeuse of configdefault instead of
config to preserve the dependency checks.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-06-18 08:57:29 -04:00
Josuah Demangeon
64e6b4fd42 drivers: bluetooth: hci_bflb: match EVT RX count to ACL TX count
Make sure to have enough even packets for every ACL TX packets we want to
respond. Declare (BT_EVT_RX_COUNT) as (BT_ACL_TX_COUNT + 1).

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-06-18 08:57:29 -04:00
Anas Nashif
ea1fbf3588 driver: fix various typos
Fixed various typos under drivers/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 10:12:27 -04:00
Vincent Tardy
7401a1259a bluetooth: stm32wbax: add BT_STM32WBA_BASIC_PLUS_LIB KConfig
Add new KConfig BT_STM32WBA_BASIC_PLUS_LIB specifying the
configuration of the stm32wba ble library for bluetooth
basic plus features.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-06-16 10:27:55 +02:00
William Markezana
1a1b89bdbc drivers: bluetooth: hci_bflb: match ACL TX count to controller variant
Each BLE controller blob variant reports a fixed number of ACL TX
packets in the HCI LE Read Buffer Size response (extracted from the
binaries): 2 to 16 for BL70x, 2 or 8 for BL60x, 2 to 8 for BL70xL and
4 or 10 for BL61x. Set the BT_BUF_ACL_TX_COUNT default per selected
variant so the host allocates exactly as many bt_conn_tx contexts as
the controller has buffers, silencing the hci_core mismatch warning
and using the controller queue fully.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-06-10 14:54:29 -04:00
Johan Hedberg
76d92d502b drivers: bluetooth: hci_bflb: Fix send() buffer ownership contract
The bt_hci_driver_api send() contract requires that the buffer
reference is only consumed (unreffed) on success. On error, the
caller retains ownership and is responsible for unreffing the buffer.

bt_bflb_send() was unconditionally calling net_buf_unref() at a
goto done label, incorrectly consuming the buffer on all error paths.

Fix by returning early on each error path (without unreffing), and
unreffing only on the success path.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:49:04 +02:00
Johan Hedberg
9a684b5c31 drivers: bluetooth: hci_bee: Fix send() buffer ownership contract
The bt_hci_driver_api send() contract requires that the buffer
reference is only consumed (unreffed) on success. On error, the
caller retains ownership and is responsible for unreffing the buffer.

bt_hci_bee_send() was unconditionally calling net_buf_unref() at a
goto done label, incorrectly consuming the buffer on error paths too.
Additionally, buf->len was accessed after the unref, constituting a
use-after-free.

Fix by returning early on each error path (without unreffing), and
unreffing only on the success path.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:49:04 +02:00
minyuan xue
6a8ac7f93a Bluetooth: hci: add ameba HCI driver
Add HCI driver for Realtek Ameba BT controller. The driver bridges
the Realtek HAL HCI transport to the Zephyr BT HCI driver API.

Signed-off-by: minyuan xue <minyuan_xue@realsil.com.cn>
2026-06-09 10:28:58 +02:00
Johan Hedberg
90e90e0cbc drivers: bluetooth: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step. Since net_buf_drop() also handles NULL
pointers checks for those before the call can be removed.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-07 19:19:47 +02:00
Li Yunfan
7451b51c6a drivers: bluetooth: infineon: fixed stabilization delay for cyw43439
Changed stabilization delay in hci_uart_infineon.c from 250 to 270 ms
to allow cyw43439 to initialize.

Signed-off-by: Li Yunfan <lyftfc@gmail.com>
2026-06-07 19:17:42 +02:00
Johan Hedberg
cd27e70f93 drivers: bluetooth: stm32wb0: Fix mistakenly re-introduced code
This code snippet was originally removed by #109163 but then incorrectly
re-introduced by #107850 (most likely due to a rebasing error).

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-05 18:12:58 +02:00
Tejus Subramanya
1e044f6ff6 drivers: wifi: siwx91x: route Wi-Fi PS through nwp_apply_power_profile
WiseConnect zeros the BT half of its cached coex performance profile
on every Wi-Fi disconnect, leaving BT out of power save and preventing
the NWP from sleeping after re-association.

Delegate Wi-Fi power-save to siwx91x_nwp_apply_power_profile(), which
already owns both BT and Wi-Fi halves of the coex profile. Extend the
helper to accept an optional sl_wifi_performance_profile_v2_t override
so the Wi-Fi driver can pass its tailored profile (listen_interval,
dtim_aligned_type, monitor_interval); BT-only and init call sites pass
NULL to keep their current behaviour.

Signed-off-by: Tejus Subramanya <ters@silabs.com>
2026-06-04 11:07:57 +02:00
Johan Hedberg
7570b51948 drivers: bluetooth: Document the placement requirement for common data
Add code comments to make sure the common data/config fields stay in the
correct place in the driver-specific struct if those structs ever get
modified.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Johan Hedberg
2f3cd95376 drivers: bluetooth: Remove unnecessary driver data structs
There's no point in having driver specific data structs if the only thing
they contain is the common data struct. Just declare the common data struct
directly as dev->data.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Johan Hedberg
7f3c897f96 drivers: bluetooth: Handle recv() callback in common layer
Now that we have a common data struct, we can take advantage of it and
move the recv callback into it. This way the common layer takes care of
assigning, dispatching and clearing the callback. Drivers now have to use
the new bt_hci_recv() API to pass data to the layer above them (typically
a host stack). Additionally, the drivers no longer get a recv parameter as
part of their open() callback, since that's all handled by the common
layer.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Johan Hedberg
c5420dc137 drivers: bluetooth: Add support for mandatory data/config fields
Add support for the new common data & config fields for all in-tree
drivers.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-04 08:40:14 +02:00
Thomas Hebb
021c2a6431 drivers: bluetooth: h4: Take reset-assert-duration-ms from proper node
When there are multiple zephyr,bt-hci-uart nodes, we currently use the
reset-assert-duration-ms property from the first one for all of them due
to a typo in the initializer macro. Fix it.

Fixes: 9f44b011de ("bluetooth: hci: h4: optional reset pin")
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2026-06-03 08:26:55 +02:00
Dharun krithik k
f27102d5e9 drivers: bluetooth: h5: Use net_buf_take() to transfer rx_buf
Replace manual pointer transfer with net_buf_take() for better
readability and atomic operation.

Signed-off-by: Dharun krithik k <dharunkrithik@aerlync.com>
2026-06-01 12:40:25 -04:00
Ali Hozhabri
a8c09c2e34 drivers: bluetooth: hci: Modify BLE driver to support X-Nucleo-WBA25A1
Provide the necessary changes for the ST HCI SPI Bluetooth driver
to support X-NUCLEO-WBA25A1 shield.

Update ST BLE shields' overlays with the new properties.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2026-05-29 22:07:54 +02:00
Sylvio Alves
1310b9b046 drivers: bluetooth: esp32: align controller knobs with zephyr
Route the ESP32_BT_* defaults through the generic BT_CTLR_* symbols
so a standard BT_CTLR_* toggle reaches the vendor knobs without
further user intervention. Select the matching BT_CTLR_*_SUPPORT
capabilities from BT_ESP32, and add Kconfig entries for the BLE 5.x
feature gates, controller power placement and light-sleep XTAL.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-05-29 07:38:05 +02:00
Jérôme Pouiller
0e5dde875f soc: silabs: siwx91x: Fix defaultconfig statements
Defining a Kconfig symbol several times is dangerous. It is better to use
configdefault for the CMSIS related symbols.

Bluetooth configdefault depends on NWP driver. It is more accurate to
depend on the Si91x Bluetooth driver.

Finally, configdefault is supposed to be only used in Kconfig.defconfig
files. So, relocate BT_HCI_ACL_FLOW_CONTROL.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-05-29 07:36:02 +02:00
Vincent Tardy
2c690e394f drivers: bluetooth: hci: stm32wba: fix cmd packet transmission issues
This commit fixes the command packet size allocation. It allocates an
'hci_cmd_buf' buffer to store the HCI command packet to send. The buffer
size supports the maximum command packet size and the maximum event size.
This commit also fixes an issue where the buf argument was not unreferenced
when bt_buf_get_evt() failed in the BT_HCI_H4_CMD command case.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-05-27 21:32:33 -04:00
Camille BAUD
3c22e65285 bflb: bluetooth: Fix BL70x M16S1 blob
Missing bl_rand shim, use proper size of EM

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/109697

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-05-27 15:19:03 +01:00
Valerio Setti
c15cba4e7a modules: mbedtls: rename mbedTLS library and documentation usage
Having an interface library named "mbedTLS" and the real library named
"mbedtls" (as provided by the Mbed TLS module) is misleading.
This commit replaces:
- mbedTLS -> mbedtls_iface for the CMake library. "mbedTLS" is still
             available as alias to "mbedtls_iface" for backward
             compatibility, but this should be removed in the future.
- mbedTLS -> Mbed TLS in comments and documentation.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-05-27 15:16:06 +01:00
Fin Maaß
4d859419d9 drivers: serial: don't check return value of uart_irq_update()
Remove return value checks of uart_irq_update().
Needed for changing it's return value to void.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Ali Hozhabri
5e802fe73d drivers: bluetooth: hci: Simplify STM32WB0 BLE driver
Simplify the STM32WB0 BLE driver by leveraging CONFIG_PM_CUSTOM_TICKS_HOOK.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2026-05-19 07:39:05 -07:00
Davide Di Lello
82741b2614 drivers: infineon: Update copyright for Infineon
Update structure of the copyright

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-05-12 22:19:02 +02:00
Matthias Ringwald
6214844275 Bluetooth: hci: infineon: Fix unaligned opcode read
PatchRAM records store the HCI opcode as a little-endian value in the
firmware image. Read it with sys_get_le16() instead of casting the byte
pointer to uint16_t, which can fault on targets that do not allow
unaligned accesses.

Signed-off-by: Matthias Ringwald <matthias@ringwald.ch>
2026-05-12 09:13:14 +02:00
Håvard Reierstad
a805a054fe Bluetooth: HCI: include addr.h from util_hci_evt
Include `addr.h` in `util_hci_evt.c` as it uses `bt_addr_le_str`.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-05-11 13:41:54 +02:00
William Markezana
b4193f101a drivers: bluetooth: add BL60x on-chip BLE HCI driver
Extend the shared BFLB HCI driver with BL60x (BL602) support: BL60x
include paths, controller init macros, IRQ setup, and platform shim
forward declarations.

Kconfig adds BT_BFLB_BL60X with two controller variant choices
(m1s1, m8s1) and smart defaults based on enabled BT roles.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-05-08 16:00:22 -05:00
Egill Sigurdur
16ac4a5b78 kernel: mem_slab: add K_MEM_SLAB_DEFINE_TYPE for automatic alignment
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.

Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-05-07 18:09:41 -05:00
William Markezana
66b4ecb85d drivers: bluetooth: add BL61x on-chip BLE HCI driver
Extend the shared BFLB HCI driver with BL61x (BL616/BL618) support:
BL61x include paths and RF init routing through bflb_rf_init().

Kconfig adds BT_BFLB_BL61X with four controller variant choices, a
configurable PHY/RF retention memory size, and a 64 KB exchange memory
option for the BR/EDR variant.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-05-07 09:16:15 +02:00
Håvard Reierstad
41e3b91fcb Bluetooth: HCI: Allow discarding of ext adv reports
Implements a method for discarding fragmented extended advertising. In
order to acheive this, we need to consider past and future fragments
of the advertising report we discard.

The future fragments are on its way from the controller, and will result
in either a complete- or incomplete event. These are handled by tracking
the adv SID and address until the controller sends either a complete or
incomplete event. Once an advertising report is marked as discarded,
consecutive fragments will be silently discarded.

The past fragments are either already in the reassembler (in scan.c),
or on their way through the rx_queue. To handle these, and allow the
reassembler to recover from a in-progress reassembly which is discarded,
we add a work item which is rescheduled when each consecutive fragment
is received. The timeout is configurable through the new Kconfig option
`CONFIG_BT_EXT_ADV_REASSEMBLY_TIMEOUT`. On timeout, the reassembler will
change its state to discard incoming fragments from the same advertiser.
The reassembler will start assembling new fragments if it recognises a
new advertiser, or if a final fragment (either marked as complete
or incomplete) from the advertiser it is currently tracking is received.

This functionality needs to be added at a HCI driver level by using the
new `hci_ext_adv_report_process` function. It is added the the
IPC HCI driver to fix zephyrproject-rtos/zephyr#50786

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-05-06 16:29:15 +01:00
Christoph Busold
dad5096f85 drivers: entropy: Add support for architectural entropy drivers
Add new inline function entropy_get_default_device which returns
the "zephyr,entropy" device or the architectural entropy device,
if the former is not set, and use that in all places to query the
entropy device.

This allows using architectural drivers which do not have a DT
node.

Signed-off-by: Christoph Busold <cbusold@qti.qualcomm.com>
2026-05-06 07:05:12 +02:00
Vinit Mehta
42ac32c9da drivers: bluetooth: Add BT IR support for NXP hosted SoC
-Add inband independent reset support for IW612, IW416 and IW610
-Add kconfig option to enable/disable IR support

Signed-off-by: Vinit Mehta <vinit.mehta@nxp.com>
2026-05-04 14:53:51 +02:00
Manaam Rehan
1bb7e5974a drivers: bluetooth: describe BT_STM32_IPM Kconfig option
Replace the placeholder help text for BT_STM32_IPM with a short
description of the driver. This makes the option clearer in Kconfig
interfaces and avoids leaving a visible TODO in user-facing text.

Signed-off-by: Manaam Rehan <manaamrehan2k19@gmail.com>
2026-04-30 14:00:43 -04:00
Ali Hozhabri
2e933d3fec drivers: bluetooth: hci: Calculate the future time correctly
Calculate the future time correctly to avoid negative value for "value_ms".

Register the pm_policy_event when HAL_RADIO_TIMER_SetRadioTimerValue
returns success.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2026-04-24 13:00:07 +02:00
Emil Gydesen
11c4b2b295 Bluetooth: Driver: Move bt_hci_evt_hdr to end of struct
Since bt_hci_evt_hdr is a variable sized struct, it shall be
located at the end of the struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-24 10:56:33 +02:00
Yassine El Aissaoui
b904976464 drivers: hci: nxp: Add dynamic TX power configuration support
Adding support for MCXW2X and MCXW7X SoCs

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2026-04-22 08:08:53 -05:00
William Markezana
3afca7eb53 drivers: bluetooth: hci: unify Bouffalo Lab HCI driver
Merge the separate BL70X and BL70XL HCI drivers (hci_bflb_bl70x.c,
hci_bflb_bl70xl.c) into a single hci_bflb.c. Both SoCs share the
same on-chip HCI interface; platform differences (controller API
names, includes, RF calibration) are resolved via macros in a
single #if/#elif block at the top of the file.

Add BL70XL Kconfig (silicon revision, BLE variant selection) and
update depends lines to use the unified DT_HAS_BFLB_BT_HCI_ENABLED
combined with the SoC series.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-04-21 17:46:30 +01:00
Johan Hedberg
a27994d90a drivers: bluetooth: ipm_stm32wb: Take advantage of bt_addr_le_copy_addr()
Take advantatage of the new helper to avoid manually creating a
bt_addr_le_t.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-21 17:45:36 +01:00
Lyle Zhu
695d41c991 bluetooth: hci: NXP: Fix firmware upload issues
Fix two issues in the NXP HCI firmware upload code:

1. In fw_upload_wait_length(), the length complement was incorrectly
   read from the same buffer offset as the length field. It should be
   read from offset 2 to properly validate the length field.

2. In fw_upload_write_hdr_and_payload(), replace the call to
   fw_upload_send_ack() with a direct call to fw_upload_write_data()
   to send the V1_REQUEST_ACK. This ensures the ACK is sent using the
   correct write function.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-04-21 17:45:05 +01:00