Skip to contentSkip to conversation

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

PATCH Superseded Vyacheslav Bocharov 2 participants 5 messages Oct 27, 2021 – Jan 19, 2022 Bluetooth drivers

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 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 The controller does not always start when the system starts up, so we do a forced reset via gpio during initialization.

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  | 7 +++++++
 drivers/bluetooth/hci_h5.c | 5 +++++
 2 files changed, 12 insertions(+)
Signature · 1 line
2.30.2
#1 lore raw

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

Add detection of RTL8822CS controller with hci_ver = 0x08

---
 drivers/bluetooth/btrtl.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bluetooth/btrtl.c +7 -0
index c2bdd1e6060e..38d547cc6fcd 100644
@@ -156,6 +156,13 @@ static const struct id_table ic_id_table[] = {
 	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
 	  .cfg_name = "rtl_bt/rtl8822cs_config" },
 
+	/* 8822C with UART interface */
+	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0x8, HCI_UART),
+	  .config_needed = true,
+	  .has_rom_version = true,
+	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
+	  .cfg_name = "rtl_bt/rtl8822cs_config" },
+
 	/* 8822C with USB interface */
 	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
 	  .config_needed = false,
Signature · 1 line
2.30.2
Tested-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08

Quoted 15 lines · Vyacheslav Bocharov

Add detection of RTL8822CS controller with hci_ver = 0x08

---
 drivers/bluetooth/btrtl.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/bluetooth/btrtl.c +0 -0
index c2bdd1e6060e..38d547cc6fcd 100644
@@ -156,6 +156,13 @@ static const struct id_table ic_id_table[] = {
 	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
 	  .cfg_name = "rtl_bt/rtl8822cs_config" },
 

drivers/bluetooth/btrtl.c static const struct id_table ic_id_table[] = { · line 168

Quoted 10 lines
drivers/bluetooth/btrtl.c +7 -0
+	/* 8822C with UART interface */
+	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0x8, HCI_UART),
+	  .config_needed = true,
+	  .has_rom_version = true,
+	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
+	  .cfg_name = "rtl_bt/rtl8822cs_config" },
+
 	/* 8822C with USB interface */
 	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
 	  .config_needed = false,

Hi Vyacheslav,

Could I make a suggestion rebasing this patch against 5.16 and putting the UART hci ver 0008 berore 000a

this has been tested on Tanix TX6.

Before:

[   11.512883] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8822
[   11.512940] Bluetooth: hci0: RTL: unknown IC info, lmp subver 8822, hci rev 000c, hci ver 0008
[   11.512957] Bluetooth: hci0: RTL: no config loaded

After:

[   12.642167] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8822
[   12.671911] Bluetooth: hci0: RTL: rom_version status=0 version=3
[   12.671961] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_fw.bin
[   12.706248] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_config.bin
[   12.730251] Bluetooth: hci0: RTL: cfg_sz 33, total sz 40737
[   13.318832] Bluetooth: hci0: RTL: fw version 0x05a91a4a
---
 drivers/bluetooth/btrtl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +9 -1
@@ -148,7 +148,15 @@
 	  .fw_name  = "rtl_bt/rtl8761bu_fw.bin",
 	  .cfg_name = "rtl_bt/rtl8761bu_config" },
 
+ 	/* 8822C (hci ver 0008) 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 */
+	/* 8822C (hci ver 000a) with UART interface */
 	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
 	  .config_needed = true,
 	  .has_rom_version = true,

--
2.25.1

author
#3 lore raw

Re: [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08

Hi!
Thanks for reply

Quoted 29 lines · Rudi Heitbaum
Quoted 15 lines · Vyacheslav Bocharov

Add detection of RTL8822CS controller with hci_ver = 0x08

---
  drivers/bluetooth/btrtl.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/bluetooth/btrtl.c +0 -0
index c2bdd1e6060e..38d547cc6fcd 100644
@@ -156,6 +156,13 @@ static const struct id_table ic_id_table[] = {
  	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
  	  .cfg_name = "rtl_bt/rtl8822cs_config" },
 

drivers/bluetooth/btrtl.c static const struct id_table ic_id_table[] = { · line 168

Quoted 10 lines
drivers/bluetooth/btrtl.c +7 -0
+	/* 8822C with UART interface */
+	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0x8, HCI_UART),
+	  .config_needed = true,
+	  .has_rom_version = true,
+	  .fw_name  = "rtl_bt/rtl8822cs_fw.bin",
+	  .cfg_name = "rtl_bt/rtl8822cs_config" },
+
  	/* 8822C with USB interface */
  	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
  	  .config_needed = false,

Hi Vyacheslav,

Quoted 2 lines

Could I make a suggestion rebasing this patch against 5.16 and putting
the UART hci ver 0008 berore 000aI recently submitted a v4 patch with the .has_msft_ext added based on bluetooth-next, but without the correct order.

https://patchwork.kernel.org/project/bluetooth/list/?series=606500
Maybe the order of the lines is not so important?)

Quoted 2 lines

this has been tested on Tanix TX6.also tested on JetHome JetHub H1 and applied to Armbian patchset (https://github.com/armbian/build/pull/3201).

Also need to update the firmware in linux-firmware, the correct binaries are in armbian-firmware.

Quoted 43 lines

Before:

[   11.512883] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8822
[   11.512940] Bluetooth: hci0: RTL: unknown IC info, lmp subver 8822, hci rev 000c, hci ver 0008
[   11.512957] Bluetooth: hci0: RTL: no config loaded

After:

[   12.642167] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8822
[   12.671911] Bluetooth: hci0: RTL: rom_version status=0 version=3
[   12.671961] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_fw.bin
[   12.706248] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_config.bin
[   12.730251] Bluetooth: hci0: RTL: cfg_sz 33, total sz 40737
[   13.318832] Bluetooth: hci0: RTL: fw version 0x05a91a4a
---
  drivers/bluetooth/btrtl.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +9 -2
@@ -148,7 +148,15 @@
  	  .fw_name  = "rtl_bt/rtl8761bu_fw.bin",
  	  .cfg_name = "rtl_bt/rtl8761bu_config" },
 
+ 	/* 8822C (hci ver 0008) 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 */
+	/* 8822C (hci ver 000a) with UART interface */
  	{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
  	  .config_needed = true,
  	  .has_rom_version = true,
--
Quoted 2 lines

2.25.1

--
Vyacheslav

#4 lore raw

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

In reply to Vyacheslav Bocharov

Add power reset via enable-gpios in h5_btrtl_open function.

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