linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08
@ 2022-01-26  7:39 Vyacheslav Bocharov
  2022-01-26  7:39 ` [PATCH v7 1/2] Bluetooth: btrtl: Add support for RTL8822C " Vyacheslav Bocharov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vyacheslav Bocharov @ 2022-01-26  7:39 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel
  Cc: Rudi Heitbaum

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 v6..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 <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  | 8 ++++++++
 drivers/bluetooth/hci_h5.c | 5 +++++
 2 files changed, 13 insertions(+)

-- 
2.30.2


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

* [PATCH v7 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08
  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 ` Vyacheslav Bocharov
  2022-01-26  7:39 ` [PATCH v7 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov
  2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Marcel Holtmann
  2 siblings, 0 replies; 6+ messages in thread
From: Vyacheslav Bocharov @ 2022-01-26  7:39 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel
  Cc: Rudi Heitbaum

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.

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

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


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

* [PATCH v7 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open
  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
  2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Marcel Holtmann
  2 siblings, 0 replies; 6+ messages in thread
From: Vyacheslav Bocharov @ 2022-01-26  7:39 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel
  Cc: Rudi Heitbaum

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


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

* Re: [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08
  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 ` [PATCH v7 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov
@ 2022-01-26 13:40 ` Marcel Holtmann
  2022-01-26 14:14   ` Vyacheslav
  2022-01-28 11:24   ` Rudi Heitbaum
  2 siblings, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2022-01-26 13:40 UTC (permalink / raw)
  To: Vyacheslav Bocharov
  Cc: Johan Hedberg, Luiz Augusto von Dentz, BlueZ, LKML, Rudi Heitbaum

Hi Vyacheslav,

> 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 v6..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 <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  | 8 ++++++++
> drivers/bluetooth/hci_h5.c | 5 +++++
> 2 files changed, 13 insertions(+)

both patches have been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08
  2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Marcel Holtmann
@ 2022-01-26 14:14   ` Vyacheslav
  2022-01-28 11:24   ` Rudi Heitbaum
  1 sibling, 0 replies; 6+ messages in thread
From: Vyacheslav @ 2022-01-26 14:14 UTC (permalink / raw)
  To: Marcel Holtmann, LKML, BlueZ


26.01.2022 16:40, Marcel Holtmann wrote:
> Hi Vyacheslav,
> 
>> 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 v6..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 <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  | 8 ++++++++
>> drivers/bluetooth/hci_h5.c | 5 +++++
>> 2 files changed, 13 insertions(+)
> 
> both patches have been applied to bluetooth-next tree.

Thanks!

> 
> Regards
> 
> Marcel
> 


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

* Re: [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08
  2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Marcel Holtmann
  2022-01-26 14:14   ` Vyacheslav
@ 2022-01-28 11:24   ` Rudi Heitbaum
  1 sibling, 0 replies; 6+ messages in thread
From: Rudi Heitbaum @ 2022-01-28 11:24 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Vyacheslav Bocharov, Johan Hedberg, Luiz Augusto von Dentz, BlueZ, LKML

On Wed, Jan 26, 2022 at 02:40:38PM +0100, Marcel Holtmann wrote:
> Hi Vyacheslav,
> 
> > 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 v6..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 <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  | 8 ++++++++
> > drivers/bluetooth/hci_h5.c | 5 +++++
> > 2 files changed, 13 insertions(+)
> 
> both patches have been applied to bluetooth-next tree.

Thanks Marcel and Vyacheslav

> Regards
> 
> Marcel
> 

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

end of thread, other threads:[~2022-01-28 11:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v7 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Vyacheslav Bocharov
2022-01-26 13:40 ` [PATCH v7 0/2] Bluetooth: hci_h5: btrtl: Add support for RTL8822CS hci_ver 0x08 Marcel Holtmann
2022-01-26 14:14   ` Vyacheslav
2022-01-28 11:24   ` Rudi Heitbaum

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