Skip to content

Commit eff2d68

Browse files
jwrdegoedeholtmann
authored andcommitted
Bluetooth: btusb: Add a Kconfig option to enable USB autosuspend by default
On many laptops the btusb device is the only USB device not having USB autosuspend enabled, this causes not only the HCI but also the USB controller to stay awake, together using aprox. 0.4W of power. Modern ultrabooks idle around 6W (at 50% screen brightness), 3.5W for Apollo Lake devices. 0.4W is a significant chunk of this (7 / 11%). The btusb driver already contains code to allow enabling USB autosuspend, but currently leaves it up to the user / userspace to enable it. This means that for most people it will not be enabled, leading to an unnecessarily high power consumption. Since enabling it is not entirely without risk of regressions, this commit adds a Kconfig option so that Linux distributions can choose to enable it by default. This commit also adds a module option so that when distros receive bugs they can easily ask the user to disable it again for easy debugging. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 1b25990 commit eff2d68

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/bluetooth/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ config BT_HCIBTUSB
3131
Say Y here to compile support for Bluetooth USB devices into the
3232
kernel or say M to compile it as module (btusb).
3333

34+
config BT_HCIBTUSB_AUTOSUSPEND
35+
bool "Enable USB autosuspend for Bluetooth USB devices by default.
36+
depends on BT_HCIBTUSB
37+
help
38+
Say Y here to enable USB autosuspend for Bluetooth USB devices by
39+
default.
40+
41+
This can be overridden by passing btusb.enable_autosuspend=[y|n]
42+
on the kernel commandline.
43+
3444
config BT_HCIBTUSB_BCM
3545
bool "Broadcom protocol support"
3646
depends on BT_HCIBTUSB

drivers/bluetooth/btusb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
static bool disable_scofix;
4242
static bool force_scofix;
43+
static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND);
4344

4445
static bool reset = true;
4546

@@ -3213,6 +3214,9 @@ static int btusb_probe(struct usb_interface *intf,
32133214
}
32143215
#endif
32153216

3217+
if (enable_autosuspend)
3218+
usb_enable_autosuspend(data->udev);
3219+
32163220
err = hci_register_dev(hdev);
32173221
if (err < 0)
32183222
goto out_free_dev;
@@ -3425,6 +3429,9 @@ MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size");
34253429
module_param(force_scofix, bool, 0644);
34263430
MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size");
34273431

3432+
module_param(enable_autosuspend, bool, 0644);
3433+
MODULE_PARM_DESC(enable_autosuspend, "Enable USB autosuspend by default");
3434+
34283435
module_param(reset, bool, 0644);
34293436
MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
34303437

0 commit comments

Comments
 (0)