mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
wifi: rtw89: fw: add fw_def struct to put firmware name and format version
The RTL8922DE has a RTL8922DE-VS variant which uses different firmware name and format version, and the rule to select firmware type will be needed to extend. Prepare for coming patches. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260213061552.29997-2-pkshih@realtek.com
This commit is contained in:
parent
c95323ea9d
commit
abaa59fb24
|
|
@ -6753,7 +6753,8 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
|||
bool support_mlo;
|
||||
bool no_chanctx;
|
||||
|
||||
firmware = rtw89_early_fw_feature_recognize(device, chip, &early_fw, &fw_format);
|
||||
firmware = rtw89_early_fw_feature_recognize(device, chip, variant,
|
||||
&early_fw, &fw_format);
|
||||
|
||||
ops = kmemdup(&rtw89_ops, sizeof(rtw89_ops), GFP_KERNEL);
|
||||
if (!ops)
|
||||
|
|
|
|||
|
|
@ -4152,6 +4152,11 @@ struct rtw89_reg_imr {
|
|||
u32 set;
|
||||
};
|
||||
|
||||
struct rtw89_fw_def {
|
||||
const char *fw_basename;
|
||||
u8 fw_format_max;
|
||||
};
|
||||
|
||||
struct rtw89_phy_table {
|
||||
const struct rtw89_reg2_def *regs;
|
||||
u32 n_regs;
|
||||
|
|
@ -4494,8 +4499,7 @@ struct rtw89_chip_info {
|
|||
const struct rtw89_chip_ops *ops;
|
||||
const struct rtw89_mac_gen_def *mac_def;
|
||||
const struct rtw89_phy_gen_def *phy_def;
|
||||
const char *fw_basename;
|
||||
u8 fw_format_max;
|
||||
struct rtw89_fw_def fw_def;
|
||||
bool try_ce_fw;
|
||||
u8 bbmcu_nr;
|
||||
u32 needed_fw_elms;
|
||||
|
|
@ -4633,6 +4637,7 @@ struct rtw89_chip_info {
|
|||
struct rtw89_chip_variant {
|
||||
bool no_mcs_12_13: 1;
|
||||
u32 fw_min_ver_code;
|
||||
const struct rtw89_fw_def *fw_def_override;
|
||||
};
|
||||
|
||||
union rtw89_bus_info {
|
||||
|
|
@ -7379,6 +7384,22 @@ void rtw89_chip_calc_rx_gain_normal(struct rtw89_dev *rtwdev,
|
|||
chip->ops->calc_rx_gain_normal(rtwdev, chan, path, phy_idx, calc);
|
||||
}
|
||||
|
||||
static inline const struct rtw89_fw_def *
|
||||
__rtw89_chip_get_fw_def(const struct rtw89_chip_info *chip,
|
||||
const struct rtw89_chip_variant *variant)
|
||||
{
|
||||
if (variant && variant->fw_def_override)
|
||||
return variant->fw_def_override;
|
||||
|
||||
return &chip->fw_def;
|
||||
}
|
||||
|
||||
static inline
|
||||
const struct rtw89_fw_def *rtw89_chip_get_fw_def(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
return __rtw89_chip_get_fw_def(rtwdev->chip, rtwdev->variant);
|
||||
}
|
||||
|
||||
static inline void rtw89_load_txpwr_table(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_txpwr_table *tbl)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -965,18 +965,20 @@ static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)
|
|||
const struct firmware *
|
||||
rtw89_early_fw_feature_recognize(struct device *device,
|
||||
const struct rtw89_chip_info *chip,
|
||||
const struct rtw89_chip_variant *variant,
|
||||
struct rtw89_fw_info *early_fw,
|
||||
int *used_fw_format)
|
||||
{
|
||||
const struct rtw89_fw_def *fw_def = __rtw89_chip_get_fw_def(chip, variant);
|
||||
const struct firmware *firmware;
|
||||
char fw_name[64];
|
||||
int fw_format;
|
||||
u32 ver_code;
|
||||
int ret;
|
||||
|
||||
for (fw_format = chip->fw_format_max; fw_format >= 0; fw_format--) {
|
||||
for (fw_format = fw_def->fw_format_max; fw_format >= 0; fw_format--) {
|
||||
rtw89_fw_get_filename(fw_name, sizeof(fw_name),
|
||||
chip->fw_basename, fw_format);
|
||||
fw_def->fw_basename, fw_format);
|
||||
|
||||
ret = request_firmware(&firmware, fw_name, device);
|
||||
if (!ret) {
|
||||
|
|
@ -2024,11 +2026,11 @@ void rtw89_load_firmware_work(struct work_struct *work)
|
|||
{
|
||||
struct rtw89_dev *rtwdev =
|
||||
container_of(work, struct rtw89_dev, load_firmware_work);
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_fw_def *fw_def = rtw89_chip_get_fw_def(rtwdev);
|
||||
char fw_name[64];
|
||||
|
||||
rtw89_fw_get_filename(fw_name, sizeof(fw_name),
|
||||
chip->fw_basename, rtwdev->fw.fw_format);
|
||||
fw_def->fw_basename, rtwdev->fw.fw_format);
|
||||
|
||||
rtw89_load_firmware_req(rtwdev, &rtwdev->fw.req, fw_name, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5171,6 +5171,7 @@ int rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev);
|
|||
const struct firmware *
|
||||
rtw89_early_fw_feature_recognize(struct device *device,
|
||||
const struct rtw89_chip_info *chip,
|
||||
const struct rtw89_chip_variant *variant,
|
||||
struct rtw89_fw_info *early_fw,
|
||||
int *used_fw_format);
|
||||
int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,
|
||||
|
|
|
|||
|
|
@ -2580,8 +2580,10 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
|
|||
.ops = &rtw8851b_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_ax,
|
||||
.phy_def = &rtw89_phy_gen_ax,
|
||||
.fw_basename = RTW8851B_FW_BASENAME,
|
||||
.fw_format_max = RTW8851B_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8851B_FW_BASENAME,
|
||||
.fw_format_max = RTW8851B_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = true,
|
||||
.bbmcu_nr = 0,
|
||||
.needed_fw_elms = 0,
|
||||
|
|
|
|||
|
|
@ -2265,8 +2265,10 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
|||
.ops = &rtw8852a_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_ax,
|
||||
.phy_def = &rtw89_phy_gen_ax,
|
||||
.fw_basename = RTW8852A_FW_BASENAME,
|
||||
.fw_format_max = RTW8852A_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8852A_FW_BASENAME,
|
||||
.fw_format_max = RTW8852A_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = false,
|
||||
.bbmcu_nr = 0,
|
||||
.needed_fw_elms = 0,
|
||||
|
|
|
|||
|
|
@ -911,8 +911,10 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
|||
.ops = &rtw8852b_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_ax,
|
||||
.phy_def = &rtw89_phy_gen_ax,
|
||||
.fw_basename = RTW8852B_FW_BASENAME,
|
||||
.fw_format_max = RTW8852B_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8852B_FW_BASENAME,
|
||||
.fw_format_max = RTW8852B_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = true,
|
||||
.bbmcu_nr = 0,
|
||||
.needed_fw_elms = 0,
|
||||
|
|
|
|||
|
|
@ -757,8 +757,10 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
|
|||
.ops = &rtw8852bt_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_ax,
|
||||
.phy_def = &rtw89_phy_gen_ax,
|
||||
.fw_basename = RTW8852BT_FW_BASENAME,
|
||||
.fw_format_max = RTW8852BT_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8852BT_FW_BASENAME,
|
||||
.fw_format_max = RTW8852BT_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = true,
|
||||
.bbmcu_nr = 0,
|
||||
.needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ,
|
||||
|
|
|
|||
|
|
@ -3106,8 +3106,10 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
|||
.ops = &rtw8852c_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_ax,
|
||||
.phy_def = &rtw89_phy_gen_ax,
|
||||
.fw_basename = RTW8852C_FW_BASENAME,
|
||||
.fw_format_max = RTW8852C_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8852C_FW_BASENAME,
|
||||
.fw_format_max = RTW8852C_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = false,
|
||||
.bbmcu_nr = 0,
|
||||
.needed_fw_elms = 0,
|
||||
|
|
|
|||
|
|
@ -2916,8 +2916,10 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
|
|||
.ops = &rtw8922a_chip_ops,
|
||||
.mac_def = &rtw89_mac_gen_be,
|
||||
.phy_def = &rtw89_phy_gen_be,
|
||||
.fw_basename = RTW8922A_FW_BASENAME,
|
||||
.fw_format_max = RTW8922A_FW_FORMAT_MAX,
|
||||
.fw_def = {
|
||||
.fw_basename = RTW8922A_FW_BASENAME,
|
||||
.fw_format_max = RTW8922A_FW_FORMAT_MAX,
|
||||
},
|
||||
.try_ce_fw = false,
|
||||
.bbmcu_nr = 1,
|
||||
.needed_fw_elms = RTW89_BE_GEN_DEF_NEEDED_FW_ELEMENTS,
|
||||
|
|
@ -3057,6 +3059,7 @@ EXPORT_SYMBOL(rtw8922a_chip_info);
|
|||
const struct rtw89_chip_variant rtw8922ae_vs_variant = {
|
||||
.no_mcs_12_13 = true,
|
||||
.fw_min_ver_code = RTW89_FW_VER_CODE(0, 35, 54, 0),
|
||||
.fw_def_override = NULL,
|
||||
};
|
||||
EXPORT_SYMBOL(rtw8922ae_vs_variant);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user