Skip to contentSkip to conversation

Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08

PATCH Superseded Vyacheslav Bocharov 2 participants 4 messages Jan 26, 2022 Bluetooth drivers

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08

Add a variation of RTL8822CS with hci_ver = 0x08. This is fully similar to RTL8822CS with hci_ver = 0x0a observed on the Tanix TX6 Android set-top box and JetHome JetHub H1.

While testing the RTL8822CS SDIO WiFi/BT adapter, I found that in some cases the kernel could not initialize it. However, manually resetting the adapter via gpio allows it to start correctly.
Apparently at system start the adapter is in an undefined state (including the unknown state of gpio after starting uboot). A forced reset helps to initialize the adapter in most cases. Experimentally it was found that 100ms is enough to reset.
So, add power reset via enable-gpios in h5_btrtl_open function.

Changes from v5:
- fix patch description
Changes from v4:
- fix patch description
Changes from v3:
- add has_msft_ext option
Changes from v2:
- align the patches for bluetooth-next
Changes from v1:
- remove Signed-off-by chbgdn <[email protected]> as not reachable

Vyacheslav Bocharov (2):
Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08
Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open

 drivers/bluetooth/btrtl.c  | 8 ++++++++
 drivers/bluetooth/hci_h5.c | 5 +++++
 2 files changed, 13 insertions(+)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v6 1/2 Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08

Add a variation of RTL8822CS with hci_ver = 0x08. This is fully similar to RTL8822CS with hci_ver = 0x0a observed on the Tanix TX6 Android set-top box and JetHome JetHub H1.

---
 drivers/bluetooth/btrtl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/bluetooth/btrtl.c +8 -0
index c2bdd1e6060e..c2030f7e25b4 100644
@@ -148,6 +148,14 @@ static const struct id_table ic_id_table[] = {
 	  .fw_name  = "rtl_bt/rtl8761bu_fw.bin",
 	  .cfg_name = "rtl_bt/rtl8761bu_config" },
 
+	/* 8822C with UART interface */
+	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0x8, HCI_UART),
+	  .config_needed = true,
+	  .has_rom_version = true,
+	  .has_msft_ext = true,
+	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
+	  .cfg_name = "rtl_bt/rtl8822cs_config" },
+
 	/* 8822C with UART interface */
 	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
 	  .config_needed = true,
Signature · 1 line
2.30.2
#2 lore raw

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=608534

---Test result---

Test Summary:

CheckPatch                    FAIL      3.28 seconds
GitLint                       PASS      1.98 seconds
SubjectPrefix                 PASS      1.74 seconds
BuildKernel                   PASS      29.19 seconds
BuildKernel32                 PASS      26.18 seconds
Incremental Build with patchesPASS      41.66 seconds
TestRunner: Setup             PASS      461.68 seconds
TestRunner: l2cap-tester      PASS      13.20 seconds
TestRunner: bnep-tester       PASS      6.01 seconds
TestRunner: mgmt-tester       PASS      103.37 seconds
TestRunner: rfcomm-tester     PASS      7.32 seconds
TestRunner: sco-tester        PASS      7.60 seconds
TestRunner: smp-tester        PASS      7.54 seconds
TestRunner: userchan-tester   PASS      6.27 seconds

Details
##############################
Test: CheckPatch - FAIL - 3.28 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v6,2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open\WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #60:
to initialize the adapter in most cases. It has been found experimentally that

total: 0 errors, 1 warnings, 11 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12724610.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v6 2/2 Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open

In reply to Vyacheslav Bocharov

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.

---
 drivers/bluetooth/hci_h5.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/bluetooth/hci_h5.c +5 -0
index 34286ffe0568..fdf504b0d265 100644
@@ -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);
Signature · 1 line
2.30.2