Bluetooth: Pause discovery and advertising during suspend

To prevent spurious wake ups, we disable any discovery or advertising
when we enter suspend and restore it when we exit suspend. While paused,
we disable any management requests to modify discovery or advertising.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Abhishek Pandit-Subedi
2020-03-11 08:54:03 -07:00
committed by Marcel Holtmann
parent dd522a7429
commit 4867bd007d
3 changed files with 96 additions and 0 deletions

View File

@@ -91,6 +91,12 @@ struct discovery_state {
#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
enum suspend_tasks {
SUSPEND_PAUSE_DISCOVERY,
SUSPEND_UNPAUSE_DISCOVERY,
SUSPEND_PAUSE_ADVERTISING,
SUSPEND_UNPAUSE_ADVERTISING,
SUSPEND_SCAN_DISABLE,
SUSPEND_SCAN_ENABLE,
SUSPEND_DISCONNECTING,
@@ -410,6 +416,11 @@ struct hci_dev {
struct discovery_state discovery;
int discovery_old_state;
bool discovery_paused;
int advertising_old_state;
bool advertising_paused;
struct notifier_block suspend_notifier;
struct work_struct suspend_prepare;
enum suspended_state suspend_state_next;