* [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
@ 2021-09-20 12:57 Hans de Goede
2021-09-20 13:25 ` [5.15,regression,fix] " bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hans de Goede @ 2021-09-20 12:57 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
Cc: Hans de Goede, linux-bluetooth, Archie Pusaka
The recently added H5_WAKEUP_DISABLE h5->flags flag gets checked in
h5_btrtl_open(), but it gets set in h5_serdev_probe() *after*
calling hci_uart_register_device() and thus after h5_btrtl_open()
is called, set this flag earlier.
Also on devices where suspend/resume involves fully re-probing the HCI,
runtime-pm suspend should not be used, make the runtime-pm setup
conditional on the H5_WAKEUP_DISABLE flag too.
This fixes the HCI being removed and then re-added every 10 seconds
because it was being reprobed as soon as it was runtime-suspended.
Cc: Archie Pusaka <apusaka@chromium.org>
Fixes: 66f077dde749 ("Bluetooth: hci_h5: add WAKEUP_DISABLE flag")
Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/bluetooth/hci_h5.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 0c0dedece59c..59b712742d33 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -846,6 +846,8 @@ static int h5_serdev_probe(struct serdev_device *serdev)
h5->vnd = data->vnd;
}
+ if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
+ set_bit(H5_WAKEUP_DISABLE, &h5->flags);
h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(h5->enable_gpio))
@@ -860,9 +862,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)
if (err)
return err;
- if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
- set_bit(H5_WAKEUP_DISABLE, &h5->flags);
-
return 0;
}
@@ -962,11 +961,13 @@ static void h5_btrtl_open(struct h5 *h5)
serdev_device_set_parity(h5->hu->serdev, SERDEV_PARITY_EVEN);
serdev_device_set_baudrate(h5->hu->serdev, 115200);
- pm_runtime_set_active(&h5->hu->serdev->dev);
- pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
- pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
- SUSPEND_TIMEOUT_MS);
- pm_runtime_enable(&h5->hu->serdev->dev);
+ if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags)) {
+ pm_runtime_set_active(&h5->hu->serdev->dev);
+ pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
+ pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
+ SUSPEND_TIMEOUT_MS);
+ pm_runtime_enable(&h5->hu->serdev->dev);
+ }
/* The controller needs up to 500ms to wakeup */
gpiod_set_value_cansleep(h5->enable_gpio, 1);
@@ -976,7 +977,8 @@ static void h5_btrtl_open(struct h5 *h5)
static void h5_btrtl_close(struct h5 *h5)
{
- pm_runtime_disable(&h5->hu->serdev->dev);
+ if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags))
+ pm_runtime_disable(&h5->hu->serdev->dev);
gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
gpiod_set_value_cansleep(h5->enable_gpio, 0);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [5.15,regression,fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
2021-09-20 12:57 [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs Hans de Goede
@ 2021-09-20 13:25 ` bluez.test.bot
2021-09-24 2:57 ` [PATCH 5.15 regression fix] " Archie Pusaka
2021-09-24 9:37 ` Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-09-20 13:25 UTC (permalink / raw)
To: linux-bluetooth, hdegoede
[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]
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=549789
---Test result---
Test Summary:
CheckPatch PASS 1.66 seconds
GitLint FAIL 0.90 seconds
BuildKernel PASS 674.28 seconds
TestRunner: Setup PASS 434.82 seconds
TestRunner: l2cap-tester PASS 3.59 seconds
TestRunner: bnep-tester PASS 2.54 seconds
TestRunner: mgmt-tester PASS 36.08 seconds
TestRunner: rfcomm-tester PASS 2.90 seconds
TestRunner: smp-tester PASS 2.83 seconds
TestRunner: userchan-tester PASS 2.63 seconds
Details
##############################
Test: GitLint - FAIL - 0.90 seconds
Run gitlint with rule in .gitlint
[5.15,regression,fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
2: B4 Second line is not empty: "h5_btrtl_open(), but it gets set in h5_serdev_probe() *after*"
---
Regards,
Linux Bluetooth
[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 51566 bytes --]
[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3934 bytes --]
[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 626845 bytes --]
[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 14791 bytes --]
[-- Attachment #6: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11858 bytes --]
[-- Attachment #7: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 7768 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
2021-09-20 12:57 [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs Hans de Goede
2021-09-20 13:25 ` [5.15,regression,fix] " bluez.test.bot
@ 2021-09-24 2:57 ` Archie Pusaka
2021-09-24 9:37 ` Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Archie Pusaka @ 2021-09-24 2:57 UTC (permalink / raw)
To: Hans de Goede
Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
linux-bluetooth, Archie Pusaka
Hi Hans,
On Mon, 20 Sept 2021 at 20:57, Hans de Goede <hdegoede@redhat.com> wrote:
>
> The recently added H5_WAKEUP_DISABLE h5->flags flag gets checked in
> h5_btrtl_open(), but it gets set in h5_serdev_probe() *after*
> calling hci_uart_register_device() and thus after h5_btrtl_open()
> is called, set this flag earlier.
>
> Also on devices where suspend/resume involves fully re-probing the HCI,
> runtime-pm suspend should not be used, make the runtime-pm setup
> conditional on the H5_WAKEUP_DISABLE flag too.
>
> This fixes the HCI being removed and then re-added every 10 seconds
> because it was being reprobed as soon as it was runtime-suspended.
>
> Cc: Archie Pusaka <apusaka@chromium.org>
> Fixes: 66f077dde749 ("Bluetooth: hci_h5: add WAKEUP_DISABLE flag")
> Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
You are correct, I should have checked H5_WAKEUP_DISABLE before using
autosuspend.
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
> ---
> drivers/bluetooth/hci_h5.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
> index 0c0dedece59c..59b712742d33 100644
> --- a/drivers/bluetooth/hci_h5.c
> +++ b/drivers/bluetooth/hci_h5.c
> @@ -846,6 +846,8 @@ static int h5_serdev_probe(struct serdev_device *serdev)
> h5->vnd = data->vnd;
> }
>
> + if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
> + set_bit(H5_WAKEUP_DISABLE, &h5->flags);
>
> h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
> if (IS_ERR(h5->enable_gpio))
> @@ -860,9 +862,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)
> if (err)
> return err;
>
> - if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
> - set_bit(H5_WAKEUP_DISABLE, &h5->flags);
> -
We can simplify by just returning err and not check its value.
> return 0;
> }
>
> @@ -962,11 +961,13 @@ static void h5_btrtl_open(struct h5 *h5)
> serdev_device_set_parity(h5->hu->serdev, SERDEV_PARITY_EVEN);
> serdev_device_set_baudrate(h5->hu->serdev, 115200);
>
> - pm_runtime_set_active(&h5->hu->serdev->dev);
> - pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
> - pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
> - SUSPEND_TIMEOUT_MS);
> - pm_runtime_enable(&h5->hu->serdev->dev);
> + if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags)) {
> + pm_runtime_set_active(&h5->hu->serdev->dev);
> + pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
> + pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
> + SUSPEND_TIMEOUT_MS);
> + pm_runtime_enable(&h5->hu->serdev->dev);
> + }
>
> /* The controller needs up to 500ms to wakeup */
> gpiod_set_value_cansleep(h5->enable_gpio, 1);
> @@ -976,7 +977,8 @@ static void h5_btrtl_open(struct h5 *h5)
>
> static void h5_btrtl_close(struct h5 *h5)
> {
> - pm_runtime_disable(&h5->hu->serdev->dev);
> + if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags))
> + pm_runtime_disable(&h5->hu->serdev->dev);
>
> gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
> gpiod_set_value_cansleep(h5->enable_gpio, 0);
> --
> 2.31.1
>
Thanks,
Archie
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
2021-09-20 12:57 [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs Hans de Goede
2021-09-20 13:25 ` [5.15,regression,fix] " bluez.test.bot
2021-09-24 2:57 ` [PATCH 5.15 regression fix] " Archie Pusaka
@ 2021-09-24 9:37 ` Marcel Holtmann
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2021-09-24 9:37 UTC (permalink / raw)
To: Hans de Goede
Cc: Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth, Archie Pusaka
Hi Hans,
> The recently added H5_WAKEUP_DISABLE h5->flags flag gets checked in
> h5_btrtl_open(), but it gets set in h5_serdev_probe() *after*
> calling hci_uart_register_device() and thus after h5_btrtl_open()
> is called, set this flag earlier.
>
> Also on devices where suspend/resume involves fully re-probing the HCI,
> runtime-pm suspend should not be used, make the runtime-pm setup
> conditional on the H5_WAKEUP_DISABLE flag too.
>
> This fixes the HCI being removed and then re-added every 10 seconds
> because it was being reprobed as soon as it was runtime-suspended.
>
> Cc: Archie Pusaka <apusaka@chromium.org>
> Fixes: 66f077dde749 ("Bluetooth: hci_h5: add WAKEUP_DISABLE flag")
> Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/bluetooth/hci_h5.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-24 9:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 12:57 [PATCH 5.15 regression fix] Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs Hans de Goede
2021-09-20 13:25 ` [5.15,regression,fix] " bluez.test.bot
2021-09-24 2:57 ` [PATCH 5.15 regression fix] " Archie Pusaka
2021-09-24 9:37 ` Marcel Holtmann
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).