linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08
@ 2021-10-27  9:14 Vyacheslav Bocharov
  2021-10-27  9:14 ` [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
  2021-10-27  9:14 ` [PATCH v3 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov
  0 siblings, 2 replies; 5+ messages in thread
From: Vyacheslav Bocharov @ 2021-10-27  9:14 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz; +Cc: linux-bluetooth, linux-kernel

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 <chbgdn@gmail.com> 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(+)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08
  2021-10-27  9:14 [PATCH v3 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Vyacheslav Bocharov
@ 2021-10-27  9:14 ` Vyacheslav Bocharov
  2022-01-19  9:01   ` Rudi Heitbaum
  2021-10-27  9:14 ` [PATCH v3 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov
  1 sibling, 1 reply; 5+ messages in thread
From: Vyacheslav Bocharov @ 2021-10-27  9:14 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz; +Cc: linux-bluetooth, linux-kernel

Add detection of RTL8822CS controller with hci_ver = 0x08

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
---
 drivers/bluetooth/btrtl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index c2bdd1e6060e..38d547cc6fcd 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open
  2021-10-27  9:14 [PATCH v3 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Vyacheslav Bocharov
  2021-10-27  9:14 ` [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
@ 2021-10-27  9:14 ` Vyacheslav Bocharov
  1 sibling, 0 replies; 5+ messages in thread
From: Vyacheslav Bocharov @ 2021-10-27  9:14 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz; +Cc: linux-bluetooth, linux-kernel

Add power reset via enable-gpios in h5_btrtl_open function.

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08
  2021-10-27  9:14 ` [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
@ 2022-01-19  9:01   ` Rudi Heitbaum
  2022-01-19  9:44     ` Vyacheslav
  0 siblings, 1 reply; 5+ messages in thread
From: Rudi Heitbaum @ 2022-01-19  9:01 UTC (permalink / raw)
  To: Vyacheslav Bocharov
  Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel

On Wed, Oct 27, 2021 at 12:14:15PM +0300, Vyacheslav Bocharov wrote:
> Add detection of RTL8822CS controller with hci_ver = 0x08
> 
> Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
> ---
>  drivers/bluetooth/btrtl.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index c2bdd1e6060e..38d547cc6fcd 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -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,

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

Tested-by: Rudi Heitbaum <rudi@heitbaum.com>

---
 drivers/bluetooth/btrtl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
--- a/drivers/bluetooth/btrtl.c	2022-01-09 22:55:34.000000000 +0000
+++ b/drivers/bluetooth/btrtl.c	2022-01-15 07:12:21.102080089 +0000
@@ -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08
  2022-01-19  9:01   ` Rudi Heitbaum
@ 2022-01-19  9:44     ` Vyacheslav
  0 siblings, 0 replies; 5+ messages in thread
From: Vyacheslav @ 2022-01-19  9:44 UTC (permalink / raw)
  To: Rudi Heitbaum
  Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel

Hi!
Thanks for reply

19.01.2022 12:01, Rudi Heitbaum wrote:
 > On Wed, Oct 27, 2021 at 12:14:15PM +0300, Vyacheslav Bocharov wrote:
 >> Add detection of RTL8822CS controller with hci_ver = 0x08
 >>
 >> Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
 >> ---
 >>   drivers/bluetooth/btrtl.c | 7 +++++++
 >>   1 file changed, 7 insertions(+)
 >>
 >> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
 >> index c2bdd1e6060e..38d547cc6fcd 100644
 >> --- a/drivers/bluetooth/btrtl.c
 >> +++ b/drivers/bluetooth/btrtl.c
 >> @@ -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,
 >
 > Hi Vyacheslav,
 >
 > 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?)

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

 >
 > 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
 >
 > Tested-by: Rudi Heitbaum <rudi@heitbaum.com>
 >
 > ---
 >   drivers/bluetooth/btrtl.c | 10 +++++++++-
 >   1 file changed, 9 insertions(+), 1 deletion(-)
 >
 > diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
 > --- a/drivers/bluetooth/btrtl.c	2022-01-09 22:55:34.000000000 +0000
 > +++ b/drivers/bluetooth/btrtl.c	2022-01-15 07:12:21.102080089 +0000
 > @@ -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
 >
--
Vyacheslav

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-19  9:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27  9:14 [PATCH v3 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Vyacheslav Bocharov
2021-10-27  9:14 ` [PATCH v3 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
2022-01-19  9:01   ` Rudi Heitbaum
2022-01-19  9:44     ` Vyacheslav
2021-10-27  9:14 ` [PATCH v3 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov

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