58 lines
1.7 KiB
Diff
58 lines
1.7 KiB
Diff
From 11ac6d1c7ffc68f6a88f1c1dd25eafe378727e98 Mon Sep 17 00:00:00 2001
|
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
|
Date: Wed, 31 Oct 2018 19:48:25 -0700
|
|
Subject: [PATCH 191/323] Bluetooth: hci_h5: Add support for reset GPIO
|
|
|
|
Some boards (e.g. Pine64 and Pinebook) wire a GPIO to reset pin of
|
|
RTL8723BS
|
|
|
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
|
---
|
|
drivers/bluetooth/hci_h5.c | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
|
|
index 996729e78..19c4f8a79 100644
|
|
--- a/drivers/bluetooth/hci_h5.c
|
|
+++ b/drivers/bluetooth/hci_h5.c
|
|
@@ -93,6 +93,7 @@ struct h5 {
|
|
const struct h5_vnd *vnd;
|
|
const char *id;
|
|
|
|
+ struct gpio_desc *reset_gpio;
|
|
struct gpio_desc *enable_gpio;
|
|
struct gpio_desc *device_wake_gpio;
|
|
};
|
|
@@ -833,6 +834,10 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
|
if (IS_ERR(h5->device_wake_gpio))
|
|
return PTR_ERR(h5->device_wake_gpio);
|
|
|
|
+ h5->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
|
+ if (IS_ERR(h5->reset_gpio))
|
|
+ return PTR_ERR(h5->reset_gpio);
|
|
+
|
|
return hci_uart_register_device(&h5->serdev_hu, &h5p);
|
|
}
|
|
|
|
@@ -926,6 +931,9 @@ static void h5_btrtl_open(struct h5 *h5)
|
|
|
|
/* The controller needs up to 500ms to wakeup */
|
|
gpiod_set_value_cansleep(h5->enable_gpio, 1);
|
|
+ /* Take it out of reset */
|
|
+ gpiod_set_value_cansleep(h5->reset_gpio, 0);
|
|
+ msleep(100);
|
|
gpiod_set_value_cansleep(h5->device_wake_gpio, 1);
|
|
msleep(500);
|
|
}
|
|
@@ -933,6 +941,7 @@ static void h5_btrtl_open(struct h5 *h5)
|
|
static void h5_btrtl_close(struct h5 *h5)
|
|
{
|
|
gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
|
|
+ gpiod_set_value_cansleep(h5->reset_gpio, 1);
|
|
gpiod_set_value_cansleep(h5->enable_gpio, 0);
|
|
}
|
|
|
|
--
|
|
2.34.0
|
|
|