Commit graph

795 commits

Author SHA1 Message Date
Alessandro Manganaro
7ca2072ed0 drivers: bluetooth: hci: Fix stm32wb BLE behavior
Implementing HCI setup function to have a correct and proper
initialization procedure to fix #75318 issue

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-08-05 11:32:17 +02:00
Gerard Marull-Paretas
ffe10833ea drivers: bluetooth: hci: nrf53: use nrf_spu_extdomain_set
Instead of hardcoded values and device instances.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-01 08:56:56 +01:00
Gerard Marull-Paretas
8bc461ebe0 drivers: bluetooth: hci: nrf53: simplify DEBUG_SETUP code
debug.h module provides dummy implementation when necessary.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-01 08:56:56 +01:00
Hao Luo
8379f64393 drivers: bluetooth: hci_ambiq: get the spi cfg from the device
Use the SPI configuration from the SPI device for data transaction.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-28 07:29:28 +03:00
Pieter De Gendt
ad63ca284e kconfig: replace known integer constants with variables
Make the intent of the value clear and avoid invalid ranges with typos.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-27 20:49:15 +03:00
Alessandro Manganaro
375bf0b835 drivers: bluetooth: hci: hci_stm32wba.c
Providing setup implementation for
STM32WBA BLE HCI driver

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-07-03 15:06:48 -04:00
Alessandro Manganaro
2c42032ef4 drivers: bluetooth: hci: Kconfig
Enabling BT_HCI_SET_PUBLIC_ADDR option for
STM32WBA BLE HCI driver

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-07-03 15:06:48 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Nazar Palamar
2eaae36220 driver/bluetooth/hci/hci_ifx_psoc6_bless: fix long bt startup time
Added force unblock psoc6 bless rx thread to process controller
events (at the end of psoc6_bless_send function)

Internal case: SWINTEGRAT-1767

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-24 12:43:48 -04:00
Lingao Meng
b11c43cb09 drivers: bluetooth: Remove unused rsp params
The `rsp` params actually not used, so removed.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-24 14:26:22 +02:00
Nazar Palamar
41c9ec3e42 driver/bluetooth/h4_ifx_cyw43xxx: Allow CBUCK regulator to discharge
Problem:
re-plug USB (e.g cy8cproto_062_4343w kit) can cause that
CY43xx device become unresponsive (cy8cproto_062_4343w).
As result we catch ASSERTION FAIL (timeout) on HCI_Reset command.

Fix: added delay (BT_POWER_CBUCK_DISCHARGE_TIME_MS) to be sure
that BT CBUCK regulator to discharge.

Tested on:
cy8cproto_062_4343w, cy8ckit_062s2_ai and cy8ckit_062s2_43012 kits.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-24 09:46:01 +02:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Nazar Palamar
17889d23b9 driver/bluetooth: Added initial version of hci cyw208xx driver
Added initial version of hci cyw208xx driver

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-13 05:52:19 -04:00
Lyle Zhu
d74698a36b driver: bluetooth: hci: Support NXP BT CTLR FW blobs
Add Kconfig.nxp to support NXP Bluetooth Chipset.
Current only NXP IW612 Chipset (BT_NXP_NW612) has
been supported.

Add modules/hal_nxp/bt_controller/CMakeLists.txt to
determine whether any firmware is selected, and
check whether the firmware exists.

If the firmware exists, copy the firmware to the
temporary folder ${ZEPHYR_BINARY_DIR}/include/
generated/bt_nxp_ctlr_fw.h. OR, raise a fatal error.

In file hci_nxp_setup.c, includes the temporary file
bt_nxp_ctlr_fw.h.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-06-13 05:45:36 -04:00
Lyle Zhu
d164f9c0bb driver: bluetooth: hci: Add NXP BT module support
Implement UART firmware download driver for NXP
BT module.

Only support Murata 2EL M.2 module on RT1170EVKB.

And only one instance can be supported now.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-06-13 05:45:36 -04:00
Johan Hedberg
3ecd7dbd4c Bluetooth: drivers: Convert Silabs HCI driver to new API
Convert the slz_hci.c HCI driver to use the new HCI driver API. This also
fixes the HCI bus type to correctly indicate VIRTUAL instead of UART.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
fcddefd7f0 Bluetooth: drivers: Convert NXP HCI driver to new API
Convert the hci_nxp.c HCI driver to use the new HCI driver API. Also move
the driver binding under dts/bindings/bluetooth, like all other HCI driver
bindings.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
f33aab9889 Bluetooth: drivers: Convert DA1469X HCI driver to new API
Convert the Renesas DA1469X HCI driver to the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
501e7158a8 Bluetooth: drivers: Convert STM32 IPM driver to new API
Convert the ipm_stm32wb.c HCI driver to the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
b7b606bdaf Bluetooth: drivers: Convert ST STM32WBA driver to new API
Convert the hci_stm32wba.c driver to the new HCI API. Unlike in most cases,
the devicetree node is already enabled on the SoC level (rather than board
level). This is in order to mirror how the Kconfig option was originally
enabled, i.e. on the SoC level.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
5a09c17746 Bluetooth: drivers: Convert SPI drivers to use new HCI API
Convert the spi.c and hci_spi_st.c drivers to use the new HCI driver API.
Both drivers are converted in one go since one derives from the other's
devicetree binding.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
8953b4eb63 Bluetooth: drivers: Convert ESP32 HCI driver to new API
Convert the hci_esp32.c HCI driver to the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
e7637413b6 Bluetooth: drivers: Convert psoc6_bless driver to new API
Convert the hci_psoc6_bless.c HCI driver to the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
6e584a4773 Bluetooth: drivers: Convert IPC driver to new API
Convert the ipc.c HCI driver to the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
589b92baaf Bluetooth: Kconfig: Remove BT_NO_DRIVER
There are no actual users in the main tree anymore, so just remove this
option.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
130ae9e120 Bluetooth: drivers: Convert Ambiq Apollo driver to new API
Convert the Ambiq Apollo HCI driver to the new HCI API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
66b53866a7 Bluetooth: drivers: userchan: don't fail everything if driver init fails
With the new HCI driver model it's not always critical if a single
instance fails to initialize. This is especially true for many test
applications which provide their own HCI drivers. Instead of causing a
complete failure, simply fail to initialize the driver instance.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
bb91aa0b7f Bluetooth: drivers: Convert userchan driver to new API
Convert the HCI User Channel driver to use the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
97c3a1e4be Bluetooth: drivers: hci: Get rid of Kconfig choice
The drivers should be independent after the move to the new HCI driver
API. Having them as a choice also has unexpected consequences with some
drivers being unexpectedly enabled.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
00d66339fc Bluetooth: drivers: h5: Convert to new HCI driver API
Convert the H:5 HCI driver to use the new HCI driver API.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
44e0f5fee3 Bluetooth: controller: Update to new HCI driver API
Update the native controller to the new HCI driver API. The devicetree
node is placed under existing `radio` nodes, which seemed like the most
intuitive option.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Johan Hedberg
3482a3be53 Bluetooth: drivers: Convert H4 (UART) HCI driver to new API
Convert the H4 driver to the new HCI driver API. This includes updating
also any boards that use the driver, i.e. adding the appropriate
devicetree node and chosen property to them.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Alessandro Manganaro
57044d2d61 drivers: bluetooth: hci: STM32WBA driver updates according Cube FW 1.3.1
STM32WBA Bluetooth HCI driver updates according Cube FW 1.3.1

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-06-10 15:04:36 -05:00
Ali Hozhabri
569183bbad drivers: bluetooth: hci: Add BlueNRG reset API to ST HCI SPI BT driver
Add API to perform hardware reset optionally entering firmware updater
mode.

Remove redundant declaration for bt_spi_send_aci_config; otherwise, we will
have compiler warning if CONFIG_BT_BLUENRG_ACI is not set.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-06-10 07:03:05 -07:00
Ryan Erickson
2eef28a624 drivers: change Laird references to Ezurio
Laird is now Ezurio.
Update web links.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2024-06-05 17:37:54 -05:00
Yassine El Aissaoui
5c308e0344 bluetooth: hci_nxp: move vendor specific setup to its dedicated place
Some vendor specific setup was done inside
the open() HCI function, those should be
inside setup() function instead.

Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-06-04 19:10:22 -04:00
Aaron Ye
30c41e9559 drivers: bluetooth: hci_ambiq: add necessary SPI CS control
Before sending packet to controller the host needs to poll the status of
controller to know it's ready, or before reading packets from controller
the host needs to get the payload size of coming packets by sending
specific command and putting the status or size to the rx buffer, the CS
should be held at this moment to continue to send or receive packets.
This change is needed for the based SPI driver update.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-06-04 13:39:27 +02:00
Patrick Stewart
1868987a2f Bluetooth: userchan: Support TCP fragmentation of HCI packets
Keep reading from the HCI socket when a packet is incomplete. The other
end may not write entire packets, or TCP could fragment in the middle of a
packet.
Also fix a potential infinite loop by advancing to the next packet before
any continue statements.

Signed-off-by: Patrick Stewart <patrick@rfcreations.com>
2024-05-30 01:01:04 -07:00
Johan Hedberg
f48a57b2a8 Bluetooth: drivers: Remove unmaintained B91 HCI driver
The driver isn't currently buildable due to "west blobs" support never
having been added for hal_telink. Furthermore, even if the blob
dependency is manually made available it turns out the code has
bitrotten to the point where it doesn't build anymore. This situation
has continued for several years without anyone taking action, so I think
it's safe to assume this is unmaintained and should be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-05-30 09:00:22 +02:00
Aaron Ye
3f56baa295 drivers: bluetooth: hci: add retry mechanism for Apollo SPI busy scenario
The controller may be unavailable to receive packets because it is busy
on processing something or have packets to send to host. Need to free the
SPI bus and wait some moment to try again.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Aaron Ye
47ce99f7b0 drivers: bluetooth: hci: correct the Ambiq Apollox support BT feature
The BLE controller of some Ambiq Apollox Blue SOC may have issue to
report the expected supported features bitmask successfully, thought the
features are actually supportive. Need to correct them before going to
the host stack.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Aaron Ye
af54a38827 drivers: bluetooth: hci: add Ambiq Apollo3 Blue SOC support
This commit add the SPI-based HCI support for the Ambiq Apollo3 Blue
SOC (e.g. Apollo3 Blue Plus, Apollo3 Blue) support.
Also correct the dependency of necessary peripheral.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Axel Le Bourhis
ee03123dd1 drivers: hci: Add NXP HCI driver
Add HCI driver generic to NXP platforms.
Update west.yml to have ble support for rw61x

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-05-25 11:23:04 +03:00
Andrzej Kaczmarek
2e2aeb13ed drivers: bluetooth: da1469x: Fix deferred buffer allocation
If rx buffer allocation has to be deferred to rx_thread, we need to stop
isr reading from mailbox as otherwise rx_thread won't be able to process
other buffers.

Since CMAC2SYS irq is cleared before data is read from mailbox, in case
rx buffer allocation was deferred we also need to trigger irq manually
to make sure all pending data is processed.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-25 11:21:16 +03:00
Andrzej Kaczmarek
6306596b27 drivers: hci: da1469x: Add driver for CMAC core on DA1469x
This adds HCI driver which enables communication with CMAC core on
Renesas SmartBond DA1469x series. The CMAC core is running an Apache
NimBLE controller binary and uses shared memory for communcation via
mailboxes.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-16 18:58:00 -04:00
Ali Hozhabri
fae32ac0b8 drivers: bluetooth: hci: Fix int conversion warning
Fix int conversion warning (-Wint-conversion), which is caused by
parallel PRs.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-05-09 10:28:58 +02:00
Théo Battrel
b2e235d530 Bluetooth: Remove legacy debug symbols
The `BT_DEBUG_*` Kconfig symbols have been deprecated for more than 2
versions, remove them.

Update code that was still using them.

Remove the Bluetooth specific `Kconfig.template.log_config_bt` and use
`Kconfig.template.log_config_inherit` from the logging subsystem
instead, now that the legacy symbols can be removed.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-05-07 09:49:27 +02:00
Pisit Sawangvonganan
3d39926f94 bluetooth: hci: refactored bluetooth hci packet type indicators
Introduced a unified definition for HCI packet type indicators in
'bluetooth/hci_types.h. This change streamlines the code in
'drivers/bluetooth/hci/', reducing redundancy.
Enhances maintainability and consistency across all HCI drivers.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-01 10:33:12 +02:00
Nazar Palamar
6d684c91c2 drivers: bluetooth/cyw43xxx: check that hw_flow_control is set
Add BUILD_ASSERT to check that hw_flow_control is set.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-04-23 15:35:53 +02:00
Aleksander Wasaznik
a64d20f6f0 Bluetooth: host: sched-lock bt_recv()
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-13 07:05:20 -04:00