Radxa Zero 3: Fix 3W's Bluetooth Support

Bluetooth on the 3W was non-functional. Required functions are copied
from radxa-cubie-a5e.csc (also used in kickpik2b.csc). These should
ideally be extracted into a shared location.

The antenna switch (internal vs external) is still missing. Radxa
implements this via DT overlays and their rsetup tool:
  https://docs.radxa.com/en/zero/zero3/os-config/rsetup\#overlays
  https://github.com/radxa-pkg/radxa-overlays/blob/main/arch/arm64/boot/dts/rockchip/overlays/radxa-zero3-external-antenna.dts

Only tested on 3W; impact on 3E is unknown. The functions and packages
should ideally be limited to 3W builds, but this seems impossible
without splitting the CSC file.
This commit is contained in:
Andreas Reis
2025-08-16 20:17:22 +02:00
committed by Rolf Leggewie
parent 8229ea9a85
commit f3a21c739c

View File

@@ -13,9 +13,50 @@ BOOT_SCENARIO="spl-blobs"
BOOTFS_TYPE="fat" # Only for vendor/legacy
PACKAGE_LIST_BOARD="rfkill bluetooth bluez bluez-tools"
# add for OBEX file transfer:
# PACKAGE_LIST_BOARD+=" bluez-obexd"
AIC8800_TYPE="sdio"
enable_extension "radxa-aic8800"
function post_family_tweaks_bsp__aic8800_wireless() {
display_alert "$BOARD" "Installing AIC8800 Tweaks" "info"
mkdir -p "${destination}"/etc/modprobe.d
mkdir -p "${destination}"/etc/modules-load.d
# Add wireless conf
cat > "${destination}"/etc/modprobe.d/aic8800-wireless.conf <<- EOT
options aic8800_fdrv_sdio aicwf_dbg_level=0 custregd=0 ps_on=0
#options aic8800_bsp_sdio aic_fw_path=/lib/firmware/aic8800_fw/SDIO/aic8800
EOT
# Add needed bluetooth modules
cat > "${destination}"/etc/modules-load.d/aic8800-btlpm.conf <<- EOT
hidp
rfcomm
bnep
aic8800_btlpm_sdio
EOT
# Add AIC8800 Bluetooth Service and Script
if [[ -d "$SRC/packages/bsp/aic8800" ]]; then
install -d -m 0755 "${destination}/usr/bin"
install -m 0755 "$SRC/packages/bsp/aic8800/aic-bluetooth" "${destination}/usr/bin/aic-bluetooth"
install -d -m 0755 "${destination}/usr/lib/systemd/system"
install -m 0644 "$SRC/packages/bsp/aic8800/aic-bluetooth.service" "${destination}/usr/lib/systemd/system/aic-bluetooth.service"
else
display_alert "$BOARD" "Skipping AIC8800 BT assets (packages/bsp/aic8800 not found)" "warn"
fi
}
# Enable AIC8800 Bluetooth Service
function post_family_tweaks__enable_aic8800_bluetooth_service() {
display_alert "$BOARD" "Enabling AIC8800 Bluetooth Service" "info"
if chroot_sdcard test -f /lib/systemd/system/aic-bluetooth.service || chroot_sdcard test -f /etc/systemd/system/aic-bluetooth.service; then
chroot_sdcard systemctl --no-reload enable aic-bluetooth.service
else
display_alert "$BOARD" "aic-bluetooth.service not found in image; skipping enable" "warn"
fi
}
function post_family_config__use_mainline_uboot_except_vendor() {
# use mainline u-boot for _current_ and _edge_
if [[ "$BRANCH" != "current" && "$BRANCH" != "edge" ]]; then
@@ -50,4 +91,4 @@ function post_family_config_branch_vendor__radxa-zero3_use_vendor_uboot() {
function write_uboot_platform() {
dd if=$1/u-boot-rockchip.bin of=$2 seek=64 conv=notrunc status=none
}
}
}