Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-board Bluetooth: loading firmware with devicetree #3459

Closed
macmpi opened this issue Feb 10, 2020 · 8 comments
Closed

On-board Bluetooth: loading firmware with devicetree #3459

macmpi opened this issue Feb 10, 2020 · 8 comments

Comments

@macmpi
Copy link

macmpi commented Feb 10, 2020

I'm trying to understand how to load Bluetooth firmware with device-tree rather than using pi-bluetooth Raspbian package together with related btuart script and assorted downstream-patched depreciated hciattach (indeed btattach seems still unreliable for this).
Rationale is, for instance, to seamlessly setup Bluetooth on a PiZeroW with different distributions such as AlpineLinux, and enjoy proper Bluetooth operations even when audio streaming is involved (A2DP).

bcm2835-rpi-zero-w.dts seems to have the pieces together to do the trick, but firmware does NOT appear to load by default.
I noticed @lategoodbye and @pelwell discussed similar topic on Pi4 context, but I'm not sure this now supported on all Pi device with onboard Bluetooth.

Do we need any statement in config.txt or some other extra setup to do the magic?

@lategoodbye
Copy link
Contributor

lategoodbye commented Feb 10, 2020

There are two essential kernel parts which are:

  • the necessary serdev driver ( config BT_HCIUART_BCM )
  • the necessary bluetooth section in the DT which contains the compatible brcm,bcm43438-bt to trigger probing of the serdev driver

Both requirements should be fulfilled for all RPi variants with mainline kernel >= 5.5. Btw the RPi 4 required a patch in the serdev driver (include in Linux 5.4) to get working.

@macmpi
Copy link
Author

macmpi commented Feb 10, 2020

Thanks.
bcm27xx DT files for downstream kernel do not have the section indeed, but I thought it would work with bcmbt-overlay: unfortunately firmware does not happen to load Bluetooth firmware on AlpineLinux 3.11 (5.4.x).

bcm28xx DT files have the section (even on 5.4), but I guess those can only be used with upstream kernel, right?

@lategoodbye
Copy link
Contributor

I think you should provide the following information:

  • used Raspberry Pi board
  • dmesg output
  • full path of the bluetooth firmware

@macmpi
Copy link
Author

macmpi commented Feb 11, 2020

Typically, I'm on a raspberry PiZero W under Alpine 3.11 (distribution's stock linux-rpi kernel 5.4), firmware at /lib/firmware/brcm/BCM43430A1.hcd

I compare 2 setups:

  1. with btuart script running during sysinit: console shows firmware gets loaded (but dmesg does not). dmesg & hciconfig feature are here. All is (mostly) fine on Bluetooth side.

  2. without that sysinit script, but with bcmbt overlay instead. dmesg & hciconfig feature are here. Firmware not loaded, and hci0 not available.

I'd like to load firmware with device-tree rather than with btuart/downstream hciattach, if at all reliably possible. I guess bcm27xx DT files will probably include this sometime soon?
Thanks for any hint.

(note, unrelated, but in all case I'm having wierd errors on my cdrom drive, I'm at lost with...usb driver issue?)

[   19.831006] blk_update_request: I/O error, dev sr0, sector 910720 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[   19.831025] Buffer I/O error on dev sr0, logical block 113840, async page read

@lategoodbye
Copy link
Contributor

lategoodbye commented Feb 11, 2020

Did you checked that serdev and BT_HCIUART_BCM is enabled in kernel config?

Btw the overlay looks useless to me without the definition of the shutdown-gpios.

@macmpi
Copy link
Author

macmpi commented Feb 11, 2020

Yes, that part seems ok

cat /boot/config-rpi | grep BT_HCIUART_BCM
CONFIG_BT_HCIUART_BCM=y

lsmod | grep serdev
serdev                 20480  0

@macmpi
Copy link
Author

macmpi commented Feb 13, 2020

I see there's some recent significant work on DT files stuff (upstream/downstream), including overlay_prefix firmware support...

@pelwell is there any chance Bluetooth firmware loading get integrated in downstream DT files as part of this work?
Any suggested alternative method to get it working in the meantime?

@macmpi
Copy link
Author

macmpi commented Jul 1, 2020

closing as per #3682

@macmpi macmpi closed this as completed Jul 1, 2020
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

No branches or pull requests

2 participants