Created
February 17, 2019 10:57
-
-
Save lategoodbye/79bac99d4f1158a719a48ea3c45eb7f1 to your computer and use it in GitHub Desktop.
Enable Bluetooth on Tinker Board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9ac9831e38b3e816431ae371f4dc429dc2213129 Mon Sep 17 00:00:00 2001 | |
From: Stefan Wahren <stefan.wahren@i2se.com> | |
Date: Sun, 17 Feb 2019 11:46:01 +0100 | |
Subject: [PATCH 1/2] Bluetooth: hci_h5: Add device tree support | |
This adds support for device tree probing of Realtek chipset 8723bs | |
(e.g. used on Asus Tinker Board). | |
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> | |
--- | |
drivers/bluetooth/Kconfig | 2 +- | |
drivers/bluetooth/hci_h5.c | 14 ++++++++++++++ | |
2 files changed, 15 insertions(+), 1 deletion(-) | |
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig | |
index 7b2e76e..8392add 100644 | |
--- a/drivers/bluetooth/Kconfig | |
+++ b/drivers/bluetooth/Kconfig | |
@@ -200,7 +200,7 @@ config BT_HCIUART_RTL | |
depends on BT_HCIUART | |
depends on BT_HCIUART_SERDEV | |
depends on GPIOLIB | |
- depends on ACPI | |
+ depends on (!ACPI || SERIAL_DEV_CTRL_TTYPORT) | |
select BT_HCIUART_3WIRE | |
select BT_RTL | |
help | |
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c | |
index 069d1c8..5dbaff4 100644 | |
--- a/drivers/bluetooth/hci_h5.c | |
+++ b/drivers/bluetooth/hci_h5.c | |
@@ -26,6 +26,7 @@ | |
#include <linux/gpio/consumer.h> | |
#include <linux/kernel.h> | |
#include <linux/mod_devicetable.h> | |
+#include <linux/of_device.h> | |
#include <linux/serdev.h> | |
#include <linux/skbuff.h> | |
@@ -822,6 +823,8 @@ static int h5_serdev_probe(struct serdev_device *serdev) | |
if (h5->vnd->acpi_gpio_map) | |
devm_acpi_dev_add_driver_gpios(dev, | |
h5->vnd->acpi_gpio_map); | |
+ } else { | |
+ h5->vnd = of_device_get_match_data(&serdev->dev); | |
} | |
h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); | |
@@ -1011,6 +1014,16 @@ static const struct acpi_device_id h5_acpi_match[] = { | |
MODULE_DEVICE_TABLE(acpi, h5_acpi_match); | |
#endif | |
+#ifdef CONFIG_OF | |
+static const struct of_device_id h5_of_match[] = { | |
+#ifdef CONFIG_BT_HCIUART_RTL | |
+ { .compatible = "realtek,rtl8723bs-bt", .data = &rtl_vnd }, | |
+#endif | |
+ { }, | |
+}; | |
+MODULE_DEVICE_TABLE(of, h5_of_match); | |
+#endif | |
+ | |
static const struct dev_pm_ops h5_serdev_pm_ops = { | |
SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume) | |
}; | |
@@ -1020,6 +1033,7 @@ static struct serdev_device_driver h5_serdev_driver = { | |
.remove = h5_serdev_remove, | |
.driver = { | |
.name = "hci_uart_h5", | |
+ .of_match_table = of_match_ptr(h5_of_match), | |
.acpi_match_table = ACPI_PTR(h5_acpi_match), | |
.pm = &h5_serdev_pm_ops, | |
}, | |
-- | |
2.7.4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d71e4a00f42040895901168fe80aa17957ae7a75 Mon Sep 17 00:00:00 2001 | |
From: Stefan Wahren <stefan.wahren@i2se.com> | |
Date: Sun, 17 Feb 2019 11:50:59 +0100 | |
Subject: [PATCH 2/2] dt-bindings: Add support for Realtek Bluetooth serial | |
devices | |
This adds support for Realtek Bluetooth serial devices. | |
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> | |
--- | |
.../devicetree/bindings/net/realtek-bluetooth.txt | 18 ++++++++++++++++++ | |
1 file changed, 18 insertions(+) | |
create mode 100644 Documentation/devicetree/bindings/net/realtek-bluetooth.txt | |
diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.txt b/Documentation/devicetree/bindings/net/realtek-bluetooth.txt | |
new file mode 100644 | |
index 0000000..4002ca1 | |
--- /dev/null | |
+++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.txt | |
@@ -0,0 +1,18 @@ | |
+Realtek Bluetooth devices connected via a UART | |
+ | |
+These devices typically also have a WI-FI connected via SDIO - the | |
+compatible described here is used just for referencing the Bluetooth. | |
+ | |
+- compatible: should be "realtek,rtl8723bs-bt" | |
+ | |
+Example: | |
+ | |
+&uart0 { | |
+ pinctrl-0 = <&uart0_pins>; | |
+ | |
+ bluetooth { | |
+ compatible = "realtek,rtl8723bs-bt"; | |
+ enable-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; | |
+ devive-wake-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>; | |
+ }; | |
+}; | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment