-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Add Bluetooth overlays #3682
Add Bluetooth overlays #3682
Conversation
All overlays require documentation in the README file - if you add that now I can review it all together. |
Nice. |
Anything merged is eventually ported to all current branches (where possible). |
Sure, I can mention it. Just to clarify (because I don't have one for tests), does Zero W support flow control (so that bt-overlay.dts is the right one)?
Sorry, I didn't get it... Do you mean I need to add some different overlay for bcm2708? |
I have no problem with what you've done so far, but I think we can do better from a user's perspective. I don't like the fact that they have to know whether their Pi supports BT flow control - it would be better that enabling Bluetooth in a common way (i.e. one overlay, or one parameter) automatically chose the default baud rate, but with an override to change it. The serdev enumeration that enables the Bluetooth support checks for enabled nodes, which means the What do you think? |
Sounds great! Basically, I can add the However, there is this Pi3 rev 1.2/1.3 difference in flow control support, and both of them share the same device tree. Do you have an idea how to handle it with your approach? I can only think of another dtparam to force baud rate, but it means the user will have to set it manually on Pi3 rev 1.3. |
Hmm - okay then, in that case it makes sense for the firmware to set a sensible baud rate using the parameter before any user settings are applied. Until the firmware is updated, users of the 3B <= rev 1.2 will have to set the baud rate manually. |
Which (I think) means the |
What's the final take on this? (@gentoo-root yes indeed, PiZeroW does support HW flowcontrol) |
The next patch adds a device tree overlay for Bluetooth. The Bluetooth device node is a child of uart0 (pl011). The children of pl011 are not registered as platform devices by of_platform_bus_create, because they fall into `of_device_is_compatible(bus, "arm,primecell")` check. These children are registered by of_serdev_register_devices, called through this chain of calls: - uart_add_one_port (drivers/tty/serial/amba-pl011.c) - tty_port_register_device_attr_serdev - serdev_tty_port_register - serdev_controller_add - of_serdev_register_devices serdev_tty_port_register depends on CONFIG_SERIAL_DEV_CTRL_TTYPORT, which in turn depends on CONFIG_SERIAL_DEV_BUS=y. This patch modifies the defconfigs of Raspberry Pi devices to set these options and allow to bind drivers to subnodes of UART devices that can be added by device tree overlays. Signed-off-by: Maxim Mikityanskiy <[email protected]>
Yes. BTW, adding the I'm on it currently. |
I updated the patch, tested the following combinations on Pi3B rev 1.2 and got the expected results:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from addressing the line comments I'm going to need some entries in the README file for the new parameter, but we're nearly there.
target-path = "/aliases"; | ||
__overlay__ { | ||
serial0 = "/soc/serial@7e201000"; | ||
serial1 = "/soc/serial@7e215040"; | ||
}; | ||
}; | ||
|
||
__overrides__ { | ||
probe = <&minibt>,"status"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probe
is a bit vague - I suggest re-using the same name used with the base DTBS, e.g. knlbt
.
I updated the patch, addressing all the comments above. I'll retest it one more time after we are done with the review. |
Add device tree nodes for Bluetooth on supported Raspberry Pi boards. It's disabled by default and can be enabled by `krnbt=on` dtparam. It's an alternative way of configuring Bluetooth, as compared to hciattach or btattach. When the dtparam is enabled, the Bluetooth driver is probed automatically and doesn't require any additional bring-up scripts. Note that Raspberry Pi 3 B rev 1.2 doesn't have the required hardware flow control pins of UART0 connected to the Bluetooth module, so the user should decrease the baudrate by passing `krnbt_baudrate=921600` dtparam to make it more stable. It resembles the behavior of the btuart script from Raspbian. The miniuart-bt overlay was modified to support Bluetooth probing with device tree, too. It's disabled by default and can be enabled by `krnbt=on` parameter of the miniuart-bt overlay. Signed-off-by: Maxim Mikityanskiy <[email protected]>
That looks good - I'll test it in the morning. |
Thanks - that works as expected. It doesn't solve the problem of Pis which haven't had their BDADDR written to OTP, but as this is an opt-in change I can live with that. |
Great!Tthanks so much @gentoo-root and @pelwell |
Your wish is my command. |
kernel: drm/vc4: Allow interlaced HDMI modes from FKMS See: raspberrypi/linux#3698 kernel: Isp driver fixes See: raspberrypi/linux#3695 kernel: Add Bluetooth overlays See: raspberrypi/linux#3682 firmware: arm_loader: Allow interlaced HDMI modes from FKMS See: raspberrypi/linux#3698 firmware: arm_loader: Limit rather than reject boosts with disable_auto_turbo firmware: i2c: Clearing the TA bit may time out See: #1422 firmware: arm_loader: Add an accelerated memmove firmware: arm_loader: memmove kernel to preferred text_offset See: #1421 firmware: filesystem: Fix GPT regression on USB after SD fix See: #1420 firmware: bootloader: Some tweaks for LED, UART, USB timeouts
kernel: drm/vc4: Allow interlaced HDMI modes from FKMS See: raspberrypi/linux#3698 kernel: Isp driver fixes See: raspberrypi/linux#3695 kernel: Add Bluetooth overlays See: raspberrypi/linux#3682 firmware: arm_loader: Allow interlaced HDMI modes from FKMS See: raspberrypi/linux#3698 firmware: arm_loader: Limit rather than reject boosts with disable_auto_turbo firmware: i2c: Clearing the TA bit may time out See: raspberrypi/firmware#1422 firmware: arm_loader: Add an accelerated memmove firmware: arm_loader: memmove kernel to preferred text_offset See: raspberrypi/firmware#1421 firmware: filesystem: Fix GPT regression on USB after SD fix See: raspberrypi/firmware#1420 firmware: bootloader: Some tweaks for LED, UART, USB timeouts
Just a note to say that the krnbt parameter of the miniuart-bt overlay won't apply as it was written - it was an overlay parameter that tried to directly modify a node in the base DTB, and that's not currently supported. The workaround is to add another fragment, which can be initially empty, targetting the node in the base DTB, and modify the parameter to update the fragment. The fixed version is in rpi-5.4.y now (and will be copied to the others...) but just missed the firmware release. Having said that, I can't make miniuart-bt,kernbt work at the moment, for reasons I haven't figured out. The kernel claims the uart1 (/dev/ttyS0 disappears) and attempts to bring up the HCI interface, but it times out on the baudrate change:
|
This change has caused additional serial ports to no longer appear as character devices - see https://github.com/raspberrypi/firmware/issues/1438 for the report. |
Thanks for doing this. It is a big help. Are there specific kernel config parameters which need to be set to make this work? Any specific packages which need to be installed? |
Fixed it. I meandered around the kernel config and changed a bunch of things but did not change it. I then went and grabbed the raspberry kernel source from Rpi and made a new config and rebuilt and now this config.txt setting works on aarch64 as well. |
As a follow-up for #3675, this pull request adds device tree overlays to give users an option to configure Bluetooth without hciattach/btattach, and changes the defconfigs to make this way work.