void-packages/srcpkgs/pinebookpro-kernel/patches/0003-bluetooth-hci_bcm-disa...

52 lines
1.6 KiB
Diff

From c057897812518b6c2366d8102643bcdf66592c4b Mon Sep 17 00:00:00 2001
From: Tobias Schramm <t.schramm@manjaro.org>
Date: Thu, 28 May 2020 14:15:08 +0200
Subject: [PATCH 3/8] bluetooth: hci_bcm: disable power on shutdown
Firmware behaves wonky when not power cycled over reboots
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
drivers/bluetooth/hci_bcm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 8ea5ca8d71d6..6d5871992f79 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -1469,6 +1469,23 @@ static void bcm_serdev_remove(struct serdev_device *serdev)
hci_uart_unregister_device(&bcmdev->serdev_hu);
}
+static void bcm_serdev_shutdown(struct serdev_device *serdev)
+{
+ struct bcm_device *bcmdev = serdev_device_get_drvdata(serdev);
+
+/*
+ if (test_bit(HCI_UART_REGISTERED, &bcmdev->hu->flags)) {
+ hci_uart_unregister_device(&bcmdev->serdev_hu);
+ }
+*/
+ dev_info(bcmdev->dev, "Cutting power to bluetooth module\n");
+ if (bcm_gpio_set_power(bcmdev, false)) {
+ dev_err(bcmdev->dev, "Failed to power down\n");
+ }
+ usleep_range(500000, 1000000);
+}
+
+
#ifdef CONFIG_OF
static struct bcm_device_data bcm4354_device_data = {
.no_early_set_baudrate = true,
@@ -1494,6 +1511,7 @@ MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match);
static struct serdev_device_driver bcm_serdev_driver = {
.probe = bcm_serdev_probe,
.remove = bcm_serdev_remove,
+ .shutdown = bcm_serdev_shutdown,
.driver = {
.name = "hci_uart_bcm",
.of_match_table = of_match_ptr(bcm_bluetooth_of_match),
--
2.28.0