BACKPORT: FROMGIT: Bluetooth: Fix Advertisement Monitor Suspend/Resume

During system suspend, advertisement monitoring is disabled by setting
the HCI_VS_MSFT_LE_Set_Advertisement_Filter_Enable to False. This
disables the monitoring during suspend, however, if the controller is
monitoring a device, it sends HCI_VS_MSFT_LE_Monitor_Device_Event to
indicate that the monitoring has been stopped for that particular
device. This event may occur after suspend depending on the
low_threshold_timeout and peer device advertisement frequency, which
causes early wake up.

Right way to disable the monitoring for suspend is by removing all the
monitors before suspend and re-monitor after resume to ensure no events
are received during suspend. This patch fixes this suspend/resume issue.

Following tests are performed:
- Add monitors before suspend and make sure DeviceFound gets triggered
- Suspend the system and verify that all monitors are removed by kernel
  but not Released by bluetoothd
- Wake up and verify that all monitors are added again and DeviceFound
  gets triggered

Signed-off-by: Manish Mandlik <mmandlik@google.com>
Reviewed-by: Archie Pusaka <apusaka@google.com>
Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
(cherry picked from commit 47cb494480397a79fd8ad5a662f32c3ed1897e88
 git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
 master)

BUG=b:192392727
TEST=Above tests steps are performed

Signed-off-by: Manish Mandlik <mmandlik@google.com>
Change-Id: Ib31940aba2253e3f25cbca09a2d977d27170e163
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3161439
Tested-by: Manish Mandlik <mmandlik@chromium.org>
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Commit-Queue: Manish Mandlik <mmandlik@chromium.org>
3 files changed