kernel: backport RTL8761B FW name change to v5.10
authorQuintin Hill <stuff@quintin.me.uk>
Sun, 23 Oct 2022 08:22:37 +0000 (09:22 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 12 Nov 2022 16:05:13 +0000 (17:05 +0100)
Make the firmware filenames referenced by the module consistent for
v5.10 and v5.15 kernels.  Backport two upstream patches a cleanup commit
and the commit making the change, the former is required for the latter
to apply cleanly.

Signed-off-by: Quintin Hill <stuff@quintin.me.uk>
target/linux/generic/backport-5.10/883-v5.11-Bluetooth-btrtl-Refine-the-ic_id_table-for-clearer-a.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/884-v5.14-Bluetooth-btrtl-rename-USB-fw-for-RTL8761.patch [new file with mode: 0644]

diff --git a/target/linux/generic/backport-5.10/883-v5.11-Bluetooth-btrtl-Refine-the-ic_id_table-for-clearer-a.patch b/target/linux/generic/backport-5.10/883-v5.11-Bluetooth-btrtl-Refine-the-ic_id_table-for-clearer-a.patch
new file mode 100644 (file)
index 0000000..0975033
--- /dev/null
@@ -0,0 +1,183 @@
+From 6f9ff24645f55ffae12ef717b4f221c3e7dfe115 Mon Sep 17 00:00:00 2001
+From: Max Chou <max.chou@realtek.com>
+Date: Wed, 4 Nov 2020 20:04:14 +0800
+Subject: [PATCH] Bluetooth: btrtl: Refine the ic_id_table for clearer and more
+ regular
+
+Enhance the ic_id_table that it's able to maintain regularly.
+To judge which chip should be initialized by LMP subversion, HCI revision,
+ HCI version and HCI bus which were given in the ic_id_table.
+Also, refine the incorrect LMP subversion of ROM for RTL8723D and
+RTL8723A.
+
+Suggested-by: Alex Lu <alex_lu@realsil.com.cn>
+Signed-off-by: Max Chou <max.chou@realtek.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+---
+ drivers/bluetooth/btrtl.c | 65 ++++++++++++---------------------------
+ 1 file changed, 19 insertions(+), 46 deletions(-)
+
+--- a/drivers/bluetooth/btrtl.c
++++ b/drivers/bluetooth/btrtl.c
+@@ -18,10 +18,8 @@
+ #define VERSION "0.1"
+ #define RTL_EPATCH_SIGNATURE  "Realtech"
+-#define RTL_ROM_LMP_3499      0x3499
+ #define RTL_ROM_LMP_8723A     0x1200
+ #define RTL_ROM_LMP_8723B     0x8723
+-#define RTL_ROM_LMP_8723D     0x8873
+ #define RTL_ROM_LMP_8821A     0x8821
+ #define RTL_ROM_LMP_8761A     0x8761
+ #define RTL_ROM_LMP_8822B     0x8822
+@@ -31,10 +29,13 @@
+ #define IC_MATCH_FL_HCIREV    (1 << 1)
+ #define IC_MATCH_FL_HCIVER    (1 << 2)
+ #define IC_MATCH_FL_HCIBUS    (1 << 3)
+-#define IC_INFO(lmps, hcir) \
+-      .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV, \
++#define IC_INFO(lmps, hcir, hciv, bus) \
++      .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \
++                     IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
+       .lmp_subver = (lmps), \
+-      .hci_rev = (hcir)
++      .hci_rev = (hcir), \
++      .hci_ver = (hciv), \
++      .hci_bus = (bus)
+ struct id_table {
+       __u16 match_flags;
+@@ -58,112 +59,85 @@ struct btrtl_device_info {
+ };
+ static const struct id_table ic_id_table[] = {
+-      { IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8723A, 0x0,
+-        .config_needed = false,
+-        .has_rom_version = false,
+-        .fw_name = "rtl_bt/rtl8723a_fw.bin",
+-        .cfg_name = NULL },
+-
+-      { IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_3499, 0x0,
++      /* 8723A */
++      { IC_INFO(RTL_ROM_LMP_8723A, 0xb, 0x6, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = false,
+         .fw_name = "rtl_bt/rtl8723a_fw.bin",
+         .cfg_name = NULL },
+       /* 8723BS */
+-      { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
+-                       IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS,
+-        .lmp_subver = RTL_ROM_LMP_8723B,
+-        .hci_rev = 0xb,
+-        .hci_ver = 6,
+-        .hci_bus = HCI_UART,
++      { IC_INFO(RTL_ROM_LMP_8723B, 0xb, 0x6, HCI_UART),
+         .config_needed = true,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8723bs_fw.bin",
+         .cfg_name = "rtl_bt/rtl8723bs_config" },
+       /* 8723B */
+-      { IC_INFO(RTL_ROM_LMP_8723B, 0xb),
++      { IC_INFO(RTL_ROM_LMP_8723B, 0xb, 0x6, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8723b_fw.bin",
+         .cfg_name = "rtl_bt/rtl8723b_config" },
+       /* 8723D */
+-      { IC_INFO(RTL_ROM_LMP_8723B, 0xd),
++      { IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
+         .config_needed = true,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8723d_fw.bin",
+         .cfg_name = "rtl_bt/rtl8723d_config" },
+       /* 8723DS */
+-      { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
+-                       IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS,
+-        .lmp_subver = RTL_ROM_LMP_8723B,
+-        .hci_rev = 0xd,
+-        .hci_ver = 8,
+-        .hci_bus = HCI_UART,
++      { IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_UART),
+         .config_needed = true,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8723ds_fw.bin",
+         .cfg_name = "rtl_bt/rtl8723ds_config" },
+-      /* 8723DU */
+-      { IC_INFO(RTL_ROM_LMP_8723D, 0x826C),
+-        .config_needed = true,
+-        .has_rom_version = true,
+-        .fw_name  = "rtl_bt/rtl8723d_fw.bin",
+-        .cfg_name = "rtl_bt/rtl8723d_config" },
+-
+       /* 8821A */
+-      { IC_INFO(RTL_ROM_LMP_8821A, 0xa),
++      { IC_INFO(RTL_ROM_LMP_8821A, 0xa, 0x6, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8821a_fw.bin",
+         .cfg_name = "rtl_bt/rtl8821a_config" },
+       /* 8821C */
+-      { IC_INFO(RTL_ROM_LMP_8821A, 0xc),
++      { IC_INFO(RTL_ROM_LMP_8821A, 0xc, 0x8, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8821c_fw.bin",
+         .cfg_name = "rtl_bt/rtl8821c_config" },
+       /* 8761A */
+-      { IC_INFO(RTL_ROM_LMP_8761A, 0xa),
++      { IC_INFO(RTL_ROM_LMP_8761A, 0xa, 0x6, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8761a_fw.bin",
+         .cfg_name = "rtl_bt/rtl8761a_config" },
+       /* 8761B */
+-      { IC_INFO(RTL_ROM_LMP_8761A, 0xb),
++      { IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8761b_fw.bin",
+         .cfg_name = "rtl_bt/rtl8761b_config" },
+       /* 8822C with UART interface */
+-      { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
+-                       IC_MATCH_FL_HCIBUS,
+-        .lmp_subver = RTL_ROM_LMP_8822B,
+-        .hci_rev = 0x000c,
+-        .hci_ver = 0x0a,
+-        .hci_bus = HCI_UART,
++      { IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, 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),
++      { IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8822cu_fw.bin",
+         .cfg_name = "rtl_bt/rtl8822cu_config" },
+       /* 8822B */
+-      { IC_INFO(RTL_ROM_LMP_8822B, 0xb),
++      { IC_INFO(RTL_ROM_LMP_8822B, 0xb, 0x7, HCI_USB),
+         .config_needed = true,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8822b_fw.bin",
+@@ -654,7 +628,6 @@ int btrtl_download_firmware(struct hci_d
+       switch (btrtl_dev->ic_info->lmp_subver) {
+       case RTL_ROM_LMP_8723A:
+-      case RTL_ROM_LMP_3499:
+               return btrtl_setup_rtl8723a(hdev, btrtl_dev);
+       case RTL_ROM_LMP_8723B:
+       case RTL_ROM_LMP_8821A:
diff --git a/target/linux/generic/backport-5.10/884-v5.14-Bluetooth-btrtl-rename-USB-fw-for-RTL8761.patch b/target/linux/generic/backport-5.10/884-v5.14-Bluetooth-btrtl-rename-USB-fw-for-RTL8761.patch
new file mode 100644 (file)
index 0000000..5372ce8
--- /dev/null
@@ -0,0 +1,39 @@
+From 9fd2e2949b43dea869f7fce0f8f51df44f635d59 Mon Sep 17 00:00:00 2001
+From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
+Date: Fri, 28 May 2021 17:26:44 +0200
+Subject: [PATCH] Bluetooth: btrtl: rename USB fw for RTL8761
+
+According Realteks own BT drivers firmware RTL8761B is for UART
+and RTL8761BU is for USB.
+
+Change existing 8761B to UART and add an 8761BU entry for USB
+
+Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+---
+ drivers/bluetooth/btrtl.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/bluetooth/btrtl.c
++++ b/drivers/bluetooth/btrtl.c
+@@ -116,12 +116,19 @@ static const struct id_table ic_id_table
+         .cfg_name = "rtl_bt/rtl8761a_config" },
+       /* 8761B */
+-      { IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_USB),
++      { IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_UART),
+         .config_needed = false,
+         .has_rom_version = true,
+         .fw_name  = "rtl_bt/rtl8761b_fw.bin",
+         .cfg_name = "rtl_bt/rtl8761b_config" },
++      /* 8761BU */
++      { IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_USB),
++        .config_needed = false,
++        .has_rom_version = true,
++        .fw_name  = "rtl_bt/rtl8761bu_fw.bin",
++        .cfg_name = "rtl_bt/rtl8761bu_config" },
++
+       /* 8822C with UART interface */
+       { IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
+         .config_needed = true,