mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
Bluetooth: Add hook for driver to prevent wake from suspend
Let drivers have a hook to disable configuring scanning during suspend. Drivers should use the device_may_wakeup function call to determine whether hci should be configured for wakeup. For example, an implementation for btusb may look like the following: bool btusb_prevent_wake(struct hci_dev *hdev) { struct btusb_data *data = hci_get_drvdata(hdev); return !device_may_wakeup(&data->udev->dev); } Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Reviewed-by: Alain Michaud <alainm@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
0d2c9825e4
commit
81dafad53c
2 changed files with 5 additions and 2 deletions
|
@ -503,6 +503,7 @@ struct hci_dev {
|
||||||
int (*set_diag)(struct hci_dev *hdev, bool enable);
|
int (*set_diag)(struct hci_dev *hdev, bool enable);
|
||||||
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
|
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
|
||||||
void (*cmd_timeout)(struct hci_dev *hdev);
|
void (*cmd_timeout)(struct hci_dev *hdev);
|
||||||
|
bool (*prevent_wake)(struct hci_dev *hdev);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HCI_PHY_HANDLE(handle) (handle & 0xff)
|
#define HCI_PHY_HANDLE(handle) (handle & 0xff)
|
||||||
|
|
|
@ -3350,8 +3350,10 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action,
|
||||||
*/
|
*/
|
||||||
ret = hci_change_suspend_state(hdev, BT_SUSPEND_DISCONNECT);
|
ret = hci_change_suspend_state(hdev, BT_SUSPEND_DISCONNECT);
|
||||||
|
|
||||||
/* Only configure whitelist if disconnect succeeded */
|
/* Only configure whitelist if disconnect succeeded and wake
|
||||||
if (!ret)
|
* isn't being prevented.
|
||||||
|
*/
|
||||||
|
if (!ret && !(hdev->prevent_wake && hdev->prevent_wake(hdev)))
|
||||||
ret = hci_change_suspend_state(hdev,
|
ret = hci_change_suspend_state(hdev,
|
||||||
BT_SUSPEND_CONFIGURE_WAKE);
|
BT_SUSPEND_CONFIGURE_WAKE);
|
||||||
} else if (action == PM_POST_SUSPEND) {
|
} else if (action == PM_POST_SUSPEND) {
|
||||||
|
|
Loading…
Reference in a new issue