summary refs log tree commit diff
path: root/gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch')
-rw-r--r--gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch b/gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch
new file mode 100644
index 0000000000..4ec2d8b6ef
--- /dev/null
+++ b/gnu/packages/patches/linux-libre-pinebook-pro-05-bluetooth-hci_bcm-disable-power-on-shutdown.patch
@@ -0,0 +1,51 @@
+From 60a2b2a921205f5a42c94f7e9c491ca7d11ad820 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 05/22] 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.30.0
+