Skip to content

sun60iw2: bring up AIC8800 UART Bluetooth on the Orange Pi A733 boards#10149

Merged
igorpecovnik merged 2 commits into
armbian:mainfrom
shkolnik:sun60iw2-opi-bt
Jul 11, 2026
Merged

sun60iw2: bring up AIC8800 UART Bluetooth on the Orange Pi A733 boards#10149
igorpecovnik merged 2 commits into
armbian:mainfrom
shkolnik:sun60iw2-opi-bt

Conversation

@shkolnik

@shkolnik shkolnik commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Hi all — this is the Bluetooth follow-up I mentioned in the Orange Pi Zero 3W PR: a small, family-wide bring-up of the AIC8800D80's UART Bluetooth on both A733 boards (Orange Pi 4 Pro and Zero 3W). WiFi already works out of the box on these boards; this closes the last combo-radio gap. I tested it on my Orange Pi Zero 3W and it appears solid — as always, very open to feedback on the approach.

The AIC8800D80 combo's BT is UART HCI on ttyS1. Its firmware (loaded over SDIO by aic8800_bsp) idles the BT core in low-power until BT_WAKE is asserted, so a plain hciattach times out waiting for HCI_Reset. The fix is to assert the wake via the btlpm sysfs knob, then attach the generic H4 line discipline.

Documentation summary for feature / change

Not needed — no user-facing config; Bluetooth just works on these boards after this change.

How Has This Been Tested?

Validated on real hardware, Orange Pi Zero 3W (Trixie CLI image):

  • aic8800-bluetooth.service comes up clean on boot; hci0 is UP RUNNING.
  • bluetoothctl LE scan returns nearby devices.
  • rfkill unblock + btlpm wake path exercised (without the wake, hciattach reproducibly times out on HCI_Reset).

The Orange Pi 4 Pro shares the identical AIC8800D80 combo and UART-HCI wiring, so the same path applies; I've enabled it on both boards. (My primary bring-up + validation was on the Zero 3W.)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Thanks!
-James

Summary by CodeRabbit

  • New Features
    • Added Bluetooth support setup for select Orange Pi boards using the AIC8800D80 combo module.
    • Automatic Bluetooth bring-up is now enabled during image setup, including required system service configuration.
    • A new service helps initialize Bluetooth over UART and recover automatically if it stops.

The AIC8800D80 combo's BT is UART HCI on ttyS1. Its firmware (loaded over
SDIO by aic8800_bsp) idles the BT core in low-power until BT_WAKE is
asserted, so a plain hciattach times out waiting for HCI_Reset. Assert the
wake via the btlpm sysfs knob, then attach the generic H4 line discipline.

Adds aic8800-bluetooth.service (stock bluez hciattach, no vendor blob),
installed and enabled by the family for boards that set SUN60IW2_UART_BT
(both Orange Pi A733 boards). Validated on the Zero 3W.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • Needs review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a620578a-da16-4280-8959-7a97f0f41dbb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a SUN60IW2_UART_BT board configuration flag to orangepi4pro and orangepizero3w boards, conditional logic in the sun60iw2 family tweaks to install bluez/rfkill and enable a new systemd service, and a new aic8800-bluetooth.service unit for UART-based Bluetooth bring-up on ttyS1.

Changes

AIC8800D80 UART Bluetooth support

Layer / File(s) Summary
Bluetooth systemd service unit
packages/bsp/sunxi/aic8800-bluetooth.service
New systemd unit ordering after bluetooth.service, unblocking rfkill, waiting for/writing to /proc/bluetooth/sleep/btwrite, then launching hciattach on /dev/ttyS1 with restart-on-failure and multi-user.target install.
Family tweak installation and board flags
config/boards/orangepi4pro.csc, config/boards/orangepizero3w.csc, config/sources/families/sun60iw2.conf
Adds SUN60IW2_UART_BT="yes" to both board configs and adds conditional logic in post_family_tweaks__sun60iw2 to install bluez/rfkill, copy the service unit into the rootfs, and enable it via chroot when the flag is set.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • armbian/build#9967: Extends the sun60iw2/orangepi4pro board config introduced there by adding the SUN60IW2_UART_BT flag and related Bluetooth bring-up logic.

Suggested reviewers: igorpecovnik

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enabling AIC8800 UART Bluetooth on sun60iw2 Orange Pi A733 boards.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 08 Milestone: Third quarter release size/small PR with less then 50 lines Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... BSP Board Support Packages labels Jul 9, 2026

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

🧹 Nitpick comments (1)
packages/bsp/sunxi/aic8800-bluetooth.service (1)

3-4: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider Before=bluetooth.service instead of After=bluetooth.service.

Both repo precedents for UART HCI bring-up (pinebook-bluetooth.service uses Before=bluetooth.service; rtl8723bs-bluetooth.service uses After=bluetooth.target, which also precedes bluetooth.service) start hciattach before bluetoothd so the HCI device exists when the daemon initializes. With After=bluetooth.service, bluetoothd starts with no adapter and must detect hci0 via udev after hciattach creates it — functional but suboptimal, and can delay adapter availability.

Switching to Before=bluetooth.service (keeping Wants=bluetooth.service) ensures hciattach creates hci0 first, then bluetoothd starts and finds the adapter ready.

♻️ Proposed ordering fix
 [Unit]
 Description=AIC8800 Bluetooth (UART HCI on ttyS1)
-After=bluetooth.service
+Before=bluetooth.service
 Wants=bluetooth.service
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/sunxi/aic8800-bluetooth.service` around lines 3 - 4, The unit
ordering in the bluetooth service is backwards for UART HCI bring-up:
`aic8800-bluetooth.service` should start `hciattach` before `bluetooth.service`
so the adapter exists when bluetoothd initializes. Update the service ordering
directive in this unit from `After=bluetooth.service` to
`Before=bluetooth.service` while keeping `Wants=bluetooth.service`, matching the
existing bring-up pattern used by the other bluetooth service units.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bsp/sunxi/aic8800-bluetooth.service`:
- Around line 3-4: The unit ordering in the bluetooth service is backwards for
UART HCI bring-up: `aic8800-bluetooth.service` should start `hciattach` before
`bluetooth.service` so the adapter exists when bluetoothd initializes. Update
the service ordering directive in this unit from `After=bluetooth.service` to
`Before=bluetooth.service` while keeping `Wants=bluetooth.service`, matching the
existing bring-up pattern used by the other bluetooth service units.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce4e648a-79cc-4e16-bded-90361714c519

📥 Commits

Reviewing files that changed from the base of the PR and between d8387c6 and 4bbc0cd.

📒 Files selected for processing (4)
  • config/boards/orangepi4pro.csc
  • config/boards/orangepizero3w.csc
  • config/sources/families/sun60iw2.conf
  • packages/bsp/sunxi/aic8800-bluetooth.service

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Jul 9, 2026
@github-actions github-actions Bot added Ready to merge Reviewed, tested and ready for merge Needs review Seeking for review and removed Ready to merge Reviewed, tested and ready for merge labels Jul 9, 2026
@igorpecovnik igorpecovnik merged commit 4b4ddb5 into armbian:main Jul 11, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release BSP Board Support Packages Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants