diff options
author | Abhishek Pandit-Subedi <abhishekpandit@chromium.org> | 2020-03-11 18:54:00 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2020-03-11 20:00:48 +0300 |
commit | 9952d90ea2885d7cbf80cd233f694f09a9c0eaec (patch) | |
tree | 9b954ac288ac5dbcc782127c2b964012034fd2f6 /net/bluetooth/hci_request.c | |
parent | 72da7b2ccabd5fd93d6b8d0093936e980602652b (diff) | |
download | linux-9952d90ea2885d7cbf80cd233f694f09a9c0eaec.tar.xz |
Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND
Register for PM_SUSPEND_PREPARE and PM_POST_SUSPEND to make sure the
Bluetooth controller is prepared correctly for suspend/resume. Implement
the registration, scheduling and task handling portions only in this
patch.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r-- | net/bluetooth/hci_request.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 53179ae856ae..2343166614f0 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -918,6 +918,21 @@ static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) return adv_instance->scan_rsp_len; } +/* Call with hci_dev_lock */ +void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next) +{ + if (next == hdev->suspend_state) { + bt_dev_dbg(hdev, "Same state before and after: %d", next); + goto done; + } + + hdev->suspend_state = next; + +done: + clear_bit(SUSPEND_PREPARE_NOTIFIER, hdev->suspend_tasks); + wake_up(&hdev->suspend_wait_q); +} + static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev) { u8 instance = hdev->cur_adv_instance; |