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>
This commit is contained in:

committed by
Marcel Holtmann

parent
72da7b2cca
commit
9952d90ea2
@@ -88,6 +88,20 @@ struct discovery_state {
|
||||
unsigned long scan_duration;
|
||||
};
|
||||
|
||||
#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
|
||||
|
||||
enum suspend_tasks {
|
||||
SUSPEND_POWERING_DOWN,
|
||||
|
||||
SUSPEND_PREPARE_NOTIFIER,
|
||||
__SUSPEND_NUM_TASKS
|
||||
};
|
||||
|
||||
enum suspended_state {
|
||||
BT_RUNNING = 0,
|
||||
BT_SUSPENDED,
|
||||
};
|
||||
|
||||
struct hci_conn_hash {
|
||||
struct list_head list;
|
||||
unsigned int acl_num;
|
||||
@@ -390,6 +404,15 @@ struct hci_dev {
|
||||
void *smp_bredr_data;
|
||||
|
||||
struct discovery_state discovery;
|
||||
|
||||
struct notifier_block suspend_notifier;
|
||||
struct work_struct suspend_prepare;
|
||||
enum suspended_state suspend_state_next;
|
||||
enum suspended_state suspend_state;
|
||||
|
||||
wait_queue_head_t suspend_wait_q;
|
||||
DECLARE_BITMAP(suspend_tasks, __SUSPEND_NUM_TASKS);
|
||||
|
||||
struct hci_conn_hash conn_hash;
|
||||
|
||||
struct list_head mgmt_pending;
|
||||
|
Reference in New Issue
Block a user