Commit bee5395c authored by Ying Hsu's avatar Ying Hsu Committed by Luiz Augusto von Dentz

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 4539ca67 ("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: 4539ca67 ("Bluetooth: Rename driver .prevent_wake to .wakeup")
Signed-off-by: default avatarYing Hsu <yinghsu@chromium.org>
Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 6828b583
...@@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev) ...@@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev)
return 0; 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 /** hci_uart_write_wakeup - transmit buffer wakeup
* @serdev: serial device * @serdev: serial device
* *
...@@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu, ...@@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu,
hdev->flush = hci_uart_flush; hdev->flush = hci_uart_flush;
hdev->send = hci_uart_send_frame; hdev->send = hci_uart_send_frame;
hdev->setup = hci_uart_setup; hdev->setup = hci_uart_setup;
if (!hdev->wakeup)
hdev->wakeup = hci_uart_wakeup;
SET_HCIDEV_DEV(hdev, &hu->serdev->dev); SET_HCIDEV_DEV(hdev, &hu->serdev->dev);
if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags)) if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment