From: Vyacheslav Bocharov <adeep@lexina.in>
To: marcel@holtmann.org, johan.hedberg@gmail.com,
luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Rudi Heitbaum <rudi@heitbaum.com>
Subject: [PATCH v7 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open
Date: Wed, 26 Jan 2022 10:39:05 +0300 [thread overview]
Message-ID: <20220126073905.3637841-3-adeep@lexina.in> (raw)
In-Reply-To: <20220126073905.3637841-1-adeep@lexina.in>
Add power reset for bluetooth via enable-gpios in h5_btrtl_open function.
While testing the RTL8822CS SDIO WiFi/BT adapter, it was found that in
some cases the kernel could not initialize BT firmware. However,
manually resetting the adapter via gpio (off/on sequence) allows it to
start correctly.
Apparently, when the system starts, the adapter is in an undefined state
(including unknown gpio state after starting uboot). A forced reset helps
to initialize the adapter in most cases. It has been found experimentally
that 100 ms is sufficient for a reset.
Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
---
drivers/bluetooth/hci_h5.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 34286ffe0568..fdf504b0d265 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -966,6 +966,11 @@ static void h5_btrtl_open(struct h5 *h5)
pm_runtime_enable(&h5->hu->serdev->dev);
}
+ /* The controller needs reset to startup */
+ gpiod_set_value_cansleep(h5->enable_gpio, 0);
+ gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
+ msleep(100);
+
/* The controller needs up to 500ms to wakeup */
gpiod_set_value_cansleep(h5->enable_gpio, 1);
gpiod_set_value_cansleep(h5->device_wake_gpio, 1);
--
2.30.2
next prev parent reply other threads:[~2022-01-26 7:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 7:39 [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Vyacheslav Bocharov
2022-01-26 7:39 ` [PATCH v7 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
2022-01-26 7:39 ` Vyacheslav Bocharov [this message]
2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS " Marcel Holtmann
2022-01-26 14:14 ` Vyacheslav
2022-01-28 11:24 ` Rudi Heitbaum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220126073905.3637841-3-adeep@lexina.in \
--to=adeep@lexina.in \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=rudi@heitbaum.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®