linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Qulcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
@ 2023-11-19 13:40 Paul Menzel
  2023-11-19 13:42 ` Qualcomm " Paul Menzel
  2023-11-19 14:35 ` Qulcomm " Greg KH
  0 siblings, 2 replies; 13+ messages in thread
From: Paul Menzel @ 2023-11-19 13:40 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-usb, linux-pm, Hans de Goede

Dear Linux folks,


On the Dell XPS 13 9360 from 2016, BIOS 2.21.0 06/02/2022, with Debian 
sid/unstable and Debian’s Linux 6.5.10 kernel, I am trying to extend the 
run-time with battery, at under 50 % of it’s original capacity, and I am 
using PowerTOP 2.15.

     [    0.000000] microcode: updated early: 0xf0 -> 0xf4, date = 
2023-02-22
     [    0.000000] Linux version 6.5.0-4-amd64 
(debian-kernel@lists.debian.org) (gcc-13 (Debian 13.2.0-6) 13.2.0, GNU 
ld (GNU Binutils for Debian) 2.41) #1 SMP PREEMPT_DYNAMIC Debian 
6.5.10-1 (2023-11-03)
     […]
     [    0.000000] DMI: Dell Inc. XPS 13 9360/0596KF, BIOS 2.21.0 
06/02/2022
     […]
     [   15.646414] usbcore: registered new interface driver btusb
     [   15.648188] ath10k_pci 0000:3a:00.0: pci irq msi oper_irq_mode 2 
irq_mode 0 reset_mode 0
     [   15.649555] bluetooth hci0: firmware: direct-loading firmware 
qca/rampatch_usb_00000302.bin
     [   15.650018] Bluetooth: hci0: using rampatch file: 
qca/rampatch_usb_00000302.bin
     [   15.650020] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, 
firmware rome 0x302 build 0x111

Although radio/wireless devices are turned off in GNOME, PowerTOP shows 
the Bluetooth device drawing 0.85 W of energy:

     848 mW    100.0%   Device         USB device: usb-device-0cf3-e300

     $ lsusb -d 0cf3:e300
     Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications 
QCA61x4 Bluetooth 4.0

     $ lspci -nn -s 3a:00.0
     3a:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 
802.11ac Wireless Network Adapter [168c:003e] (rev 32)

After unloading the module `btusb`, the entry disappears from the 
PowerTOP list after a while.

     usbcore: deregistering interface driver btusb

Auto-suspend was enabled for the device. (Though it shouldn’t have 
mattered as it was disabled in GNOME?)

Anyways, have you heard of such an issue? Can I provide more 
information, to get it to not use any energy while being disable in GNOME?


Kind regards,

Paul


```
$ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen 
Core Processor Host Bridge/DRAM Registers [8086:5904] (rev 02)
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 
620 [8086:5916] (rev 02)
00:04.0 Signal processing controller [1180]: Intel Corporation Xeon 
E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem 
[8086:1903] (rev 02)
00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 
3.0 xHCI Controller [8086:9d2f] (rev 21)
00:14.2 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Thermal subsystem [8086:9d31] (rev 21)
00:15.0 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Serial IO I2C Controller #0 [8086:9d60] (rev 21)
00:15.1 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Serial IO I2C Controller #1 [8086:9d61] (rev 21)
00:16.0 Communication controller [0780]: Intel Corporation Sunrise 
Point-LP CSME HECI #1 [8086:9d3a] (rev 21)
00:1c.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #1 [8086:9d10] (rev f1)
00:1c.4 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #5 [8086:9d14] (rev f1)
00:1c.5 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #6 [8086:9d15] (rev f1)
00:1d.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #9 [8086:9d18] (rev f1)
00:1f.0 ISA bridge [0601]: Intel Corporation Sunrise Point-LP LPC 
Controller [8086:9d58] (rev 21)
00:1f.2 Memory controller [0580]: Intel Corporation Sunrise Point-LP PMC 
[8086:9d21] (rev 21)
00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-LP HD Audio 
[8086:9d71] (rev 21)
00:1f.4 SMBus [0c05]: Intel Corporation Sunrise Point-LP SMBus 
[8086:9d23] (rev 21)
01:00.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:00.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:01.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:02.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
39:00.0 USB controller [0c03]: Intel Corporation DSL6340 USB 3.1 
Controller [Alpine Ridge] [8086:15b5]
3a:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac 
Wireless Network Adapter [168c:003e] (rev 32)
3b:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A 
PCI Express Card Reader [10ec:525a] (rev 01)
3c:00.0 Non-Volatile memory controller [0108]: SK hynix PC300 NVMe Solid 
State Drive 512GB [1c5c:1284]
$ lspci -t
-[0000:00]-+-00.0
            +-02.0
            +-04.0
            +-14.0
            +-14.2
            +-15.0
            +-15.1
            +-16.0
            +-1c.0-[01-39]----00.0-[02-39]--+-00.0-[03]--
            |                               +-01.0-[04-38]--
            |                               \-02.0-[39]----00.0
            +-1c.4-[3a]----00.0
            +-1c.5-[3b]----00.0
            +-1d.0-[3c]----00.0
            +-1f.0
            +-1f.2
            +-1f.3
            \-1f.4
$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
         |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, 
Driver=r8152, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
         |__ Port 1: Dev 3, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
     |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=, 12M
     |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=, 12M
     |__ Port 4: Dev 3, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
     |__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
     |__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
```

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-19 13:40 Qulcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME Paul Menzel
@ 2023-11-19 13:42 ` Paul Menzel
  2023-11-19 15:43   ` Alan Stern
  2023-11-19 14:35 ` Qulcomm " Greg KH
  1 sibling, 1 reply; 13+ messages in thread
From: Paul Menzel @ 2023-11-19 13:42 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-usb, linux-pm, Hans de Goede

[Fix typo in subject line]

Dear Linux folks,


On the Dell XPS 13 9360 from 2016, BIOS 2.21.0 06/02/2022, with Debian 
sid/unstable and Debian’s Linux 6.5.10 kernel, I am trying to extend the 
run-time with battery, at under 50 % of it’s original capacity, and I am 
using PowerTOP 2.15.

     [    0.000000] microcode: updated early: 0xf0 -> 0xf4, date = 
2023-02-22
     [    0.000000] Linux version 6.5.0-4-amd64 
(debian-kernel@lists.debian.org) (gcc-13 (Debian 13.2.0-6) 13.2.0, GNU 
ld (GNU Binutils for Debian) 2.41) #1 SMP PREEMPT_DYNAMIC Debian 
6.5.10-1 (2023-11-03)
     […]
     [    0.000000] DMI: Dell Inc. XPS 13 9360/0596KF, BIOS 2.21.0 
06/02/2022
     […]
     [   15.646414] usbcore: registered new interface driver btusb
     [   15.648188] ath10k_pci 0000:3a:00.0: pci irq msi oper_irq_mode 2 
irq_mode 0 reset_mode 0
     [   15.649555] bluetooth hci0: firmware: direct-loading firmware 
qca/rampatch_usb_00000302.bin
     [   15.650018] Bluetooth: hci0: using rampatch file: 
qca/rampatch_usb_00000302.bin
     [   15.650020] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, 
firmware rome 0x302 build 0x111

Although radio/wireless devices are turned off in GNOME, PowerTOP shows 
the Bluetooth device drawing 0.85 W of energy:

     848 mW    100.0%   Device         USB device: usb-device-0cf3-e300

     $ lsusb -d 0cf3:e300
     Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications 
QCA61x4 Bluetooth 4.0

     $ lspci -nn -s 3a:00.0
     3a:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 
802.11ac Wireless Network Adapter [168c:003e] (rev 32)

After unloading the module `btusb`, the entry disappears from the 
PowerTOP list after a while.

     usbcore: deregistering interface driver btusb

Auto-suspend was enabled for the device. (Though it shouldn’t have 
mattered as it was disabled in GNOME?)

Anyways, have you heard of such an issue? Can I provide more 
information, to get it to not use any energy while being disable in GNOME?


Kind regards,

Paul


```
$ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen 
Core Processor Host Bridge/DRAM Registers [8086:5904] (rev 02)
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 
620 [8086:5916] (rev 02)
00:04.0 Signal processing controller [1180]: Intel Corporation Xeon 
E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem 
[8086:1903] (rev 02)
00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 
3.0 xHCI Controller [8086:9d2f] (rev 21)
00:14.2 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Thermal subsystem [8086:9d31] (rev 21)
00:15.0 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Serial IO I2C Controller #0 [8086:9d60] (rev 21)
00:15.1 Signal processing controller [1180]: Intel Corporation Sunrise 
Point-LP Serial IO I2C Controller #1 [8086:9d61] (rev 21)
00:16.0 Communication controller [0780]: Intel Corporation Sunrise 
Point-LP CSME HECI #1 [8086:9d3a] (rev 21)
00:1c.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #1 [8086:9d10] (rev f1)
00:1c.4 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #5 [8086:9d14] (rev f1)
00:1c.5 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #6 [8086:9d15] (rev f1)
00:1d.0 PCI bridge [0604]: Intel Corporation Sunrise Point-LP PCI 
Express Root Port #9 [8086:9d18] (rev f1)
00:1f.0 ISA bridge [0601]: Intel Corporation Sunrise Point-LP LPC 
Controller [8086:9d58] (rev 21)
00:1f.2 Memory controller [0580]: Intel Corporation Sunrise Point-LP PMC 
[8086:9d21] (rev 21)
00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-LP HD Audio 
[8086:9d71] (rev 21)
00:1f.4 SMBus [0c05]: Intel Corporation Sunrise Point-LP SMBus 
[8086:9d23] (rev 21)
01:00.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:00.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:01.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
02:02.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 
Bridge [Alpine Ridge 2C 2015] [8086:1576]
39:00.0 USB controller [0c03]: Intel Corporation DSL6340 USB 3.1 
Controller [Alpine Ridge] [8086:15b5]
3a:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac 
Wireless Network Adapter [168c:003e] (rev 32)
3b:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A 
PCI Express Card Reader [10ec:525a] (rev 01)
3c:00.0 Non-Volatile memory controller [0108]: SK hynix PC300 NVMe Solid 
State Drive 512GB [1c5c:1284]
$ lspci -t
-[0000:00]-+-00.0
            +-02.0
            +-04.0
            +-14.0
            +-14.2
            +-15.0
            +-15.1
            +-16.0
            +-1c.0-[01-39]----00.0-[02-39]--+-00.0-[03]--
            |                               +-01.0-[04-38]--
            |                               \-02.0-[39]----00.0
            +-1c.4-[3a]----00.0
            +-1c.5-[3b]----00.0
            +-1d.0-[3c]----00.0
            +-1f.0
            +-1f.2
            +-1f.3
            \-1f.4
$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
         |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, 
Driver=r8152, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
         |__ Port 1: Dev 3, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
     |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=, 12M
     |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=, 12M
     |__ Port 4: Dev 3, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
     |__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
     |__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
```

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qulcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-19 13:40 Qulcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME Paul Menzel
  2023-11-19 13:42 ` Qualcomm " Paul Menzel
@ 2023-11-19 14:35 ` Greg KH
  1 sibling, 0 replies; 13+ messages in thread
From: Greg KH @ 2023-11-19 14:35 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede

On Sun, Nov 19, 2023 at 02:40:35PM +0100, Paul Menzel wrote:
> Dear Linux folks,
> 
> 
> On the Dell XPS 13 9360 from 2016, BIOS 2.21.0 06/02/2022, with Debian
> sid/unstable and Debian’s Linux 6.5.10 kernel, I am trying to extend the
> run-time with battery, at under 50 % of it’s original capacity, and I am
> using PowerTOP 2.15.
> 
>     [    0.000000] microcode: updated early: 0xf0 -> 0xf4, date = 2023-02-22
>     [    0.000000] Linux version 6.5.0-4-amd64
> (debian-kernel@lists.debian.org) (gcc-13 (Debian 13.2.0-6) 13.2.0, GNU ld
> (GNU Binutils for Debian) 2.41) #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1
> (2023-11-03)
>     […]
>     [    0.000000] DMI: Dell Inc. XPS 13 9360/0596KF, BIOS 2.21.0 06/02/2022
>     […]
>     [   15.646414] usbcore: registered new interface driver btusb
>     [   15.648188] ath10k_pci 0000:3a:00.0: pci irq msi oper_irq_mode 2
> irq_mode 0 reset_mode 0
>     [   15.649555] bluetooth hci0: firmware: direct-loading firmware
> qca/rampatch_usb_00000302.bin
>     [   15.650018] Bluetooth: hci0: using rampatch file:
> qca/rampatch_usb_00000302.bin
>     [   15.650020] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8,
> firmware rome 0x302 build 0x111
> 
> Although radio/wireless devices are turned off in GNOME, PowerTOP shows the
> Bluetooth device drawing 0.85 W of energy:
> 
>     848 mW    100.0%   Device         USB device: usb-device-0cf3-e300
> 
>     $ lsusb -d 0cf3:e300
>     Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4
> Bluetooth 4.0
> 
>     $ lspci -nn -s 3a:00.0
>     3a:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac
> Wireless Network Adapter [168c:003e] (rev 32)
> 
> After unloading the module `btusb`, the entry disappears from the PowerTOP
> list after a while.
> 
>     usbcore: deregistering interface driver btusb
> 
> Auto-suspend was enabled for the device. (Though it shouldn’t have mattered
> as it was disabled in GNOME?)
> 
> Anyways, have you heard of such an issue? Can I provide more information, to
> get it to not use any energy while being disable in GNOME?

USB devices still can draw power when their "wireless ability" is
disabled, that's up to the hardware to go into lower power states if it
can, or wants to.

So I recommend working with the bluetooth developers, maybe this device
can really not go any lower in power and still work properly when asked
to?  Do you know if the chipset even supports this?  If not, there's not
much the kernel can do about it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-19 13:42 ` Qualcomm " Paul Menzel
@ 2023-11-19 15:43   ` Alan Stern
  2023-11-19 22:09     ` Paul Menzel
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Stern @ 2023-11-19 15:43 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede

On Sun, Nov 19, 2023 at 02:42:58PM +0100, Paul Menzel wrote:
> [Fix typo in subject line]
> 
> Dear Linux folks,
> 
> 
> On the Dell XPS 13 9360 from 2016, BIOS 2.21.0 06/02/2022, with Debian
> sid/unstable and Debian’s Linux 6.5.10 kernel, I am trying to extend the
> run-time with battery, at under 50 % of it’s original capacity, and I am
> using PowerTOP 2.15.

> Although radio/wireless devices are turned off in GNOME, PowerTOP shows the
> Bluetooth device drawing 0.85 W of energy:
> 
>     848 mW    100.0%   Device         USB device: usb-device-0cf3-e300
> 
>     $ lsusb -d 0cf3:e300
>     Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4
> Bluetooth 4.0

> After unloading the module `btusb`, the entry disappears from the PowerTOP
> list after a while.
> 
>     usbcore: deregistering interface driver btusb
> 
> Auto-suspend was enabled for the device. (Though it shouldn’t have mattered
> as it was disabled in GNOME?)

Enabling autosuspend means that the device _may_ go into runtime suspend 
when it's not being used.  Whether it _will_ do so depends on the driver 
(btusb in this case).

> Anyways, have you heard of such an issue? Can I provide more information, to
> get it to not use any energy while being disable in GNOME?

What is the output from

	grep . /sys/bus/usb/devices/1-3/power/*

both with and without the btusb module loaded?

Alan Stern

> $ lsusb -t
> /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
>     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
>         |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=r8152,
> 5000M
> /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
>     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
>         |__ Port 1: Dev 3, If 0, Class=Human Interface Device,
> Driver=usbhid, 12M
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
>     |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=, 12M
>     |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=, 12M
>     |__ Port 4: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid,
> 12M
>     |__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
>     |__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
> ```

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-19 15:43   ` Alan Stern
@ 2023-11-19 22:09     ` Paul Menzel
  2023-11-20  2:26       ` Alan Stern
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Menzel @ 2023-11-19 22:09 UTC (permalink / raw)
  To: Alan Stern
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede

Dear Alan,


Thank you very much for your quick response.

Am 19.11.23 um 16:43 schrieb Alan Stern:
> On Sun, Nov 19, 2023 at 02:42:58PM +0100, Paul Menzel wrote:

>> On the Dell XPS 13 9360 from 2016, BIOS 2.21.0 06/02/2022, with Debian
>> sid/unstable and Debian’s Linux 6.5.10 kernel, I am trying to extend the
>> run-time with battery, at under 50 % of it’s original capacity, and I am
>> using PowerTOP 2.15.
> 
>> Although radio/wireless devices are turned off in GNOME, PowerTOP shows the
>> Bluetooth device drawing 0.85 W of energy:
>>
>>      848 mW    100.0%   Device         USB device: usb-device-0cf3-e300
>>
>>      $ lsusb -d 0cf3:e300
>>      Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4 Bluetooth 4.0
> 
>> After unloading the module `btusb`, the entry disappears from the PowerTOP
>> list after a while.
>>
>>      usbcore: deregistering interface driver btusb
>>
>> Auto-suspend was enabled for the device. (Though it shouldn’t have mattered
>> as it was disabled in GNOME?)
> 
> Enabling autosuspend means that the device _may_ go into runtime suspend
> when it's not being used.  Whether it _will_ do so depends on the driver
> (btusb in this case).

Thank you for the clarification.

>> Anyways, have you heard of such an issue? Can I provide more information, to
>> get it to not use any energy while being disable in GNOME?
> 
> What is the output from
> 
> 	grep . /sys/bus/usb/devices/1-3/power/*
> 
> both with and without the btusb module loaded?

```
$ sudo modprobe btusb
$ sudo dmesg | tail -10
[313699.136637] wlp58s0: Limiting TX power to 17 dBm as advertised by 
00:f6:63:af:fa:4f
[314037.905400] WARNING! power/level is deprecated; use power/control 
instead
[314065.418431] usbcore: registered new interface driver btusb
[314065.421509] bluetooth hci0: firmware: direct-loading firmware 
qca/rampatch_usb_00000302.bin
[314065.423852] Bluetooth: hci0: using rampatch file: 
qca/rampatch_usb_00000302.bin
[314065.423865] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, 
firmware rome 0x302 build 0x111
[314065.791131] bluetooth hci0: firmware: direct-loading firmware 
qca/nvm_usb_00000302.bin
[314065.791228] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin
[314065.823499] Bluetooth: hci0: HCI Enhanced Setup Synchronous 
Connection command is advertised, but not supported.
[314066.117644] Bluetooth: MGMT ver 1.22
$ grep . /sys/bus/usb/devices/1-3/power/*
/sys/bus/usb/devices/1-3/power/active_duration:119053224
/sys/bus/usb/devices/1-3/power/async:enabled
/sys/bus/usb/devices/1-3/power/autosuspend:2
/sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
/sys/bus/usb/devices/1-3/power/connected_duration:148065372
/sys/bus/usb/devices/1-3/power/control:auto
/sys/bus/usb/devices/1-3/power/level:auto
/sys/bus/usb/devices/1-3/power/persist:1
/sys/bus/usb/devices/1-3/power/runtime_active_kids:0
/sys/bus/usb/devices/1-3/power/runtime_active_time:119060567
/sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
/sys/bus/usb/devices/1-3/power/runtime_status:active
/sys/bus/usb/devices/1-3/power/runtime_suspended_time:28831453
/sys/bus/usb/devices/1-3/power/runtime_usage:0
/sys/bus/usb/devices/1-3/power/wakeup:disabled
```

```
$ sudo modprobe -r btusb
$ sudo dmesg | tail -1
[314106.155163] usbcore: deregistering interface driver btusb
$ grep . /sys/bus/usb/devices/1-3/power/*
/sys/bus/usb/devices/1-3/power/active_duration:119072176
/sys/bus/usb/devices/1-3/power/async:enabled
/sys/bus/usb/devices/1-3/power/autosuspend:2
/sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
/sys/bus/usb/devices/1-3/power/connected_duration:148320980
/sys/bus/usb/devices/1-3/power/control:auto
/sys/bus/usb/devices/1-3/power/level:auto
/sys/bus/usb/devices/1-3/power/persist:1
/sys/bus/usb/devices/1-3/power/runtime_active_kids:0
/sys/bus/usb/devices/1-3/power/runtime_active_time:119079518
/sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
/sys/bus/usb/devices/1-3/power/runtime_status:suspended
/sys/bus/usb/devices/1-3/power/runtime_suspended_time:29068110
/sys/bus/usb/devices/1-3/power/runtime_usage:0
/sys/bus/usb/devices/1-3/power/wakeup:disabled
```


Kind regards,

Paul


>> $ lsusb -t
>> /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
>>      |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
>>          |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
>> /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
>>      |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
>>          |__ Port 1: Dev 3, If 0, Class=Human Interface Device,
>> Driver=usbhid, 12M
>> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
>> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
>>      |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=, 12M
>>      |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=, 12M
>>      |__ Port 4: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
>>      |__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
>>      |__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
>> ```

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-19 22:09     ` Paul Menzel
@ 2023-11-20  2:26       ` Alan Stern
  2023-11-20  7:52         ` Paul Menzel
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Stern @ 2023-11-20  2:26 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede

On Sun, Nov 19, 2023 at 11:09:32PM +0100, Paul Menzel wrote:
> $ sudo modprobe btusb

> $ grep . /sys/bus/usb/devices/1-3/power/*
> /sys/bus/usb/devices/1-3/power/active_duration:119053224
> /sys/bus/usb/devices/1-3/power/async:enabled
> /sys/bus/usb/devices/1-3/power/autosuspend:2
> /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
> /sys/bus/usb/devices/1-3/power/connected_duration:148065372
> /sys/bus/usb/devices/1-3/power/control:auto
> /sys/bus/usb/devices/1-3/power/level:auto
> /sys/bus/usb/devices/1-3/power/persist:1
> /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
> /sys/bus/usb/devices/1-3/power/runtime_active_time:119060567
> /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
> /sys/bus/usb/devices/1-3/power/runtime_status:active
> /sys/bus/usb/devices/1-3/power/runtime_suspended_time:28831453
> /sys/bus/usb/devices/1-3/power/runtime_usage:0
> /sys/bus/usb/devices/1-3/power/wakeup:disabled
> ```

Hmmm.  It's not immediately clear why the device isn't being suspended.
The btusb driver does support autosuspend.

Can you also post the output from

	grep . /sys/bus/usb/devices/1-3:*/power/*

with the driver module loaded?  I should have asked for it before.

> ```
> $ sudo modprobe -r btusb
> $ sudo dmesg | tail -1
> [314106.155163] usbcore: deregistering interface driver btusb
> $ grep . /sys/bus/usb/devices/1-3/power/*
> /sys/bus/usb/devices/1-3/power/active_duration:119072176
> /sys/bus/usb/devices/1-3/power/async:enabled
> /sys/bus/usb/devices/1-3/power/autosuspend:2
> /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
> /sys/bus/usb/devices/1-3/power/connected_duration:148320980
> /sys/bus/usb/devices/1-3/power/control:auto
> /sys/bus/usb/devices/1-3/power/level:auto
> /sys/bus/usb/devices/1-3/power/persist:1
> /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
> /sys/bus/usb/devices/1-3/power/runtime_active_time:119079518
> /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
> /sys/bus/usb/devices/1-3/power/runtime_status:suspended
> /sys/bus/usb/devices/1-3/power/runtime_suspended_time:29068110
> /sys/bus/usb/devices/1-3/power/runtime_usage:0
> /sys/bus/usb/devices/1-3/power/wakeup:disabled
> ```

Okay, and here we see that without the driver, the device does get 
suspended.

Alan Stern

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-20  2:26       ` Alan Stern
@ 2023-11-20  7:52         ` Paul Menzel
  2023-11-20 18:10           ` Alan Stern
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Menzel @ 2023-11-20  7:52 UTC (permalink / raw)
  To: Alan Stern
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones

Dear Alan,


Than you again for your quick reply.

Am 20.11.23 um 03:26 schrieb Alan Stern:
> On Sun, Nov 19, 2023 at 11:09:32PM +0100, Paul Menzel wrote:
>> $ sudo modprobe btusb
> 
>> $ grep . /sys/bus/usb/devices/1-3/power/*
>> /sys/bus/usb/devices/1-3/power/active_duration:119053224
>> /sys/bus/usb/devices/1-3/power/async:enabled
>> /sys/bus/usb/devices/1-3/power/autosuspend:2
>> /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
>> /sys/bus/usb/devices/1-3/power/connected_duration:148065372
>> /sys/bus/usb/devices/1-3/power/control:auto
>> /sys/bus/usb/devices/1-3/power/level:auto
>> /sys/bus/usb/devices/1-3/power/persist:1
>> /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
>> /sys/bus/usb/devices/1-3/power/runtime_active_time:119060567
>> /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
>> /sys/bus/usb/devices/1-3/power/runtime_status:active
>> /sys/bus/usb/devices/1-3/power/runtime_suspended_time:28831453
>> /sys/bus/usb/devices/1-3/power/runtime_usage:0
>> /sys/bus/usb/devices/1-3/power/wakeup:disabled
>> ```
> 
> Hmmm.  It's not immediately clear why the device isn't being suspended.
> The btusb driver does support autosuspend.
> 
> Can you also post the output from
> 
> 	grep . /sys/bus/usb/devices/1-3:*/power/*
> 
> with the driver module loaded?  I should have asked for it before.

```
$ sudo modprobe btusb
$ sudo dmesg | tail -9
[319747.390712] r8152 4-1.2:1.0 enx18dbf22dccf3: carrier on
[320256.946094] bluetooth hci0: firmware: direct-loading firmware 
qca/rampatch_usb_00000302.bin
[320256.949333] Bluetooth: hci0: using rampatch file: 
qca/rampatch_usb_00000302.bin
[320256.949349] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, 
firmware rome 0x302 build 0x111
[320256.949643] usbcore: registered new interface driver btusb
[320257.308935] bluetooth hci0: firmware: direct-loading firmware 
qca/nvm_usb_00000302.bin
[320257.309043] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin
[320257.336220] Bluetooth: hci0: HCI Enhanced Setup Synchronous 
Connection command is advertised, but not supported.
[320257.638188] Bluetooth: MGMT ver 1.22
$ /sbin/rfkill
ID TYPE      DEVICE    SOFT      HARD
  1 wlan      phy0   blocked unblocked
28 bluetooth hci0   blocked unblocked
$ grep . /sys/bus/usb/devices/1-3:*/power/*
/sys/bus/usb/devices/1-3:1.0/power/async:enabled
/sys/bus/usb/devices/1-3:1.0/power/runtime_active_kids:0
/sys/bus/usb/devices/1-3:1.0/power/runtime_enabled:enabled
/sys/bus/usb/devices/1-3:1.0/power/runtime_status:suspended
/sys/bus/usb/devices/1-3:1.0/power/runtime_usage:0
/sys/bus/usb/devices/1-3:1.1/power/async:enabled
/sys/bus/usb/devices/1-3:1.1/power/runtime_active_kids:0
/sys/bus/usb/devices/1-3:1.1/power/runtime_enabled:enabled
/sys/bus/usb/devices/1-3:1.1/power/runtime_status:suspended
/sys/bus/usb/devices/1-3:1.1/power/runtime_usage:0
```

For completeness:

```
$ grep . /sys/bus/usb/devices/1-3/power/*
/sys/bus/usb/devices/1-3/power/active_duration:120462288
/sys/bus/usb/devices/1-3/power/async:enabled
/sys/bus/usb/devices/1-3/power/autosuspend:2
/sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
/sys/bus/usb/devices/1-3/power/connected_duration:155617216
/sys/bus/usb/devices/1-3/power/control:auto
/sys/bus/usb/devices/1-3/power/level:auto
/sys/bus/usb/devices/1-3/power/persist:1
/sys/bus/usb/devices/1-3/power/runtime_active_kids:0
/sys/bus/usb/devices/1-3/power/runtime_active_time:120468920
/sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
/sys/bus/usb/devices/1-3/power/runtime_status:active
/sys/bus/usb/devices/1-3/power/runtime_suspended_time:34969407
/sys/bus/usb/devices/1-3/power/runtime_usage:0
/sys/bus/usb/devices/1-3/power/wakeup:disabled
```

>> ```
>> $ sudo modprobe -r btusb
>> $ sudo dmesg | tail -1
>> [314106.155163] usbcore: deregistering interface driver btusb
>> $ grep . /sys/bus/usb/devices/1-3/power/*
>> /sys/bus/usb/devices/1-3/power/active_duration:119072176
>> /sys/bus/usb/devices/1-3/power/async:enabled
>> /sys/bus/usb/devices/1-3/power/autosuspend:2
>> /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
>> /sys/bus/usb/devices/1-3/power/connected_duration:148320980
>> /sys/bus/usb/devices/1-3/power/control:auto
>> /sys/bus/usb/devices/1-3/power/level:auto
>> /sys/bus/usb/devices/1-3/power/persist:1
>> /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
>> /sys/bus/usb/devices/1-3/power/runtime_active_time:119079518
>> /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
>> /sys/bus/usb/devices/1-3/power/runtime_status:suspended
>> /sys/bus/usb/devices/1-3/power/runtime_suspended_time:29068110
>> /sys/bus/usb/devices/1-3/power/runtime_usage:0
>> /sys/bus/usb/devices/1-3/power/wakeup:disabled
>> ```
> 
> Okay, and here we see that without the driver, the device does get
> suspended.

Indeed. Thank you for pointing at `runtime_status:suspended` compared to 
`runtime_status:active`.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-20  7:52         ` Paul Menzel
@ 2023-11-20 18:10           ` Alan Stern
  2023-11-20 22:05             ` Paul Menzel
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Stern @ 2023-11-20 18:10 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones

On Mon, Nov 20, 2023 at 08:52:19AM +0100, Paul Menzel wrote:
> Dear Alan,
> 
> 
> Than you again for your quick reply.
> 
> Am 20.11.23 um 03:26 schrieb Alan Stern:
> > On Sun, Nov 19, 2023 at 11:09:32PM +0100, Paul Menzel wrote:
> > > $ sudo modprobe btusb
> > 
> > > $ grep . /sys/bus/usb/devices/1-3/power/*
> > > /sys/bus/usb/devices/1-3/power/active_duration:119053224
> > > /sys/bus/usb/devices/1-3/power/async:enabled
> > > /sys/bus/usb/devices/1-3/power/autosuspend:2
> > > /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
> > > /sys/bus/usb/devices/1-3/power/connected_duration:148065372
> > > /sys/bus/usb/devices/1-3/power/control:auto
> > > /sys/bus/usb/devices/1-3/power/level:auto
> > > /sys/bus/usb/devices/1-3/power/persist:1
> > > /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
> > > /sys/bus/usb/devices/1-3/power/runtime_active_time:119060567
> > > /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
> > > /sys/bus/usb/devices/1-3/power/runtime_status:active
> > > /sys/bus/usb/devices/1-3/power/runtime_suspended_time:28831453
> > > /sys/bus/usb/devices/1-3/power/runtime_usage:0
> > > /sys/bus/usb/devices/1-3/power/wakeup:disabled
> > > ```
> > 
> > Hmmm.  It's not immediately clear why the device isn't being suspended.
> > The btusb driver does support autosuspend.
> > 
> > Can you also post the output from
> > 
> > 	grep . /sys/bus/usb/devices/1-3:*/power/*
> > 
> > with the driver module loaded?  I should have asked for it before.
> 
> ```
> $ sudo modprobe btusb
> $ sudo dmesg | tail -9
> [319747.390712] r8152 4-1.2:1.0 enx18dbf22dccf3: carrier on
> [320256.946094] bluetooth hci0: firmware: direct-loading firmware
> qca/rampatch_usb_00000302.bin
> [320256.949333] Bluetooth: hci0: using rampatch file:
> qca/rampatch_usb_00000302.bin
> [320256.949349] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, firmware
> rome 0x302 build 0x111
> [320256.949643] usbcore: registered new interface driver btusb
> [320257.308935] bluetooth hci0: firmware: direct-loading firmware
> qca/nvm_usb_00000302.bin
> [320257.309043] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin
> [320257.336220] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection
> command is advertised, but not supported.
> [320257.638188] Bluetooth: MGMT ver 1.22
> $ /sbin/rfkill
> ID TYPE      DEVICE    SOFT      HARD
>  1 wlan      phy0   blocked unblocked
> 28 bluetooth hci0   blocked unblocked
> $ grep . /sys/bus/usb/devices/1-3:*/power/*
> /sys/bus/usb/devices/1-3:1.0/power/async:enabled
> /sys/bus/usb/devices/1-3:1.0/power/runtime_active_kids:0
> /sys/bus/usb/devices/1-3:1.0/power/runtime_enabled:enabled
> /sys/bus/usb/devices/1-3:1.0/power/runtime_status:suspended
> /sys/bus/usb/devices/1-3:1.0/power/runtime_usage:0
> /sys/bus/usb/devices/1-3:1.1/power/async:enabled
> /sys/bus/usb/devices/1-3:1.1/power/runtime_active_kids:0
> /sys/bus/usb/devices/1-3:1.1/power/runtime_enabled:enabled
> /sys/bus/usb/devices/1-3:1.1/power/runtime_status:suspended
> /sys/bus/usb/devices/1-3:1.1/power/runtime_usage:0
> ```

Again, nothing out of the ordinary.  Maybe dynamic debugging will give 
us a clue.  Try doing this:

	Unload the btusb module.

	echo module usbcore +p >/sys/kernel/debug/dynamic_debug/control

	Load the btusb module

	Make sure that Bluetooth is turned off in Gnome

	Wait a few seconds

	echo module usbcore -p >/sys/kernel/debug/dynamic_debug/control

Then let's see what the dmesg log contains for that time period.

Also, please post the output from "lsusb -v" for the Bluetooth device.

Alan Stern

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-20 18:10           ` Alan Stern
@ 2023-11-20 22:05             ` Paul Menzel
  2023-11-21 16:23               ` Alan Stern
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Menzel @ 2023-11-20 22:05 UTC (permalink / raw)
  To: Alan Stern
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones, Rocky Liao

[Cc: +Rocky Liao as Qualcomm developer]

Dear Alan,


Thank you so much for continuous support in debugging this issue.

Am 20.11.23 um 19:10 schrieb Alan Stern:
> On Mon, Nov 20, 2023 at 08:52:19AM +0100, Paul Menzel wrote:

>> Am 20.11.23 um 03:26 schrieb Alan Stern:
>>> On Sun, Nov 19, 2023 at 11:09:32PM +0100, Paul Menzel wrote:
>>>> $ sudo modprobe btusb
>>>
>>>> $ grep . /sys/bus/usb/devices/1-3/power/*
>>>> /sys/bus/usb/devices/1-3/power/active_duration:119053224
>>>> /sys/bus/usb/devices/1-3/power/async:enabled
>>>> /sys/bus/usb/devices/1-3/power/autosuspend:2
>>>> /sys/bus/usb/devices/1-3/power/autosuspend_delay_ms:2000
>>>> /sys/bus/usb/devices/1-3/power/connected_duration:148065372
>>>> /sys/bus/usb/devices/1-3/power/control:auto
>>>> /sys/bus/usb/devices/1-3/power/level:auto
>>>> /sys/bus/usb/devices/1-3/power/persist:1
>>>> /sys/bus/usb/devices/1-3/power/runtime_active_kids:0
>>>> /sys/bus/usb/devices/1-3/power/runtime_active_time:119060567
>>>> /sys/bus/usb/devices/1-3/power/runtime_enabled:enabled
>>>> /sys/bus/usb/devices/1-3/power/runtime_status:active
>>>> /sys/bus/usb/devices/1-3/power/runtime_suspended_time:28831453
>>>> /sys/bus/usb/devices/1-3/power/runtime_usage:0
>>>> /sys/bus/usb/devices/1-3/power/wakeup:disabled
>>>> ```
>>>
>>> Hmmm.  It's not immediately clear why the device isn't being suspended.
>>> The btusb driver does support autosuspend.
>>>
>>> Can you also post the output from
>>>
>>> 	grep . /sys/bus/usb/devices/1-3:*/power/*
>>>
>>> with the driver module loaded?  I should have asked for it before.
>>
>> ```
>> $ sudo modprobe btusb
>> $ sudo dmesg | tail -9
>> [319747.390712] r8152 4-1.2:1.0 enx18dbf22dccf3: carrier on
>> [320256.946094] bluetooth hci0: firmware: direct-loading firmware qca/rampatch_usb_00000302.bin
>> [320256.949333] Bluetooth: hci0: using rampatch file: qca/rampatch_usb_00000302.bin
>> [320256.949349] Bluetooth: hci0: QCA: patch rome 0x302 build 0x3e8, firmware rome 0x302 build 0x111
>> [320256.949643] usbcore: registered new interface driver btusb
>> [320257.308935] bluetooth hci0: firmware: direct-loading firmware qca/nvm_usb_00000302.bin
>> [320257.309043] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin
>> [320257.336220] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
>> [320257.638188] Bluetooth: MGMT ver 1.22
>> $ /sbin/rfkill
>> ID TYPE      DEVICE    SOFT      HARD
>>   1 wlan      phy0   blocked unblocked
>>  28 bluetooth hci0   blocked unblocked
>> $ grep . /sys/bus/usb/devices/1-3:*/power/*
>> /sys/bus/usb/devices/1-3:1.0/power/async:enabled
>> /sys/bus/usb/devices/1-3:1.0/power/runtime_active_kids:0
>> /sys/bus/usb/devices/1-3:1.0/power/runtime_enabled:enabled
>> /sys/bus/usb/devices/1-3:1.0/power/runtime_status:suspended
>> /sys/bus/usb/devices/1-3:1.0/power/runtime_usage:0
>> /sys/bus/usb/devices/1-3:1.1/power/async:enabled
>> /sys/bus/usb/devices/1-3:1.1/power/runtime_active_kids:0
>> /sys/bus/usb/devices/1-3:1.1/power/runtime_enabled:enabled
>> /sys/bus/usb/devices/1-3:1.1/power/runtime_status:suspended
>> /sys/bus/usb/devices/1-3:1.1/power/runtime_usage:0
>> ```
> 
> Again, nothing out of the ordinary.  Maybe dynamic debugging will give
> us a clue.  Try doing this:
> 
> 	Unload the btusb module.
> 
> 	echo module usbcore +p >/sys/kernel/debug/dynamic_debug/control
> 
> 	Load the btusb module
> 
> 	Make sure that Bluetooth is turned off in Gnome
> 
> 	Wait a few seconds
> 
> 	echo module usbcore -p >/sys/kernel/debug/dynamic_debug/control
> 
> Then let's see what the dmesg log contains for that time period.


```
$ sudo modprobe -r btusb
$ sudo dmesg | tail -1
[340309.272439] usbcore: deregistering interface driver btusb
$ echo module usbcore +p | sudo tee /sys/kernel/debug/dynamic_debug/control
module usbcore +p
$ sudo modprobe btusb
$ /sbin/rfkill
ID TYPE      DEVICE      SOFT      HARD
  1 wlan      phy0   unblocked unblocked
36 bluetooth hci0     blocked unblocked
$ echo module usbcore -p | sudo tee /sys/kernel/debug/dynamic_debug/control
module usbcore -p
$ sudo modprobe -r btusb
$ sudo dmesg | tail -1
[340608.761313] usbcore: deregistering interface driver btusb
$ sudo dmesg
[…]
[340309.272439] usbcore: deregistering interface driver btusb
[340560.326182] xhci_hcd 0000:00:14.0: hcd_pci_runtime_resume: 0
[340560.326214] usb usb1: usb auto-resume
[340560.326258] hub 1-0:1.0: hub_resume
[340560.326381] usb usb1-port3: status 0107 change 0000
[340560.326418] usb usb1-port4: status 0107 change 0000
[340560.326451] usb usb1-port5: status 0507 change 0000
[340560.326650] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
[340560.326807] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
[340560.373988] usb 1-3: usb auto-resume
[340560.373998] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0008
[340560.441936] usb 1-3: Waited 0ms for CONNECT
[340560.441957] usb 1-3: finish reset-resume
[340560.570940] usb 1-3: reset full-speed USB device number 2 using xhci_hcd
[340560.721096] btusb 1-3:1.0: usb_probe_interface
[340560.721126] btusb 1-3:1.0: usb_probe_interface - got id
[340560.723193] Bluetooth: hci0: HCI Enhanced Setup Synchronous 
Connection command is advertised, but not supported.
[340560.728684] usbcore: registered new interface driver btusb
[340560.902021] Bluetooth: MGMT ver 1.22
[340608.761313] usbcore: deregistering interface driver btusb
```

So, unfortunately, nothing seems to be logged in the 48 seconds.

> Also, please post the output from "lsusb -v" for the Bluetooth device.

```
$ sudo lsusb -d 0cf3:e300 -v

Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4 
Bluetooth 4.0
Device Descriptor:
   bLength                18
   bDescriptorType         1
   bcdUSB               2.01
   bDeviceClass          224 Wireless
   bDeviceSubClass         1 Radio Frequency
   bDeviceProtocol         1 Bluetooth
   bMaxPacketSize0        64
   idVendor           0x0cf3 Qualcomm Atheros Communications
   idProduct          0xe300 QCA61x4 Bluetooth 4.0
   bcdDevice            0.01
   iManufacturer           0
   iProduct                0
   iSerial                 0
   bNumConfigurations      1
   Configuration Descriptor:
     bLength                 9
     bDescriptorType         2
     wTotalLength       0x00b1
     bNumInterfaces          2
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xe0
       Self Powered
       Remote Wakeup
     MaxPower              100mA
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           3
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0010  1x 16 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0040  1x 64 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x02  EP 2 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0040  1x 64 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       0
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0000  1x 0 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0000  1x 0 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       1
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0009  1x 9 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0009  1x 9 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       2
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0011  1x 17 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0011  1x 17 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       3
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0019  1x 25 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0019  1x 25 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       4
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0021  1x 33 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0021  1x 33 bytes
         bInterval               1
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        1
       bAlternateSetting       5
       bNumEndpoints           2
       bInterfaceClass       224 Wireless
       bInterfaceSubClass      1 Radio Frequency
       bInterfaceProtocol      1 Bluetooth
       iInterface              0
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0031  1x 49 bytes
         bInterval               1
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            1
           Transfer Type            Isochronous
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0031  1x 49 bytes
         bInterval               1
Binary Object Store Descriptor:
   bLength                 5
   bDescriptorType        15
   wTotalLength       0x000c
   bNumDeviceCaps          1
   USB 2.0 Extension Device Capability:
     bLength                 7
     bDescriptorType        16
     bDevCapabilityType      2
     bmAttributes   0x00000002
       HIRD Link Power Management (LPM) Supported
Device Status:     0x0001
   Self Powered
```






Kind regards,

Paul


PS: Somewhere, I saw somebody post the output of `usb-devices` from 
usb-utils. So for the record:

```
$ usb-devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh=12
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=06.05
S:  Manufacturer=Linux 6.5.0-4-amd64 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:00:14.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0cf3 ProdID=e300 Rev=00.01
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms

T:  Bus=01 Lev=01 Prnt=02 Port=03 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=04f3 ProdID=2234 Rev=11.11
S:  Manufacturer=ELAN
S:  Product=Touchscreen
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl=2ms
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms

T:  Bus=01 Lev=01 Prnt=03 Port=04 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0c45 ProdID=670c Rev=56.26
S:  Manufacturer=CN09GTFMLOG008C8B7FWA01
S:  Product=Integrated_Webcam_HD
C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo
E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=4ms
I:  If#= 1 Alt= 0 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 6
D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev=06.05
S:  Manufacturer=Linux 6.5.0-4-amd64 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:00:14.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
```

PPS: Looking through the commit log/history for 
`drivers/bluetooth/btusb.c`, I found commit 7ecacafc2406 (Bluetooth: 
btusb: Disable runtime suspend on Realtek devices) [1] authored on 
December 5th, 2019. This is for Realtek devices though, and not Qualcomm.

[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7ecacafc240638148567742cca41aa7144b4fe1e

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-20 22:05             ` Paul Menzel
@ 2023-11-21 16:23               ` Alan Stern
  2023-11-21 17:12                 ` Paul Menzel
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Stern @ 2023-11-21 16:23 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones, Rocky Liao

On Mon, Nov 20, 2023 at 11:05:04PM +0100, Paul Menzel wrote:
> [Cc: +Rocky Liao as Qualcomm developer]

> Am 20.11.23 um 19:10 schrieb Alan Stern:
> > Again, nothing out of the ordinary.  Maybe dynamic debugging will give
> > us a clue.  Try doing this:
> > 
> > 	Unload the btusb module.
> > 
> > 	echo module usbcore +p >/sys/kernel/debug/dynamic_debug/control
> > 
> > 	Load the btusb module
> > 
> > 	Make sure that Bluetooth is turned off in Gnome
> > 
> > 	Wait a few seconds
> > 
> > 	echo module usbcore -p >/sys/kernel/debug/dynamic_debug/control
> > 
> > Then let's see what the dmesg log contains for that time period.
> 
> 
> ```
> $ sudo modprobe -r btusb
> $ sudo dmesg | tail -1
> [340309.272439] usbcore: deregistering interface driver btusb
> $ echo module usbcore +p | sudo tee /sys/kernel/debug/dynamic_debug/control
> module usbcore +p
> $ sudo modprobe btusb
> $ /sbin/rfkill
> ID TYPE      DEVICE      SOFT      HARD
>  1 wlan      phy0   unblocked unblocked
> 36 bluetooth hci0     blocked unblocked
> $ echo module usbcore -p | sudo tee /sys/kernel/debug/dynamic_debug/control
> module usbcore -p
> $ sudo modprobe -r btusb
> $ sudo dmesg | tail -1
> [340608.761313] usbcore: deregistering interface driver btusb
> $ sudo dmesg
> […]
> [340309.272439] usbcore: deregistering interface driver btusb
> [340560.326182] xhci_hcd 0000:00:14.0: hcd_pci_runtime_resume: 0
> [340560.326214] usb usb1: usb auto-resume
> [340560.326258] hub 1-0:1.0: hub_resume
> [340560.326381] usb usb1-port3: status 0107 change 0000
> [340560.326418] usb usb1-port4: status 0107 change 0000
> [340560.326451] usb usb1-port5: status 0507 change 0000
> [340560.326650] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
> [340560.326807] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
> [340560.373988] usb 1-3: usb auto-resume
> [340560.373998] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0008
> [340560.441936] usb 1-3: Waited 0ms for CONNECT
> [340560.441957] usb 1-3: finish reset-resume
> [340560.570940] usb 1-3: reset full-speed USB device number 2 using xhci_hcd

Those two lines are unexpected.  Why does the device need to be reset?
While the btusb module is loaded, does anything show up in
/sys/bus/usb/devices/1-3/quirks?

> > Also, please post the output from "lsusb -v" for the Bluetooth device.
> 
> ```
> $ sudo lsusb -d 0cf3:e300 -v
> 
> Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4
> Bluetooth 4.0
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.01
>   bDeviceClass          224 Wireless
>   bDeviceSubClass         1 Radio Frequency
>   bDeviceProtocol         1 Bluetooth
>   bMaxPacketSize0        64
>   idVendor           0x0cf3 Qualcomm Atheros Communications
>   idProduct          0xe300 QCA61x4 Bluetooth 4.0
>   bcdDevice            0.01
>   iManufacturer           0
>   iProduct                0
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength       0x00b1
>     bNumInterfaces          2
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xe0
>       Self Powered
>       Remote Wakeup

That's what I was interested in.  The device does support remote wakeup.

> PPS: Looking through the commit log/history for `drivers/bluetooth/btusb.c`,
> I found commit 7ecacafc2406 (Bluetooth: btusb: Disable runtime suspend on
> Realtek devices) [1] authored on December 5th, 2019. This is for Realtek
> devices though, and not Qualcomm.

Furthermore the driver has changed considerably since 2019.  See
commits 8274db0776d1, 895915226a59, 7bd9fb058d77, and 34ec58b9fd1c.

Alan Stern

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-21 16:23               ` Alan Stern
@ 2023-11-21 17:12                 ` Paul Menzel
  2023-11-21 17:40                   ` Alan Stern
  0 siblings, 1 reply; 13+ messages in thread
From: Paul Menzel @ 2023-11-21 17:12 UTC (permalink / raw)
  To: Alan Stern
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones, Rocky Liao

Dear Alan,


Thank you for your reply.

Am 21.11.23 um 17:23 schrieb Alan Stern:
> On Mon, Nov 20, 2023 at 11:05:04PM +0100, Paul Menzel wrote:
>> [Cc: +Rocky Liao as Qualcomm developer]
> 
>> Am 20.11.23 um 19:10 schrieb Alan Stern:
>>> Again, nothing out of the ordinary.  Maybe dynamic debugging will give
>>> us a clue.  Try doing this:
>>>
>>> 	Unload the btusb module.
>>>
>>> 	echo module usbcore +p >/sys/kernel/debug/dynamic_debug/control
>>>
>>> 	Load the btusb module
>>>
>>> 	Make sure that Bluetooth is turned off in Gnome
>>>
>>> 	Wait a few seconds
>>>
>>> 	echo module usbcore -p >/sys/kernel/debug/dynamic_debug/control
>>>
>>> Then let's see what the dmesg log contains for that time period.
>>
>> ```
>> $ sudo modprobe -r btusb
>> $ sudo dmesg | tail -1
>> [340309.272439] usbcore: deregistering interface driver btusb
>> $ echo module usbcore +p | sudo tee /sys/kernel/debug/dynamic_debug/control
>> module usbcore +p
>> $ sudo modprobe btusb
>> $ /sbin/rfkill
>> ID TYPE      DEVICE      SOFT      HARD
>>   1 wlan      phy0   unblocked unblocked
>> 36 bluetooth hci0     blocked unblocked
>> $ echo module usbcore -p | sudo tee /sys/kernel/debug/dynamic_debug/control
>> module usbcore -p
>> $ sudo modprobe -r btusb
>> $ sudo dmesg | tail -1
>> [340608.761313] usbcore: deregistering interface driver btusb
>> $ sudo dmesg
>> […]
>> [340309.272439] usbcore: deregistering interface driver btusb
>> [340560.326182] xhci_hcd 0000:00:14.0: hcd_pci_runtime_resume: 0
>> [340560.326214] usb usb1: usb auto-resume
>> [340560.326258] hub 1-0:1.0: hub_resume
>> [340560.326381] usb usb1-port3: status 0107 change 0000
>> [340560.326418] usb usb1-port4: status 0107 change 0000
>> [340560.326451] usb usb1-port5: status 0507 change 0000
>> [340560.326650] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
>> [340560.326807] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0000
>> [340560.373988] usb 1-3: usb auto-resume
>> [340560.373998] hub 1-0:1.0: state 7 ports 12 chg 0000 evt 0008
>> [340560.441936] usb 1-3: Waited 0ms for CONNECT
>> [340560.441957] usb 1-3: finish reset-resume
>> [340560.570940] usb 1-3: reset full-speed USB device number 2 using xhci_hcd
> 
> Those two lines are unexpected.  Why does the device need to be reset?
> While the btusb module is loaded, does anything show up in
> /sys/bus/usb/devices/1-3/quirks?

     $ more /sys/bus/usb/devices/1-3/quirks
     0x2

>>> Also, please post the output from "lsusb -v" for the Bluetooth device.
>>
>> ```
>> $ sudo lsusb -d 0cf3:e300 -v
>>
>> Bus 001 Device 002: ID 0cf3:e300 Qualcomm Atheros Communications QCA61x4
>> Bluetooth 4.0
>> Device Descriptor:
>>    bLength                18
>>    bDescriptorType         1
>>    bcdUSB               2.01
>>    bDeviceClass          224 Wireless
>>    bDeviceSubClass         1 Radio Frequency
>>    bDeviceProtocol         1 Bluetooth
>>    bMaxPacketSize0        64
>>    idVendor           0x0cf3 Qualcomm Atheros Communications
>>    idProduct          0xe300 QCA61x4 Bluetooth 4.0
>>    bcdDevice            0.01
>>    iManufacturer           0
>>    iProduct                0
>>    iSerial                 0
>>    bNumConfigurations      1
>>    Configuration Descriptor:
>>      bLength                 9
>>      bDescriptorType         2
>>      wTotalLength       0x00b1
>>      bNumInterfaces          2
>>      bConfigurationValue     1
>>      iConfiguration          0
>>      bmAttributes         0xe0
>>        Self Powered
>>        Remote Wakeup
> 
> That's what I was interested in.  The device does support remote wakeup.

That would make sense so it can be resumed? (It does not necessarily 
mean something like Wake-On-LAN, right?

Also, for this device it’s disabled?

     $ grep . /sys/bus/usb/devices/1-3/power/wakeup
     disabled

>> PPS: Looking through the commit log/history for `drivers/bluetooth/btusb.c`,
>> I found commit 7ecacafc2406 (Bluetooth: btusb: Disable runtime suspend on
>> Realtek devices) [1] authored on December 5th, 2019. This is for Realtek
>> devices though, and not Qualcomm.
> 
> Furthermore the driver has changed considerably since 2019.  See
> commits 8274db0776d1, 895915226a59, 7bd9fb058d77, and 34ec58b9fd1c.

Thank you for the references.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-21 17:12                 ` Paul Menzel
@ 2023-11-21 17:40                   ` Alan Stern
  2023-11-21 20:02                     ` Paul Menzel
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Stern @ 2023-11-21 17:40 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm,
	Hans de Goede, Mike Jones, Rocky Liao

On Tue, Nov 21, 2023 at 06:12:30PM +0100, Paul Menzel wrote:
> Dear Alan,
> 
> 
> Thank you for your reply.
> 
> Am 21.11.23 um 17:23 schrieb Alan Stern:
> > > [340560.441957] usb 1-3: finish reset-resume
> > > [340560.570940] usb 1-3: reset full-speed USB device number 2 using xhci_hcd
> > 
> > Those two lines are unexpected.  Why does the device need to be reset?
> > While the btusb module is loaded, does anything show up in
> > /sys/bus/usb/devices/1-3/quirks?
> 
>     $ more /sys/bus/usb/devices/1-3/quirks
>     0x2

Ah.  0x2 is the RESET_RESUME quirk bit.  The fact that it is on explains 
why the device gets reset when it is resumed.

It also explains why the device isn't getting suspended.  The USB core 
will not autosuspend a device that has the RESET_RESUME quirk if its 
driver wants remote-wakeup or does not support reset-resume.  The btusb 
driver is like that.

Apparently the RESET_RESUME quirk bit is set by the btusb driver itself 
(see the btusb_check_needs_reset_resume() routine in btusb.c), based on 
the computing platform rather than on the Bluetooth device.  The 
btusb_needs_reset_resume_table[] contains three entries: Dell OptiPlex 
3060, Dell XPS 9360, and Dell Inspiron 5565.

Since your system is an XPS 9360, it has this problem with suspending 
the onboard Bluetooth device.  The only way the kernel can deal with it 
is to avoid putting the device into runtime suspend while the driver 
module is loaded.

So there's your answer.  If you rebuild the btusb driver after removing 
the XPS 9360 entry from btusb_needs_reset_resume_table[], you should 
find that the device does get runtime suspended.  (But then it might not 
operate properly if you try to turn it on again after it has been 
suspended.)

> > >      bmAttributes         0xe0
> > >        Self Powered
> > >        Remote Wakeup
> >
> > That's what I was interested in.  The device does support remote wakeup.
>
> That would make sense so it can be resumed? (It does not necessarily mean
> something like Wake-On-LAN, right?

It _does_ mean something like Wake-On-LAN: The device is capable of 
asking the system to wake it up under some conditions while it or the 
system is suspended.

> Also, for this device it’s disabled?
> 
>     $ grep . /sys/bus/usb/devices/1-3/power/wakeup
>     disabled

Yes.  You can change that setting by writing "enabled" to the sysfs 
file.  But I don't think this will make any difference to your runtime 
suspend problem; the power/wakeup setting affects only system suspend, 
not runtime suspend.

Alan Stern

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Qualcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME
  2023-11-21 17:40                   ` Alan Stern
@ 2023-11-21 20:02                     ` Paul Menzel
  0 siblings, 0 replies; 13+ messages in thread
From: Paul Menzel @ 2023-11-21 20:02 UTC (permalink / raw)
  To: Alan Stern, Hans de Goede
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, linux-usb, linux-pm, Mike Jones,
	Rocky Liao

Dear Alan, dear Hans,


Am 21.11.23 um 18:40 schrieb Alan Stern:
> On Tue, Nov 21, 2023 at 06:12:30PM +0100, Paul Menzel wrote:

>> Am 21.11.23 um 17:23 schrieb Alan Stern:
>>>> [340560.441957] usb 1-3: finish reset-resume
>>>> [340560.570940] usb 1-3: reset full-speed USB device number 2 using xhci_hcd
>>>
>>> Those two lines are unexpected.  Why does the device need to be reset?
>>> While the btusb module is loaded, does anything show up in
>>> /sys/bus/usb/devices/1-3/quirks?
>>
>>      $ more /sys/bus/usb/devices/1-3/quirks
>>      0x2
> 
> Ah.  0x2 is the RESET_RESUME quirk bit.  The fact that it is on explains
> why the device gets reset when it is resumed.
> 
> It also explains why the device isn't getting suspended.  The USB core
> will not autosuspend a device that has the RESET_RESUME quirk if its
> driver wants remote-wakeup or does not support reset-resume.  The btusb
> driver is like that.
> 
> Apparently the RESET_RESUME quirk bit is set by the btusb driver itself
> (see the btusb_check_needs_reset_resume() routine in btusb.c), based on
> the computing platform rather than on the Bluetooth device.  The
> btusb_needs_reset_resume_table[] contains three entries: Dell OptiPlex
> 3060, Dell XPS 9360, and Dell Inspiron 5565.
> 
> Since your system is an XPS 9360, it has this problem with suspending
> the onboard Bluetooth device.  The only way the kernel can deal with it
> is to avoid putting the device into runtime suspend while the driver
> module is loaded.
> 
> So there's your answer.  If you rebuild the btusb driver after removing
> the XPS 9360 entry from btusb_needs_reset_resume_table[], you should
> find that the device does get runtime suspended.  (But then it might not
> operate properly if you try to turn it on again after it has been
> suspended.)

Thank you for finding this. This is commit 596b07a9a226 (Bluetooth: 
btusb: Add Dell XPS 13 9360 to btusb_needs_reset_resume_table) from 
April 2018 [1]. Hans, was it ever confirmed to be a platform limitation? 
Does the Microsoft Windows driver do the same? Did the Dell engineers 
verify it with the schematics? I was unable to see this in the bug 
report [2].

Also, it would be nice, if Linux logged, if quirks are applied that 
affect power usage.

As Alan wrote, that I’d need to rebuild the module to deactivate the 
behavior, there is no switch to override the quirk table, right?

>>>>       bmAttributes         0xe0
>>>>         Self Powered
>>>>         Remote Wakeup
>>>
>>> That's what I was interested in.  The device does support remote wakeup.
>>
>> That would make sense so it can be resumed? (It does not necessarily mean
>> something like Wake-On-LAN, right?
> 
> It _does_ mean something like Wake-On-LAN: The device is capable of
> asking the system to wake it up under some conditions while it or the
> system is suspended.
> 
>> Also, for this device it’s disabled?
>>
>>      $ grep . /sys/bus/usb/devices/1-3/power/wakeup
>>      disabled
> 
> Yes.  You can change that setting by writing "enabled" to the sysfs
> file.  But I don't think this will make any difference to your runtime
> suspend problem; the power/wakeup setting affects only system suspend,
> not runtime suspend.

Thank you again for the clarification.


Kind regards,

Paul


[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=596b07a9a22656493726edf1739569102bd3e136
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1514836

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-11-21 20:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-19 13:40 Qulcomm Atheros QCA61x4 keeps drawing 0.85 W despite Bluetooth being disable in GNOME Paul Menzel
2023-11-19 13:42 ` Qualcomm " Paul Menzel
2023-11-19 15:43   ` Alan Stern
2023-11-19 22:09     ` Paul Menzel
2023-11-20  2:26       ` Alan Stern
2023-11-20  7:52         ` Paul Menzel
2023-11-20 18:10           ` Alan Stern
2023-11-20 22:05             ` Paul Menzel
2023-11-21 16:23               ` Alan Stern
2023-11-21 17:12                 ` Paul Menzel
2023-11-21 17:40                   ` Alan Stern
2023-11-21 20:02                     ` Paul Menzel
2023-11-19 14:35 ` Qulcomm " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).