1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Bluetooth support for Realtek devices
5 * Copyright (C) 2015 Endless Mobile, Inc.
8 #include <linux/module.h>
9 #include <linux/firmware.h>
10 #include <linux/unaligned.h>
11 #include <linux/usb.h>
13 #include <net/bluetooth/bluetooth.h>
14 #include <net/bluetooth/hci_core.h>
20 #define RTL_CHIP_8723CS_CG 3
21 #define RTL_CHIP_8723CS_VF 4
22 #define RTL_CHIP_8723CS_XX 5
23 #define RTL_EPATCH_SIGNATURE "Realtech"
24 #define RTL_EPATCH_SIGNATURE_V2 "RTBTCore"
25 #define RTL_ROM_LMP_8703B 0x8703
26 #define RTL_ROM_LMP_8723A 0x1200
27 #define RTL_ROM_LMP_8723B 0x8723
28 #define RTL_ROM_LMP_8821A 0x8821
29 #define RTL_ROM_LMP_8761A 0x8761
30 #define RTL_ROM_LMP_8822B 0x8822
31 #define RTL_ROM_LMP_8852A 0x8852
32 #define RTL_ROM_LMP_8851B 0x8851
33 #define RTL_ROM_LMP_8922A 0x8922
34 #define RTL_CONFIG_MAGIC 0x8723ab55
36 #define RTL_VSC_OP_COREDUMP 0xfcff
38 #define IC_MATCH_FL_LMPSUBV (1 << 0)
39 #define IC_MATCH_FL_HCIREV (1 << 1)
40 #define IC_MATCH_FL_HCIVER (1 << 2)
41 #define IC_MATCH_FL_HCIBUS (1 << 3)
42 #define IC_MATCH_FL_CHIP_TYPE (1 << 4)
43 #define IC_INFO(lmps, hcir, hciv, bus) \
44 .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \
45 IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
46 .lmp_subver = (lmps), \
51 #define RTL_CHIP_SUBVER (&(struct rtl_vendor_cmd) {{0x10, 0x38, 0x04, 0x28, 0x80}})
52 #define RTL_CHIP_REV (&(struct rtl_vendor_cmd) {{0x10, 0x3A, 0x04, 0x28, 0x80}})
53 #define RTL_SEC_PROJ (&(struct rtl_vendor_cmd) {{0x10, 0xA4, 0x0D, 0x00, 0xb0}})
55 #define RTL_PATCH_SNIPPETS 0x01
56 #define RTL_PATCH_DUMMY_HEADER 0x02
57 #define RTL_PATCH_SECURITY_HEADER 0x03
92 struct btrtl_device_info
{
93 const struct id_table
*ic_info
;
102 struct list_head patch_subsecs
;
105 static const struct id_table ic_id_table
[] = {
107 { IC_INFO(RTL_ROM_LMP_8723A
, 0xb, 0x6, HCI_USB
),
108 .config_needed
= false,
109 .has_rom_version
= false,
110 .fw_name
= "rtl_bt/rtl8723a_fw",
112 .hw_info
= "rtl8723au" },
115 { IC_INFO(RTL_ROM_LMP_8723B
, 0xb, 0x6, HCI_UART
),
116 .config_needed
= true,
117 .has_rom_version
= true,
118 .fw_name
= "rtl_bt/rtl8723bs_fw",
119 .cfg_name
= "rtl_bt/rtl8723bs_config",
120 .hw_info
= "rtl8723bs" },
123 { IC_INFO(RTL_ROM_LMP_8723B
, 0xb, 0x6, HCI_USB
),
124 .config_needed
= false,
125 .has_rom_version
= true,
126 .fw_name
= "rtl_bt/rtl8723b_fw",
127 .cfg_name
= "rtl_bt/rtl8723b_config",
128 .hw_info
= "rtl8723bu" },
131 { .match_flags
= IC_MATCH_FL_LMPSUBV
| IC_MATCH_FL_CHIP_TYPE
|
133 .lmp_subver
= RTL_ROM_LMP_8703B
,
134 .chip_type
= RTL_CHIP_8723CS_CG
,
136 .config_needed
= true,
137 .has_rom_version
= true,
138 .fw_name
= "rtl_bt/rtl8723cs_cg_fw",
139 .cfg_name
= "rtl_bt/rtl8723cs_cg_config",
140 .hw_info
= "rtl8723cs-cg" },
143 { .match_flags
= IC_MATCH_FL_LMPSUBV
| IC_MATCH_FL_CHIP_TYPE
|
145 .lmp_subver
= RTL_ROM_LMP_8703B
,
146 .chip_type
= RTL_CHIP_8723CS_VF
,
148 .config_needed
= true,
149 .has_rom_version
= true,
150 .fw_name
= "rtl_bt/rtl8723cs_vf_fw",
151 .cfg_name
= "rtl_bt/rtl8723cs_vf_config",
152 .hw_info
= "rtl8723cs-vf" },
155 { .match_flags
= IC_MATCH_FL_LMPSUBV
| IC_MATCH_FL_CHIP_TYPE
|
157 .lmp_subver
= RTL_ROM_LMP_8703B
,
158 .chip_type
= RTL_CHIP_8723CS_XX
,
160 .config_needed
= true,
161 .has_rom_version
= true,
162 .fw_name
= "rtl_bt/rtl8723cs_xx_fw",
163 .cfg_name
= "rtl_bt/rtl8723cs_xx_config",
164 .hw_info
= "rtl8723cs" },
167 { IC_INFO(RTL_ROM_LMP_8723B
, 0xd, 0x8, HCI_USB
),
168 .config_needed
= true,
169 .has_rom_version
= true,
170 .fw_name
= "rtl_bt/rtl8723d_fw",
171 .cfg_name
= "rtl_bt/rtl8723d_config",
172 .hw_info
= "rtl8723du" },
175 { IC_INFO(RTL_ROM_LMP_8723B
, 0xd, 0x8, HCI_UART
),
176 .config_needed
= true,
177 .has_rom_version
= true,
178 .fw_name
= "rtl_bt/rtl8723ds_fw",
179 .cfg_name
= "rtl_bt/rtl8723ds_config",
180 .hw_info
= "rtl8723ds" },
183 { IC_INFO(RTL_ROM_LMP_8821A
, 0xa, 0x6, HCI_USB
),
184 .config_needed
= false,
185 .has_rom_version
= true,
186 .fw_name
= "rtl_bt/rtl8821a_fw",
187 .cfg_name
= "rtl_bt/rtl8821a_config",
188 .hw_info
= "rtl8821au" },
191 { IC_INFO(RTL_ROM_LMP_8821A
, 0xc, 0x8, HCI_USB
),
192 .config_needed
= false,
193 .has_rom_version
= true,
194 .has_msft_ext
= true,
195 .fw_name
= "rtl_bt/rtl8821c_fw",
196 .cfg_name
= "rtl_bt/rtl8821c_config",
197 .hw_info
= "rtl8821cu" },
200 { IC_INFO(RTL_ROM_LMP_8821A
, 0xc, 0x8, HCI_UART
),
201 .config_needed
= true,
202 .has_rom_version
= true,
203 .has_msft_ext
= true,
204 .fw_name
= "rtl_bt/rtl8821cs_fw",
205 .cfg_name
= "rtl_bt/rtl8821cs_config",
206 .hw_info
= "rtl8821cs" },
209 { IC_INFO(RTL_ROM_LMP_8761A
, 0xa, 0x6, HCI_USB
),
210 .config_needed
= false,
211 .has_rom_version
= true,
212 .fw_name
= "rtl_bt/rtl8761a_fw",
213 .cfg_name
= "rtl_bt/rtl8761a_config",
214 .hw_info
= "rtl8761au" },
217 { IC_INFO(RTL_ROM_LMP_8761A
, 0xb, 0xa, HCI_UART
),
218 .config_needed
= false,
219 .has_rom_version
= true,
220 .has_msft_ext
= true,
221 .fw_name
= "rtl_bt/rtl8761b_fw",
222 .cfg_name
= "rtl_bt/rtl8761b_config",
223 .hw_info
= "rtl8761btv" },
226 { IC_INFO(RTL_ROM_LMP_8761A
, 0xb, 0xa, HCI_USB
),
227 .config_needed
= false,
228 .has_rom_version
= true,
229 .fw_name
= "rtl_bt/rtl8761bu_fw",
230 .cfg_name
= "rtl_bt/rtl8761bu_config",
231 .hw_info
= "rtl8761bu" },
233 /* 8822C with UART interface */
234 { IC_INFO(RTL_ROM_LMP_8822B
, 0xc, 0x8, HCI_UART
),
235 .config_needed
= true,
236 .has_rom_version
= true,
237 .has_msft_ext
= true,
238 .fw_name
= "rtl_bt/rtl8822cs_fw",
239 .cfg_name
= "rtl_bt/rtl8822cs_config",
240 .hw_info
= "rtl8822cs" },
242 /* 8822C with UART interface */
243 { IC_INFO(RTL_ROM_LMP_8822B
, 0xc, 0xa, HCI_UART
),
244 .config_needed
= true,
245 .has_rom_version
= true,
246 .has_msft_ext
= true,
247 .fw_name
= "rtl_bt/rtl8822cs_fw",
248 .cfg_name
= "rtl_bt/rtl8822cs_config",
249 .hw_info
= "rtl8822cs" },
251 /* 8822C with USB interface */
252 { IC_INFO(RTL_ROM_LMP_8822B
, 0xc, 0xa, HCI_USB
),
253 .config_needed
= false,
254 .has_rom_version
= true,
255 .has_msft_ext
= true,
256 .fw_name
= "rtl_bt/rtl8822cu_fw",
257 .cfg_name
= "rtl_bt/rtl8822cu_config",
258 .hw_info
= "rtl8822cu" },
261 { IC_INFO(RTL_ROM_LMP_8822B
, 0xb, 0x7, HCI_USB
),
262 .config_needed
= true,
263 .has_rom_version
= true,
264 .has_msft_ext
= true,
265 .fw_name
= "rtl_bt/rtl8822b_fw",
266 .cfg_name
= "rtl_bt/rtl8822b_config",
267 .hw_info
= "rtl8822bu" },
270 { IC_INFO(RTL_ROM_LMP_8852A
, 0xa, 0xb, HCI_USB
),
271 .config_needed
= false,
272 .has_rom_version
= true,
273 .has_msft_ext
= true,
274 .fw_name
= "rtl_bt/rtl8852au_fw",
275 .cfg_name
= "rtl_bt/rtl8852au_config",
276 .hw_info
= "rtl8852au" },
278 /* 8852B with UART interface */
279 { IC_INFO(RTL_ROM_LMP_8852A
, 0xb, 0xb, HCI_UART
),
280 .config_needed
= true,
281 .has_rom_version
= true,
282 .has_msft_ext
= true,
283 .fw_name
= "rtl_bt/rtl8852bs_fw",
284 .cfg_name
= "rtl_bt/rtl8852bs_config",
285 .hw_info
= "rtl8852bs" },
288 { IC_INFO(RTL_ROM_LMP_8852A
, 0xb, 0xb, HCI_USB
),
289 .config_needed
= false,
290 .has_rom_version
= true,
291 .has_msft_ext
= true,
292 .fw_name
= "rtl_bt/rtl8852bu_fw",
293 .cfg_name
= "rtl_bt/rtl8852bu_config",
294 .hw_info
= "rtl8852bu" },
297 { IC_INFO(RTL_ROM_LMP_8852A
, 0xc, 0xc, HCI_USB
),
298 .config_needed
= false,
299 .has_rom_version
= true,
300 .has_msft_ext
= true,
301 .fw_name
= "rtl_bt/rtl8852cu_fw",
302 .cfg_name
= "rtl_bt/rtl8852cu_config",
303 .hw_info
= "rtl8852cu" },
306 { IC_INFO(RTL_ROM_LMP_8851B
, 0xb, 0xc, HCI_USB
),
307 .config_needed
= false,
308 .has_rom_version
= true,
309 .has_msft_ext
= false,
310 .fw_name
= "rtl_bt/rtl8851bu_fw",
311 .cfg_name
= "rtl_bt/rtl8851bu_config",
312 .hw_info
= "rtl8851bu" },
315 { IC_INFO(RTL_ROM_LMP_8922A
, 0xa, 0xc, HCI_USB
),
316 .config_needed
= false,
317 .has_rom_version
= true,
318 .has_msft_ext
= true,
319 .fw_name
= "rtl_bt/rtl8922au_fw",
320 .cfg_name
= "rtl_bt/rtl8922au_config",
321 .hw_info
= "rtl8922au" },
323 /* 8852BT/8852BE-VT */
324 { IC_INFO(RTL_ROM_LMP_8852A
, 0x87, 0xc, HCI_USB
),
325 .config_needed
= false,
326 .has_rom_version
= true,
327 .has_msft_ext
= true,
328 .fw_name
= "rtl_bt/rtl8852btu_fw",
329 .cfg_name
= "rtl_bt/rtl8852btu_config",
330 .hw_info
= "rtl8852btu" },
333 static const struct id_table
*btrtl_match_ic(u16 lmp_subver
, u16 hci_rev
,
334 u8 hci_ver
, u8 hci_bus
,
339 for (i
= 0; i
< ARRAY_SIZE(ic_id_table
); i
++) {
340 if ((ic_id_table
[i
].match_flags
& IC_MATCH_FL_LMPSUBV
) &&
341 (ic_id_table
[i
].lmp_subver
!= lmp_subver
))
343 if ((ic_id_table
[i
].match_flags
& IC_MATCH_FL_HCIREV
) &&
344 (ic_id_table
[i
].hci_rev
!= hci_rev
))
346 if ((ic_id_table
[i
].match_flags
& IC_MATCH_FL_HCIVER
) &&
347 (ic_id_table
[i
].hci_ver
!= hci_ver
))
349 if ((ic_id_table
[i
].match_flags
& IC_MATCH_FL_HCIBUS
) &&
350 (ic_id_table
[i
].hci_bus
!= hci_bus
))
352 if ((ic_id_table
[i
].match_flags
& IC_MATCH_FL_CHIP_TYPE
) &&
353 (ic_id_table
[i
].chip_type
!= chip_type
))
358 if (i
>= ARRAY_SIZE(ic_id_table
))
361 return &ic_id_table
[i
];
364 static struct sk_buff
*btrtl_read_local_version(struct hci_dev
*hdev
)
368 skb
= __hci_cmd_sync(hdev
, HCI_OP_READ_LOCAL_VERSION
, 0, NULL
,
371 rtl_dev_err(hdev
, "HCI_OP_READ_LOCAL_VERSION failed (%ld)",
376 if (skb
->len
!= sizeof(struct hci_rp_read_local_version
)) {
377 rtl_dev_err(hdev
, "HCI_OP_READ_LOCAL_VERSION event length mismatch");
379 return ERR_PTR(-EIO
);
385 static int rtl_read_rom_version(struct hci_dev
*hdev
, u8
*version
)
387 struct rtl_rom_version_evt
*rom_version
;
390 /* Read RTL ROM version command */
391 skb
= __hci_cmd_sync(hdev
, 0xfc6d, 0, NULL
, HCI_INIT_TIMEOUT
);
393 rtl_dev_err(hdev
, "Read ROM version failed (%ld)",
398 if (skb
->len
!= sizeof(*rom_version
)) {
399 rtl_dev_err(hdev
, "version event length mismatch");
404 rom_version
= (struct rtl_rom_version_evt
*)skb
->data
;
405 rtl_dev_info(hdev
, "rom_version status=%x version=%x",
406 rom_version
->status
, rom_version
->version
);
408 *version
= rom_version
->version
;
414 static int btrtl_vendor_read_reg16(struct hci_dev
*hdev
,
415 struct rtl_vendor_cmd
*cmd
, u8
*rp
)
420 skb
= __hci_cmd_sync(hdev
, 0xfc61, sizeof(*cmd
), cmd
,
424 rtl_dev_err(hdev
, "RTL: Read reg16 failed (%d)", err
);
428 if (skb
->len
!= 3 || skb
->data
[0]) {
429 bt_dev_err(hdev
, "RTL: Read reg16 length mismatch");
435 memcpy(rp
, skb
->data
+ 1, 2);
442 static void *rtl_iov_pull_data(struct rtl_iovec
*iov
, u32 len
)
444 void *data
= iov
->data
;
455 static void btrtl_insert_ordered_subsec(struct rtl_subsection
*node
,
456 struct btrtl_device_info
*btrtl_dev
)
458 struct list_head
*pos
;
459 struct list_head
*next
;
460 struct rtl_subsection
*subsec
;
462 list_for_each_safe(pos
, next
, &btrtl_dev
->patch_subsecs
) {
463 subsec
= list_entry(pos
, struct rtl_subsection
, list
);
464 if (subsec
->prio
>= node
->prio
)
467 __list_add(&node
->list
, pos
->prev
, pos
);
470 static int btrtl_parse_section(struct hci_dev
*hdev
,
471 struct btrtl_device_info
*btrtl_dev
, u32 opcode
,
474 struct rtl_section_hdr
*hdr
;
475 struct rtl_subsection
*subsec
;
476 struct rtl_common_subsec
*common_subsec
;
477 struct rtl_sec_hdr
*sec_hdr
;
483 struct rtl_iovec iov
= {
488 hdr
= rtl_iov_pull_data(&iov
, sizeof(*hdr
));
491 num_subsecs
= le16_to_cpu(hdr
->num
);
493 for (i
= 0; i
< num_subsecs
; i
++) {
494 common_subsec
= rtl_iov_pull_data(&iov
, sizeof(*common_subsec
));
497 subsec_len
= le32_to_cpu(common_subsec
->len
);
499 rtl_dev_dbg(hdev
, "subsec, eco 0x%02x, len %08x",
500 common_subsec
->eco
, subsec_len
);
502 ptr
= rtl_iov_pull_data(&iov
, subsec_len
);
506 if (common_subsec
->eco
!= btrtl_dev
->rom_version
+ 1)
510 case RTL_PATCH_SECURITY_HEADER
:
511 sec_hdr
= (void *)common_subsec
;
512 if (sec_hdr
->key_id
!= btrtl_dev
->key_id
)
517 subsec
= kzalloc(sizeof(*subsec
), GFP_KERNEL
);
520 subsec
->opcode
= opcode
;
521 subsec
->prio
= common_subsec
->prio
;
522 subsec
->len
= subsec_len
;
524 btrtl_insert_ordered_subsec(subsec
, btrtl_dev
);
531 static int rtlbt_parse_firmware_v2(struct hci_dev
*hdev
,
532 struct btrtl_device_info
*btrtl_dev
,
533 unsigned char **_buf
)
535 struct rtl_epatch_header_v2
*hdr
;
540 struct rtl_section
*section
;
541 struct rtl_subsection
*entry
, *tmp
;
547 struct rtl_iovec iov
= {
548 .data
= btrtl_dev
->fw_data
,
549 .len
= btrtl_dev
->fw_len
- 7, /* Cut the tail */
552 rc
= btrtl_vendor_read_reg16(hdev
, RTL_SEC_PROJ
, reg_val
);
557 rtl_dev_dbg(hdev
, "%s: key id %u", __func__
, key_id
);
559 btrtl_dev
->key_id
= key_id
;
561 hdr
= rtl_iov_pull_data(&iov
, sizeof(*hdr
));
564 num_sections
= le32_to_cpu(hdr
->num_sections
);
566 rtl_dev_dbg(hdev
, "FW version %08x-%08x", *((u32
*)hdr
->fw_version
),
567 *((u32
*)(hdr
->fw_version
+ 4)));
569 for (i
= 0; i
< num_sections
; i
++) {
570 section
= rtl_iov_pull_data(&iov
, sizeof(*section
));
573 section_len
= le32_to_cpu(section
->len
);
574 opcode
= le32_to_cpu(section
->opcode
);
576 rtl_dev_dbg(hdev
, "opcode 0x%04x", section
->opcode
);
578 ptr
= rtl_iov_pull_data(&iov
, section_len
);
583 case RTL_PATCH_SNIPPETS
:
584 rc
= btrtl_parse_section(hdev
, btrtl_dev
, opcode
,
587 case RTL_PATCH_SECURITY_HEADER
:
588 /* If key_id from chip is zero, ignore all security
593 rc
= btrtl_parse_section(hdev
, btrtl_dev
, opcode
,
596 case RTL_PATCH_DUMMY_HEADER
:
597 rc
= btrtl_parse_section(hdev
, btrtl_dev
, opcode
,
605 rtl_dev_err(hdev
, "RTL: Parse section (%u) err %d",
615 /* Allocate mem and copy all found subsecs. */
616 ptr
= kvmalloc(len
, GFP_KERNEL
);
621 list_for_each_entry_safe(entry
, tmp
, &btrtl_dev
->patch_subsecs
, list
) {
622 rtl_dev_dbg(hdev
, "RTL: opcode %08x, addr %p, len 0x%x",
623 entry
->opcode
, entry
->data
, entry
->len
);
624 memcpy(ptr
+ len
, entry
->data
, entry
->len
);
635 static int rtlbt_parse_firmware(struct hci_dev
*hdev
,
636 struct btrtl_device_info
*btrtl_dev
,
637 unsigned char **_buf
)
639 static const u8 extension_sig
[] = { 0x51, 0x04, 0xfd, 0x77 };
640 struct btrealtek_data
*coredump_info
= hci_get_priv(hdev
);
641 struct rtl_epatch_header
*epatch_info
;
645 u8 opcode
, length
, data
;
647 const unsigned char *fwptr
, *chip_id_base
;
648 const unsigned char *patch_length_base
, *patch_offset_base
;
649 u32 patch_offset
= 0;
650 u16 patch_length
, num_patches
;
651 static const struct {
654 } project_id_to_lmp_subver
[] = {
655 { RTL_ROM_LMP_8723A
, 0 },
656 { RTL_ROM_LMP_8723B
, 1 },
657 { RTL_ROM_LMP_8821A
, 2 },
658 { RTL_ROM_LMP_8761A
, 3 },
659 { RTL_ROM_LMP_8703B
, 7 },
660 { RTL_ROM_LMP_8822B
, 8 },
661 { RTL_ROM_LMP_8723B
, 9 }, /* 8723D */
662 { RTL_ROM_LMP_8821A
, 10 }, /* 8821C */
663 { RTL_ROM_LMP_8822B
, 13 }, /* 8822C */
664 { RTL_ROM_LMP_8761A
, 14 }, /* 8761B */
665 { RTL_ROM_LMP_8852A
, 18 }, /* 8852A */
666 { RTL_ROM_LMP_8852A
, 20 }, /* 8852B */
667 { RTL_ROM_LMP_8852A
, 25 }, /* 8852C */
668 { RTL_ROM_LMP_8851B
, 36 }, /* 8851B */
669 { RTL_ROM_LMP_8922A
, 44 }, /* 8922A */
670 { RTL_ROM_LMP_8852A
, 47 }, /* 8852BT */
673 if (btrtl_dev
->fw_len
<= 8)
676 if (!memcmp(btrtl_dev
->fw_data
, RTL_EPATCH_SIGNATURE
, 8))
677 min_size
= sizeof(struct rtl_epatch_header
) +
678 sizeof(extension_sig
) + 3;
679 else if (!memcmp(btrtl_dev
->fw_data
, RTL_EPATCH_SIGNATURE_V2
, 8))
680 min_size
= sizeof(struct rtl_epatch_header_v2
) +
681 sizeof(extension_sig
) + 3;
685 if (btrtl_dev
->fw_len
< min_size
)
688 fwptr
= btrtl_dev
->fw_data
+ btrtl_dev
->fw_len
- sizeof(extension_sig
);
689 if (memcmp(fwptr
, extension_sig
, sizeof(extension_sig
)) != 0) {
690 rtl_dev_err(hdev
, "extension section signature mismatch");
694 /* Loop from the end of the firmware parsing instructions, until
695 * we find an instruction that identifies the "project ID" for the
696 * hardware supported by this firwmare file.
697 * Once we have that, we double-check that project_id is suitable
698 * for the hardware we are working with.
700 while (fwptr
>= btrtl_dev
->fw_data
+ (sizeof(*epatch_info
) + 3)) {
705 BT_DBG("check op=%x len=%x data=%x", opcode
, length
, data
);
707 if (opcode
== 0xff) /* EOF */
711 rtl_dev_err(hdev
, "found instruction with length 0");
715 if (opcode
== 0 && length
== 1) {
723 if (project_id
< 0) {
724 rtl_dev_err(hdev
, "failed to find version instruction");
728 /* Find project_id in table */
729 for (i
= 0; i
< ARRAY_SIZE(project_id_to_lmp_subver
); i
++) {
730 if (project_id
== project_id_to_lmp_subver
[i
].id
) {
731 btrtl_dev
->project_id
= project_id
;
736 if (i
>= ARRAY_SIZE(project_id_to_lmp_subver
)) {
737 rtl_dev_err(hdev
, "unknown project id %d", project_id
);
741 if (btrtl_dev
->ic_info
->lmp_subver
!=
742 project_id_to_lmp_subver
[i
].lmp_subver
) {
743 rtl_dev_err(hdev
, "firmware is for %x but this is a %x",
744 project_id_to_lmp_subver
[i
].lmp_subver
,
745 btrtl_dev
->ic_info
->lmp_subver
);
749 if (memcmp(btrtl_dev
->fw_data
, RTL_EPATCH_SIGNATURE
, 8) != 0) {
750 if (!memcmp(btrtl_dev
->fw_data
, RTL_EPATCH_SIGNATURE_V2
, 8))
751 return rtlbt_parse_firmware_v2(hdev
, btrtl_dev
, _buf
);
752 rtl_dev_err(hdev
, "bad EPATCH signature");
756 epatch_info
= (struct rtl_epatch_header
*)btrtl_dev
->fw_data
;
757 num_patches
= le16_to_cpu(epatch_info
->num_patches
);
759 BT_DBG("fw_version=%x, num_patches=%d",
760 le32_to_cpu(epatch_info
->fw_version
), num_patches
);
761 coredump_info
->rtl_dump
.fw_version
= le32_to_cpu(epatch_info
->fw_version
);
763 /* After the rtl_epatch_header there is a funky patch metadata section.
764 * Assuming 2 patches, the layout is:
765 * ChipID1 ChipID2 PatchLength1 PatchLength2 PatchOffset1 PatchOffset2
767 * Find the right patch for this chip.
769 min_size
+= 8 * num_patches
;
770 if (btrtl_dev
->fw_len
< min_size
)
773 chip_id_base
= btrtl_dev
->fw_data
+ sizeof(struct rtl_epatch_header
);
774 patch_length_base
= chip_id_base
+ (sizeof(u16
) * num_patches
);
775 patch_offset_base
= patch_length_base
+ (sizeof(u16
) * num_patches
);
776 for (i
= 0; i
< num_patches
; i
++) {
777 u16 chip_id
= get_unaligned_le16(chip_id_base
+
779 if (chip_id
== btrtl_dev
->rom_version
+ 1) {
780 patch_length
= get_unaligned_le16(patch_length_base
+
782 patch_offset
= get_unaligned_le32(patch_offset_base
+
789 rtl_dev_err(hdev
, "didn't find patch for chip id %d",
790 btrtl_dev
->rom_version
);
794 BT_DBG("length=%x offset=%x index %d", patch_length
, patch_offset
, i
);
795 min_size
= patch_offset
+ patch_length
;
796 if (btrtl_dev
->fw_len
< min_size
)
799 /* Copy the firmware into a new buffer and write the version at
803 buf
= kvmalloc(patch_length
, GFP_KERNEL
);
807 memcpy(buf
, btrtl_dev
->fw_data
+ patch_offset
, patch_length
- 4);
808 memcpy(buf
+ patch_length
- 4, &epatch_info
->fw_version
, 4);
814 static int rtl_download_firmware(struct hci_dev
*hdev
,
815 const unsigned char *data
, int fw_len
)
817 struct rtl_download_cmd
*dl_cmd
;
818 int frag_num
= fw_len
/ RTL_FRAG_LEN
+ 1;
819 int frag_len
= RTL_FRAG_LEN
;
824 struct hci_rp_read_local_version
*rp
;
826 dl_cmd
= kmalloc(sizeof(*dl_cmd
), GFP_KERNEL
);
830 for (i
= 0; i
< frag_num
; i
++) {
834 if (dl_cmd
->index
== 0x7f)
837 if (i
== (frag_num
- 1)) {
838 dl_cmd
->index
|= 0x80; /* data end */
839 frag_len
= fw_len
% RTL_FRAG_LEN
;
841 rtl_dev_dbg(hdev
, "download fw (%d/%d). index = %d", i
,
842 frag_num
, dl_cmd
->index
);
843 memcpy(dl_cmd
->data
, data
, frag_len
);
845 /* Send download command */
846 skb
= __hci_cmd_sync(hdev
, 0xfc20, frag_len
+ 1, dl_cmd
,
849 rtl_dev_err(hdev
, "download fw command failed (%ld)",
855 if (skb
->len
!= sizeof(struct rtl_download_response
)) {
856 rtl_dev_err(hdev
, "download fw event length mismatch");
863 data
+= RTL_FRAG_LEN
;
866 skb
= btrtl_read_local_version(hdev
);
869 rtl_dev_err(hdev
, "read local version failed");
873 rp
= (struct hci_rp_read_local_version
*)skb
->data
;
874 rtl_dev_info(hdev
, "fw version 0x%04x%04x",
875 __le16_to_cpu(rp
->hci_rev
), __le16_to_cpu(rp
->lmp_subver
));
883 static int rtl_load_file(struct hci_dev
*hdev
, const char *name
, u8
**buff
)
885 const struct firmware
*fw
;
888 rtl_dev_info(hdev
, "loading %s", name
);
889 ret
= request_firmware(&fw
, name
, &hdev
->dev
);
893 *buff
= kvmemdup(fw
->data
, fw
->size
, GFP_KERNEL
);
897 release_firmware(fw
);
902 static int btrtl_setup_rtl8723a(struct hci_dev
*hdev
,
903 struct btrtl_device_info
*btrtl_dev
)
905 if (btrtl_dev
->fw_len
< 8)
908 /* Check that the firmware doesn't have the epatch signature
909 * (which is only for RTL8723B and newer).
911 if (!memcmp(btrtl_dev
->fw_data
, RTL_EPATCH_SIGNATURE
, 8)) {
912 rtl_dev_err(hdev
, "unexpected EPATCH signature!");
916 return rtl_download_firmware(hdev
, btrtl_dev
->fw_data
,
920 static int btrtl_setup_rtl8723b(struct hci_dev
*hdev
,
921 struct btrtl_device_info
*btrtl_dev
)
923 unsigned char *fw_data
= NULL
;
927 ret
= rtlbt_parse_firmware(hdev
, btrtl_dev
, &fw_data
);
931 if (btrtl_dev
->cfg_len
> 0) {
932 tbuff
= kvzalloc(ret
+ btrtl_dev
->cfg_len
, GFP_KERNEL
);
938 memcpy(tbuff
, fw_data
, ret
);
941 memcpy(tbuff
+ ret
, btrtl_dev
->cfg_data
, btrtl_dev
->cfg_len
);
942 ret
+= btrtl_dev
->cfg_len
;
947 rtl_dev_info(hdev
, "cfg_sz %d, total sz %d", btrtl_dev
->cfg_len
, ret
);
949 ret
= rtl_download_firmware(hdev
, fw_data
, ret
);
956 static void btrtl_coredump(struct hci_dev
*hdev
)
958 static const u8 param
[] = { 0x00, 0x00 };
960 __hci_cmd_send(hdev
, RTL_VSC_OP_COREDUMP
, sizeof(param
), param
);
963 static void btrtl_dmp_hdr(struct hci_dev
*hdev
, struct sk_buff
*skb
)
965 struct btrealtek_data
*coredump_info
= hci_get_priv(hdev
);
968 if (coredump_info
->rtl_dump
.controller
)
969 snprintf(buf
, sizeof(buf
), "Controller Name: %s\n",
970 coredump_info
->rtl_dump
.controller
);
972 snprintf(buf
, sizeof(buf
), "Controller Name: Unknown\n");
973 skb_put_data(skb
, buf
, strlen(buf
));
975 snprintf(buf
, sizeof(buf
), "Firmware Version: 0x%X\n",
976 coredump_info
->rtl_dump
.fw_version
);
977 skb_put_data(skb
, buf
, strlen(buf
));
979 snprintf(buf
, sizeof(buf
), "Driver: %s\n", coredump_info
->rtl_dump
.driver_name
);
980 skb_put_data(skb
, buf
, strlen(buf
));
982 snprintf(buf
, sizeof(buf
), "Vendor: Realtek\n");
983 skb_put_data(skb
, buf
, strlen(buf
));
986 static void btrtl_register_devcoredump_support(struct hci_dev
*hdev
)
988 hci_devcd_register(hdev
, btrtl_coredump
, btrtl_dmp_hdr
, NULL
);
992 void btrtl_set_driver_name(struct hci_dev
*hdev
, const char *driver_name
)
994 struct btrealtek_data
*coredump_info
= hci_get_priv(hdev
);
996 coredump_info
->rtl_dump
.driver_name
= driver_name
;
998 EXPORT_SYMBOL_GPL(btrtl_set_driver_name
);
1000 static bool rtl_has_chip_type(u16 lmp_subver
)
1002 switch (lmp_subver
) {
1003 case RTL_ROM_LMP_8703B
:
1012 static int rtl_read_chip_type(struct hci_dev
*hdev
, u8
*type
)
1014 struct rtl_chip_type_evt
*chip_type
;
1015 struct sk_buff
*skb
;
1016 const unsigned char cmd_buf
[] = {0x00, 0x94, 0xa0, 0x00, 0xb0};
1018 /* Read RTL chip type command */
1019 skb
= __hci_cmd_sync(hdev
, 0xfc61, 5, cmd_buf
, HCI_INIT_TIMEOUT
);
1021 rtl_dev_err(hdev
, "Read chip type failed (%ld)",
1023 return PTR_ERR(skb
);
1026 chip_type
= skb_pull_data(skb
, sizeof(*chip_type
));
1028 rtl_dev_err(hdev
, "RTL chip type event length mismatch");
1033 rtl_dev_info(hdev
, "chip_type status=%x type=%x",
1034 chip_type
->status
, chip_type
->type
);
1036 *type
= chip_type
->type
& 0x0f;
1042 void btrtl_free(struct btrtl_device_info
*btrtl_dev
)
1044 struct rtl_subsection
*entry
, *tmp
;
1046 kvfree(btrtl_dev
->fw_data
);
1047 kvfree(btrtl_dev
->cfg_data
);
1049 list_for_each_entry_safe(entry
, tmp
, &btrtl_dev
->patch_subsecs
, list
) {
1050 list_del(&entry
->list
);
1056 EXPORT_SYMBOL_GPL(btrtl_free
);
1058 struct btrtl_device_info
*btrtl_initialize(struct hci_dev
*hdev
,
1059 const char *postfix
)
1061 struct btrealtek_data
*coredump_info
= hci_get_priv(hdev
);
1062 struct btrtl_device_info
*btrtl_dev
;
1063 struct sk_buff
*skb
;
1064 struct hci_rp_read_local_version
*resp
;
1065 struct hci_command_hdr
*cmd
;
1068 u16 hci_rev
, lmp_subver
;
1069 u8 hci_ver
, lmp_ver
, chip_type
= 0;
1073 btrtl_dev
= kzalloc(sizeof(*btrtl_dev
), GFP_KERNEL
);
1079 INIT_LIST_HEAD(&btrtl_dev
->patch_subsecs
);
1082 ret
= btrtl_vendor_read_reg16(hdev
, RTL_CHIP_SUBVER
, reg_val
);
1085 lmp_subver
= get_unaligned_le16(reg_val
);
1087 if (lmp_subver
== RTL_ROM_LMP_8822B
) {
1088 ret
= btrtl_vendor_read_reg16(hdev
, RTL_CHIP_REV
, reg_val
);
1091 hci_rev
= get_unaligned_le16(reg_val
);
1094 if (hci_rev
== 0x000e) {
1097 btrtl_dev
->ic_info
= btrtl_match_ic(lmp_subver
, hci_rev
,
1104 skb
= btrtl_read_local_version(hdev
);
1110 resp
= (struct hci_rp_read_local_version
*)skb
->data
;
1112 hci_ver
= resp
->hci_ver
;
1113 hci_rev
= le16_to_cpu(resp
->hci_rev
);
1114 lmp_ver
= resp
->lmp_ver
;
1115 lmp_subver
= le16_to_cpu(resp
->lmp_subver
);
1119 if (rtl_has_chip_type(lmp_subver
)) {
1120 ret
= rtl_read_chip_type(hdev
, &chip_type
);
1125 btrtl_dev
->ic_info
= btrtl_match_ic(lmp_subver
, hci_rev
, hci_ver
,
1126 hdev
->bus
, chip_type
);
1129 rtl_dev_info(hdev
, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x",
1131 lmp_ver
, lmp_subver
);
1133 if (!btrtl_dev
->ic_info
&& !btrtl_dev
->drop_fw
)
1134 btrtl_dev
->drop_fw
= true;
1136 btrtl_dev
->drop_fw
= false;
1138 if (btrtl_dev
->drop_fw
) {
1139 skb
= bt_skb_alloc(sizeof(*cmd
), GFP_KERNEL
);
1143 cmd
= skb_put(skb
, HCI_COMMAND_HDR_SIZE
);
1144 cmd
->opcode
= cpu_to_le16(0xfc66);
1147 hci_skb_pkt_type(skb
) = HCI_COMMAND_PKT
;
1149 ret
= hdev
->send(hdev
, skb
);
1151 bt_dev_err(hdev
, "sending frame failed (%d)", ret
);
1156 /* Ensure the above vendor command is sent to controller and
1164 if (!btrtl_dev
->ic_info
) {
1165 rtl_dev_info(hdev
, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
1166 lmp_subver
, hci_rev
, hci_ver
);
1170 if (btrtl_dev
->ic_info
->has_rom_version
) {
1171 ret
= rtl_read_rom_version(hdev
, &btrtl_dev
->rom_version
);
1176 if (!btrtl_dev
->ic_info
->fw_name
) {
1181 btrtl_dev
->fw_len
= -EIO
;
1182 if (lmp_subver
== RTL_ROM_LMP_8852A
&& hci_rev
== 0x000c) {
1183 snprintf(fw_name
, sizeof(fw_name
), "%s_v2.bin",
1184 btrtl_dev
->ic_info
->fw_name
);
1185 btrtl_dev
->fw_len
= rtl_load_file(hdev
, fw_name
,
1186 &btrtl_dev
->fw_data
);
1189 if (btrtl_dev
->fw_len
< 0) {
1190 snprintf(fw_name
, sizeof(fw_name
), "%s.bin",
1191 btrtl_dev
->ic_info
->fw_name
);
1192 btrtl_dev
->fw_len
= rtl_load_file(hdev
, fw_name
,
1193 &btrtl_dev
->fw_data
);
1196 if (btrtl_dev
->fw_len
< 0) {
1197 rtl_dev_err(hdev
, "firmware file %s not found",
1198 btrtl_dev
->ic_info
->fw_name
);
1199 ret
= btrtl_dev
->fw_len
;
1203 if (btrtl_dev
->ic_info
->cfg_name
) {
1205 snprintf(cfg_name
, sizeof(cfg_name
), "%s-%s.bin",
1206 btrtl_dev
->ic_info
->cfg_name
, postfix
);
1208 snprintf(cfg_name
, sizeof(cfg_name
), "%s.bin",
1209 btrtl_dev
->ic_info
->cfg_name
);
1211 btrtl_dev
->cfg_len
= rtl_load_file(hdev
, cfg_name
,
1212 &btrtl_dev
->cfg_data
);
1213 if (btrtl_dev
->ic_info
->config_needed
&&
1214 btrtl_dev
->cfg_len
<= 0) {
1215 rtl_dev_err(hdev
, "mandatory config file %s not found",
1216 btrtl_dev
->ic_info
->cfg_name
);
1217 ret
= btrtl_dev
->cfg_len
;
1222 /* The following chips supports the Microsoft vendor extension,
1223 * therefore set the corresponding VsMsftOpCode.
1225 if (btrtl_dev
->ic_info
->has_msft_ext
)
1226 hci_set_msft_opcode(hdev
, 0xFCF0);
1228 if (btrtl_dev
->ic_info
)
1229 coredump_info
->rtl_dump
.controller
= btrtl_dev
->ic_info
->hw_info
;
1234 btrtl_free(btrtl_dev
);
1236 return ERR_PTR(ret
);
1238 EXPORT_SYMBOL_GPL(btrtl_initialize
);
1240 int btrtl_download_firmware(struct hci_dev
*hdev
,
1241 struct btrtl_device_info
*btrtl_dev
)
1245 /* Match a set of subver values that correspond to stock firmware,
1246 * which is not compatible with standard btusb.
1247 * If matched, upload an alternative firmware that does conform to
1248 * standard btusb. Once that firmware is uploaded, the subver changes
1249 * to a different value.
1251 if (!btrtl_dev
->ic_info
) {
1252 rtl_dev_info(hdev
, "assuming no firmware upload needed");
1257 switch (btrtl_dev
->ic_info
->lmp_subver
) {
1258 case RTL_ROM_LMP_8723A
:
1259 err
= btrtl_setup_rtl8723a(hdev
, btrtl_dev
);
1261 case RTL_ROM_LMP_8723B
:
1262 case RTL_ROM_LMP_8821A
:
1263 case RTL_ROM_LMP_8761A
:
1264 case RTL_ROM_LMP_8822B
:
1265 case RTL_ROM_LMP_8852A
:
1266 case RTL_ROM_LMP_8703B
:
1267 case RTL_ROM_LMP_8851B
:
1268 case RTL_ROM_LMP_8922A
:
1269 err
= btrtl_setup_rtl8723b(hdev
, btrtl_dev
);
1272 rtl_dev_info(hdev
, "assuming no firmware upload needed");
1277 btrtl_register_devcoredump_support(hdev
);
1281 EXPORT_SYMBOL_GPL(btrtl_download_firmware
);
1283 void btrtl_set_quirks(struct hci_dev
*hdev
, struct btrtl_device_info
*btrtl_dev
)
1285 /* Enable controller to do both LE scan and BR/EDR inquiry
1288 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY
, &hdev
->quirks
);
1290 /* Enable central-peripheral role (able to create new connections with
1291 * an existing connection in slave role).
1293 /* Enable WBS supported for the specific Realtek devices. */
1294 switch (btrtl_dev
->project_id
) {
1301 case CHIP_ID_8852BT
:
1302 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED
, &hdev
->quirks
);
1304 /* RTL8852C needs to transmit mSBC data continuously without
1305 * the zero length of USB packets for the ALT 6 supported chips
1307 if (btrtl_dev
->project_id
== CHIP_ID_8852C
)
1308 btrealtek_set_flag(hdev
, REALTEK_ALT6_CONTINUOUS_TX_CHIP
);
1310 if (btrtl_dev
->project_id
== CHIP_ID_8852A
||
1311 btrtl_dev
->project_id
== CHIP_ID_8852B
||
1312 btrtl_dev
->project_id
== CHIP_ID_8852C
)
1313 set_bit(HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER
, &hdev
->quirks
);
1315 hci_set_aosp_capable(hdev
);
1318 rtl_dev_dbg(hdev
, "Central-peripheral role not enabled.");
1319 rtl_dev_dbg(hdev
, "WBS supported not enabled.");
1323 if (!btrtl_dev
->ic_info
)
1326 switch (btrtl_dev
->ic_info
->lmp_subver
) {
1327 case RTL_ROM_LMP_8703B
:
1328 /* 8723CS reports two pages for local ext features,
1329 * but it doesn't support any features from page 2 -
1330 * it either responds with garbage or with error status
1332 set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2
,
1339 EXPORT_SYMBOL_GPL(btrtl_set_quirks
);
1341 int btrtl_setup_realtek(struct hci_dev
*hdev
)
1343 struct btrtl_device_info
*btrtl_dev
;
1346 btrtl_dev
= btrtl_initialize(hdev
, NULL
);
1347 if (IS_ERR(btrtl_dev
))
1348 return PTR_ERR(btrtl_dev
);
1350 ret
= btrtl_download_firmware(hdev
, btrtl_dev
);
1352 btrtl_set_quirks(hdev
, btrtl_dev
);
1354 hci_set_hw_info(hdev
,
1355 "RTL lmp_subver=%u hci_rev=%u hci_ver=%u hci_bus=%u",
1356 btrtl_dev
->ic_info
->lmp_subver
,
1357 btrtl_dev
->ic_info
->hci_rev
,
1358 btrtl_dev
->ic_info
->hci_ver
,
1359 btrtl_dev
->ic_info
->hci_bus
);
1361 btrtl_free(btrtl_dev
);
1364 EXPORT_SYMBOL_GPL(btrtl_setup_realtek
);
1366 int btrtl_shutdown_realtek(struct hci_dev
*hdev
)
1368 struct sk_buff
*skb
;
1371 /* According to the vendor driver, BT must be reset on close to avoid
1374 skb
= __hci_cmd_sync(hdev
, HCI_OP_RESET
, 0, NULL
, HCI_CMD_TIMEOUT
);
1377 bt_dev_err(hdev
, "HCI reset during shutdown failed");
1384 EXPORT_SYMBOL_GPL(btrtl_shutdown_realtek
);
1386 static unsigned int btrtl_convert_baudrate(u32 device_baudrate
)
1388 switch (device_baudrate
) {
1423 int btrtl_get_uart_settings(struct hci_dev
*hdev
,
1424 struct btrtl_device_info
*btrtl_dev
,
1425 unsigned int *controller_baudrate
,
1426 u32
*device_baudrate
, bool *flow_control
)
1428 struct rtl_vendor_config
*config
;
1429 struct rtl_vendor_config_entry
*entry
;
1430 int i
, total_data_len
;
1433 total_data_len
= btrtl_dev
->cfg_len
- sizeof(*config
);
1434 if (total_data_len
<= 0) {
1435 rtl_dev_warn(hdev
, "no config loaded");
1439 config
= (struct rtl_vendor_config
*)btrtl_dev
->cfg_data
;
1440 if (le32_to_cpu(config
->signature
) != RTL_CONFIG_MAGIC
) {
1441 rtl_dev_err(hdev
, "invalid config magic");
1445 if (total_data_len
< le16_to_cpu(config
->total_len
)) {
1446 rtl_dev_err(hdev
, "config is too short");
1450 for (i
= 0; i
< total_data_len
; ) {
1451 entry
= ((void *)config
->entry
) + i
;
1453 switch (le16_to_cpu(entry
->offset
)) {
1455 if (entry
->len
< sizeof(*device_baudrate
)) {
1456 rtl_dev_err(hdev
, "invalid UART config entry");
1460 *device_baudrate
= get_unaligned_le32(entry
->data
);
1461 *controller_baudrate
= btrtl_convert_baudrate(
1464 if (entry
->len
>= 13)
1465 *flow_control
= !!(entry
->data
[12] & BIT(2));
1467 *flow_control
= false;
1473 rtl_dev_dbg(hdev
, "skipping config entry 0x%x (len %u)",
1474 le16_to_cpu(entry
->offset
), entry
->len
);
1478 i
+= sizeof(*entry
) + entry
->len
;
1482 rtl_dev_err(hdev
, "no UART config entry found");
1486 rtl_dev_dbg(hdev
, "device baudrate = 0x%08x", *device_baudrate
);
1487 rtl_dev_dbg(hdev
, "controller baudrate = %u", *controller_baudrate
);
1488 rtl_dev_dbg(hdev
, "flow control %d", *flow_control
);
1492 EXPORT_SYMBOL_GPL(btrtl_get_uart_settings
);
1494 MODULE_AUTHOR("Daniel Drake <drake@endlessm.com>");
1495 MODULE_DESCRIPTION("Bluetooth support for Realtek devices ver " VERSION
);
1496 MODULE_VERSION(VERSION
);
1497 MODULE_LICENSE("GPL");
1498 MODULE_FIRMWARE("rtl_bt/rtl8723a_fw.bin");
1499 MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
1500 MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
1501 MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
1502 MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
1503 MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin");
1504 MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin");
1505 MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin");
1506 MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin");
1507 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin");
1508 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin");
1509 MODULE_FIRMWARE("rtl_bt/rtl8723d_fw.bin");
1510 MODULE_FIRMWARE("rtl_bt/rtl8723d_config.bin");
1511 MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin");
1512 MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
1513 MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
1514 MODULE_FIRMWARE("rtl_bt/rtl8761a_config.bin");
1515 MODULE_FIRMWARE("rtl_bt/rtl8761b_fw.bin");
1516 MODULE_FIRMWARE("rtl_bt/rtl8761b_config.bin");
1517 MODULE_FIRMWARE("rtl_bt/rtl8761bu_fw.bin");
1518 MODULE_FIRMWARE("rtl_bt/rtl8761bu_config.bin");
1519 MODULE_FIRMWARE("rtl_bt/rtl8821a_fw.bin");
1520 MODULE_FIRMWARE("rtl_bt/rtl8821a_config.bin");
1521 MODULE_FIRMWARE("rtl_bt/rtl8821c_fw.bin");
1522 MODULE_FIRMWARE("rtl_bt/rtl8821c_config.bin");
1523 MODULE_FIRMWARE("rtl_bt/rtl8821cs_fw.bin");
1524 MODULE_FIRMWARE("rtl_bt/rtl8821cs_config.bin");
1525 MODULE_FIRMWARE("rtl_bt/rtl8822b_fw.bin");
1526 MODULE_FIRMWARE("rtl_bt/rtl8822b_config.bin");
1527 MODULE_FIRMWARE("rtl_bt/rtl8822cs_fw.bin");
1528 MODULE_FIRMWARE("rtl_bt/rtl8822cs_config.bin");
1529 MODULE_FIRMWARE("rtl_bt/rtl8822cu_fw.bin");
1530 MODULE_FIRMWARE("rtl_bt/rtl8822cu_config.bin");
1531 MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin");
1532 MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin");
1533 MODULE_FIRMWARE("rtl_bt/rtl8852au_fw.bin");
1534 MODULE_FIRMWARE("rtl_bt/rtl8852au_config.bin");
1535 MODULE_FIRMWARE("rtl_bt/rtl8852bs_fw.bin");
1536 MODULE_FIRMWARE("rtl_bt/rtl8852bs_config.bin");
1537 MODULE_FIRMWARE("rtl_bt/rtl8852bu_fw.bin");
1538 MODULE_FIRMWARE("rtl_bt/rtl8852bu_config.bin");
1539 MODULE_FIRMWARE("rtl_bt/rtl8852btu_fw.bin");
1540 MODULE_FIRMWARE("rtl_bt/rtl8852btu_config.bin");
1541 MODULE_FIRMWARE("rtl_bt/rtl8852cu_fw.bin");
1542 MODULE_FIRMWARE("rtl_bt/rtl8852cu_fw_v2.bin");
1543 MODULE_FIRMWARE("rtl_bt/rtl8852cu_config.bin");
1544 MODULE_FIRMWARE("rtl_bt/rtl8922au_fw.bin");
1545 MODULE_FIRMWARE("rtl_bt/rtl8922au_config.bin");