[PATCH] Bluetooth: btusb: Remove WAKEUP_DISABLE and add WAKEUP_AUTOSUSPEND for Realtek devices
Subsystems:
bluetooth drivers , the rest
STALE1819d
REVIEWED: 4 (2M)
3 review trailers.
3 messages,
3 authors,
2021-08-09
· open the first message on its own page
From: Max Chou <redacted>
For the commit of 9e45524a011107a73bc2cdde8370c61e82e93a4d, wakeup is
always disabled for Realtek devices. However, there's the capability
for Realtek devices to apply USB wake-up.
In this commit, remove WAKEUP_DISABLE feature for Realtek devices.
If users would switch wake-up, they should access
"/sys/bus/usb/.../power/wakeup"
In this commit, it also adds the feature as WAKEUP_AUTOSUSPEND
for Realtek devices because it should set do_remote_wakeup on autosuspend.
Signed-off-by: Max Chou <redacted>
Tested-by: Hilda Wu <redacted>
Reviewed-by: Archie Pusaka <redacted>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
drivers/bluetooth/btusb.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 488f110e17e2..73a835bf37f7 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c @@ -527,7 +527,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
#define BTUSB_OOB_WAKE_ENABLED 11
#define BTUSB_HW_RESET_ACTIVE 12
#define BTUSB_TX_WAIT_VND_EVT 13
- #define BTUSB_WAKEUP_DISABLE 14
+ #define BTUSB_WAKEUP_AUTOSUSPEND 14
struct btusb_data {
struct hci_dev * hdev ; @@ -1349,13 +1349,6 @@ static int btusb_open(struct hci_dev *hdev)
data -> intf -> needs_remote_wakeup = 1 ;
- /* Disable device remote wakeup when host is suspended
- * For Realtek chips , global suspend without
- * SET_FEATURE ( DEVICE_REMOTE_WAKEUP ) can save more power in device .
- */
- if ( test_bit ( BTUSB_WAKEUP_DISABLE , & data -> flags ))
- device_wakeup_disable ( & data -> udev -> dev );
-
if ( test_and_set_bit ( BTUSB_INTR_RUNNING , & data -> flags ))
goto done ;
@@ -1422,7 +1415,7 @@ static int btusb_close(struct hci_dev *hdev)
data -> intf -> needs_remote_wakeup = 0 ;
/* Enable remote wake up for auto-suspend */
- if ( test_bit ( BTUSB_WAKEUP_DISABLE , & data -> flags ))
+ if ( test_bit ( BTUSB_WAKEUP_AUTOSUSPEND , & data -> flags ))
data -> intf -> needs_remote_wakeup = 1 ;
usb_autopm_put_interface ( data -> intf ); @@ -3877,11 +3870,8 @@ static int btusb_probe(struct usb_interface *intf,
hdev -> shutdown = btrtl_shutdown_realtek ;
hdev -> cmd_timeout = btusb_rtl_cmd_timeout ;
- /* Realtek devices lose their updated firmware over global
- * suspend that means host doesn ' t send SET_FEATURE
- * ( DEVICE_REMOTE_WAKEUP )
- */
- set_bit ( BTUSB_WAKEUP_DISABLE , & data -> flags );
+ /* Realtek devices need to set remote wakeup on auto-suspend */
+ set_bit ( BTUSB_WAKEUP_AUTOSUSPEND , & data -> flags );
}
if ( ! reset ) @@ -4056,12 +4046,15 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
* Actually , it depends on whether the usb host sends
* set feature ( enable wakeup ) or not .
*/
- if ( test_bit ( BTUSB_WAKEUP_DISABLE , & data -> flags )) {
+ if ( test_bit ( BTUSB_WAKEUP_AUTOSUSPEND , & data -> flags )) {
if ( PMSG_IS_AUTO ( message ) &&
device_can_wakeup ( & data -> udev -> dev ))
data -> udev -> do_remote_wakeup = 1 ;
- else if ( ! PMSG_IS_AUTO ( message ))
+ else if ( ! PMSG_IS_AUTO ( message ) &&
+ ! device_may_wakeup ( & data -> udev -> dev )) {
+ data -> udev -> do_remote_wakeup = 0 ;
data -> udev -> reset_resume = 1 ;
+ }
}
return 0 ; --
2.17.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=528479
---Test result---
Test Summary:
CheckPatch PASS 0.52 seconds
GitLint FAIL 0.12 seconds
BuildKernel FAIL 337.33 seconds
TestRunner: Setup PASS 363.65 seconds
TestRunner: l2cap-tester PASS 2.59 seconds
TestRunner: bnep-tester PASS 1.97 seconds
TestRunner: mgmt-tester PASS 30.89 seconds
TestRunner: rfcomm-tester PASS 2.18 seconds
TestRunner: sco-tester PASS 2.06 seconds
TestRunner: smp-tester FAIL 2.18 seconds
TestRunner: userchan-tester PASS 2.02 seconds
Details
##############################
Test: CheckPatch - PASS - 0.52 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
##############################
Test: GitLint - FAIL - 0.12 seconds
Run gitlint with rule in .gitlint
Bluetooth: btusb: Remove WAKEUP_DISABLE and add WAKEUP_AUTOSUSPEND for Realtek devices
1: T1 Title exceeds max length (86>72): "Bluetooth: btusb: Remove WAKEUP_DISABLE and add WAKEUP_AUTOSUSPEND for Realtek devices"
##############################
Test: BuildKernel - FAIL - 337.33 seconds
Build Kernel with minimal configuration supports Bluetooth
drivers/bluetooth/btusb.c: In function ‘btusb_prevent_wake’:
drivers/bluetooth/btusb.c:3593:15: error: ‘BTUSB_WAKEUP_DISABLE’ undeclared (first use in this function)
3593 | if (test_bit(BTUSB_WAKEUP_DISABLE, &data->flags))
| ^~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btusb.c:3593:15: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.build:271: drivers/bluetooth/btusb.o] Error 1
make[1]: *** [scripts/Makefile.build:514: drivers/bluetooth] Error 2
make: *** [Makefile:1841: drivers] Error 2
##############################
Test: TestRunner: Setup - PASS - 363.65 seconds
Setup environment for running Test Runner
##############################
Test: TestRunner: l2cap-tester - PASS - 2.59 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner: bnep-tester - PASS - 1.97 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner: mgmt-tester - PASS - 30.89 seconds
Run test-runner with mgmt-tester
Total: 448, Passed: 445 (99.3%), Failed: 0, Not Run: 3
##############################
Test: TestRunner: rfcomm-tester - PASS - 2.18 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner: sco-tester - PASS - 2.06 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner: smp-tester - FAIL - 2.18 seconds
Run test-runner with smp-tester
Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0
Failed Test Cases
SMP Client - SC Request 2 Failed 0.023 seconds
##############################
Test: TestRunner: userchan-tester - PASS - 2.02 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0
---
Regards,
Linux Bluetooth
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bluetooth/master]
[also build test ERROR on bluetooth-next/master v5.14-rc5 next-20210809]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]
url: https://github.com/0day-ci/linux/commits/max-chou-realtek-com/Bluetooth-btusb-Remove-WAKEUP_DISABLE-and-add-WAKEUP_AUTOSUSPEND-for-Realtek-devices/20210809-210601
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: h8300-buildonly-randconfig-r001-20210809 (attached as .config)
compiler: h8300-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a791e68679a17d6560048ebc7b8ca1ed4491a5b5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review max-chou-realtek-com/Bluetooth-btusb-Remove-WAKEUP_DISABLE-and-add-WAKEUP_AUTOSUSPEND-for-Realtek-devices/20210809-210601
git checkout a791e68679a17d6560048ebc7b8ca1ed4491a5b5
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=h8300 SHELL=/bin/bash drivers/bluetooth/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
All errors (new ones prefixed by >>):
drivers/bluetooth/btusb.c: In function 'btusb_prevent_wake': quoted drivers/bluetooth/btusb.c:4402:15: error: 'BTUSB_WAKEUP_DISABLE' undeclared (first use in this function) 4402 | if (test_bit(BTUSB_WAKEUP_DISABLE, &data->flags))
| ^~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btusb.c:4402:15: note: each undeclared identifier is reported only once for each function it appears in
vim +/BTUSB_WAKEUP_DISABLE +4402 drivers/bluetooth/btusb.c
fc54910280eb38 Hans de Goede 2018-04-27 4397
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4398 static bool btusb_prevent_wake(struct hci_dev *hdev)
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4399 {
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4400 struct btusb_data *data = hci_get_drvdata(hdev);
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4401
34a68655a1414a Abhishek Pandit-Subedi 2020-06-24 @4402 if (test_bit(BTUSB_WAKEUP_DISABLE, &data->flags))
34a68655a1414a Abhishek Pandit-Subedi 2020-06-24 4403 return true;
34a68655a1414a Abhishek Pandit-Subedi 2020-06-24 4404
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4405 return !device_may_wakeup(&data->udev->dev);
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4406 }
b7d0bf11a7ad0e Abhishek Pandit-Subedi 2020-05-12 4407
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org