| From 3502043ada2ec74784dbcf95c5481f166f8216c9 Mon Sep 17 00:00:00 2001 |
| From: Archie Pusaka <apusaka@chromium.org> |
| Date: Fri, 27 Aug 2021 23:26:52 +0800 |
| Subject: [PATCH] CHROMIUM: Disable Remote Wakeup for RTL8822 USB |
| |
| Some upstream patch enables RTL chips to remote wakeup in order |
| to let future gens of RTK chips to act as wakeup source. However, |
| it also enables RTL8822 to do so. Previously, RTL8822 remote wakeup |
| capability are disabled in order to save power. |
| |
| This patch keeps remote wakeup for RTL8822 disabled in order to |
| preserve the condition. |
| |
| BUG=b:178449733 |
| TEST=verify BT keyboard cannot wake Blooglet from suspend |
| UPSTREAM-TASK=b:323789053 |
| |
| Signed-off-by: Archie Pusaka <apusaka@chromium.org> |
| |
| Change-Id: I8bdf506da4c7c575ab69502d44afa246c423d827 |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5266181 |
| Reviewed-by: Yun-hao Chung <howardchung@chromium.org> |
| Reviewed-by: Douglas Anderson <dianders@chromium.org> |
| Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com> |
| Tested-by: Archie Pusaka <apusaka@chromium.org> |
| --- |
| drivers/bluetooth/btrtl.c | 5 +++++ |
| drivers/bluetooth/btusb.c | 4 +++- |
| include/net/bluetooth/hci.h | 5 +++++ |
| 3 files changed, 13 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c |
| index 28de6678e4bb95c42067e97761c4a1afaedd67c7..1aae39b241509081efb0d9256f5ba6fd505975da 100644 |
| --- a/drivers/bluetooth/btrtl.c |
| +++ b/drivers/bluetooth/btrtl.c |
| @@ -1282,6 +1282,11 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev) |
| /* Enable WBS supported for the specific Realtek devices. */ |
| switch (btrtl_dev->project_id) { |
| case CHIP_ID_8822C: |
| + /* Disallow RTL8822 to remote wakeup, in order to enter |
| + * global suspend and save power. |
| + */ |
| + set_bit(HCI_QUIRK_DISABLE_REMOTE_WAKE, &hdev->quirks); |
| + fallthrough; |
| case CHIP_ID_8852A: |
| case CHIP_ID_8852B: |
| case CHIP_ID_8852C: |
| diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
| index 5baf5a3334e350f58c7f2afc492ddb9f082ffa90..263a5e7d3786ecf100c37b6615110fb65cb1d414 100644 |
| --- a/drivers/bluetooth/btusb.c |
| +++ b/drivers/bluetooth/btusb.c |
| @@ -4734,7 +4734,9 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) |
| device_can_wakeup(&data->udev->dev)) |
| data->udev->do_remote_wakeup = 1; |
| else if (!PMSG_IS_AUTO(message) && |
| - !device_may_wakeup(&data->udev->dev)) { |
| + (!device_may_wakeup(&data->udev->dev) || |
| + test_bit(HCI_QUIRK_DISABLE_REMOTE_WAKE, |
| + &data->hdev->quirks))) { |
| data->udev->do_remote_wakeup = 0; |
| data->udev->reset_resume = 1; |
| } |
| diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
| index e372a88e8c3f6a9a640f791ad4ddcf9be25a7947..0dcef636fe11f0aec1f365b4f7766c26947b7c41 100644 |
| --- a/include/net/bluetooth/hci.h |
| +++ b/include/net/bluetooth/hci.h |
| @@ -335,6 +335,11 @@ enum { |
| * during the hdev->setup vendor callback. |
| */ |
| HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY, |
| + |
| + /* CHROMIUM-only: This quirk prevents RTL8822 to perform remote wake |
| + * on system suspend to save power. This shouldn't be upstreamed. |
| + */ |
| + HCI_QUIRK_DISABLE_REMOTE_WAKE, |
| }; |
| |
| /* HCI device flags */ |
| -- |
| 2.45.2.993.g49e7a77208-goog |
| |