Re: [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version

From: Leif Liddy
Date: Thu Mar 08 2018 - 19:56:36 EST


Sorry for being a bit slow to respond to this.

I'm the original author of commit:
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/drivers/bluetooth/btusb.c?id=fd865802c66bc451dc515ed89360f84376ce1a56

> Says: "There's been numerous reported instances where BTUSB_QCA_ROME
> bluetooth controllers stop functioning upon resume from suspend."

> So it may be platform specific but it is not just limited to 1 or
>2 platforms I think.

This issue might very well be limited to just a few platforms.
Here's a link to the original bug report I submitted.

https://bugzilla.kernel.org/show_bug.cgi?id=193571

There was a number of people who reported they were having similar
issues with various QCA Rome bluetooth devices.
The userspace fix that seemed to work for everyone was resetting the usb device.

ie

#!/bin/bash
echo 0 > /sys/bus/usb/devices/1-4/authorized
echo 1 > /sys/bus/usb/devices/1-4/authorized

or

#!/usr/bin/python
from usb.core import find as finddev
dev = finddev(idVendor=0x0cf3, idProduct=0xe300)
dev.reset()

It's difficult to ascertain what the underlying issue was for each
person (and associated device) who commented. I can only speak
authoritatively for my own device.
It's a Samsung ATIV Book 9 12.2 (2015) laptop that contains an
integrated bluetooth controller that's attached to the internal usb
bus.

# lsusb
Bus 001 Device 005: ID 0cf3:e300 Atheros Communications, Inc.

After suspending the laptop for an extended length of time (sometimes
it would take an hour or two before issue occurred), and resuming
--the bluetooth controller would not come back on-line. After reading
through various forums, I suspected the issue I was experiencing was
due to the bluetooth device losing it's firmware during suspend.
The original patch I created did fix the issue. (I do realize that
targeting all QCA Rome chipset's was the wrong decision). Hans de
Goede's rewritten version (commit: 61f5acea8737) also worked for my
device. Since, some people think that the underlying issue may been
fixed elsewhere in the kernel. I'm going to remove Hans' commit and
see if the issue persists (with kernel 4.15.6). I'll report back
tomorrow with the results.


-Leif

On Wed, Feb 28, 2018 at 11:54 AM, Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
> Hi,
>
>
> On 27-02-18 15:07, Hans de Goede wrote:
>>
>> Hi,
>>
>> On 27-02-18 03:29, Brian Norris wrote:
>>>
>>> On Thu, Feb 22, 2018 at 11:14 PM, Hans de Goede <hdegoede@xxxxxxxxxx>
>>> wrote:
>>>>
>>>> On 23-02-18 04:12, Brian Norris wrote:
>>>>>
>>>>> Hmm? I'm not sure I completely follow here when you say "he was not
>>>>> hitting the firmware loading race". If things were functioning fine
>>>>> with
>>>>> system suspend (but not with autosuspend), then he's not seeing the
>>>>> controller (quoting commit fd865802c66b) "losing power during suspend".
>>>>
>>>>
>>>>
>>>> He was running a kernel with the original "fd865802c66b Bluetooth:
>>>> btusb:
>>>> fix QCA Rome suspend/resume" commit, which fixes regular suspend for
>>>> devices which are "losing power during suspend", but does nothing for
>>>> runtime-suspend.
>>>>
>>>> He ran tests both with and without runtime-pm enabled with that same
>>>> kernel
>>>> and he needed to disable runtime-pm to get working bluetooth.
>>>
>>>
>>> Did he ever test with commit fd865802c66b reverted?
>>>
>>> My symptoms were exactly the same as you described. BT was broken as
>>> of v4.14 if I had runtime suspend enabled. Things were fine if I
>>> either (a) reverted the patch or (b) disabled runtime suspend. I
>>> obviously preferred (a), which is why I continued to complain :)
>>>
>>> Did your tester ever try (a)? If not, then I don't think you've really
>>> ensured that he really needed a "fixed" version; he may not have
>>> needed the patch at all.
>>>
>>> Or an alternative question: did that system work on an older Fedora
>>> release (and presumably an older kernel)? If so, then he probably also
>>> did not need that patch.
>>>
>>>>> So, that would suggest he could only be seeing the race (as I was), and
>>>>> that his machine does not deserve a RESET_RESUME quirk?
>>>>
>>>>
>>>>
>>>> I hope my above answer helps to clarify why I believe the quirk is
>>>> necessary on his machine.
>>>
>>>
>>> I'm sorry, but no it doesn't. If anything, it suggests to me even more
>>> that it may not have been necessary.
>>
>>
>> Ok, I've started another test-kernel build for the reporter this time
>> without any quirks at all and I've asked him to test.
>
>
> You were right, the Yoga 920 works fine without any quirks, thank you
> for being persistent on getting this tested properly.
>
> I will submit a patch dropping the Yoga 920 from the
> btusb_needs_reset_resume_table.
>
> Regards,
>
> Hans