mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-17 04:04:55 +00:00
Bluetooth: btrtl: Add support for a config filename postfix
The contents of the rtl_bt/rtlXXXX_config.bin file may be board specific allow the caller of btrtl_initialize to specify a postfix identifying the board, which if specified will make btrtl_initialize look for rtl_bt/rtlXXXX_config-<postfix>.bin instead. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
c50903e3ee
commit
1cc194caaf
2 changed files with 24 additions and 14 deletions
|
|
@ -89,21 +89,21 @@ static const struct id_table ic_id_table[] = {
|
||||||
.config_needed = true,
|
.config_needed = true,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8723bs_fw.bin",
|
.fw_name = "rtl_bt/rtl8723bs_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8723bs_config.bin" },
|
.cfg_name = "rtl_bt/rtl8723bs_config" },
|
||||||
|
|
||||||
/* 8723B */
|
/* 8723B */
|
||||||
{ IC_INFO(RTL_ROM_LMP_8723B, 0xb),
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xb),
|
||||||
.config_needed = false,
|
.config_needed = false,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8723b_fw.bin",
|
.fw_name = "rtl_bt/rtl8723b_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8723b_config.bin" },
|
.cfg_name = "rtl_bt/rtl8723b_config" },
|
||||||
|
|
||||||
/* 8723D */
|
/* 8723D */
|
||||||
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd),
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd),
|
||||||
.config_needed = true,
|
.config_needed = true,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8723d_fw.bin",
|
.fw_name = "rtl_bt/rtl8723d_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8723d_config.bin" },
|
.cfg_name = "rtl_bt/rtl8723d_config" },
|
||||||
|
|
||||||
/* 8723DS */
|
/* 8723DS */
|
||||||
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
|
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
|
||||||
|
|
@ -115,35 +115,35 @@ static const struct id_table ic_id_table[] = {
|
||||||
.config_needed = true,
|
.config_needed = true,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8723ds_fw.bin",
|
.fw_name = "rtl_bt/rtl8723ds_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8723ds_config.bin" },
|
.cfg_name = "rtl_bt/rtl8723ds_config" },
|
||||||
|
|
||||||
/* 8821A */
|
/* 8821A */
|
||||||
{ IC_INFO(RTL_ROM_LMP_8821A, 0xa),
|
{ IC_INFO(RTL_ROM_LMP_8821A, 0xa),
|
||||||
.config_needed = false,
|
.config_needed = false,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8821a_fw.bin",
|
.fw_name = "rtl_bt/rtl8821a_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8821a_config.bin" },
|
.cfg_name = "rtl_bt/rtl8821a_config" },
|
||||||
|
|
||||||
/* 8821C */
|
/* 8821C */
|
||||||
{ IC_INFO(RTL_ROM_LMP_8821A, 0xc),
|
{ IC_INFO(RTL_ROM_LMP_8821A, 0xc),
|
||||||
.config_needed = false,
|
.config_needed = false,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8821c_fw.bin",
|
.fw_name = "rtl_bt/rtl8821c_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8821c_config.bin" },
|
.cfg_name = "rtl_bt/rtl8821c_config" },
|
||||||
|
|
||||||
/* 8761A */
|
/* 8761A */
|
||||||
{ IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0,
|
{ IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0,
|
||||||
.config_needed = false,
|
.config_needed = false,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8761a_fw.bin",
|
.fw_name = "rtl_bt/rtl8761a_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8761a_config.bin" },
|
.cfg_name = "rtl_bt/rtl8761a_config" },
|
||||||
|
|
||||||
/* 8822B */
|
/* 8822B */
|
||||||
{ IC_INFO(RTL_ROM_LMP_8822B, 0xb),
|
{ IC_INFO(RTL_ROM_LMP_8822B, 0xb),
|
||||||
.config_needed = true,
|
.config_needed = true,
|
||||||
.has_rom_version = true,
|
.has_rom_version = true,
|
||||||
.fw_name = "rtl_bt/rtl8822b_fw.bin",
|
.fw_name = "rtl_bt/rtl8822b_fw.bin",
|
||||||
.cfg_name = "rtl_bt/rtl8822b_config.bin" },
|
.cfg_name = "rtl_bt/rtl8822b_config" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
|
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
|
||||||
|
|
@ -507,11 +507,13 @@ void btrtl_free(struct btrtl_device_info *btrtl_dev)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(btrtl_free);
|
EXPORT_SYMBOL_GPL(btrtl_free);
|
||||||
|
|
||||||
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev)
|
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||||
|
const char *postfix)
|
||||||
{
|
{
|
||||||
struct btrtl_device_info *btrtl_dev;
|
struct btrtl_device_info *btrtl_dev;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct hci_rp_read_local_version *resp;
|
struct hci_rp_read_local_version *resp;
|
||||||
|
char cfg_name[40];
|
||||||
u16 hci_rev, lmp_subver;
|
u16 hci_rev, lmp_subver;
|
||||||
u8 hci_ver;
|
u8 hci_ver;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -564,8 +566,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btrtl_dev->ic_info->cfg_name) {
|
if (btrtl_dev->ic_info->cfg_name) {
|
||||||
btrtl_dev->cfg_len = rtl_load_file(hdev,
|
if (postfix) {
|
||||||
btrtl_dev->ic_info->cfg_name,
|
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,
|
||||||
&btrtl_dev->cfg_data);
|
&btrtl_dev->cfg_data);
|
||||||
if (btrtl_dev->ic_info->config_needed &&
|
if (btrtl_dev->ic_info->config_needed &&
|
||||||
btrtl_dev->cfg_len <= 0) {
|
btrtl_dev->cfg_len <= 0) {
|
||||||
|
|
@ -615,7 +623,7 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
|
||||||
struct btrtl_device_info *btrtl_dev;
|
struct btrtl_device_info *btrtl_dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
btrtl_dev = btrtl_initialize(hdev);
|
btrtl_dev = btrtl_initialize(hdev, NULL);
|
||||||
if (IS_ERR(btrtl_dev))
|
if (IS_ERR(btrtl_dev))
|
||||||
return PTR_ERR(btrtl_dev);
|
return PTR_ERR(btrtl_dev);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ struct rtl_vendor_config {
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_BT_RTL)
|
#if IS_ENABLED(CONFIG_BT_RTL)
|
||||||
|
|
||||||
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev);
|
struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||||
|
const char *postfix);
|
||||||
void btrtl_free(struct btrtl_device_info *btrtl_dev);
|
void btrtl_free(struct btrtl_device_info *btrtl_dev);
|
||||||
int btrtl_download_firmware(struct hci_dev *hdev,
|
int btrtl_download_firmware(struct hci_dev *hdev,
|
||||||
struct btrtl_device_info *btrtl_dev);
|
struct btrtl_device_info *btrtl_dev);
|
||||||
|
|
@ -71,7 +72,8 @@ int btrtl_get_uart_settings(struct hci_dev *hdev,
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev)
|
static inline struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||||
|
const char *postfix)
|
||||||
{
|
{
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue