2019-05-27 14:55:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-05-14 16:49:09 +08:00
|
|
|
/*
|
|
|
|
* Bluetooth support for Realtek devices
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Endless Mobile, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/firmware.h>
|
|
|
|
#include <asm/unaligned.h>
|
|
|
|
#include <linux/usb.h>
|
|
|
|
|
|
|
|
#include <net/bluetooth/bluetooth.h>
|
|
|
|
#include <net/bluetooth/hci_core.h>
|
|
|
|
|
|
|
|
#include "btrtl.h"
|
|
|
|
|
|
|
|
#define VERSION "0.1"
|
|
|
|
|
2023-03-08 06:17:31 +08:00
|
|
|
#define RTL_CHIP_8723CS_CG 3
|
|
|
|
#define RTL_CHIP_8723CS_VF 4
|
|
|
|
#define RTL_CHIP_8723CS_XX 5
|
2015-05-14 16:49:09 +08:00
|
|
|
#define RTL_EPATCH_SIGNATURE "Realtech"
|
2023-04-17 10:33:58 +08:00
|
|
|
#define RTL_EPATCH_SIGNATURE_V2 "RTBTCore"
|
2023-03-08 06:17:31 +08:00
|
|
|
#define RTL_ROM_LMP_8703B 0x8703
|
2015-05-14 16:49:09 +08:00
|
|
|
#define RTL_ROM_LMP_8723A 0x1200
|
|
|
|
#define RTL_ROM_LMP_8723B 0x8723
|
|
|
|
#define RTL_ROM_LMP_8821A 0x8821
|
|
|
|
#define RTL_ROM_LMP_8761A 0x8761
|
2016-09-09 23:02:05 +08:00
|
|
|
#define RTL_ROM_LMP_8822B 0x8822
|
2020-11-10 11:38:37 +08:00
|
|
|
#define RTL_ROM_LMP_8852A 0x8852
|
2023-04-18 13:43:54 +08:00
|
|
|
#define RTL_ROM_LMP_8851B 0x8851
|
2018-08-02 22:57:15 +08:00
|
|
|
#define RTL_CONFIG_MAGIC 0x8723ab55
|
2015-05-14 16:49:09 +08:00
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
#define IC_MATCH_FL_LMPSUBV (1 << 0)
|
|
|
|
#define IC_MATCH_FL_HCIREV (1 << 1)
|
2018-08-02 22:57:16 +08:00
|
|
|
#define IC_MATCH_FL_HCIVER (1 << 2)
|
|
|
|
#define IC_MATCH_FL_HCIBUS (1 << 3)
|
2023-03-08 06:17:31 +08:00
|
|
|
#define IC_MATCH_FL_CHIP_TYPE (1 << 4)
|
2020-11-04 20:04:14 +08:00
|
|
|
#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, \
|
2018-02-12 02:24:33 +08:00
|
|
|
.lmp_subver = (lmps), \
|
2020-11-04 20:04:14 +08:00
|
|
|
.hci_rev = (hcir), \
|
|
|
|
.hci_ver = (hciv), \
|
|
|
|
.hci_bus = (bus)
|
2018-02-12 02:24:33 +08:00
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
#define RTL_CHIP_SUBVER (&(struct rtl_vendor_cmd) {{0x10, 0x38, 0x04, 0x28, 0x80}})
|
|
|
|
#define RTL_CHIP_REV (&(struct rtl_vendor_cmd) {{0x10, 0x3A, 0x04, 0x28, 0x80}})
|
|
|
|
#define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0x0D, 0x00, 0xb0}})
|
|
|
|
|
|
|
|
#define RTL_PATCH_SNIPPETS 0x01
|
|
|
|
#define RTL_PATCH_DUMMY_HEADER 0x02
|
|
|
|
#define RTL_PATCH_SECURITY_HEADER 0x03
|
|
|
|
|
2021-01-27 11:01:52 +08:00
|
|
|
enum btrtl_chip_id {
|
|
|
|
CHIP_ID_8723A,
|
|
|
|
CHIP_ID_8723B,
|
|
|
|
CHIP_ID_8821A,
|
|
|
|
CHIP_ID_8761A,
|
|
|
|
CHIP_ID_8822B = 8,
|
|
|
|
CHIP_ID_8723D,
|
|
|
|
CHIP_ID_8821C,
|
|
|
|
CHIP_ID_8822C = 13,
|
|
|
|
CHIP_ID_8761B,
|
|
|
|
CHIP_ID_8852A = 18,
|
2022-03-14 14:54:22 +08:00
|
|
|
CHIP_ID_8852B = 20,
|
2022-04-11 17:19:57 +08:00
|
|
|
CHIP_ID_8852C = 25,
|
2023-04-18 13:43:54 +08:00
|
|
|
CHIP_ID_8851B = 36,
|
2021-01-27 11:01:52 +08:00
|
|
|
};
|
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
struct id_table {
|
|
|
|
__u16 match_flags;
|
|
|
|
__u16 lmp_subver;
|
|
|
|
__u16 hci_rev;
|
2018-08-02 22:57:16 +08:00
|
|
|
__u8 hci_ver;
|
|
|
|
__u8 hci_bus;
|
2023-03-08 06:17:31 +08:00
|
|
|
__u8 chip_type;
|
2018-02-12 02:24:33 +08:00
|
|
|
bool config_needed;
|
2018-08-02 22:57:13 +08:00
|
|
|
bool has_rom_version;
|
2021-09-29 02:10:50 +08:00
|
|
|
bool has_msft_ext;
|
2018-02-12 02:24:33 +08:00
|
|
|
char *fw_name;
|
|
|
|
char *cfg_name;
|
|
|
|
};
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
struct btrtl_device_info {
|
|
|
|
const struct id_table *ic_info;
|
|
|
|
u8 rom_version;
|
|
|
|
u8 *fw_data;
|
|
|
|
int fw_len;
|
|
|
|
u8 *cfg_data;
|
|
|
|
int cfg_len;
|
2020-10-26 16:28:38 +08:00
|
|
|
bool drop_fw;
|
2021-01-27 11:01:52 +08:00
|
|
|
int project_id;
|
2023-04-17 10:33:58 +08:00
|
|
|
u8 key_id;
|
|
|
|
struct list_head patch_subsecs;
|
2018-08-02 22:57:13 +08:00
|
|
|
};
|
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
static const struct id_table ic_id_table[] = {
|
2020-11-04 20:04:14 +08:00
|
|
|
/* 8723A */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8723A, 0xb, 0x6, HCI_USB),
|
2018-08-02 22:57:13 +08:00
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = false,
|
|
|
|
.fw_name = "rtl_bt/rtl8723a_fw.bin",
|
|
|
|
.cfg_name = NULL },
|
|
|
|
|
2018-08-02 22:57:16 +08:00
|
|
|
/* 8723BS */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xb, 0x6, HCI_UART),
|
2018-08-02 22:57:16 +08:00
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8723bs_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8723bs_config" },
|
2018-08-02 22:57:16 +08:00
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
/* 8723B */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xb, 0x6, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = false,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8723b_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8723b_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
|
2023-03-08 06:17:31 +08:00
|
|
|
/* 8723CS-CG */
|
|
|
|
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
|
|
|
IC_MATCH_FL_HCIBUS,
|
|
|
|
.lmp_subver = RTL_ROM_LMP_8703B,
|
|
|
|
.chip_type = RTL_CHIP_8723CS_CG,
|
|
|
|
.hci_bus = HCI_UART,
|
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8723cs_cg_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8723cs_cg_config" },
|
|
|
|
|
|
|
|
/* 8723CS-VF */
|
|
|
|
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
|
|
|
IC_MATCH_FL_HCIBUS,
|
|
|
|
.lmp_subver = RTL_ROM_LMP_8703B,
|
|
|
|
.chip_type = RTL_CHIP_8723CS_VF,
|
|
|
|
.hci_bus = HCI_UART,
|
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8723cs_vf_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8723cs_vf_config" },
|
|
|
|
|
|
|
|
/* 8723CS-XX */
|
|
|
|
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
|
|
|
IC_MATCH_FL_HCIBUS,
|
|
|
|
.lmp_subver = RTL_ROM_LMP_8703B,
|
|
|
|
.chip_type = RTL_CHIP_8723CS_XX,
|
|
|
|
.hci_bus = HCI_UART,
|
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8723cs_xx_config" },
|
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
/* 8723D */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = true,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8723d_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8723d_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
|
2018-08-02 22:57:16 +08:00
|
|
|
/* 8723DS */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_UART),
|
2018-08-02 22:57:16 +08:00
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8723ds_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8723ds_config" },
|
2018-08-02 22:57:16 +08:00
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
/* 8821A */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8821A, 0xa, 0x6, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = false,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8821a_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8821a_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
|
|
|
|
/* 8821C */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8821A, 0xc, 0x8, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = false,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2021-09-30 01:48:19 +08:00
|
|
|
.has_msft_ext = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8821c_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8821c_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
|
2023-02-28 23:22:04 +08:00
|
|
|
/* 8821CS */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8821A, 0xc, 0x8, HCI_UART),
|
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.has_msft_ext = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8821cs_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8821cs_config" },
|
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
/* 8761A */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8761A, 0xa, 0x6, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = false,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8761a_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8761a_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
|
2020-04-11 09:34:27 +08:00
|
|
|
/* 8761B */
|
2021-05-28 23:26:44 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_UART),
|
2020-04-11 09:34:27 +08:00
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
2021-09-29 02:10:50 +08:00
|
|
|
.has_msft_ext = true,
|
2020-04-11 09:34:27 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8761b_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8761b_config" },
|
|
|
|
|
2021-05-28 23:26:44 +08:00
|
|
|
/* 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" },
|
|
|
|
|
2022-01-26 15:39:04 +08:00
|
|
|
/* 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" },
|
|
|
|
|
2020-02-17 16:14:55 +08:00
|
|
|
/* 8822C with UART interface */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
|
2020-02-17 16:14:55 +08:00
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
2021-09-29 02:10:50 +08:00
|
|
|
.has_msft_ext = true,
|
2020-02-17 16:14:55 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8822cs_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8822cs_config" },
|
|
|
|
|
2018-09-09 01:05:59 +08:00
|
|
|
/* 8822C with USB interface */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
|
2018-09-09 01:05:59 +08:00
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
2021-09-29 02:10:50 +08:00
|
|
|
.has_msft_ext = true,
|
2018-09-09 01:05:59 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8822cu_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8822cu_config" },
|
|
|
|
|
2018-02-12 02:24:33 +08:00
|
|
|
/* 8822B */
|
2020-11-04 20:04:14 +08:00
|
|
|
{ IC_INFO(RTL_ROM_LMP_8822B, 0xb, 0x7, HCI_USB),
|
2018-02-12 02:24:33 +08:00
|
|
|
.config_needed = true,
|
2018-08-02 22:57:13 +08:00
|
|
|
.has_rom_version = true,
|
2021-09-29 02:10:50 +08:00
|
|
|
.has_msft_ext = true,
|
2018-02-12 02:24:33 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8822b_fw.bin",
|
2018-08-02 22:57:17 +08:00
|
|
|
.cfg_name = "rtl_bt/rtl8822b_config" },
|
2020-11-10 11:38:37 +08:00
|
|
|
|
|
|
|
/* 8852A */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8852A, 0xa, 0xb, HCI_USB),
|
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
2021-09-29 02:10:50 +08:00
|
|
|
.has_msft_ext = true,
|
2020-11-10 11:38:37 +08:00
|
|
|
.fw_name = "rtl_bt/rtl8852au_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8852au_config" },
|
2022-03-14 14:54:22 +08:00
|
|
|
|
2023-02-22 17:47:20 +08:00
|
|
|
/* 8852B with UART interface */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8852A, 0xb, 0xb, HCI_UART),
|
|
|
|
.config_needed = true,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.has_msft_ext = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8852bs_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8852bs_config" },
|
|
|
|
|
2022-03-14 14:54:22 +08:00
|
|
|
/* 8852B */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8852A, 0xb, 0xb, HCI_USB),
|
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.has_msft_ext = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8852bu_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8852bu_config" },
|
2022-04-11 17:19:57 +08:00
|
|
|
|
|
|
|
/* 8852C */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8852A, 0xc, 0xc, HCI_USB),
|
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.has_msft_ext = true,
|
|
|
|
.fw_name = "rtl_bt/rtl8852cu_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8852cu_config" },
|
2023-04-18 13:43:54 +08:00
|
|
|
|
|
|
|
/* 8851B */
|
|
|
|
{ IC_INFO(RTL_ROM_LMP_8851B, 0xb, 0xc, HCI_USB),
|
|
|
|
.config_needed = false,
|
|
|
|
.has_rom_version = true,
|
|
|
|
.has_msft_ext = false,
|
|
|
|
.fw_name = "rtl_bt/rtl8851bu_fw.bin",
|
|
|
|
.cfg_name = "rtl_bt/rtl8851bu_config" },
|
2018-02-12 02:24:33 +08:00
|
|
|
};
|
|
|
|
|
2018-08-02 22:57:16 +08:00
|
|
|
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
|
2023-03-08 06:17:31 +08:00
|
|
|
u8 hci_ver, u8 hci_bus,
|
|
|
|
u8 chip_type)
|
2018-08-02 22:57:13 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(ic_id_table); i++) {
|
|
|
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_LMPSUBV) &&
|
|
|
|
(ic_id_table[i].lmp_subver != lmp_subver))
|
|
|
|
continue;
|
|
|
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIREV) &&
|
|
|
|
(ic_id_table[i].hci_rev != hci_rev))
|
|
|
|
continue;
|
2018-08-02 22:57:16 +08:00
|
|
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIVER) &&
|
|
|
|
(ic_id_table[i].hci_ver != hci_ver))
|
|
|
|
continue;
|
|
|
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) &&
|
|
|
|
(ic_id_table[i].hci_bus != hci_bus))
|
|
|
|
continue;
|
2023-03-08 06:17:31 +08:00
|
|
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) &&
|
|
|
|
(ic_id_table[i].chip_type != chip_type))
|
|
|
|
continue;
|
2018-08-02 22:57:13 +08:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i >= ARRAY_SIZE(ic_id_table))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &ic_id_table[i];
|
|
|
|
}
|
|
|
|
|
2019-08-31 16:36:02 +08:00
|
|
|
static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
|
|
|
skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
|
|
|
|
HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)",
|
|
|
|
PTR_ERR(skb));
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skb->len != sizeof(struct hci_rp_read_local_version)) {
|
|
|
|
rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch");
|
|
|
|
kfree_skb(skb);
|
|
|
|
return ERR_PTR(-EIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
|
|
|
|
{
|
|
|
|
struct rtl_rom_version_evt *rom_version;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
|
|
|
/* Read RTL ROM version command */
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "Read ROM version failed (%ld)",
|
2018-08-02 22:57:14 +08:00
|
|
|
PTR_ERR(skb));
|
2015-05-14 16:49:09 +08:00
|
|
|
return PTR_ERR(skb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skb->len != sizeof(*rom_version)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "version event length mismatch");
|
2015-05-14 16:49:09 +08:00
|
|
|
kfree_skb(skb);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
rom_version = (struct rtl_rom_version_evt *)skb->data;
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_info(hdev, "rom_version status=%x version=%x",
|
2018-08-02 22:57:14 +08:00
|
|
|
rom_version->status, rom_version->version);
|
2015-05-14 16:49:09 +08:00
|
|
|
|
|
|
|
*version = rom_version->version;
|
|
|
|
|
|
|
|
kfree_skb(skb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
static int btrtl_vendor_read_reg16(struct hci_dev *hdev,
|
|
|
|
struct rtl_vendor_cmd *cmd, u8 *rp)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc61, sizeof(*cmd), cmd,
|
|
|
|
HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
err = PTR_ERR(skb);
|
|
|
|
rtl_dev_err(hdev, "RTL: Read reg16 failed (%d)", err);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skb->len != 3 || skb->data[0]) {
|
|
|
|
bt_dev_err(hdev, "RTL: Read reg16 length mismatch");
|
|
|
|
kfree_skb(skb);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rp)
|
|
|
|
memcpy(rp, skb->data + 1, 2);
|
|
|
|
|
|
|
|
kfree_skb(skb);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *rtl_iov_pull_data(struct rtl_iovec *iov, u32 len)
|
|
|
|
{
|
|
|
|
void *data = iov->data;
|
|
|
|
|
|
|
|
if (iov->len < len)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
iov->data += len;
|
|
|
|
iov->len -= len;
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void btrtl_insert_ordered_subsec(struct rtl_subsection *node,
|
|
|
|
struct btrtl_device_info *btrtl_dev)
|
|
|
|
{
|
|
|
|
struct list_head *pos;
|
|
|
|
struct list_head *next;
|
|
|
|
struct rtl_subsection *subsec;
|
|
|
|
|
|
|
|
list_for_each_safe(pos, next, &btrtl_dev->patch_subsecs) {
|
|
|
|
subsec = list_entry(pos, struct rtl_subsection, list);
|
|
|
|
if (subsec->prio >= node->prio)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
__list_add(&node->list, pos->prev, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int btrtl_parse_section(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev, u32 opcode,
|
|
|
|
u8 *data, u32 len)
|
|
|
|
{
|
|
|
|
struct rtl_section_hdr *hdr;
|
|
|
|
struct rtl_subsection *subsec;
|
|
|
|
struct rtl_common_subsec *common_subsec;
|
|
|
|
struct rtl_sec_hdr *sec_hdr;
|
|
|
|
int i;
|
|
|
|
u8 *ptr;
|
|
|
|
u16 num_subsecs;
|
|
|
|
u32 subsec_len;
|
|
|
|
int rc = 0;
|
|
|
|
struct rtl_iovec iov = {
|
|
|
|
.data = data,
|
|
|
|
.len = len,
|
|
|
|
};
|
|
|
|
|
|
|
|
hdr = rtl_iov_pull_data(&iov, sizeof(*hdr));
|
|
|
|
if (!hdr)
|
|
|
|
return -EINVAL;
|
|
|
|
num_subsecs = le16_to_cpu(hdr->num);
|
|
|
|
|
|
|
|
for (i = 0; i < num_subsecs; i++) {
|
|
|
|
common_subsec = rtl_iov_pull_data(&iov, sizeof(*common_subsec));
|
|
|
|
if (!common_subsec)
|
|
|
|
break;
|
|
|
|
subsec_len = le32_to_cpu(common_subsec->len);
|
|
|
|
|
|
|
|
rtl_dev_dbg(hdev, "subsec, eco 0x%02x, len %08x",
|
|
|
|
common_subsec->eco, subsec_len);
|
|
|
|
|
|
|
|
ptr = rtl_iov_pull_data(&iov, subsec_len);
|
|
|
|
if (!ptr)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (common_subsec->eco != btrtl_dev->rom_version + 1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch (opcode) {
|
|
|
|
case RTL_PATCH_SECURITY_HEADER:
|
|
|
|
sec_hdr = (void *)common_subsec;
|
|
|
|
if (sec_hdr->key_id != btrtl_dev->key_id)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
subsec = kzalloc(sizeof(*subsec), GFP_KERNEL);
|
|
|
|
if (!subsec)
|
|
|
|
return -ENOMEM;
|
|
|
|
subsec->opcode = opcode;
|
|
|
|
subsec->prio = common_subsec->prio;
|
|
|
|
subsec->len = subsec_len;
|
|
|
|
subsec->data = ptr;
|
|
|
|
btrtl_insert_ordered_subsec(subsec, btrtl_dev);
|
|
|
|
rc += subsec_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev,
|
|
|
|
unsigned char **_buf)
|
|
|
|
{
|
|
|
|
struct rtl_epatch_header_v2 *hdr;
|
|
|
|
int rc;
|
|
|
|
u8 reg_val[2];
|
|
|
|
u8 key_id;
|
|
|
|
u32 num_sections;
|
|
|
|
struct rtl_section *section;
|
|
|
|
struct rtl_subsection *entry, *tmp;
|
|
|
|
u32 section_len;
|
|
|
|
u32 opcode;
|
|
|
|
int len = 0;
|
|
|
|
int i;
|
|
|
|
u8 *ptr;
|
|
|
|
struct rtl_iovec iov = {
|
|
|
|
.data = btrtl_dev->fw_data,
|
|
|
|
.len = btrtl_dev->fw_len - 7, /* Cut the tail */
|
|
|
|
};
|
|
|
|
|
|
|
|
rc = btrtl_vendor_read_reg16(hdev, RTL_SEC_PROJ, reg_val);
|
|
|
|
if (rc < 0)
|
|
|
|
return -EIO;
|
|
|
|
key_id = reg_val[0];
|
|
|
|
|
|
|
|
rtl_dev_dbg(hdev, "%s: key id %u", __func__, key_id);
|
|
|
|
|
|
|
|
btrtl_dev->key_id = key_id;
|
|
|
|
|
|
|
|
hdr = rtl_iov_pull_data(&iov, sizeof(*hdr));
|
|
|
|
if (!hdr)
|
|
|
|
return -EINVAL;
|
|
|
|
num_sections = le32_to_cpu(hdr->num_sections);
|
|
|
|
|
|
|
|
rtl_dev_dbg(hdev, "FW version %08x-%08x", *((u32 *)hdr->fw_version),
|
|
|
|
*((u32 *)(hdr->fw_version + 4)));
|
|
|
|
|
|
|
|
for (i = 0; i < num_sections; i++) {
|
|
|
|
section = rtl_iov_pull_data(&iov, sizeof(*section));
|
|
|
|
if (!section)
|
|
|
|
break;
|
|
|
|
section_len = le32_to_cpu(section->len);
|
|
|
|
opcode = le32_to_cpu(section->opcode);
|
|
|
|
|
|
|
|
rtl_dev_dbg(hdev, "opcode 0x%04x", section->opcode);
|
|
|
|
|
|
|
|
ptr = rtl_iov_pull_data(&iov, section_len);
|
|
|
|
if (!ptr)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (opcode) {
|
|
|
|
case RTL_PATCH_SNIPPETS:
|
|
|
|
rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
|
|
|
|
ptr, section_len);
|
|
|
|
break;
|
|
|
|
case RTL_PATCH_SECURITY_HEADER:
|
|
|
|
/* If key_id from chip is zero, ignore all security
|
|
|
|
* headers.
|
|
|
|
*/
|
|
|
|
if (!key_id)
|
|
|
|
break;
|
|
|
|
rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
|
|
|
|
ptr, section_len);
|
|
|
|
break;
|
|
|
|
case RTL_PATCH_DUMMY_HEADER:
|
|
|
|
rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
|
|
|
|
ptr, section_len);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (rc < 0) {
|
|
|
|
rtl_dev_err(hdev, "RTL: Parse section (%u) err %d",
|
|
|
|
opcode, rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
len += rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!len)
|
|
|
|
return -ENODATA;
|
|
|
|
|
|
|
|
/* Allocate mem and copy all found subsecs. */
|
|
|
|
ptr = kvmalloc(len, GFP_KERNEL);
|
|
|
|
if (!ptr)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) {
|
|
|
|
rtl_dev_dbg(hdev, "RTL: opcode %08x, addr %p, len 0x%x",
|
|
|
|
entry->opcode, entry->data, entry->len);
|
|
|
|
memcpy(ptr + len, entry->data, entry->len);
|
|
|
|
len += entry->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!len)
|
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
*_buf = ptr;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
static int rtlbt_parse_firmware(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev,
|
2018-02-12 02:24:33 +08:00
|
|
|
unsigned char **_buf)
|
2015-05-14 16:49:09 +08:00
|
|
|
{
|
2018-09-26 16:32:08 +08:00
|
|
|
static const u8 extension_sig[] = { 0x51, 0x04, 0xfd, 0x77 };
|
2015-05-14 16:49:09 +08:00
|
|
|
struct rtl_epatch_header *epatch_info;
|
|
|
|
unsigned char *buf;
|
2018-08-02 22:57:13 +08:00
|
|
|
int i, len;
|
2015-05-14 16:49:09 +08:00
|
|
|
size_t min_size;
|
2018-08-02 22:57:13 +08:00
|
|
|
u8 opcode, length, data;
|
2015-05-14 16:49:09 +08:00
|
|
|
int project_id = -1;
|
|
|
|
const unsigned char *fwptr, *chip_id_base;
|
|
|
|
const unsigned char *patch_length_base, *patch_offset_base;
|
|
|
|
u32 patch_offset = 0;
|
|
|
|
u16 patch_length, num_patches;
|
2016-09-09 23:02:05 +08:00
|
|
|
static const struct {
|
|
|
|
__u16 lmp_subver;
|
|
|
|
__u8 id;
|
|
|
|
} project_id_to_lmp_subver[] = {
|
|
|
|
{ RTL_ROM_LMP_8723A, 0 },
|
|
|
|
{ RTL_ROM_LMP_8723B, 1 },
|
|
|
|
{ RTL_ROM_LMP_8821A, 2 },
|
|
|
|
{ RTL_ROM_LMP_8761A, 3 },
|
2023-03-08 06:17:31 +08:00
|
|
|
{ RTL_ROM_LMP_8703B, 7 },
|
2016-09-09 23:02:05 +08:00
|
|
|
{ RTL_ROM_LMP_8822B, 8 },
|
2018-02-12 02:24:33 +08:00
|
|
|
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
|
|
|
|
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
|
2018-09-09 01:05:59 +08:00
|
|
|
{ RTL_ROM_LMP_8822B, 13 }, /* 8822C */
|
2020-04-11 09:34:27 +08:00
|
|
|
{ RTL_ROM_LMP_8761A, 14 }, /* 8761B */
|
2020-11-10 11:38:37 +08:00
|
|
|
{ RTL_ROM_LMP_8852A, 18 }, /* 8852A */
|
2022-03-14 14:54:22 +08:00
|
|
|
{ RTL_ROM_LMP_8852A, 20 }, /* 8852B */
|
2022-04-11 17:19:57 +08:00
|
|
|
{ RTL_ROM_LMP_8852A, 25 }, /* 8852C */
|
2023-04-18 13:43:54 +08:00
|
|
|
{ RTL_ROM_LMP_8851B, 36 }, /* 8851B */
|
2015-05-14 16:49:09 +08:00
|
|
|
};
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
if (btrtl_dev->fw_len <= 8)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8))
|
|
|
|
min_size = sizeof(struct rtl_epatch_header) +
|
|
|
|
sizeof(extension_sig) + 3;
|
|
|
|
else if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE_V2, 8))
|
|
|
|
min_size = sizeof(struct rtl_epatch_header_v2) +
|
|
|
|
sizeof(extension_sig) + 3;
|
|
|
|
else
|
|
|
|
return -EINVAL;
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->fw_len < min_size)
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
fwptr = btrtl_dev->fw_data + btrtl_dev->fw_len - sizeof(extension_sig);
|
2015-05-14 16:49:09 +08:00
|
|
|
if (memcmp(fwptr, extension_sig, sizeof(extension_sig)) != 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "extension section signature mismatch");
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Loop from the end of the firmware parsing instructions, until
|
|
|
|
* we find an instruction that identifies the "project ID" for the
|
|
|
|
* hardware supported by this firwmare file.
|
2022-07-20 22:10:33 +08:00
|
|
|
* Once we have that, we double-check that project_id is suitable
|
2015-05-14 16:49:09 +08:00
|
|
|
* for the hardware we are working with.
|
|
|
|
*/
|
2018-08-02 22:57:13 +08:00
|
|
|
while (fwptr >= btrtl_dev->fw_data + (sizeof(*epatch_info) + 3)) {
|
2015-05-14 16:49:09 +08:00
|
|
|
opcode = *--fwptr;
|
|
|
|
length = *--fwptr;
|
|
|
|
data = *--fwptr;
|
|
|
|
|
|
|
|
BT_DBG("check op=%x len=%x data=%x", opcode, length, data);
|
|
|
|
|
|
|
|
if (opcode == 0xff) /* EOF */
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (length == 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "found instruction with length 0");
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opcode == 0 && length == 1) {
|
|
|
|
project_id = data;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fwptr -= length;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project_id < 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "failed to find version instruction");
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2016-09-09 23:02:05 +08:00
|
|
|
/* Find project_id in table */
|
|
|
|
for (i = 0; i < ARRAY_SIZE(project_id_to_lmp_subver); i++) {
|
2021-01-27 11:01:52 +08:00
|
|
|
if (project_id == project_id_to_lmp_subver[i].id) {
|
|
|
|
btrtl_dev->project_id = project_id;
|
2016-09-09 23:02:05 +08:00
|
|
|
break;
|
2021-01-27 11:01:52 +08:00
|
|
|
}
|
2016-09-09 23:02:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i >= ARRAY_SIZE(project_id_to_lmp_subver)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "unknown project id %d", project_id);
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->ic_info->lmp_subver !=
|
|
|
|
project_id_to_lmp_subver[i].lmp_subver) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "firmware is for %x but this is a %x",
|
2018-08-02 22:57:14 +08:00
|
|
|
project_id_to_lmp_subver[i].lmp_subver,
|
|
|
|
btrtl_dev->ic_info->lmp_subver);
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
if (memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8) != 0) {
|
|
|
|
if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE_V2, 8))
|
|
|
|
return rtlbt_parse_firmware_v2(hdev, btrtl_dev, _buf);
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "bad EPATCH signature");
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
epatch_info = (struct rtl_epatch_header *)btrtl_dev->fw_data;
|
2015-05-14 16:49:09 +08:00
|
|
|
num_patches = le16_to_cpu(epatch_info->num_patches);
|
|
|
|
BT_DBG("fw_version=%x, num_patches=%d",
|
|
|
|
le32_to_cpu(epatch_info->fw_version), num_patches);
|
|
|
|
|
|
|
|
/* After the rtl_epatch_header there is a funky patch metadata section.
|
|
|
|
* Assuming 2 patches, the layout is:
|
|
|
|
* ChipID1 ChipID2 PatchLength1 PatchLength2 PatchOffset1 PatchOffset2
|
|
|
|
*
|
|
|
|
* Find the right patch for this chip.
|
|
|
|
*/
|
|
|
|
min_size += 8 * num_patches;
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->fw_len < min_size)
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
chip_id_base = btrtl_dev->fw_data + sizeof(struct rtl_epatch_header);
|
2015-05-14 16:49:09 +08:00
|
|
|
patch_length_base = chip_id_base + (sizeof(u16) * num_patches);
|
|
|
|
patch_offset_base = patch_length_base + (sizeof(u16) * num_patches);
|
|
|
|
for (i = 0; i < num_patches; i++) {
|
|
|
|
u16 chip_id = get_unaligned_le16(chip_id_base +
|
|
|
|
(i * sizeof(u16)));
|
2018-08-02 22:57:13 +08:00
|
|
|
if (chip_id == btrtl_dev->rom_version + 1) {
|
2015-05-14 16:49:09 +08:00
|
|
|
patch_length = get_unaligned_le16(patch_length_base +
|
|
|
|
(i * sizeof(u16)));
|
|
|
|
patch_offset = get_unaligned_le32(patch_offset_base +
|
|
|
|
(i * sizeof(u32)));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!patch_offset) {
|
2018-08-02 22:57:14 +08:00
|
|
|
rtl_dev_err(hdev, "didn't find patch for chip id %d",
|
|
|
|
btrtl_dev->rom_version);
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BT_DBG("length=%x offset=%x index %d", patch_length, patch_offset, i);
|
|
|
|
min_size = patch_offset + patch_length;
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->fw_len < min_size)
|
2015-05-14 16:49:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* Copy the firmware into a new buffer and write the version at
|
|
|
|
* the end.
|
|
|
|
*/
|
|
|
|
len = patch_length;
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
buf = kvmalloc(patch_length, GFP_KERNEL);
|
2015-05-14 16:49:09 +08:00
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
memcpy(buf, btrtl_dev->fw_data + patch_offset, patch_length - 4);
|
2015-05-14 16:49:09 +08:00
|
|
|
memcpy(buf + patch_length - 4, &epatch_info->fw_version, 4);
|
|
|
|
|
|
|
|
*_buf = buf;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl_download_firmware(struct hci_dev *hdev,
|
|
|
|
const unsigned char *data, int fw_len)
|
|
|
|
{
|
|
|
|
struct rtl_download_cmd *dl_cmd;
|
|
|
|
int frag_num = fw_len / RTL_FRAG_LEN + 1;
|
|
|
|
int frag_len = RTL_FRAG_LEN;
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
2023-04-17 10:33:58 +08:00
|
|
|
int j = 0;
|
2019-08-31 16:36:02 +08:00
|
|
|
struct sk_buff *skb;
|
|
|
|
struct hci_rp_read_local_version *rp;
|
2015-05-14 16:49:09 +08:00
|
|
|
|
|
|
|
dl_cmd = kmalloc(sizeof(struct rtl_download_cmd), GFP_KERNEL);
|
|
|
|
if (!dl_cmd)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
for (i = 0; i < frag_num; i++) {
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
dl_cmd->index = j++;
|
|
|
|
if (dl_cmd->index == 0x7f)
|
|
|
|
j = 1;
|
2019-09-05 13:21:57 +08:00
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
if (i == (frag_num - 1)) {
|
|
|
|
dl_cmd->index |= 0x80; /* data end */
|
|
|
|
frag_len = fw_len % RTL_FRAG_LEN;
|
|
|
|
}
|
2023-04-17 10:33:58 +08:00
|
|
|
rtl_dev_dbg(hdev, "download fw (%d/%d). index = %d", i,
|
|
|
|
frag_num, dl_cmd->index);
|
2015-05-14 16:49:09 +08:00
|
|
|
memcpy(dl_cmd->data, data, frag_len);
|
|
|
|
|
|
|
|
/* Send download command */
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd,
|
|
|
|
HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "download fw command failed (%ld)",
|
2018-08-02 22:57:14 +08:00
|
|
|
PTR_ERR(skb));
|
2019-09-18 16:56:41 +08:00
|
|
|
ret = PTR_ERR(skb);
|
2015-05-14 16:49:09 +08:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skb->len != sizeof(struct rtl_download_response)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "download fw event length mismatch");
|
2015-05-14 16:49:09 +08:00
|
|
|
kfree_skb(skb);
|
|
|
|
ret = -EIO;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
kfree_skb(skb);
|
|
|
|
data += RTL_FRAG_LEN;
|
|
|
|
}
|
|
|
|
|
2019-08-31 16:36:02 +08:00
|
|
|
skb = btrtl_read_local_version(hdev);
|
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
ret = PTR_ERR(skb);
|
|
|
|
rtl_dev_err(hdev, "read local version failed");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
rp = (struct hci_rp_read_local_version *)skb->data;
|
|
|
|
rtl_dev_info(hdev, "fw version 0x%04x%04x",
|
|
|
|
__le16_to_cpu(rp->hci_rev), __le16_to_cpu(rp->lmp_subver));
|
|
|
|
kfree_skb(skb);
|
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
out:
|
|
|
|
kfree(dl_cmd);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
|
2016-09-09 23:02:05 +08:00
|
|
|
{
|
|
|
|
const struct firmware *fw;
|
|
|
|
int ret;
|
|
|
|
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_info(hdev, "loading %s", name);
|
2016-09-09 23:02:05 +08:00
|
|
|
ret = request_firmware(&fw, name, &hdev->dev);
|
2017-02-20 10:04:57 +08:00
|
|
|
if (ret < 0)
|
2016-09-09 23:02:05 +08:00
|
|
|
return ret;
|
|
|
|
ret = fw->size;
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
*buff = kvmalloc(fw->size, GFP_KERNEL);
|
|
|
|
if (*buff)
|
|
|
|
memcpy(*buff, fw->data, ret);
|
|
|
|
else
|
2017-07-28 22:41:11 +08:00
|
|
|
ret = -ENOMEM;
|
2016-09-09 23:02:05 +08:00
|
|
|
|
|
|
|
release_firmware(fw);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
static int btrtl_setup_rtl8723a(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev)
|
2015-05-14 16:49:09 +08:00
|
|
|
{
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->fw_len < 8)
|
|
|
|
return -EINVAL;
|
2015-05-14 16:49:09 +08:00
|
|
|
|
|
|
|
/* Check that the firmware doesn't have the epatch signature
|
|
|
|
* (which is only for RTL8723B and newer).
|
|
|
|
*/
|
2018-08-02 22:57:13 +08:00
|
|
|
if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "unexpected EPATCH signature!");
|
2018-08-02 22:57:13 +08:00
|
|
|
return -EINVAL;
|
2015-05-14 16:49:09 +08:00
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
return rtl_download_firmware(hdev, btrtl_dev->fw_data,
|
|
|
|
btrtl_dev->fw_len);
|
2015-05-14 16:49:09 +08:00
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev)
|
2015-05-14 16:49:09 +08:00
|
|
|
{
|
|
|
|
unsigned char *fw_data = NULL;
|
|
|
|
int ret;
|
2016-09-09 23:02:05 +08:00
|
|
|
u8 *tbuff;
|
2015-05-14 16:49:09 +08:00
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data);
|
2015-05-14 16:49:09 +08:00
|
|
|
if (ret < 0)
|
|
|
|
goto out;
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
if (btrtl_dev->cfg_len > 0) {
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
tbuff = kvzalloc(ret + btrtl_dev->cfg_len, GFP_KERNEL);
|
2016-09-09 23:02:05 +08:00
|
|
|
if (!tbuff) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(tbuff, fw_data, ret);
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
kvfree(fw_data);
|
2016-09-09 23:02:05 +08:00
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
memcpy(tbuff + ret, btrtl_dev->cfg_data, btrtl_dev->cfg_len);
|
|
|
|
ret += btrtl_dev->cfg_len;
|
2016-09-09 23:02:05 +08:00
|
|
|
|
|
|
|
fw_data = tbuff;
|
|
|
|
}
|
|
|
|
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret);
|
2016-09-09 23:02:05 +08:00
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
ret = rtl_download_firmware(hdev, fw_data, ret);
|
|
|
|
|
|
|
|
out:
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
kvfree(fw_data);
|
2015-05-14 16:49:09 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2023-03-08 06:17:31 +08:00
|
|
|
static bool rtl_has_chip_type(u16 lmp_subver)
|
|
|
|
{
|
|
|
|
switch (lmp_subver) {
|
|
|
|
case RTL_ROM_LMP_8703B:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type)
|
|
|
|
{
|
|
|
|
struct rtl_chip_type_evt *chip_type;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
const unsigned char cmd_buf[] = {0x00, 0x94, 0xa0, 0x00, 0xb0};
|
|
|
|
|
|
|
|
/* Read RTL chip type command */
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
rtl_dev_err(hdev, "Read chip type failed (%ld)",
|
|
|
|
PTR_ERR(skb));
|
|
|
|
return PTR_ERR(skb);
|
|
|
|
}
|
|
|
|
|
|
|
|
chip_type = skb_pull_data(skb, sizeof(*chip_type));
|
|
|
|
if (!chip_type) {
|
|
|
|
rtl_dev_err(hdev, "RTL chip type event length mismatch");
|
|
|
|
kfree_skb(skb);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl_dev_info(hdev, "chip_type status=%x type=%x",
|
|
|
|
chip_type->status, chip_type->type);
|
|
|
|
|
|
|
|
*type = chip_type->type & 0x0f;
|
|
|
|
|
|
|
|
kfree_skb(skb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
void btrtl_free(struct btrtl_device_info *btrtl_dev)
|
|
|
|
{
|
2023-04-17 10:33:58 +08:00
|
|
|
struct rtl_subsection *entry, *tmp;
|
|
|
|
|
Bluetooth: btrtl: Use kvmalloc for FW allocations
Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:
Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>
As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.
This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2020-01-25 01:15:35 +08:00
|
|
|
kvfree(btrtl_dev->fw_data);
|
|
|
|
kvfree(btrtl_dev->cfg_data);
|
2023-04-17 10:33:58 +08:00
|
|
|
|
|
|
|
list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) {
|
|
|
|
list_del(&entry->list);
|
|
|
|
kfree(entry);
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
kfree(btrtl_dev);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(btrtl_free);
|
|
|
|
|
2018-08-02 22:57:17 +08:00
|
|
|
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
|
|
|
const char *postfix)
|
2015-05-14 16:49:09 +08:00
|
|
|
{
|
2018-08-02 22:57:13 +08:00
|
|
|
struct btrtl_device_info *btrtl_dev;
|
2015-05-14 16:49:09 +08:00
|
|
|
struct sk_buff *skb;
|
|
|
|
struct hci_rp_read_local_version *resp;
|
2018-08-02 22:57:17 +08:00
|
|
|
char cfg_name[40];
|
2018-02-12 02:24:33 +08:00
|
|
|
u16 hci_rev, lmp_subver;
|
2023-04-17 10:33:58 +08:00
|
|
|
u8 hci_ver, lmp_ver, chip_type = 0;
|
2018-08-02 22:57:13 +08:00
|
|
|
int ret;
|
2020-10-26 16:28:38 +08:00
|
|
|
u16 opcode;
|
|
|
|
u8 cmd[2];
|
2023-04-17 10:33:58 +08:00
|
|
|
u8 reg_val[2];
|
2018-08-02 22:57:13 +08:00
|
|
|
|
|
|
|
btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL);
|
|
|
|
if (!btrtl_dev) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto err_alloc;
|
|
|
|
}
|
2015-05-14 16:49:09 +08:00
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
INIT_LIST_HEAD(&btrtl_dev->patch_subsecs);
|
|
|
|
|
|
|
|
check_version:
|
|
|
|
ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_SUBVER, reg_val);
|
|
|
|
if (ret < 0)
|
|
|
|
goto err_free;
|
|
|
|
lmp_subver = get_unaligned_le16(reg_val);
|
|
|
|
|
|
|
|
if (lmp_subver == RTL_ROM_LMP_8822B) {
|
|
|
|
ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_REV, reg_val);
|
|
|
|
if (ret < 0)
|
|
|
|
goto err_free;
|
|
|
|
hci_rev = get_unaligned_le16(reg_val);
|
|
|
|
|
|
|
|
/* 8822E */
|
|
|
|
if (hci_rev == 0x000e) {
|
|
|
|
hci_ver = 0x0c;
|
|
|
|
lmp_ver = 0x0c;
|
|
|
|
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev,
|
|
|
|
hci_ver, hdev->bus,
|
|
|
|
chip_type);
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
skb = btrtl_read_local_version(hdev);
|
2018-08-02 22:57:13 +08:00
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
ret = PTR_ERR(skb);
|
|
|
|
goto err_free;
|
|
|
|
}
|
2015-05-14 16:49:09 +08:00
|
|
|
|
|
|
|
resp = (struct hci_rp_read_local_version *)skb->data;
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
hci_ver = resp->hci_ver;
|
|
|
|
hci_rev = le16_to_cpu(resp->hci_rev);
|
|
|
|
lmp_ver = resp->lmp_ver;
|
2015-05-14 16:49:09 +08:00
|
|
|
lmp_subver = le16_to_cpu(resp->lmp_subver);
|
2020-10-26 16:28:38 +08:00
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
kfree_skb(skb);
|
|
|
|
|
2023-03-08 06:17:31 +08:00
|
|
|
if (rtl_has_chip_type(lmp_subver)) {
|
|
|
|
ret = rtl_read_chip_type(hdev, &chip_type);
|
|
|
|
if (ret)
|
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
|
2021-09-30 18:36:34 +08:00
|
|
|
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
|
2023-03-08 06:17:31 +08:00
|
|
|
hdev->bus, chip_type);
|
2021-09-30 18:36:34 +08:00
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
next:
|
|
|
|
rtl_dev_info(hdev, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x",
|
|
|
|
hci_ver, hci_rev,
|
|
|
|
lmp_ver, lmp_subver);
|
|
|
|
|
|
|
|
if (!btrtl_dev->ic_info && !btrtl_dev->drop_fw)
|
2020-10-26 16:28:38 +08:00
|
|
|
btrtl_dev->drop_fw = true;
|
2023-04-17 10:33:58 +08:00
|
|
|
else
|
|
|
|
btrtl_dev->drop_fw = false;
|
2020-10-26 16:28:38 +08:00
|
|
|
|
|
|
|
if (btrtl_dev->drop_fw) {
|
|
|
|
opcode = hci_opcode_pack(0x3f, 0x66);
|
|
|
|
cmd[0] = opcode & 0xff;
|
|
|
|
cmd[1] = opcode >> 8;
|
|
|
|
|
|
|
|
skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL);
|
2020-11-10 20:39:15 +08:00
|
|
|
if (!skb)
|
2023-04-17 10:33:58 +08:00
|
|
|
goto err_free;
|
2020-10-26 16:28:38 +08:00
|
|
|
|
|
|
|
skb_put_data(skb, cmd, sizeof(cmd));
|
|
|
|
hci_skb_pkt_type(skb) = HCI_COMMAND_PKT;
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
ret = hdev->send(hdev, skb);
|
|
|
|
if (ret < 0) {
|
|
|
|
bt_dev_err(hdev, "sending frame failed (%d)", ret);
|
|
|
|
kfree_skb(skb);
|
|
|
|
goto err_free;
|
|
|
|
}
|
2020-10-26 16:28:38 +08:00
|
|
|
|
|
|
|
/* Ensure the above vendor command is sent to controller and
|
|
|
|
* process has done.
|
|
|
|
*/
|
|
|
|
msleep(200);
|
|
|
|
|
2023-04-17 10:33:58 +08:00
|
|
|
goto check_version;
|
2020-10-26 16:28:38 +08:00
|
|
|
}
|
2015-05-14 16:49:09 +08:00
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
if (!btrtl_dev->ic_info) {
|
2019-08-31 16:41:13 +08:00
|
|
|
rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
|
2018-08-02 22:57:16 +08:00
|
|
|
lmp_subver, hci_rev, hci_ver);
|
2019-01-27 16:33:59 +08:00
|
|
|
return btrtl_dev;
|
2018-08-02 22:57:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (btrtl_dev->ic_info->has_rom_version) {
|
|
|
|
ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version);
|
|
|
|
if (ret)
|
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
btrtl_dev->fw_len = rtl_load_file(hdev, btrtl_dev->ic_info->fw_name,
|
|
|
|
&btrtl_dev->fw_data);
|
|
|
|
if (btrtl_dev->fw_len < 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "firmware file %s not found",
|
2018-08-02 22:57:13 +08:00
|
|
|
btrtl_dev->ic_info->fw_name);
|
|
|
|
ret = btrtl_dev->fw_len;
|
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (btrtl_dev->ic_info->cfg_name) {
|
2018-08-02 22:57:17 +08:00
|
|
|
if (postfix) {
|
|
|
|
snprintf(cfg_name, sizeof(cfg_name), "%s-%s.bin",
|
|
|
|
btrtl_dev->ic_info->cfg_name, postfix);
|
|
|
|
} else {
|
|
|
|
snprintf(cfg_name, sizeof(cfg_name), "%s.bin",
|
|
|
|
btrtl_dev->ic_info->cfg_name);
|
|
|
|
}
|
|
|
|
btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
|
2018-08-02 22:57:13 +08:00
|
|
|
&btrtl_dev->cfg_data);
|
|
|
|
if (btrtl_dev->ic_info->config_needed &&
|
|
|
|
btrtl_dev->cfg_len <= 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "mandatory config file %s not found",
|
2018-08-02 22:57:13 +08:00
|
|
|
btrtl_dev->ic_info->cfg_name);
|
|
|
|
ret = btrtl_dev->cfg_len;
|
|
|
|
goto err_free;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-13 16:37:03 +08:00
|
|
|
/* The following chips supports the Microsoft vendor extension,
|
|
|
|
* therefore set the corresponding VsMsftOpCode.
|
2020-12-18 06:53:21 +08:00
|
|
|
*/
|
2021-09-29 02:10:50 +08:00
|
|
|
if (btrtl_dev->ic_info->has_msft_ext)
|
2020-12-18 06:53:21 +08:00
|
|
|
hci_set_msft_opcode(hdev, 0xFCF0);
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
return btrtl_dev;
|
|
|
|
|
|
|
|
err_free:
|
|
|
|
btrtl_free(btrtl_dev);
|
|
|
|
err_alloc:
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(btrtl_initialize);
|
|
|
|
|
|
|
|
int btrtl_download_firmware(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev)
|
|
|
|
{
|
2015-05-14 16:49:09 +08:00
|
|
|
/* Match a set of subver values that correspond to stock firmware,
|
|
|
|
* which is not compatible with standard btusb.
|
|
|
|
* If matched, upload an alternative firmware that does conform to
|
|
|
|
* standard btusb. Once that firmware is uploaded, the subver changes
|
|
|
|
* to a different value.
|
|
|
|
*/
|
2019-01-27 16:33:59 +08:00
|
|
|
if (!btrtl_dev->ic_info) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_info(hdev, "assuming no firmware upload needed");
|
2019-01-27 16:33:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-02 22:57:13 +08:00
|
|
|
switch (btrtl_dev->ic_info->lmp_subver) {
|
2015-05-14 16:49:09 +08:00
|
|
|
case RTL_ROM_LMP_8723A:
|
2018-08-02 22:57:13 +08:00
|
|
|
return btrtl_setup_rtl8723a(hdev, btrtl_dev);
|
2015-05-14 16:49:09 +08:00
|
|
|
case RTL_ROM_LMP_8723B:
|
|
|
|
case RTL_ROM_LMP_8821A:
|
|
|
|
case RTL_ROM_LMP_8761A:
|
2016-09-09 23:02:05 +08:00
|
|
|
case RTL_ROM_LMP_8822B:
|
2020-11-10 11:38:37 +08:00
|
|
|
case RTL_ROM_LMP_8852A:
|
2023-03-08 06:17:31 +08:00
|
|
|
case RTL_ROM_LMP_8703B:
|
2023-04-18 13:43:54 +08:00
|
|
|
case RTL_ROM_LMP_8851B:
|
2018-08-02 22:57:13 +08:00
|
|
|
return btrtl_setup_rtl8723b(hdev, btrtl_dev);
|
2015-05-14 16:49:09 +08:00
|
|
|
default:
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_info(hdev, "assuming no firmware upload needed");
|
2015-05-14 16:49:09 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2018-08-02 22:57:13 +08:00
|
|
|
EXPORT_SYMBOL_GPL(btrtl_download_firmware);
|
|
|
|
|
2021-05-27 15:19:54 +08:00
|
|
|
void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
|
2018-08-02 22:57:13 +08:00
|
|
|
{
|
2019-08-30 20:02:14 +08:00
|
|
|
/* Enable controller to do both LE scan and BR/EDR inquiry
|
|
|
|
* simultaneously.
|
|
|
|
*/
|
|
|
|
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
|
|
|
|
|
2020-12-23 02:16:27 +08:00
|
|
|
/* Enable central-peripheral role (able to create new connections with
|
|
|
|
* an existing connection in slave role).
|
|
|
|
*/
|
2021-01-27 11:01:52 +08:00
|
|
|
/* Enable WBS supported for the specific Realtek devices. */
|
|
|
|
switch (btrtl_dev->project_id) {
|
|
|
|
case CHIP_ID_8822C:
|
|
|
|
case CHIP_ID_8852A:
|
2022-03-14 14:54:22 +08:00
|
|
|
case CHIP_ID_8852B:
|
2022-04-11 17:19:57 +08:00
|
|
|
case CHIP_ID_8852C:
|
2023-04-18 13:43:54 +08:00
|
|
|
case CHIP_ID_8851B:
|
2020-12-23 02:16:27 +08:00
|
|
|
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
|
2021-01-27 11:01:52 +08:00
|
|
|
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
|
2022-10-05 16:43:31 +08:00
|
|
|
|
|
|
|
/* RTL8852C needs to transmit mSBC data continuously without
|
|
|
|
* the zero length of USB packets for the ALT 6 supported chips
|
|
|
|
*/
|
|
|
|
if (btrtl_dev->project_id == CHIP_ID_8852C)
|
|
|
|
btrealtek_set_flag(hdev, REALTEK_ALT6_CONTINUOUS_TX_CHIP);
|
|
|
|
|
2021-09-26 15:07:48 +08:00
|
|
|
hci_set_aosp_capable(hdev);
|
2020-12-23 02:16:27 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rtl_dev_dbg(hdev, "Central-peripheral role not enabled.");
|
2021-01-27 11:01:52 +08:00
|
|
|
rtl_dev_dbg(hdev, "WBS supported not enabled.");
|
2020-12-23 02:16:27 +08:00
|
|
|
break;
|
|
|
|
}
|
2023-03-08 06:17:31 +08:00
|
|
|
|
2023-03-21 19:48:26 +08:00
|
|
|
if (!btrtl_dev->ic_info)
|
|
|
|
return;
|
|
|
|
|
2023-03-08 06:17:31 +08:00
|
|
|
switch (btrtl_dev->ic_info->lmp_subver) {
|
|
|
|
case RTL_ROM_LMP_8703B:
|
|
|
|
/* 8723CS reports two pages for local ext features,
|
|
|
|
* but it doesn't support any features from page 2 -
|
|
|
|
* it either responds with garbage or with error status
|
|
|
|
*/
|
|
|
|
set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2,
|
|
|
|
&hdev->quirks);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2021-05-27 15:19:54 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(btrtl_set_quirks);
|
|
|
|
|
|
|
|
int btrtl_setup_realtek(struct hci_dev *hdev)
|
|
|
|
{
|
|
|
|
struct btrtl_device_info *btrtl_dev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
btrtl_dev = btrtl_initialize(hdev, NULL);
|
|
|
|
if (IS_ERR(btrtl_dev))
|
|
|
|
return PTR_ERR(btrtl_dev);
|
|
|
|
|
|
|
|
ret = btrtl_download_firmware(hdev, btrtl_dev);
|
|
|
|
|
|
|
|
btrtl_set_quirks(hdev, btrtl_dev);
|
2020-12-23 02:16:27 +08:00
|
|
|
|
|
|
|
btrtl_free(btrtl_dev);
|
2018-08-02 22:57:13 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2015-05-14 16:49:09 +08:00
|
|
|
EXPORT_SYMBOL_GPL(btrtl_setup_realtek);
|
|
|
|
|
2019-06-25 16:30:51 +08:00
|
|
|
int btrtl_shutdown_realtek(struct hci_dev *hdev)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* According to the vendor driver, BT must be reset on close to avoid
|
|
|
|
* firmware crash.
|
|
|
|
*/
|
|
|
|
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
|
|
|
|
if (IS_ERR(skb)) {
|
|
|
|
ret = PTR_ERR(skb);
|
|
|
|
bt_dev_err(hdev, "HCI reset during shutdown failed");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
kfree_skb(skb);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(btrtl_shutdown_realtek);
|
|
|
|
|
2018-08-02 22:57:15 +08:00
|
|
|
static unsigned int btrtl_convert_baudrate(u32 device_baudrate)
|
|
|
|
{
|
|
|
|
switch (device_baudrate) {
|
|
|
|
case 0x0252a00a:
|
|
|
|
return 230400;
|
|
|
|
|
|
|
|
case 0x05f75004:
|
|
|
|
return 921600;
|
|
|
|
|
|
|
|
case 0x00005004:
|
|
|
|
return 1000000;
|
|
|
|
|
|
|
|
case 0x04928002:
|
|
|
|
case 0x01128002:
|
|
|
|
return 1500000;
|
|
|
|
|
|
|
|
case 0x00005002:
|
|
|
|
return 2000000;
|
|
|
|
|
|
|
|
case 0x0000b001:
|
|
|
|
return 2500000;
|
|
|
|
|
|
|
|
case 0x04928001:
|
|
|
|
return 3000000;
|
|
|
|
|
|
|
|
case 0x052a6001:
|
|
|
|
return 3500000;
|
|
|
|
|
|
|
|
case 0x00005001:
|
|
|
|
return 4000000;
|
|
|
|
|
|
|
|
case 0x0252c014:
|
|
|
|
default:
|
|
|
|
return 115200;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int btrtl_get_uart_settings(struct hci_dev *hdev,
|
|
|
|
struct btrtl_device_info *btrtl_dev,
|
|
|
|
unsigned int *controller_baudrate,
|
|
|
|
u32 *device_baudrate, bool *flow_control)
|
|
|
|
{
|
|
|
|
struct rtl_vendor_config *config;
|
|
|
|
struct rtl_vendor_config_entry *entry;
|
|
|
|
int i, total_data_len;
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
total_data_len = btrtl_dev->cfg_len - sizeof(*config);
|
|
|
|
if (total_data_len <= 0) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_warn(hdev, "no config loaded");
|
2018-08-02 22:57:15 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
config = (struct rtl_vendor_config *)btrtl_dev->cfg_data;
|
|
|
|
if (le32_to_cpu(config->signature) != RTL_CONFIG_MAGIC) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "invalid config magic");
|
2018-08-02 22:57:15 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (total_data_len < le16_to_cpu(config->total_len)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "config is too short");
|
2018-08-02 22:57:15 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < total_data_len; ) {
|
|
|
|
entry = ((void *)config->entry) + i;
|
|
|
|
|
|
|
|
switch (le16_to_cpu(entry->offset)) {
|
|
|
|
case 0xc:
|
|
|
|
if (entry->len < sizeof(*device_baudrate)) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "invalid UART config entry");
|
2018-08-02 22:57:15 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*device_baudrate = get_unaligned_le32(entry->data);
|
|
|
|
*controller_baudrate = btrtl_convert_baudrate(
|
|
|
|
*device_baudrate);
|
|
|
|
|
|
|
|
if (entry->len >= 13)
|
|
|
|
*flow_control = !!(entry->data[12] & BIT(2));
|
|
|
|
else
|
|
|
|
*flow_control = false;
|
|
|
|
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)",
|
2018-08-02 22:57:15 +08:00
|
|
|
le16_to_cpu(entry->offset), entry->len);
|
|
|
|
break;
|
2019-10-25 17:26:53 +08:00
|
|
|
}
|
2018-08-02 22:57:15 +08:00
|
|
|
|
|
|
|
i += sizeof(*entry) + entry->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_err(hdev, "no UART config entry found");
|
2018-08-02 22:57:15 +08:00
|
|
|
return -ENOENT;
|
|
|
|
}
|
|
|
|
|
2019-08-31 16:46:11 +08:00
|
|
|
rtl_dev_dbg(hdev, "device baudrate = 0x%08x", *device_baudrate);
|
|
|
|
rtl_dev_dbg(hdev, "controller baudrate = %u", *controller_baudrate);
|
|
|
|
rtl_dev_dbg(hdev, "flow control %d", *flow_control);
|
2018-08-02 22:57:15 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(btrtl_get_uart_settings);
|
|
|
|
|
2015-05-14 16:49:09 +08:00
|
|
|
MODULE_AUTHOR("Daniel Drake <drake@endlessm.com>");
|
|
|
|
MODULE_DESCRIPTION("Bluetooth support for Realtek devices ver " VERSION);
|
|
|
|
MODULE_VERSION(VERSION);
|
|
|
|
MODULE_LICENSE("GPL");
|
2018-08-02 22:57:12 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723a_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
|
2018-08-02 22:57:16 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
|
2023-03-08 06:17:31 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin");
|
2023-05-10 03:51:19 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723d_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723d_config.bin");
|
2018-08-02 22:57:16 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
|
2018-08-02 22:57:12 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761a_config.bin");
|
2023-05-10 03:51:19 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761b_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761b_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761bu_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8761bu_config.bin");
|
2018-08-02 22:57:12 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821a_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821a_config.bin");
|
2023-05-10 03:51:19 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821c_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821c_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821cs_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8821cs_config.bin");
|
2018-08-02 22:57:12 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822b_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822b_config.bin");
|
2023-05-10 03:51:19 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822cs_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822cs_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822cu_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8822cu_config.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin");
|
2020-11-10 11:38:37 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852au_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852au_config.bin");
|
2023-02-22 17:47:20 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852bs_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852bs_config.bin");
|
2022-03-14 14:54:22 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852bu_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852bu_config.bin");
|
2022-04-11 17:19:57 +08:00
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852cu_fw.bin");
|
|
|
|
MODULE_FIRMWARE("rtl_bt/rtl8852cu_config.bin");
|