Skip to content

Commit

Permalink
Fix Bluetooth on ASUS Tinker (#1891) (#1892)
Browse files Browse the repository at this point in the history
* Use upstream Linux driver for Bluetooth on ASUS Tinker

* Drop unnecessary Bluetooth initialization systemd service

Bluetooth is now entirely handled by the kernel.
  • Loading branch information
agners authored May 10, 2022
1 parent 4a42d57 commit ba8bda7
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 245 deletions.
5 changes: 3 additions & 2 deletions buildroot-external/board/asus/tinker/kernel.config
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_RTL=y
CONFIG_BT_HCIBTSDIO=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_NOKIA is not set
Expand All @@ -1527,6 +1527,7 @@ CONFIG_BT_HCIUART_ATH3K=y
CONFIG_BT_HCIUART_3WIRE=y
# CONFIG_BT_HCIUART_INTEL is not set
# CONFIG_BT_HCIUART_BCM is not set
CONFIG_BT_HCIUART_RTL=y
# CONFIG_BT_HCIUART_QCA is not set
# CONFIG_BT_HCIUART_AG6XX is not set
# CONFIG_BT_HCIUART_MRVL is not set
Expand Down Expand Up @@ -2474,7 +2475,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set
# CONFIG_SERIAL_ST_ASC is not set
CONFIG_SERIAL_DEV_BUS=y
# CONFIG_SERIAL_DEV_CTRL_TTYPORT is not set
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
# CONFIG_TTY_PRINTK is not set
# CONFIG_HVC_DCC is not set
# CONFIG_IPMI_HANDLER is not set
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From 3f3c4cd047234fb94de4d6b701d05ff0450890cf Mon Sep 17 00:00:00 2001
Message-Id: <3f3c4cd047234fb94de4d6b701d05ff0450890cf.1613588152[email protected]>
From ff0c5c49024da05b47d4fcc4d115761c43eef7a6 Mon Sep 17 00:00:00 2001
Message-Id: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232[email protected]>
From: Stefan Agner <[email protected]>
Date: Wed, 17 Feb 2021 19:55:41 +0100
Subject: [PATCH] Revert "ARM: dts: rockchip: use DMA channels for UARTs for
Expand All @@ -11,10 +11,10 @@ This reverts commit 3425fe335c29310f6628faf9a7947d07f32d8962.
1 file changed, 8 deletions(-)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 8fa80facc8cd..8636d95c45e1 100644
index 4dcdcf17c977..ff6faa82192b 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -422,8 +422,6 @@ uart0: serial@ff180000 {
@@ -378,8 +378,6 @@ uart0: serial@ff180000 {
reg-io-width = <4>;
clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
clock-names = "baudclk", "apb_pclk";
Expand All @@ -23,7 +23,7 @@ index 8fa80facc8cd..8636d95c45e1 100644
pinctrl-names = "default";
pinctrl-0 = <&uart0_xfer>;
status = "disabled";
@@ -437,8 +435,6 @@ uart1: serial@ff190000 {
@@ -393,8 +391,6 @@ uart1: serial@ff190000 {
reg-io-width = <4>;
clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
clock-names = "baudclk", "apb_pclk";
Expand All @@ -32,7 +32,7 @@ index 8fa80facc8cd..8636d95c45e1 100644
pinctrl-names = "default";
pinctrl-0 = <&uart1_xfer>;
status = "disabled";
@@ -465,8 +461,6 @@ uart3: serial@ff1b0000 {
@@ -421,8 +417,6 @@ uart3: serial@ff1b0000 {
reg-io-width = <4>;
clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
clock-names = "baudclk", "apb_pclk";
Expand All @@ -41,7 +41,7 @@ index 8fa80facc8cd..8636d95c45e1 100644
pinctrl-names = "default";
pinctrl-0 = <&uart3_xfer>;
status = "disabled";
@@ -480,8 +474,6 @@ uart4: serial@ff1c0000 {
@@ -436,8 +430,6 @@ uart4: serial@ff1c0000 {
reg-io-width = <4>;
clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>;
clock-names = "baudclk", "apb_pclk";
Expand All @@ -51,5 +51,5 @@ index 8fa80facc8cd..8636d95c45e1 100644
pinctrl-0 = <&uart4_xfer>;
status = "disabled";
--
2.30.1
2.36.1

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
From fc25c993bf2feb6e66d55bf03eb725ec688e47eb Mon Sep 17 00:00:00 2001
Message-Id: <fc25c993bf2feb6e66d55bf03eb725ec688e47eb.1599250914[email protected]>
In-Reply-To: <2ae3821fd824560ef2db3c87cfbec985177911f6.1599250914[email protected]>
References: <2ae3821fd824560ef2db3c87cfbec985177911f6.1599250914[email protected]>
From e73b4b762a0842cc75b2784e4c4267f6f4fc50c4 Mon Sep 17 00:00:00 2001
Message-Id: <e73b4b762a0842cc75b2784e4c4267f6f4fc50c4.1652225232[email protected]>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232[email protected]>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232[email protected]>
From: "Miouyouyou (Myy)" <[email protected]>
Date: Mon, 5 Nov 2018 22:15:14 +0100
Subject: [PATCH 2/3] ARM: DTS: rk3288-tinker: Defining the SPI interface
Subject: [PATCH] ARM: DTS: rk3288-tinker: Defining the SPI interface

Taken from, and tested by @TonyMac32 .

Expand All @@ -21,7 +21,7 @@ Signed-off-by: Stefan Agner <[email protected]>
1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi
index 284e7982925d..d6cc66ab5bb1 100644
index 9c1e38c54eae..cf278bcc91ad 100644
--- a/arch/arm/boot/dts/rk3288-tinker.dtsi
+++ b/arch/arm/boot/dts/rk3288-tinker.dtsi
@@ -485,6 +485,25 @@ &sdio0 {
Expand Down Expand Up @@ -51,5 +51,5 @@ index 284e7982925d..d6cc66ab5bb1 100644
rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
--
2.28.0
2.36.1

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
From 3a9d71847ae869ffdb2b0818aa86a36d57d96331 Mon Sep 17 00:00:00 2001
Message-Id: <3a9d71847ae869ffdb2b0818aa86a36d57d96331.1599250914[email protected]>
In-Reply-To: <2ae3821fd824560ef2db3c87cfbec985177911f6.1599250914[email protected]>
References: <2ae3821fd824560ef2db3c87cfbec985177911f6.1599250914[email protected]>
From 00de5155d12a178b83961f459ddccd7fa08ec25c Mon Sep 17 00:00:00 2001
Message-Id: <00de5155d12a178b83961f459ddccd7fa08ec25c.1652225232[email protected]>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232[email protected]>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232[email protected]>
From: Stefan Agner <[email protected]>
Date: Fri, 4 Sep 2020 21:57:55 +0200
Subject: [PATCH 3/3] ARM: dts: rockchip: enable I2C1/4 on rk3288-tinker
Subject: [PATCH] ARM: dts: rockchip: enable I2C1/4 on rk3288-tinker

Enable I2C devices which are accessible via 40-pin header.

Expand All @@ -14,7 +14,7 @@ Signed-off-by: Stefan Agner <[email protected]>
1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi
index d6cc66ab5bb1..7af5818ac77c 100644
index cf278bcc91ad..f23c6efd39d4 100644
--- a/arch/arm/boot/dts/rk3288-tinker.dtsi
+++ b/arch/arm/boot/dts/rk3288-tinker.dtsi
@@ -344,10 +344,18 @@ regulator-state-mem {
Expand All @@ -37,5 +37,5 @@ index d6cc66ab5bb1..7af5818ac77c 100644
status = "okay";
};
--
2.28.0
2.36.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
From 062488e4b8fd552c01e1104b3bc91a6f7ffe6c41 Mon Sep 17 00:00:00 2001
From e45da42e71e4f92995d5ec11679ca00b0971dbfe Mon Sep 17 00:00:00 2001
Message-Id: <e45da42e71e4f92995d5ec11679ca00b0971dbfe.1652225232.git.stefan@agner.ch>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
From: Myy Miouyouyou <[email protected]>
Date: Thu, 19 Oct 2017 21:24:47 +0200
Subject: [PATCH 10/28] RK3288: DTSI: rk3288.dtsi: Add missing SPI2 pinctrl
Subject: [PATCH] RK3288: DTSI: rk3288.dtsi: Add missing SPI2 pinctrl

The spi2_cs1 pin reference is missing in the spi2 first pin control
definition.
Expand All @@ -14,10 +17,10 @@ Signed-off-by: Myy Miouyouyou <[email protected]>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 5b789528..9ed532cc 100644
index ff6faa82192b..5061c5418d75 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -334,7 +334,7 @@
@@ -311,7 +311,7 @@ spi2: spi@ff130000 {
dma-names = "tx", "rx";
interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
pinctrl-names = "default";
Expand All @@ -27,5 +30,5 @@ index 5b789528..9ed532cc 100644
#address-cells = <1>;
#size-cells = <0>;
--
2.11.0
2.36.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
From ebc29962ac27264772a4227f5abd6900cb72fa79 Mon Sep 17 00:00:00 2001
From e33d3ba4c34d0893d9d07b62ad4eea41d2e8bbc0 Mon Sep 17 00:00:00 2001
Message-Id: <e33d3ba4c34d0893d9d07b62ad4eea41d2e8bbc0.1652225232.git.stefan@agner.ch>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
From: "Miouyouyou (Myy)" <[email protected]>
Date: Mon, 5 Nov 2018 20:16:05 +0100
Subject: [PATCH] ARM: DTSI: rk3288-tinker: Improving the CPU max voltage
Expand All @@ -11,10 +14,10 @@ Signed-off-by: Miouyouyou (Myy) <[email protected]>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi
index aa107ee41..3da1c830f 100644
index f23c6efd39d4..cdff130d1292 100644
--- a/arch/arm/boot/dts/rk3288-tinker.dtsi
+++ b/arch/arm/boot/dts/rk3288-tinker.dtsi
@@ -164,7 +164,7 @@
@@ -186,7 +186,7 @@ vdd_cpu: DCDC_REG1 {
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <750000>;
Expand All @@ -24,5 +27,5 @@ index aa107ee41..3da1c830f 100644
regulator-ramp-delay = <6000>;
regulator-state-mem {
--
2.16.4
2.36.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
From 302cd9b8a9f1f8a7735fabea3b9a7645dc40f9cc Mon Sep 17 00:00:00 2001
From e073d75cd0dbfbcbbf1b46e565b326db37b75e6a Mon Sep 17 00:00:00 2001
Message-Id: <e073d75cd0dbfbcbbf1b46e565b326db37b75e6a.1652225232.git.stefan@agner.ch>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
From: Myy Miouyouyou <[email protected]>
Date: Sun, 7 Jan 2018 01:52:44 +0100
Subject: [PATCH] drivers: mmc: dw-mci-rockchip: Handle ASUS Tinkerboard reboot
Expand All @@ -17,14 +20,14 @@ similar effects with eMMC hardware.

Signed-off-by: Myy Miouyouyou <[email protected]>
---
drivers/mmc/host/dw_mmc-rockchip.c | 66 ++++++++++++++++++++++++++++++++++++++
drivers/mmc/host/dw_mmc-rockchip.c | 66 ++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index a3f1c2b30..7eac1f221 100644
index d36991acd6df..a526927e29df 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -16,6 +16,11 @@
@@ -12,6 +12,11 @@
#include <linux/pm_runtime.h>
#include <linux/slab.h>

Expand All @@ -36,7 +39,7 @@ index a3f1c2b30..7eac1f221 100644
#include "dw_mmc.h"
#include "dw_mmc-pltfm.h"

@@ -334,6 +339,66 @@ static const struct of_device_id dw_mci_rockchip_match[] = {
@@ -330,6 +335,66 @@ static const struct of_device_id dw_mci_rockchip_match[] = {
};
MODULE_DEVICE_TABLE(of, dw_mci_rockchip_match);

Expand Down Expand Up @@ -103,7 +106,7 @@ index a3f1c2b30..7eac1f221 100644
static int dw_mci_rockchip_probe(struct platform_device *pdev)
{
const struct dw_mci_drv_data *drv_data;
@@ -361,6 +426,7 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
@@ -357,6 +422,7 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
}

pm_runtime_put_autosuspend(&pdev->dev);
Expand All @@ -112,5 +115,5 @@ index a3f1c2b30..7eac1f221 100644
return 0;
}
--
2.14.1
2.36.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
From 392472dc977300a9f2a62159c105a6dfed878643 Mon Sep 17 00:00:00 2001
Message-Id: <392472dc977300a9f2a62159c105a6dfed878643.1652225232.git.stefan@agner.ch>
In-Reply-To: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
References: <ff0c5c49024da05b47d4fcc4d115761c43eef7a6.1652225232.git.stefan@agner.ch>
From: Stefan Agner <[email protected]>
Date: Tue, 10 May 2022 22:57:26 +0200
Subject: [PATCH] ARM: dts: rockchip: Add Bluetooth to rk3288-tinker

Enable Bluetooth support via UART0. Use the existing bindings
for Realtek rtl8723bs Bluetooth device.

Signed-off-by: Stefan Agner <[email protected]>
---
arch/arm/boot/dts/rk3288-tinker.dtsi | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-tinker.dtsi b/arch/arm/boot/dts/rk3288-tinker.dtsi
index cdff130d1292..e904c130dedc 100644
--- a/arch/arm/boot/dts/rk3288-tinker.dtsi
+++ b/arch/arm/boot/dts/rk3288-tinker.dtsi
@@ -388,6 +388,20 @@ bl_en: bl-en {
};
};

+ bluetooth {
+ bt_enable_pin: bt-enable-pin {
+ rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ bt_device_wake_pin: bt-device-wake-pin {
+ rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ bt_host_wake_pin: bt-host-wake-pin {
+ rockchip,pins = <4 RK_PD7 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+
buttons {
pwrbtn: pwrbtn {
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -520,6 +534,18 @@ &tsadc {

&uart0 {
status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "realtek,rtl8723bs-bt";
+ pinctrl-names = "default";
+ pinctrl-0 = <&bt_device_wake_pin &bt_host_wake_pin &bt_enable_pin>;
+ enable-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
+ device-wake-gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
+ host-wake-gpios = <&gpio4 RK_PD7 GPIO_ACTIVE_HIGH>;
+ };
};

&uart1 {
--
2.36.1

Loading

1 comment on commit ba8bda7

@bblllaa
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi my friend, glad to read that you addressed the tinkerboard bluetooth issue.
I'm new to the gitHub community, HA brought me here because I want the smart home system to work well on the tinkerboard S.
I'm no expert, I'm learning these things.
I would like to ask how this improved method can be uploaded to the HA system?
Could you give me a clue? I can't find a description of this, and you surely know what happened to this bluetooth problem fix.
Is there a description of this?
How can I get this fix to work on my system?
Thank you for your help if you have so much time.

Please sign in to comment.