summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/btusb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-11-13 08:44:16 -0500
committerMarcel Holtmann <marcel@holtmann.org>2017-12-12 18:28:40 -0500
commiteff2d68ca7388ee1c08811c6bbf4d8587cba01da (patch)
treebdf2114cf04cf8c214896b0af91cd8d4c87217d4 /drivers/bluetooth/btusb.c
parent1b259904a2d0ad8c57feb498932bed5171112af3 (diff)
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 <hdegoede@redhat.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r--drivers/bluetooth/btusb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f7120c9eb9bd..808c249845db 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -40,6 +40,7 @@
40 40
41static bool disable_scofix; 41static bool disable_scofix;
42static bool force_scofix; 42static bool force_scofix;
43static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND);
43 44
44static bool reset = true; 45static bool reset = true;
45 46
@@ -3213,6 +3214,9 @@ static int btusb_probe(struct usb_interface *intf,
3213 } 3214 }
3214#endif 3215#endif
3215 3216
3217 if (enable_autosuspend)
3218 usb_enable_autosuspend(data->udev);
3219
3216 err = hci_register_dev(hdev); 3220 err = hci_register_dev(hdev);
3217 if (err < 0) 3221 if (err < 0)
3218 goto out_free_dev; 3222 goto out_free_dev;
@@ -3425,6 +3429,9 @@ MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size");
3425module_param(force_scofix, bool, 0644); 3429module_param(force_scofix, bool, 0644);
3426MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size"); 3430MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size");
3427 3431
3432module_param(enable_autosuspend, bool, 0644);
3433MODULE_PARM_DESC(enable_autosuspend, "Enable USB autosuspend by default");
3434
3428module_param(reset, bool, 0644); 3435module_param(reset, bool, 0644);
3429MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); 3436MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
3430 3437