[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220704183320.1.Ib7423c21f71003643a5bbe954ed0538ee532b29c@changeid>
Date: Mon, 4 Jul 2022 18:33:24 +0800
From: Ying Hsu <yinghsu@...omium.org>
To: marcel@...tmann.org
Cc: chromeos-bluetooth-upstreaming@...omium.org,
Ying Hsu <yinghsu@...omium.org>,
Alain Michaud <alainm@...omium.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Bluetooth: Add default wakeup callback for HCI UART driver
Bluetooth HCI devices indicate if they are able to wakeup in the wakeup
callback since 'commit 4539ca67fe8e ("Bluetooth: Rename driver
.prevent_wake to .wakeup")'. This patch adds a default wakeup callback
for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are
wakeable for backward compatibility. For those who need a customized
behavior, one can override it before calling hci_uart_register_device().
Fixes: 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup")
Signed-off-by: Ying Hsu <yinghsu@...omium.org>
Reviewed-by: Alain Michaud <alainm@...omium.org>
---
Tested this commit on trogdor (wcn399x) and hayato (RTL8822-UART).
For platforms with QCA UART connectivity, such as trogdor, we revert the
commit c1a74160eaf1 ("Bluetooth: hci_qca: Add device_may_wakeup
support") downstream as qca_wakeup() returns false and breaks wake-on-bt.
drivers/bluetooth/hci_serdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index 4cda890ce647..c0e5f42ec6b7 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev)
return 0;
}
+/* Check if the device is wakeable */
+static bool hci_uart_wakeup(struct hci_dev *hdev)
+{
+ /* HCI UART devices are assumed to be wakeable by default.
+ * Implement wakeup callback to override this behavior.
+ */
+ return true;
+}
+
/** hci_uart_write_wakeup - transmit buffer wakeup
* @serdev: serial device
*
@@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu,
hdev->flush = hci_uart_flush;
hdev->send = hci_uart_send_frame;
hdev->setup = hci_uart_setup;
+ if (!hdev->wakeup)
+ hdev->wakeup = hci_uart_wakeup;
SET_HCIDEV_DEV(hdev, &hu->serdev->dev);
if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags))
--
2.37.0.rc0.161.g10f37bed90-goog
Powered by blists - more mailing lists