|
Lee, Chun-Yi |
15a4e5 |
From: Vyacheslav Bocharov <adeep@lexina.in>
|
|
Lee, Chun-Yi |
15a4e5 |
Date: Wed, 26 Jan 2022 10:39:05 +0300
|
|
Lee, Chun-Yi |
15a4e5 |
Subject: Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open
|
|
Lee, Chun-Yi |
15a4e5 |
Patch-mainline: v5.18-rc1
|
|
Lee, Chun-Yi |
15a4e5 |
Git-commit: adce573b927adf827f2f8627f05c2ba90031ebc9
|
|
Lee, Chun-Yi |
15a4e5 |
References: jsc#PED-1407
|
|
Lee, Chun-Yi |
15a4e5 |
|
|
Lee, Chun-Yi |
15a4e5 |
Add power reset for bluetooth via enable-gpios in h5_btrtl_open function.
|
|
Lee, Chun-Yi |
15a4e5 |
|
|
Lee, Chun-Yi |
15a4e5 |
While testing the RTL8822CS SDIO WiFi/BT adapter, it was found that in
|
|
Lee, Chun-Yi |
15a4e5 |
some cases the kernel could not initialize BT firmware. However,
|
|
Lee, Chun-Yi |
15a4e5 |
manually resetting the adapter via gpio (off/on sequence) allows it to
|
|
Lee, Chun-Yi |
15a4e5 |
start correctly.
|
|
Lee, Chun-Yi |
15a4e5 |
Apparently, when the system starts, the adapter is in an undefined state
|
|
Lee, Chun-Yi |
15a4e5 |
(including unknown gpio state after starting uboot). A forced reset helps
|
|
Lee, Chun-Yi |
15a4e5 |
to initialize the adapter in most cases. It has been found experimentally
|
|
Lee, Chun-Yi |
15a4e5 |
that 100 ms is sufficient for a reset.
|
|
Lee, Chun-Yi |
15a4e5 |
|
|
Lee, Chun-Yi |
15a4e5 |
Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
|
|
Lee, Chun-Yi |
15a4e5 |
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
|
Lee, Chun-Yi |
15a4e5 |
Acked-by: Lee, Chun-Yi <jlee@suse.com>
|
|
Lee, Chun-Yi |
15a4e5 |
---
|
|
Lee, Chun-Yi |
15a4e5 |
drivers/bluetooth/hci_h5.c | 5 +++++
|
|
Lee, Chun-Yi |
15a4e5 |
1 file changed, 5 insertions(+)
|
|
Lee, Chun-Yi |
15a4e5 |
|
|
Lee, Chun-Yi |
15a4e5 |
--- a/drivers/bluetooth/hci_h5.c
|
|
Lee, Chun-Yi |
15a4e5 |
+++ b/drivers/bluetooth/hci_h5.c
|
|
Lee, Chun-Yi |
15a4e5 |
@@ -966,6 +966,11 @@ static void h5_btrtl_open(struct h5 *h5)
|
|
Lee, Chun-Yi |
15a4e5 |
pm_runtime_enable(&h5->hu->serdev->dev);
|
|
Lee, Chun-Yi |
15a4e5 |
}
|
|
Lee, Chun-Yi |
15a4e5 |
|
|
Lee, Chun-Yi |
15a4e5 |
+ /* The controller needs reset to startup */
|
|
Lee, Chun-Yi |
15a4e5 |
+ gpiod_set_value_cansleep(h5->enable_gpio, 0);
|
|
Lee, Chun-Yi |
15a4e5 |
+ gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
|
|
Lee, Chun-Yi |
15a4e5 |
+ msleep(100);
|
|
Lee, Chun-Yi |
15a4e5 |
+
|
|
Lee, Chun-Yi |
15a4e5 |
/* The controller needs up to 500ms to wakeup */
|
|
Lee, Chun-Yi |
15a4e5 |
gpiod_set_value_cansleep(h5->enable_gpio, 1);
|
|
Lee, Chun-Yi |
15a4e5 |
gpiod_set_value_cansleep(h5->device_wake_gpio, 1);
|