wifi: rtw89: 8922a: add BT-coexistence materials to initialize 8922A
Ping-Ke Shih
maintainercover wifi: rtw89: 8922a: add BT-coexistence materials to initialize 8922A
BT-coexistence adds new format of H2C command to use u8 data type as possible as it can to reduce endian transformation, such as le16_to_cpu(). 8922A is first chip to use these new format, so prepare these stuffs before enabling 8922AE. The new format is also needed by newer firmware of other chips, so also prepare for existing chips in advance.
First two patches are helpers of MAC to control grant to BT for WiFi. The other patches are to add new introduction format used by newer firmware.
This patchset is partial patches related to BT-coexistence, and I will send out remaining five patches by another patchset in coming days.
Ching-Te Ku (6):
wifi: rtw89: coex: add init_info H2C command format version 7
wifi: rtw89: coex: add BTC ctrl_info version 7 and related logic
wifi: rtw89: coex: Reorder H2C command index to align with firmware
wifi: rtw89: coex: add return value to ensure H2C command is success
or not
wifi: rtw89: coex: When Bluetooth not available don't set power/gain
wifi: rtw89: coex: Add coexistence policy to decrease WiFi packet
CRC-ERR
Ping-Ke Shih (2):
wifi: rtw89: mac: add coexistence helpers {cfg/get}_plt
wifi: rtw89: 8922a: add coexistence helpers of SW grant
drivers/net/wireless/realtek/rtw89/coex.c | 393 ++++++++++++------ drivers/net/wireless/realtek/rtw89/coex.h | 20 + drivers/net/wireless/realtek/rtw89/core.h | 90 +++- drivers/net/wireless/realtek/rtw89/debug.c | 9 +- drivers/net/wireless/realtek/rtw89/fw.c | 112 ++++- drivers/net/wireless/realtek/rtw89/fw.h | 45 +- drivers/net/wireless/realtek/rtw89/mac.c | 8 +- drivers/net/wireless/realtek/rtw89/mac.h | 25 +- drivers/net/wireless/realtek/rtw89/mac_be.c | 117 ++++++ drivers/net/wireless/realtek/rtw89/reg.h | 49 +++ drivers/net/wireless/realtek/rtw89/rtw8851b.c | 150 ++++--- drivers/net/wireless/realtek/rtw89/rtw8852a.c | 64 ++- drivers/net/wireless/realtek/rtw89/rtw8852b.c | 64 ++- drivers/net/wireless/realtek/rtw89/rtw8852c.c | 64 ++- drivers/net/wireless/realtek/rtw89/rtw8922a.c | 112 +++++ 15 files changed, 1061 insertions(+), 261 deletions(-)
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 1/8 wifi: rtw89: mac: add coexistence helpers {cfg/get}_plt
When hardware grant BT initially but transition to grant WiFi, the PLT (polluted) bit is set to assist coexistence mechanism to debug if grant signal is expected.
--- drivers/net/wireless/realtek/rtw89/mac.c | 8 +++- drivers/net/wireless/realtek/rtw89/mac.h | 22 ++++++++++- drivers/net/wireless/realtek/rtw89/mac_be.c | 41 +++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/reg.h | 14 +++++++ 4 files changed, 81 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/mac.c +6 -2
@@ -5615,7 +5615,8 @@ int rtw89_mac_cfg_gnt_v1(struct rtw89_dev *rtwdev, }EXPORT_SYMBOL (rtw89_mac_cfg_gnt_v1); -int rtw89_mac_cfg_plt (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt) +static +int rtw89_mac_cfg_plt_ax (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt) {u32 reg;u16 val;
@@ -5711,7 +5712,7 @@ bool rtw89_mac_get_ctrl_path(struct rtw89_dev *rtwdev)return !!val; } -u16 rtw89_mac_get_plt_cnt (struct rtw89_dev *rtwdev,u8 band) +static u16 rtw89_mac_get_plt_cnt_ax (struct rtw89_dev *rtwdev,u8 band) {u32 reg;u16 cnt;
@@ -6340,6 +6341,9 @@ const struct rtw89_mac_gen_def rtw89_mac_gen_ax = { .parse_phycap_map = rtw89_parse_phycap_map_ax, .cnv_efuse_state = rtw89_cnv_efuse_state_ax, + .cfg_plt = rtw89_mac_cfg_plt_ax, + .get_plt_cnt = rtw89_mac_get_plt_cnt_ax, + .get_txpwr_cr = rtw89_mac_get_txpwr_cr_ax, .write_xtal_si = rtw89_mac_write_xtal_si_ax,
drivers/net/wireless/realtek/rtw89/mac.h +20 -2
@@ -958,6 +958,9 @@ struct rtw89_mac_gen_def {int (*parse_phycap_map)(struct rtw89_dev *rtwdev);int (*cnv_efuse_state)(struct rtw89_dev *rtwdev,bool idle); +int (*cfg_plt)(struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt); +u16 (*get_plt_cnt)(struct rtw89_dev *rtwdev,u8 band); +bool (*get_txpwr_cr)(struct rtw89_dev *rtwdev,enum rtw89_phy_idx phy_idx,u32 reg_base,u32 *cr);
@@ -1185,8 +1188,23 @@ int rtw89_mac_cfg_gnt(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex_gnt *gnt_cfg);int rtw89_mac_cfg_gnt_v1 (struct rtw89_dev *rtwdev,const struct rtw89_mac_ax_coex_gnt *gnt_cfg); -int rtw89_mac_cfg_plt (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt); -u16 rtw89_mac_get_plt_cnt (struct rtw89_dev *rtwdev,u8 band); + +static inline +int rtw89_mac_cfg_plt (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt) +{ +const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def; + +return mac->cfg_plt (rtwdev, plt); +} + +static inline +u16 rtw89_mac_get_plt_cnt (struct rtw89_dev *rtwdev,u8 band) +{ +const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def; + +return mac->get_plt_cnt (rtwdev, band); +} +void rtw89_mac_cfg_sb (struct rtw89_dev *rtwdev,u32 val);u32 rtw89_mac_get_sb (struct rtw89_dev *rtwdev);bool rtw89_mac_get_ctrl_path (struct rtw89_dev *rtwdev);
drivers/net/wireless/realtek/rtw89/mac_be.c +41 -0
53 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/reg.h +14 -0
@@ -6457,6 +6457,20 @@#define B_BE_PORT_DROP_4_0_MASK GENMASK(20, 16)#define B_BE_MBSSID_DROP_15_0_MASK GENMASK(15, 0) +#define R_BE_BT_PLT 0x1087C +#define R_BE_BT_PLT_C1 0x1487C +#define B_BE_BT_PLT_PKT_CNT_MASK GENMASK(31, 16) +#define B_BE_BT_PLT_RST BIT(9) +#define B_BE_PLT_EN BIT(8) +#define B_BE_RX_PLT_GNT_LTE_RX BIT(7) +#define B_BE_RX_PLT_GNT_BT_RX BIT(6) +#define B_BE_RX_PLT_GNT_BT_TX BIT(5) +#define B_BE_RX_PLT_GNT_WL BIT(4) +#define B_BE_TX_PLT_GNT_LTE_RX BIT(3) +#define B_BE_TX_PLT_GNT_BT_RX BIT(2) +#define B_BE_TX_PLT_GNT_BT_TX BIT(1) +#define B_BE_TX_PLT_GNT_WL BIT(0) +#define R_BE_PTCL_BSS_COLOR_0 0x108A0#define R_BE_PTCL_BSS_COLOR_0_C1 0x148A0#define B_BE_BSS_COLOB_BE_PORT_3_MASK GENMASK(29, 24)
Signature · 1 line
2.25.1
Re: [PATCH 1/8] wifi: rtw89: mac: add coexistence helpers {cfg/get}_plt
Quoted 5 lines · Ping-Ke Shih
When hardware grant BT initially but transition to grant WiFi, the PLT (polluted) bit is set to assist coexistence mechanism to debug if grant signal is expected.
Signed-off-by Ping-Ke Shih <[email protected]>
8 patches applied to wireless-next.git, thanks.
0cb01e0edf78 wifi: rtw89: mac: add coexistence helpers {cfg/get}_plt d569f8545c7d wifi: rtw89: 8922a: add coexistence helpers of SW grant 652c9642eda6 wifi: rtw89: coex: add init_info H2C command format version 7 9d27596fdac5 wifi: rtw89: coex: add BTC ctrl_info version 7 and related logic 6ee10fcd284d wifi: rtw89: coex: Reorder H2C command index to align with firmware eae888cfb734 wifi: rtw89: coex: add return value to ensure H2C command is success or not bb90a32c3c7d wifi: rtw89: coex: When Bluetooth not available don't set power/gain 2422c2158fb5 wifi: rtw89: coex: Add coexistence policy to decrease WiFi packet CRC-ERR
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Ping-Ke Shih
maintainerPATCH 2/8 wifi: rtw89: 8922a: add coexistence helpers of SW grant
In reply to Ping-Ke ShihUnder some circumstances, coexistence mechanism want to keep grant BT or WiFi, such as inquiry and WiFi is connecting, to ensure BT or WiFi can transmit or receive data in that period.
--- drivers/net/wireless/realtek/rtw89/core.h | 6 ++ drivers/net/wireless/realtek/rtw89/mac.h | 3 + drivers/net/wireless/realtek/rtw89/mac_be.c | 76 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/reg.h | 28 +++++++ drivers/net/wireless/realtek/rtw89/rtw8922a.c | 2 + 5 files changed, 115 insertions(+)
drivers/net/wireless/realtek/rtw89/core.h +6 -0
@@ -1151,9 +1151,15 @@ struct rtw89_mac_ax_gnt {u8 gnt_wl; } __packed; +struct rtw89_mac_ax_wl_act { +u8 wlan_act_en; +u8 wlan_act; +}; +#define RTW89_MAC_AX_COEX_GNT_NR 2struct rtw89_mac_ax_coex_gnt {struct rtw89_mac_ax_gnt band[RTW89_MAC_AX_COEX_GNT_NR ]; +struct rtw89_mac_ax_wl_act bt[RTW89_MAC_AX_COEX_GNT_NR ]; };enum rtw89_btc_ncnt {
drivers/net/wireless/realtek/rtw89/mac.h +3 -0
@@ -1188,6 +1188,8 @@ int rtw89_mac_cfg_gnt(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex_gnt *gnt_cfg);int rtw89_mac_cfg_gnt_v1 (struct rtw89_dev *rtwdev,const struct rtw89_mac_ax_coex_gnt *gnt_cfg); +int rtw89_mac_cfg_gnt_v2 (struct rtw89_dev *rtwdev, +const struct rtw89_mac_ax_coex_gnt *gnt_cfg);static inline int rtw89_mac_cfg_plt (struct rtw89_dev *rtwdev,struct rtw89_mac_ax_plt *plt)
@@ -1210,6 +1212,7 @@ u32 rtw89_mac_get_sb(struct rtw89_dev *rtwdev);bool rtw89_mac_get_ctrl_path (struct rtw89_dev *rtwdev);int rtw89_mac_cfg_ctrl_path (struct rtw89_dev *rtwdev,bool wl);int rtw89_mac_cfg_ctrl_path_v1 (struct rtw89_dev *rtwdev,bool wl); +int rtw89_mac_cfg_ctrl_path_v2 (struct rtw89_dev *rtwdev,bool wl);void rtw89_mac_power_mode_change (struct rtw89_dev *rtwdev,bool enter);void rtw89_mac_notify_wake (struct rtw89_dev *rtwdev);
drivers/net/wireless/realtek/rtw89/mac_be.c +76 -0
82 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/reg.h +28 -0
@@ -5932,6 +5932,34 @@#define B_BE_MACID_ACQ_GRP0_CLR_P BIT(2)#define B_BE_R_MACID_ACQ_CHK_EN BIT(0) +#define R_BE_GNT_SW_CTRL 0x0E348 +#define B_BE_WL_ACT2_VAL BIT(25) +#define B_BE_WL_ACT2_SWCTRL BIT(24) +#define B_BE_WL_ACT_VAL BIT(23) +#define B_BE_WL_ACT_SWCTRL BIT(22) +#define B_BE_GNT_BT_RX_BB1_VAL BIT(21) +#define B_BE_GNT_BT_RX_BB1_SWCTRL BIT(20) +#define B_BE_GNT_BT_TX_BB1_VAL BIT(19) +#define B_BE_GNT_BT_TX_BB1_SWCTRL BIT(18) +#define B_BE_GNT_BT_RX_BB0_VAL BIT(17) +#define B_BE_GNT_BT_RX_BB0_SWCTRL BIT(16) +#define B_BE_GNT_BT_TX_BB0_VAL BIT(15) +#define B_BE_GNT_BT_TX_BB0_SWCTRL BIT(14) +#define B_BE_GNT_WL_RX_VAL BIT(13) +#define B_BE_GNT_WL_RX_SWCTRL BIT(12) +#define B_BE_GNT_WL_TX_VAL BIT(11) +#define B_BE_GNT_WL_TX_SWCTRL BIT(10) +#define B_BE_GNT_BT_BB1_VAL BIT(9) +#define B_BE_GNT_BT_BB1_SWCTRL BIT(8) +#define B_BE_GNT_WL_BB1_VAL BIT(7) +#define B_BE_GNT_WL_BB1_SWCTRL BIT(6) +#define B_BE_GNT_BT_BB0_VAL BIT(5) +#define B_BE_GNT_BT_BB0_SWCTRL BIT(4) +#define B_BE_GNT_WL_BB0_VAL BIT(3) +#define B_BE_GNT_WL_BB0_SWCTRL BIT(2) +#define B_BE_GNT_WL_BB_PWR_VAL BIT(1) +#define B_BE_GNT_WL_BB_PWR_SWCTRL BIT(0) +#define R_BE_PWR_MACID_PATH_BASE 0x0E500#define R_BE_PWR_MACID_LMT_BASE 0x0ED00
drivers/net/wireless/realtek/rtw89/rtw8922a.c +2 -0
@@ -2246,6 +2246,8 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = { .query_rxdesc = rtw89_core_query_rxdesc_v2, .fill_txdesc = rtw89_core_fill_txdesc_v2, .fill_txdesc_fwcmd = rtw89_core_fill_txdesc_fwcmd_v2, + .cfg_ctrl_path = rtw89_mac_cfg_ctrl_path_v2, + .mac_cfg_gnt = rtw89_mac_cfg_gnt_v2, .stop_sch_tx = rtw89_mac_stop_sch_tx_v2, .resume_sch_tx = rtw89_mac_resume_sch_tx_v2, .h2c_dctl_sec_cam = rtw89_fw_h2c_dctl_sec_cam_v2,
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 3/8 wifi: rtw89: coex: add init_info H2C command format version 7
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
To avoid using bit fields for H2C command, rearrange the structure. And also patch the corresponding code for the using of this structure. No logic changes for existing chips.
--- drivers/net/wireless/realtek/rtw89/coex.c | 158 ++++++++++++------ drivers/net/wireless/realtek/rtw89/coex.h | 18 ++ drivers/net/wireless/realtek/rtw89/core.h | 67 +++++++- drivers/net/wireless/realtek/rtw89/fw.c | 42 ++++- drivers/net/wireless/realtek/rtw89/fw.h | 6 + drivers/net/wireless/realtek/rtw89/reg.h | 7 + drivers/net/wireless/realtek/rtw89/rtw8851b.c | 150 +++++++++++------ drivers/net/wireless/realtek/rtw89/rtw8852a.c | 64 ++++--- drivers/net/wireless/realtek/rtw89/rtw8852b.c | 64 ++++--- drivers/net/wireless/realtek/rtw89/rtw8852c.c | 64 ++++--- drivers/net/wireless/realtek/rtw89/rtw8922a.c | 110 ++++++++++++ 11 files changed, 586 insertions(+), 164 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +106 -52
@@ -129,67 +129,74 @@ static const u32 cxtbl[] = {static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {/* firmware version must be in decreasing order for each chip */ + {RTL8922A ,RTW89_FW_VER_CODE (0 ,35 ,8 ,0 ), + .fcxbtcrpt =8 , .fcxtdma =7 , .fcxslots =7 , .fcxcysta =7 , + .fcxstep =7 , .fcxnullsta =7 , .fcxmreg =7 , .fcxgpiodbg =7 , + .fcxbtver =7 , .fcxbtscan =7 , .fcxbtafh =7 , .fcxbtdevinfo =7 , + .fwlrole =2 , .frptmap =7 , .fcxctrl =7 , .fcxinit =7 , + .info_buf =1800 , .max_role_num =6 , + }, {RTL8851B ,RTW89_FW_VER_CODE (0 ,29 ,29 ,0 ), .fcxbtcrpt =105 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =5 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =2 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =2 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =2 , .frptmap =3 , .fcxctrl =1 , + .fwlrole =2 , .frptmap =3 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1800 , .max_role_num =6 , }, {RTL8852C ,RTW89_FW_VER_CODE (0 ,27 ,57 ,0 ), .fcxbtcrpt =4 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =3 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1280 , .max_role_num =5 , }, {RTL8852C ,RTW89_FW_VER_CODE (0 ,27 ,42 ,0 ), .fcxbtcrpt =4 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =3 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =2 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =2 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1280 , .max_role_num =5 , }, {RTL8852C ,RTW89_FW_VER_CODE (0 ,27 ,0 ,0 ), .fcxbtcrpt =4 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =3 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =1 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =2 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =2 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1280 , .max_role_num =5 , }, {RTL8852B ,RTW89_FW_VER_CODE (0 ,29 ,29 ,0 ), .fcxbtcrpt =105 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =5 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =2 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =2 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =2 , .frptmap =3 , .fcxctrl =1 , + .fwlrole =2 , .frptmap =3 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1800 , .max_role_num =6 , }, {RTL8852B ,RTW89_FW_VER_CODE (0 ,29 ,14 ,0 ), .fcxbtcrpt =5 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =4 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1800 , .max_role_num =6 , }, {RTL8852B ,RTW89_FW_VER_CODE (0 ,27 ,0 ,0 ), .fcxbtcrpt =4 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =3 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =1 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =1 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =1 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1280 , .max_role_num =5 , }, {RTL8852A ,RTW89_FW_VER_CODE (0 ,13 ,37 ,0 ), .fcxbtcrpt =4 , .fcxtdma =3 , .fcxslots =1 , .fcxcysta =3 , .fcxstep =3 , .fcxnullsta =2 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =2 , .fcxbtdevinfo =1 , - .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , + .fwlrole =1 , .frptmap =3 , .fcxctrl =1 , .fcxinit =0 , .info_buf =1280 , .max_role_num =5 , }, {RTL8852A ,RTW89_FW_VER_CODE (0 ,13 ,0 ,0 ), .fcxbtcrpt =1 , .fcxtdma =1 , .fcxslots =1 , .fcxcysta =2 , .fcxstep =2 , .fcxnullsta =1 , .fcxmreg =1 , .fcxgpiodbg =1 , .fcxbtver =1 , .fcxbtscan =1 , .fcxbtafh =1 , .fcxbtdevinfo =1 , - .fwlrole =0 , .frptmap =0 , .fcxctrl =0 , + .fwlrole =0 , .frptmap =0 , .fcxctrl =0 , .fcxinit =0 , .info_buf =1024 , .max_role_num =5 , },
@@ -198,7 +205,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { .fcxbtcrpt = 1, .fcxtdma = 1, .fcxslots = 1, .fcxcysta = 2, .fcxstep = 2, .fcxnullsta = 1, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1, - .fwlrole = 0, .frptmap = 0, .fcxctrl = 0, + .fwlrole = 0, .frptmap = 0, .fcxctrl = 0, .fcxinit = 0, .info_buf = 1024, .max_role_num = 5, }, };
@@ -777,22 +784,27 @@ static void _get_reg_status(struct rtw89_dev *rtwdev, u8 type, u8 *val) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver; -struct rtw89_btc_module *md = &btc->mdinfo; +union rtw89_btc_module_info *md = &btc->mdinfo;union rtw89_btc_fbtc_mreg_val *pmreg;u32 pre_agc_addr =R_BTC_BB_PRE_AGC_S1 ;u32 reg_val; -u8 idx; +u8 idx, switch_type; -if (md->ant.btg_pos ==RF_PATH_A ) +if (ver->fcxinit ==7 ) + switch_type = md->md_v7.switch_type; +else + switch_type = md->md.switch_type; + +if (btc->btg_pos ==RF_PATH_A ) pre_agc_addr =R_BTC_BB_PRE_AGC_S0 ;switch (type) {case BTC_CSTATUS_TXDIV_POS : -if (md->switch_type ==BTC_SWITCH_INTERNAL ) +if (switch_type ==BTC_SWITCH_INTERNAL ) *val =BTC_ANT_DIV_MAIN ;break ;case BTC_CSTATUS_RXDIV_POS : -if (md->switch_type ==BTC_SWITCH_INTERNAL ) +if (switch_type ==BTC_SWITCH_INTERNAL ) *val =BTC_ANT_DIV_MAIN ;break ;case BTC_CSTATUS_BB_GNT_MUX :
@@ -2083,7 +2095,10 @@ static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type)switch (type) {case CXDRVINFO_INIT : -rtw89_fw_h2c_cxdrv_init (rtwdev); +if (ver->fcxinit ==7 ) +rtw89_fw_h2c_cxdrv_init_v7 (rtwdev); +else +rtw89_fw_h2c_cxdrv_init (rtwdev);break ;case CXDRVINFO_ROLE :if (ver->fwlrole ==0 )
@@ -2333,7 +2348,7 @@ static void _set_rf_trx_para(struct rtw89_dev *rtwdev) }/* decide trx_para_level */ -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {/* fix LNA2 + TIA gain not change by GNT_BT */ if ((btc->dm.wl_btg_rx && b->profile_cnt.now !=0 ) || dm->bt_only ==1 )
@@ -2560,8 +2575,16 @@ static bool _check_freerun(struct rtw89_dev *rtwdev)struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info;struct rtw89_btc_bt_hid_desc *hid = &bt_linfo->hid_desc; +union rtw89_btc_module_info *md = &btc->mdinfo; +const struct rtw89_btc_ver *ver = btc->ver; +u8 isolation; + +if (ver->fcxinit ==7 ) + isolation = md->md_v7.ant.isolation; +else + isolation = md->md.ant.isolation; -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) { btc->dm.trx_para_level =0 ;return false; }
@@ -2584,7 +2607,7 @@ static bool _check_freerun(struct rtw89_dev *rtwdev) }/* TODO get isolation by BT psd */ -if (btc->mdinfo.ant.isolation >=BTC_FREERUN_ANTISO_MIN ) { +if (isolation >=BTC_FREERUN_ANTISO_MIN ) { btc->dm.trx_para_level =5 ;return true; }
@@ -2712,7 +2735,7 @@ void rtw89_btc_set_policy(struct rtw89_dev *rtwdev, u16 policy_type)u8 type;u32 tbl_w1, tbl_b1, tbl_b4; -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {if (btc->cx.wl.status.map._4way) tbl_w1 = cxtbl[1 ];else
@@ -3028,7 +3051,7 @@ void rtw89_btc_set_policy_v1(struct rtw89_dev *rtwdev, u16 policy_type) type =FIELD_GET (BTC_CXP_MASK , policy_type); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {if (btc->cx.wl.status.map._4way) tbl_w1 = cxtbl[1 ];else if (hid->exist && hid->type ==BTC_HID_218 )
@@ -3615,7 +3638,7 @@ static void _action_bt_idle(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ switch (btc->cx.state_map) {case BTC_WBUSY_BNOSCAN :/*wl-busy + bt idle*/ case BTC_WSCAN_BNOSCAN :/* wl-scan + bt-idle */
@@ -3654,7 +3677,7 @@ static void _action_bt_hfp(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {if (btc->cx.wl.status.map._4way) {_set_policy (rtwdev,BTC_CXP_OFF_WL ,BTC_ACT_BT_HFP ); }else if (wl->status.map.traffic_dir &BIT (RTW89_TFC_UL )) {
@@ -3679,7 +3702,7 @@ static void _action_bt_hid(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ if (wl->status.map._4way) { policy_type =BTC_CXP_OFF_WL ; }else if (wl->status.map.traffic_dir &BIT (RTW89_TFC_UL )) {
@@ -3947,7 +3970,7 @@ static void _action_wl_other(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) +if (btc->ant_type ==BTC_ANT_SHARED )_set_policy (rtwdev,BTC_CXP_OFFB_BWB0 ,BTC_ACT_WL_OTHER );else _set_policy (rtwdev,BTC_CXP_OFF_EQ0 ,BTC_ACT_WL_OTHER );
@@ -4083,7 +4106,7 @@ static void _set_wl_preagc_ctrl(struct rtw89_dev *rtwdev)else if (ver->fwlrole ==2 && wl_rinfo->dbcc_en && wl_rinfo->dbcc_2g_phy !=RTW89_PHY_1 ) is_preagc =BTC_PREAGC_DISABLE ; -else if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) +else if (btc->ant_type ==BTC_ANT_SHARED ) is_preagc =BTC_PREAGC_DISABLE ;else is_preagc =BTC_PREAGC_ENABLE ;
@@ -4402,7 +4425,7 @@ static void _action_wl_scan(struct rtw89_dev *rtwdev)if (RTW89_CHK_FW_FEATURE (SCAN_OFFLOAD , &rtwdev->fw)) {_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W25G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) +if (btc->ant_type ==BTC_ANT_SHARED )_set_policy (rtwdev,BTC_CXP_OFFE_DEF ,BTC_RSN_NTFY_SCAN_START );else
@@ -4430,7 +4453,7 @@ static void _action_wl_25g_mcc(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W25G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_25G_MCC );
@@ -4447,7 +4470,7 @@ static void _action_wl_2g_mcc(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_2G_MCC );
@@ -4465,7 +4488,7 @@ static void _action_wl_2g_scc(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_2G_SCC );
@@ -4487,7 +4510,7 @@ static void _action_wl_2g_scc_v1(struct rtw89_dev *rtwdev)u16 policy_type =BTC_CXP_OFF_BT ;u32 dur; -if (btc->mdinfo.ant.type ==BTC_ANT_DEDICATED ) { +if (btc->ant_type ==BTC_ANT_DEDICATED ) { policy_type =BTC_CXP_OFF_EQ0 ; }else {/* shared-antenna */
@@ -4549,7 +4572,7 @@ static void _action_wl_2g_scc_v2(struct rtw89_dev *rtwdev)u16 policy_type =BTC_CXP_OFF_BT ;u32 dur; -if (btc->mdinfo.ant.type ==BTC_ANT_DEDICATED ) { +if (btc->ant_type ==BTC_ANT_DEDICATED ) { policy_type =BTC_CXP_OFF_EQ0 ; }else {/* shared-antenna */
@@ -4607,7 +4630,7 @@ static void _action_wl_2g_ap(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) { +if (btc->ant_type ==BTC_ANT_SHARED ) {if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_2G_AP );
@@ -4624,7 +4647,7 @@ static void _action_wl_2g_go(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_2G_GO );
@@ -4642,7 +4665,7 @@ static void _action_wl_2g_gc(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ _action_by_bt (rtwdev); }else {/* dedicated-antenna */ _set_policy (rtwdev,BTC_CXP_OFF_EQ0 ,BTC_ACT_WL_2G_GC );
@@ -4655,7 +4678,7 @@ static void _action_wl_2g_nan(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); -if (btc->mdinfo.ant.type ==BTC_ANT_SHARED ) {/* shared-antenna */ +if (btc->ant_type ==BTC_ANT_SHARED ) {/* shared-antenna */ if (btc->cx.bt.link_info.profile_cnt.now ==0 )_set_policy (rtwdev,BTC_CXP_OFFE_DEF2 ,BTC_ACT_WL_2G_NAN );
@@ -5560,16 +5583,26 @@ static void _set_init_info(struct rtw89_dev *rtwdev) {const struct rtw89_chip_info *chip = rtwdev->chip;struct rtw89_btc *btc = &rtwdev->btc; +const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_wl_info *wl = &btc->cx.wl; - dm->init_info.wl_only = (u8 )dm->wl_only; - dm->init_info.bt_only = (u8 )dm->bt_only; - dm->init_info.wl_init_ok = (u8 )wl->status.map.init_ok; - dm->init_info.dbcc_en = rtwdev->dbcc_en; - dm->init_info.cx_other = btc->cx.other.type; - dm->init_info.wl_guard_ch = chip->afh_guard_ch; - dm->init_info.module = btc->mdinfo; +if (ver->fcxinit ==7 ) { + dm->init_info.init_v7.wl_only = (u8 )dm->wl_only; + dm->init_info.init_v7.bt_only = (u8 )dm->bt_only; + dm->init_info.init_v7.wl_init_ok = (u8 )wl->status.map.init_ok; + dm->init_info.init_v7.cx_other = btc->cx.other.type; + dm->init_info.init_v7.wl_guard_ch = chip->afh_guard_ch; + dm->init_info.init_v7.module = btc->mdinfo.md_v7; + }else { + dm->init_info.init.wl_only = (u8 )dm->wl_only; + dm->init_info.init.bt_only = (u8 )dm->bt_only; + dm->init_info.init.wl_init_ok = (u8 )wl->status.map.init_ok; + dm->init_info.init.dbcc_en = rtwdev->dbcc_en; + dm->init_info.init.cx_other = btc->cx.other.type; + dm->init_info.init.wl_guard_ch = chip->afh_guard_ch; + dm->init_info.init.module = btc->mdinfo.md; + } }void rtw89_btc_ntfy_init (struct rtw89_dev *rtwdev,u8 mode)
@@ -6298,7 +6331,7 @@ static void rtw89_btc_ntfy_wl_sta_iter(void *data, struct ieee80211_sta *sta)if (BTC_RSSI_LOW (link_info->rssi_state[i])) rssi_map |=BIT (i); -if (btc->mdinfo.ant.type ==BTC_ANT_DEDICATED && +if (btc->ant_type ==BTC_ANT_DEDICATED &&BTC_RSSI_CHANGE (link_info->rssi_state[i])) is_sta_change = true; }
@@ -6489,13 +6522,16 @@ void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,static void _show_cx_info (struct rtw89_dev *rtwdev,struct seq_file *m) { +union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo;const struct rtw89_chip_info *chip = rtwdev->chip; +const struct rtw89_btc_ver *ver = rtwdev->btc.ver;struct rtw89_hal *hal = &rtwdev->hal;struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_bt_info *bt = &btc->cx.bt;struct rtw89_btc_wl_info *wl = &btc->cx.wl;u32 ver_main =0 , ver_sub =0 , ver_hotfix =0 , id_branch =0 ; +u8 cv, rfe, iso, ant_num, ant_single_pos;if (!(dm->coex_info_map &BTC_COEX_INFO_CX ))return ;
@@ -6545,11 +6581,24 @@ static void _show_cx_info(struct rtw89_dev *rtwdev, struct seq_file *m) ver_main, ver_sub, ver_hotfix, id_branch, bt->ver_info.fw, bt->run_patch_code ? "patch" : "ROM"); +if (ver->fcxinit ==7 ) { + cv = md->md_v7.kt_ver; + rfe = md->md_v7.rfe_type; + iso = md->md_v7.ant.isolation; + ant_num = md->md_v7.ant.num; + ant_single_pos = md->md_v7.ant.single_pos; + }else { + cv = md->md.cv; + rfe = md->md.rfe_type; + iso = md->md.ant.isolation; + ant_num = md->md.ant.num; + ant_single_pos = md->md.ant.single_pos; + } +seq_printf (m," %-15s : cv:%x, rfe_type:0x%x, ant_iso:%d, ant_pg:%d, %s" , -"[hw_info]" , btc->mdinfo.cv, btc->mdinfo.rfe_type, - btc->mdinfo.ant.isolation, btc->mdinfo.ant.num, - (btc->mdinfo.ant.num >1 ?"" : (btc->mdinfo.ant.single_pos ? -"1Ant_Pos:S1, " :"1Ant_Pos:S0, " ))); +"[hw_info]" , cv, rfe, iso, ant_num, + ant_num >1 ?"" : + ant_single_pos ?"1Ant_Pos:S1, " :"1Ant_Pos:S0, " ); seq_printf(m, "3rd_coex:%d, dbcc:%d, tx_num:%d, rx_num:%d\n", btc->cx.other.type, rtwdev->dbcc_en, hal->tx_nss,
@@ -6722,20 +6771,26 @@ static void _show_bt_info(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_cx *cx = &btc->cx;struct rtw89_btc_bt_info *bt = &cx->bt;struct rtw89_btc_wl_info *wl = &cx->wl; -struct rtw89_btc_module *module = &btc->mdinfo;struct rtw89_btc_bt_link_info *bt_linfo = &bt->link_info; +union rtw89_btc_module_info *md = &btc->mdinfo;u8 *afh = bt_linfo->afh_map;u8 *afh_le = bt_linfo->afh_map_le; +u8 bt_pos;if (!(btc->dm.coex_info_map &BTC_COEX_INFO_BT ))return ; +if (ver->fcxinit ==7 ) + bt_pos = md->md_v7.bt_pos; +else + bt_pos = md->md.bt_pos; +seq_puts (m,"========== [BT Status] ==========\n" );seq_printf (m," %-15s : enable:%s, btg:%s%s, connect:%s, " ,"[status]" , bt->enable.now ?"Y" :"N" , bt->btg_type ?"Y" :"N" , - (bt->enable.now && (bt->btg_type != module->bt_pos) ? + (bt->enable.now && (bt->btg_type != bt_pos) ?"(efuse-mismatch!!)" :"" ), (bt_linfo->status.map.connect ?"Y" :"N" ));
@@ -7123,7 +7178,6 @@ static void _show_dm_step(struct rtw89_dev *rtwdev, struct seq_file *m)static void _show_dm_info (struct rtw89_dev *rtwdev,struct seq_file *m) {struct rtw89_btc *btc = &rtwdev->btc; -struct rtw89_btc_module *module = &btc->mdinfo;struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_bt_info *bt = &btc->cx.bt;
@@ -7137,7 +7191,7 @@ static void _show_dm_info(struct rtw89_dev *rtwdev, struct seq_file *m) seq_printf(m, " %-15s : type:%s, reason:%s(), action:%s(), ant_path:%s, init_mode:%s, run_cnt:%d\n", "[status]", - module->ant.type == BTC_ANT_SHARED ? "shared" : "dedicated", + btc->ant_type == BTC_ANT_SHARED ? "shared" : "dedicated", steps_to_str(dm->run_reason), steps_to_str(dm->run_action | BTC_ACT_EXT_BIT), id_to_ant(FIELD_GET(GENMASK(7, 0), dm->set_ant_path)),
drivers/net/wireless/realtek/rtw89/coex.h +18 -0
@@ -153,6 +153,10 @@ enum btc_lps_state {#define BTC_REG_NOTFOUND 0xff +#define R_BTC_ZB_COEX_TBL_0 0xE328 +#define R_BTC_ZB_COEX_TBL_1 0xE32c +#define R_BTC_ZB_BREAK_TBL 0xE350 +enum btc_ant_div_pos {BTC_ANT_DIV_MAIN =0 ,BTC_ANT_DIV_AUX =1 ,
@@ -181,6 +185,20 @@ enum btc_btgctrl_type { BTC_BTGCTRL_BB_GNT_NOTFOUND, }; +enum btc_wa_type { +BTC_WA_5G_HI_CH_RX =BIT (0 ), +BTC_WA_NULL_AP =BIT (1 ), +BTC_WA_HFP_ZB =BIT (2 ),/* HFP PTA req bit4 define issue */ +}; + +enum btc_3cx_type { +BTC_3CX_NONE =0 , +BTC_3CX_BT2 =BIT (0 ), +BTC_3CX_ZB =BIT (1 ), +BTC_3CX_LTE =BIT (2 ), +BTC_3CX_MAX , +}; +void rtw89_btc_ntfy_poweron (struct rtw89_dev *rtwdev);void rtw89_btc_ntfy_poweroff (struct rtw89_dev *rtwdev);void rtw89_btc_ntfy_init (struct rtw89_dev *rtwdev,u8 mode);
drivers/net/wireless/realtek/rtw89/core.h +65 -2
115 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/fw.c +41 -1
54 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/fw.h +6 -0
@@ -2400,6 +2400,11 @@ struct rtw89_h2c_cxinit {#define RTW89_H2C_CXINIT_INFO_CX_OTHER BIT(3)#define RTW89_H2C_CXINIT_INFO_BT_ONLY BIT(4) +struct rtw89_h2c_cxinit_v7 { +struct rtw89_h2c_cxhdr hdr; +struct rtw89_btc_init_info_v7 init; +} __packed; +static inline void RTW89_SET_FWCMD_CXROLE_CONNECT_CNT (void *cmd,u8 val) {u8p_replace_bits ((u8 *)(cmd) +2 , val,GENMASK (7 ,0 ));
@@ -4532,6 +4537,7 @@ int rtw89_fw_h2c_rssi_offload(struct rtw89_dev *rtwdev,int rtw89_fw_h2c_tp_offload (struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif);int rtw89_fw_h2c_ra (struct rtw89_dev *rtwdev,struct rtw89_ra_info *ra,bool csi);int rtw89_fw_h2c_cxdrv_init (struct rtw89_dev *rtwdev); +int rtw89_fw_h2c_cxdrv_init_v7 (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_role (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev);
drivers/net/wireless/realtek/rtw89/reg.h +7 -0
@@ -3510,8 +3510,13 @@#define B_AX_PTA_EDCCA_EN BIT(0)#define R_BTC_COEX_WL_REQ 0xDA24 +#define R_BTC_COEX_WL_REQ_BE 0xE324 +#define B_BTC_TX_NULL_HI BIT(23)#define B_BTC_TX_BCN_HI BIT(22) +#define B_BTC_TX_TRI_HI BIT(17)#define B_BTC_RSP_ACK_HI BIT(10) +#define B_BTC_PRI_MASK_TX_TIME GENMASK(4, 3) +#define B_BTC_PRI_MASK_RX_TIME_V1 GENMASK(2, 1)#define R_BTC_BREAK_TABLE 0xDA2C#define BTC_BREAK_PARAM 0xf0ffffff
@@ -5932,6 +5937,8 @@#define B_BE_MACID_ACQ_GRP0_CLR_P BIT(2)#define B_BE_R_MACID_ACQ_CHK_EN BIT(0) +#define R_BE_BT_BREAK_TABLE 0x0E344 +#define R_BE_GNT_SW_CTRL 0x0E348#define B_BE_WL_ACT2_VAL BIT(25)#define B_BE_WL_ACT2_SWCTRL BIT(24)
drivers/net/wireless/realtek/rtw89/rtw8851b.c +98 -52
207 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8852a.c +45 -19
87 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8852b.c +45 -19
87 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8852c.c +45 -19
87 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/rtw8922a.c +110 -0
122 lines not on this page · raw message
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 4/8 wifi: rtw89: coex: add BTC ctrl_info version 7 and related logic
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
Change structure member from bit field to normal variable to reduce unnecessary translation.
--- drivers/net/wireless/realtek/rtw89/coex.c | 90 ++++++++++++++++------ drivers/net/wireless/realtek/rtw89/core.h | 15 +++- drivers/net/wireless/realtek/rtw89/debug.c | 9 ++- drivers/net/wireless/realtek/rtw89/fw.c | 44 ++++++++++- drivers/net/wireless/realtek/rtw89/fw.h | 15 +++- 5 files changed, 142 insertions(+), 31 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +66 -24
@@ -718,6 +718,7 @@ static void _send_fw_cmd(struct rtw89_dev *rtwdev, u8 h2c_class, u8 h2c_func,static void _reset_btc_var (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc; +const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_cx *cx = &btc->cx;struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_bt_info *bt = &btc->cx.bt;
@@ -735,7 +736,9 @@ static void _reset_btc_var(struct rtw89_dev *rtwdev, u8 type)if (type &BTC_RESET_CTRL ) {memset (&btc->ctrl,0 ,sizeof (btc->ctrl)); - btc->ctrl.trace_step =FCXDEF_STEP ; + btc->manual_ctrl = false; +if (ver->fcxctrl !=7 ) + btc->ctrl.ctrl.trace_step =FCXDEF_STEP ; }/* Init Coex variables that are not zero */
@@ -1129,7 +1132,7 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,void *rpt_content =NULL , *pfinfo =NULL ;u8 rpt_type =0 ;u16 wl_slot_set =0 , wl_slot_real =0 ; -u32 trace_step = btc->ctrl.trace_step, rpt_len =0 , diff_t =0 ; +u32 trace_step =0 , rpt_len =0 , diff_t =0 ;u32 cnt_leak_slot, bt_slot_real, bt_slot_set, cnt_rx_imr;u8 i, val =0 ;
@@ -1219,6 +1222,9 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,break ;case BTC_RPT_TYPE_STEP : pcinfo = &pfwinfo->rpt_fbtc_step.cinfo; +if (ver->fcxctrl !=7 ) + trace_step = btc->ctrl.ctrl.trace_step; +if (ver->fcxstep ==2 ) { pfinfo = &pfwinfo->rpt_fbtc_step.finfo.v2; pcinfo->req_len = sizeof(pfwinfo->rpt_fbtc_step.finfo.v2.step[0]) *
@@ -2109,7 +2115,10 @@ static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type)rtw89_fw_h2c_cxdrv_role_v2 (rtwdev);break ;case CXDRVINFO_CTRL : -rtw89_fw_h2c_cxdrv_ctrl (rtwdev); +if (ver->fcxctrl ==7 ) +rtw89_fw_h2c_cxdrv_ctrl_v7 (rtwdev); +else +rtw89_fw_h2c_cxdrv_ctrl (rtwdev);break ;case CXDRVINFO_TRX : dm->trx_info.tx_power = u32_get_bits(rf_para.wl_tx_power,
@@ -2450,7 +2459,7 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)u8 en =0 , i, ch =0 , bw =0 ;u8 mode, connect_cnt; -if (btc->ctrl.manual || wl->status.map.scan) +if (btc->manual_ctrl || wl->status.map.scan)return ;if (ver->fwlrole ==0 ) {
@@ -4014,7 +4023,7 @@ static void _set_btg_ctrl(struct rtw89_dev *rtwdev)u32 is_btg;u8 i, val; -if (btc->ctrl.manual) +if (btc->manual_ctrl)return ;if (ver->fwlrole ==0 )
@@ -4086,7 +4095,7 @@ static void _set_wl_preagc_ctrl(struct rtw89_dev *rtwdev)struct rtw89_btc_dm *dm = &btc->dm;u8 is_preagc, val; -if (btc->ctrl.manual) +if (btc->manual_ctrl)return ;if (wl_rinfo->link_mode ==BTC_WLINK_25G_MCC )
@@ -4210,13 +4219,12 @@ static void _set_wl_tx_limit(struct rtw89_dev *rtwdev)struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;struct rtw89_txtime_data data = {.rtwdev = rtwdev}; -u8 mode; -u8 tx_retry; +u8 mode, igno_bt, tx_retry;u32 tx_time;u16 enable;bool reenable = false; -if (btc->ctrl.manual) +if (btc->manual_ctrl)return ;if (ver->fwlrole ==0 )
@@ -4228,7 +4236,12 @@ static void _set_wl_tx_limit(struct rtw89_dev *rtwdev)else return ; -if (btc->dm.freerun || btc->ctrl.igno_bt || b->profile_cnt.now ==0 || +if (ver->fcxctrl ==7 ) + igno_bt = btc->ctrl.ctrl_v7.igno_bt; +else + igno_bt = btc->ctrl.ctrl.igno_bt; + +if (btc->dm.freerun || igno_bt || b->profile_cnt.now ==0 || mode ==BTC_WLINK_5G || mode ==BTC_WLINK_NOLINK ) { enable =0 ; tx_time =BTC_MAX_TX_TIME_DEF ;
@@ -5374,7 +5387,7 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2; -u8 mode; +u8 mode, igno_bt, always_freerun;lockdep_assert_held (&rtwdev->mutex);
@@ -5391,20 +5404,28 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason)else return ; +if (ver->fcxctrl ==7 ) { + igno_bt = btc->ctrl.ctrl_v7.igno_bt; + always_freerun = btc->ctrl.ctrl_v7.always_freerun; + }else { + igno_bt = btc->ctrl.ctrl.igno_bt; + always_freerun = btc->ctrl.ctrl.always_freerun; + } +rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): reason=%d, mode=%d\n" , __func__, reason, mode);rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): wl_only=%d, bt_only=%d\n" , __func__, dm->wl_only, dm->bt_only);/* Be careful to change the following function sequence!! */ -if (btc->ctrl.manual) { +if (btc->manual_ctrl) {rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): return for Manual CTRL!!\n" , __func__);return ; } -if (btc->ctrl.igno_bt && +if (igno_bt && (reason ==BTC_RSN_UPDATE_BT_INFO || reason ==BTC_RSN_UPDATE_BT_SCBD )) { rtw89_debug(rtwdev, RTW89_DBG_BTC,
@@ -5441,24 +5462,24 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason) dm->freerun = false; dm->cnt_dm[BTC_DCNT_RUN ]++; dm->fddt_train =BTC_FDDT_DISABLE ; - btc->ctrl.igno_bt = false; bt->scan_rx_low_pri = false; + igno_bt = false; -if (btc->ctrl.always_freerun) { +if (always_freerun) {_action_freerun (rtwdev); - btc->ctrl.igno_bt = true; + igno_bt = true; goto exit; }if (dm->wl_only) {_action_wl_only (rtwdev); - btc->ctrl.igno_bt = true; + igno_bt = true; goto exit; }if (wl->status.map.rf_off || wl->status.map.lps || dm->bt_only) {_action_wl_off (rtwdev, mode); - btc->ctrl.igno_bt = true; + igno_bt = true; goto exit; }
@@ -5548,6 +5569,10 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason) exit:rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): exit\n" , __func__); +if (ver->fcxctrl ==7 ) + btc->ctrl.ctrl_v7.igno_bt = igno_bt; +else + btc->ctrl.ctrl.igno_bt = igno_bt;_action_common (rtwdev); }
@@ -5611,11 +5636,15 @@ void rtw89_btc_ntfy_init(struct rtw89_dev *rtwdev, u8 mode)struct rtw89_btc_dm *dm = &rtwdev->btc.dm;struct rtw89_btc_wl_info *wl = &btc->cx.wl;const struct rtw89_chip_info *chip = rtwdev->chip; +const struct rtw89_btc_ver *ver = btc->ver;_reset_btc_var (rtwdev,BTC_RESET_ALL ); btc->dm.run_reason =BTC_RSN_NONE ; btc->dm.run_action =BTC_ACT_NONE ; - btc->ctrl.igno_bt = true; +if (ver->fcxctrl ==7 ) + btc->ctrl.ctrl_v7.igno_bt = true; +else + btc->ctrl.ctrl.igno_bt = true;rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): mode=%d\n" , __func__, mode);
@@ -7178,15 +7207,17 @@ static void _show_dm_step(struct rtw89_dev *rtwdev, struct seq_file *m)static void _show_dm_info (struct rtw89_dev *rtwdev,struct seq_file *m) {struct rtw89_btc *btc = &rtwdev->btc; +const struct rtw89_btc_ver *ver = btc->ver;struct rtw89_btc_dm *dm = &btc->dm;struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_bt_info *bt = &btc->cx.bt; +u8 igno_bt;if (!(dm->coex_info_map &BTC_COEX_INFO_DM ))return ;seq_printf (m,"========== [Mechanism Status %s] ==========\n" , - (btc->ctrl.manual ?"(Manual)" :"(Auto)" )); + (btc->manual_ctrl ?"(Manual)" :"(Auto)" )); seq_printf(m, " %-15s : type:%s, reason:%s(), action:%s(), ant_path:%s, init_mode:%s, run_cnt:%d\n",
@@ -7200,8 +7231,13 @@ static void _show_dm_info(struct rtw89_dev *rtwdev, struct seq_file *m)_show_dm_step (rtwdev, m); +if (ver->fcxctrl ==7 ) + igno_bt = btc->ctrl.ctrl_v7.igno_bt; +else + igno_bt = btc->ctrl.ctrl.igno_bt; +seq_printf (m," %-15s : wl_only:%d, bt_only:%d, igno_bt:%d, free_run:%d, wl_ps_ctrl:%d, wl_mimo_ps:%d, " , -"[dm_flag]" , dm->wl_only, dm->bt_only, btc->ctrl.igno_bt, +"[dm_flag]" , dm->wl_only, dm->bt_only, igno_bt, dm->freerun, btc->lps, dm->wl_mimo_ps); seq_printf(m, "leak_ap:%d, fw_offload:%s%s\n", dm->leak_ap,
@@ -7942,10 +7978,11 @@ static void _show_fbtc_step_v2(struct rtw89_dev *rtwdev, struct seq_file *m)struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_rpt_cmn_info *pcinfo =NULL ;struct rtw89_btc_fbtc_steps_v2 *pstep =NULL ; +const struct rtw89_btc_ver *ver = btc->ver;u8 type, val, cnt =0 , state =0 ;bool outloop = false;u16 i, diff_t, n_start =0 , n_stop =0 ; -u16 pos_old, pos_new; +u16 pos_old, pos_new, trace_step; pcinfo = &pfwinfo->rpt_fbtc_step.cinfo;if (!pcinfo->valid)
@@ -7962,11 +7999,16 @@ static void _show_fbtc_step_v2(struct rtw89_dev *rtwdev, struct seq_file *m) do { switch (state) { case 0: + if (ver->fcxctrl == 7 || ver->fcxctrl == 1) + trace_step = 50; + else + trace_step = btc->ctrl.ctrl.trace_step; + n_start = pos_old; if (pos_new >= pos_old) n_stop = pos_new; else - n_stop = btc->ctrl.trace_step - 1; + n_stop = trace_step - 1; state = 1; break;
@@ -8796,7 +8838,7 @@ void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m)seq_printf (m,"WL FW / BT FW %d.%d.%d.%d / NA\n" , fw_suit->major_ver, fw_suit->minor_ver, fw_suit->sub_ver, fw_suit->sub_idex); -seq_printf (m,"manual %d\n" , btc->ctrl.manual); +seq_printf (m,"manual %d\n" , btc->manual_ctrl);seq_puts (m,"=========================================\n" );
drivers/net/wireless/realtek/rtw89/core.h +14 -1
@@ -2605,6 +2605,18 @@ struct rtw89_btc_ctrl { u32 rsvd: 12; }; +struct rtw89_btc_ctrl_v7 { +u8 manual; +u8 igno_bt; +u8 always_freerun; +u8 rsvd; +} __packed; + +union rtw89_btc_ctrl_list { +struct rtw89_btc_ctrl ctrl; +struct rtw89_btc_ctrl_v7 ctrl_v7; +}; +struct rtw89_btc_dbg {/* cmd "rb" */ bool rb_done;
@@ -2790,7 +2802,7 @@ struct rtw89_btc {struct rtw89_btc_cx cx;struct rtw89_btc_dm dm; -struct rtw89_btc_ctrl ctrl; +union rtw89_btc_ctrl_list ctrl;union rtw89_btc_module_info mdinfo;struct rtw89_btc_btf_fwinfo fwinfo;struct rtw89_btc_dbg dbg;
@@ -2810,6 +2822,7 @@ struct rtw89_btc {bool bt_req_en;bool update_policy_force;bool lps; +bool manual_ctrl; };enum rtw89_btc_hmsg {
drivers/net/wireless/realtek/rtw89/debug.c +6 -3
@@ -3427,14 +3427,17 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp,struct rtw89_debugfs_priv *debugfs_priv = filp->private_data;struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;struct rtw89_btc *btc = &rtwdev->btc; -bool btc_manual; +const struct rtw89_btc_ver *ver = btc->ver;int ret; - ret =kstrtobool_from_user (user_buf, count, &btc_manual); + ret =kstrtobool_from_user (user_buf, count, &btc->manual_ctrl);if (ret)return ret; - btc->ctrl.manual = btc_manual; +if (ver->fcxctrl ==7 ) + btc->ctrl.ctrl_v7.manual = btc->manual_ctrl; +else + btc->ctrl.ctrl.manual = btc->manual_ctrl;return count; }
drivers/net/wireless/realtek/rtw89/fw.c +42 -2
62 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/fw.h +14 -1
@@ -2366,7 +2366,19 @@ struct rtw89_h2c_cxhdr {u8 len; } __packed; +struct rtw89_h2c_cxhdr_v7 { +u8 type; +u8 ver; +u8 len; +} __packed; + +struct rtw89_h2c_cxctrl_v7 { +struct rtw89_h2c_cxhdr_v7 hdr; +struct rtw89_btc_ctrl_v7 ctrl; +} __packed; +#define H2C_LEN_CXDRVHDR sizeof(struct rtw89_h2c_cxhdr) +#define H2C_LEN_CXDRVHDR_V7 sizeof(struct rtw89_h2c_cxhdr_v7)struct rtw89_h2c_cxinit {struct rtw89_h2c_cxhdr hdr;
@@ -2401,7 +2413,7 @@ struct rtw89_h2c_cxinit {#define RTW89_H2C_CXINIT_INFO_BT_ONLY BIT(4)struct rtw89_h2c_cxinit_v7 { -struct rtw89_h2c_cxhdr hdr; +struct rtw89_h2c_cxhdr_v7 hdr;struct rtw89_btc_init_info_v7 init; } __packed;
@@ -4542,6 +4554,7 @@ int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_ctrl (struct rtw89_dev *rtwdev); +int rtw89_fw_h2c_cxdrv_ctrl_v7 (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_trx (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_cxdrv_rfk (struct rtw89_dev *rtwdev);int rtw89_fw_h2c_del_pkt_offload (struct rtw89_dev *rtwdev,u8 id);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 5/8 wifi: rtw89: coex: Reorder H2C command index to align with firmware
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
Wi-Fi firmware need some driver information to do decision or do some real-time control. Driver will update these information by H2C command. The chip 8922a H2C command index is different from before chips/branch, so need to assign the correct index to let firmware parsing.
--- drivers/net/wireless/realtek/rtw89/coex.c | 53 ++++++++++++++--------- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/fw.c | 36 +++++++-------- drivers/net/wireless/realtek/rtw89/fw.h | 30 ++++++++----- 4 files changed, 72 insertions(+), 48 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +33 -20
@@ -134,70 +134,70 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { .fcxstep = 7, .fcxnullsta = 7, .fcxmreg = 7, .fcxgpiodbg = 7, .fcxbtver = 7, .fcxbtscan = 7, .fcxbtafh = 7, .fcxbtdevinfo = 7, .fwlrole = 2, .frptmap = 7, .fcxctrl = 7, .fcxinit = 7, - .info_buf = 1800, .max_role_num = 6, + .drvinfo_type = 1, .info_buf = 1800, .max_role_num = 6, }, {RTL8851B ,RTW89_FW_VER_CODE (0 ,29 ,29 ,0 ), .fcxbtcrpt = 105, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 5, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 2, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 2, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 2, .frptmap = 3, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1800, .max_role_num = 6, + .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6, }, {RTL8852C, RTW89_FW_VER_CODE(0, 27, 57, 0), .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 3, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1280, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5, }, {RTL8852C, RTW89_FW_VER_CODE(0, 27, 42, 0), .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 2, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1280, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5, }, {RTL8852C, RTW89_FW_VER_CODE(0, 27, 0, 0), .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 2, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1280, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5, }, {RTL8852B, RTW89_FW_VER_CODE(0, 29, 29, 0), .fcxbtcrpt = 105, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 5, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 2, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 2, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 2, .frptmap = 3, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1800, .max_role_num = 6, + .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6, }, {RTL8852B, RTW89_FW_VER_CODE(0, 29, 14, 0), .fcxbtcrpt = 5, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 4, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 3, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1800, .max_role_num = 6, + .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6, }, {RTL8852B, RTW89_FW_VER_CODE(0, 27, 0, 0), .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 1, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1280, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5, }, {RTL8852A, RTW89_FW_VER_CODE(0, 13, 37, 0), .fcxbtcrpt = 4, .fcxtdma = 3, .fcxslots = 1, .fcxcysta = 3, .fcxstep = 3, .fcxnullsta = 2, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 2, .fcxbtdevinfo = 1, .fwlrole = 1, .frptmap = 3, .fcxctrl = 1, .fcxinit = 0, - .info_buf = 1280, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5, }, {RTL8852A, RTW89_FW_VER_CODE(0, 13, 0, 0), .fcxbtcrpt = 1, .fcxtdma = 1, .fcxslots = 1, .fcxcysta = 2, .fcxstep = 2, .fcxnullsta = 1, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1, .fwlrole = 0, .frptmap = 0, .fcxctrl = 0, .fcxinit = 0, - .info_buf = 1024, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5, },/* keep it to be the last as default entry */
@@ -206,7 +206,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { .fcxstep = 2, .fcxnullsta = 1, .fcxmreg = 1, .fcxgpiodbg = 1, .fcxbtver = 1, .fcxbtscan = 1, .fcxbtafh = 1, .fcxbtdevinfo = 1, .fwlrole = 0, .frptmap = 0, .fcxctrl = 0, .fcxinit = 0, - .info_buf = 1024, .max_role_num = 5, + .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5, }, };
@@ -2102,25 +2102,31 @@ static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type)switch (type) {case CXDRVINFO_INIT :if (ver->fcxinit ==7 ) -rtw89_fw_h2c_cxdrv_init_v7 (rtwdev); +rtw89_fw_h2c_cxdrv_init_v7 (rtwdev, type);else -rtw89_fw_h2c_cxdrv_init (rtwdev); +rtw89_fw_h2c_cxdrv_init (rtwdev, type);break ;case CXDRVINFO_ROLE :if (ver->fwlrole ==0 ) -rtw89_fw_h2c_cxdrv_role (rtwdev); +rtw89_fw_h2c_cxdrv_role (rtwdev, type);else if (ver->fwlrole ==1 ) -rtw89_fw_h2c_cxdrv_role_v1 (rtwdev); +rtw89_fw_h2c_cxdrv_role_v1 (rtwdev, type);else if (ver->fwlrole ==2 ) -rtw89_fw_h2c_cxdrv_role_v2 (rtwdev); +rtw89_fw_h2c_cxdrv_role_v2 (rtwdev, type);break ;case CXDRVINFO_CTRL : +if (ver->drvinfo_type ==1 ) + type =2 ; +if (ver->fcxctrl ==7 ) -rtw89_fw_h2c_cxdrv_ctrl_v7 (rtwdev); +rtw89_fw_h2c_cxdrv_ctrl_v7 (rtwdev, type);else -rtw89_fw_h2c_cxdrv_ctrl (rtwdev); +rtw89_fw_h2c_cxdrv_ctrl (rtwdev, type);break ;case CXDRVINFO_TRX : +if (ver->drvinfo_type ==1 ) + type =3 ; + dm->trx_info.tx_power =u32_get_bits (rf_para.wl_tx_power,RTW89_BTC_WL_DEF_TX_PWR ); dm->trx_info.rx_gain = u32_get_bits(rf_para.wl_rx_gain,
@@ -2131,11 +2137,18 @@ static void _fw_set_drv_info(struct rtw89_dev *rtwdev, u8 type) RTW89_BTC_WL_DEF_TX_PWR); dm->trx_info.cn = wl->cn_report; dm->trx_info.nhm = wl->nhm.pwr; -rtw89_fw_h2c_cxdrv_trx (rtwdev); +rtw89_fw_h2c_cxdrv_trx (rtwdev, type);break ;case CXDRVINFO_RFK : -rtw89_fw_h2c_cxdrv_rfk (rtwdev); +if (ver->drvinfo_type ==1 ) +return ; + +rtw89_fw_h2c_cxdrv_rfk (rtwdev, type);break ; +case CXDRVINFO_TXPWR : +case CXDRVINFO_FDDT : +case CXDRVINFO_MLO : +case CXDRVINFO_OSI :default :break ; }
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -2791,6 +2791,7 @@ struct rtw89_btc_ver {u8 fcxctrl;u8 fcxinit; +u8 drvinfo_type;u16 info_buf;u8 max_role_num; };
drivers/net/wireless/realtek/rtw89/fw.c +18 -18
@@ -3753,7 +3753,7 @@ int rtw89_fw_h2c_ra(struct rtw89_dev *rtwdev, struct rtw89_ra_info *ra, bool csireturn ret; } -int rtw89_fw_h2c_cxdrv_init (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_init (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm;
@@ -3773,7 +3773,7 @@ int rtw89_fw_h2c_cxdrv_init(struct rtw89_dev *rtwdev)skb_put (skb, len); h2c = (struct rtw89_h2c_cxinit *)skb->data; - h2c->hdr.type =CXDRVINFO_INIT ; + h2c->hdr.type = type; h2c->hdr.len = len -H2C_LEN_CXDRVHDR ; h2c->ant_type = ant->type;
@@ -3820,7 +3820,7 @@ int rtw89_fw_h2c_cxdrv_init(struct rtw89_dev *rtwdev)return ret; } -int rtw89_fw_h2c_cxdrv_init_v7 (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_init_v7 (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm;
@@ -3838,7 +3838,7 @@ int rtw89_fw_h2c_cxdrv_init_v7(struct rtw89_dev *rtwdev)skb_put (skb, len); h2c = (struct rtw89_h2c_cxinit_v7 *)skb->data; - h2c->hdr.type =CXDRVINFO_INIT ; + h2c->hdr.type = type; h2c->hdr.ver = btc->ver->fcxinit; h2c->hdr.len = len -H2C_LEN_CXDRVHDR_V7 ; h2c->init = *init_info;
@@ -3866,7 +3866,7 @@ int rtw89_fw_h2c_cxdrv_init_v7(struct rtw89_dev *rtwdev)#define H2C_LEN_CXDRVINFO_ROLE_SIZE (max_role_num) \ (4 + 12 * (max_role_num) + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_role (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_role (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -3891,7 +3891,7 @@ int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev)skb_put (skb, len); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_ROLE ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd, len -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXROLE_CONNECT_CNT (cmd, role_info->connect_cnt);
@@ -3947,7 +3947,7 @@ int rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev)#define H2C_LEN_CXDRVINFO_ROLE_SIZE_V1 (max_role_num) \ (4 + 16 * (max_role_num) + H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -3971,7 +3971,7 @@ int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev)skb_put (skb, len); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_ROLE ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd, len -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXROLE_CONNECT_CNT (cmd, role_info->connect_cnt);
@@ -4037,7 +4037,7 @@ int rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev)#define H2C_LEN_CXDRVINFO_ROLE_SIZE_V2 (max_role_num) \ (4 + 8 * (max_role_num) + H2C_LEN_CXDRVINFO_ROLE_DBCC_LEN + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -4061,7 +4061,7 @@ int rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev)skb_put (skb, len); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_ROLE ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd, len -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXROLE_CONNECT_CNT (cmd, role_info->connect_cnt);
@@ -4121,7 +4121,7 @@ int rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev) }#define H2C_LEN_CXDRVINFO_CTRL (4 + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_ctrl (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_ctrl (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;const struct rtw89_btc_ver *ver = btc->ver;
@@ -4138,7 +4138,7 @@ int rtw89_fw_h2c_cxdrv_ctrl(struct rtw89_dev *rtwdev)skb_put (skb,H2C_LEN_CXDRVINFO_CTRL ); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_CTRL ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd,H2C_LEN_CXDRVINFO_CTRL -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXCTRL_MANUAL (cmd, ctrl->manual);
@@ -4165,7 +4165,7 @@ int rtw89_fw_h2c_cxdrv_ctrl(struct rtw89_dev *rtwdev)return ret; } -int rtw89_fw_h2c_cxdrv_ctrl_v7 (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_ctrl_v7 (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_ctrl_v7 *ctrl = &btc->ctrl.ctrl_v7;
@@ -4182,7 +4182,7 @@ int rtw89_fw_h2c_cxdrv_ctrl_v7(struct rtw89_dev *rtwdev)skb_put (skb, len); h2c = (struct rtw89_h2c_cxctrl_v7 *)skb->data; - h2c->hdr.type =CXDRVINFO_INIT ; + h2c->hdr.type = type; h2c->hdr.ver = btc->ver->fcxctrl; h2c->hdr.len =sizeof (*h2c) -H2C_LEN_CXDRVHDR_V7 ; h2c->ctrl = *ctrl;
@@ -4205,7 +4205,7 @@ int rtw89_fw_h2c_cxdrv_ctrl_v7(struct rtw89_dev *rtwdev) }#define H2C_LEN_CXDRVINFO_TRX (28 + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_trx (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_trx (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_trx_info *trx = &btc->dm.trx_info;
@@ -4221,7 +4221,7 @@ int rtw89_fw_h2c_cxdrv_trx(struct rtw89_dev *rtwdev)skb_put (skb,H2C_LEN_CXDRVINFO_TRX ); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_TRX ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd,H2C_LEN_CXDRVINFO_TRX -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXTRX_TXLV (cmd, trx->tx_lvl);
@@ -4261,7 +4261,7 @@ int rtw89_fw_h2c_cxdrv_trx(struct rtw89_dev *rtwdev) }#define H2C_LEN_CXDRVINFO_RFK (4 + H2C_LEN_CXDRVHDR) -int rtw89_fw_h2c_cxdrv_rfk (struct rtw89_dev *rtwdev) +int rtw89_fw_h2c_cxdrv_rfk (struct rtw89_dev *rtwdev,u8 type) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_wl_info *wl = &btc->cx.wl;
@@ -4278,7 +4278,7 @@ int rtw89_fw_h2c_cxdrv_rfk(struct rtw89_dev *rtwdev)skb_put (skb,H2C_LEN_CXDRVINFO_RFK ); cmd = skb->data; -RTW89_SET_FWCMD_CXHDR_TYPE (cmd,CXDRVINFO_RFK ); +RTW89_SET_FWCMD_CXHDR_TYPE (cmd, type);RTW89_SET_FWCMD_CXHDR_LEN (cmd,H2C_LEN_CXDRVINFO_RFK -H2C_LEN_CXDRVHDR );RTW89_SET_FWCMD_CXRFK_STATE (cmd, rfk_info->state);
drivers/net/wireless/realtek/rtw89/fw.h +20 -10
@@ -2324,9 +2324,15 @@ enum rtw89_btc_btf_set {SET_BT_IGNORE_WLAN_ACT ,SET_BT_TX_PWR ,SET_BT_LNA_CONSTRAIN , -SET_BT_GOLDEN_RX_RANGE , +SET_BT_QUERY_DEV_LIST , +SET_BT_QUERY_DEV_INFO ,SET_BT_PSD_REPORT ,SET_H2C_TEST , +SET_IOFLD_RF , +SET_IOFLD_BB , +SET_IOFLD_MAC , +SET_IOFLD_SCBD , +SET_H2C_MACRO , SET_MAX1, };
@@ -2340,6 +2346,10 @@ enum rtw89_btc_cxdrvinfo {CXDRVINFO_CTRL ,CXDRVINFO_SCAN ,CXDRVINFO_TRX ,/* WL traffic to WL fw */ +CXDRVINFO_TXPWR , +CXDRVINFO_FDDT , +CXDRVINFO_MLO , +CXDRVINFO_OSI , CXDRVINFO_MAX, };
@@ -4548,15 +4558,15 @@ int rtw89_fw_h2c_rssi_offload(struct rtw89_dev *rtwdev, struct rtw89_rx_phy_ppdu *phy_ppdu);int rtw89_fw_h2c_tp_offload (struct rtw89_dev *rtwdev,struct rtw89_vif *rtwvif);int rtw89_fw_h2c_ra (struct rtw89_dev *rtwdev,struct rtw89_ra_info *ra,bool csi); -int rtw89_fw_h2c_cxdrv_init (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_init_v7 (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_role (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_ctrl (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_ctrl_v7 (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_trx (struct rtw89_dev *rtwdev); -int rtw89_fw_h2c_cxdrv_rfk (struct rtw89_dev *rtwdev); +int rtw89_fw_h2c_cxdrv_init (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_init_v7 (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_role (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_role_v1 (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_role_v2 (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_ctrl (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_ctrl_v7 (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_trx (struct rtw89_dev *rtwdev,u8 type); +int rtw89_fw_h2c_cxdrv_rfk (struct rtw89_dev *rtwdev,u8 type);int rtw89_fw_h2c_del_pkt_offload (struct rtw89_dev *rtwdev,u8 id);int rtw89_fw_h2c_add_pkt_offload (struct rtw89_dev *rtwdev,u8 *id,struct sk_buff *skb_ofld);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 6/8 wifi: rtw89: coex: add return value to ensure H2C command is success or not
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
Add return value to H2C function, and only record down the value while H2C command success, this can help us to check the real time status.
--- drivers/net/wireless/realtek/rtw89/coex.c | 52 ++++++++++++++--------- drivers/net/wireless/realtek/rtw89/coex.h | 2 + 2 files changed, 34 insertions(+), 20 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +32 -20
@@ -683,20 +683,25 @@ static void _run_coex(struct rtw89_dev *rtwdev,static void _write_scbd (struct rtw89_dev *rtwdev,u32 val,bool state);static void _update_bt_scbd (struct rtw89_dev *rtwdev,bool only_update); -static void _send_fw_cmd (struct rtw89_dev *rtwdev,u8 h2c_class,u8 h2c_func, -void *param,u16 len) +static int _send_fw_cmd (struct rtw89_dev *rtwdev,u8 h2c_class,u8 h2c_func, +void *param,u16 len) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;struct rtw89_btc_cx *cx = &btc->cx;struct rtw89_btc_wl_info *wl = &cx->wl; +struct rtw89_btc_dm *dm = &btc->dm;int ret; -if (!wl->status.map.init_ok) { +if (len >BTC_H2C_MAXLEN || len ==0 ) { + btc->fwinfo.cnt_h2c_fail++; + dm->error.map.h2c_buffer_over = true; +return -EINVAL ; + }else if (!wl->status.map.init_ok) {rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): return by btc not init!!\n" , __func__); pfwinfo->cnt_h2c_fail++; -return ; +return -EINVAL ; } else if ((wl->status.map.rf_off_pre == BTC_LPS_RF_OFF && wl->status.map.rf_off == BTC_LPS_RF_OFF) || (wl->status.map.lps_pre == BTC_LPS_RF_OFF &&
@@ -704,15 +709,17 @@ static void _send_fw_cmd(struct rtw89_dev *rtwdev, u8 h2c_class, u8 h2c_func,rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): return by wl off!!\n" , __func__); pfwinfo->cnt_h2c_fail++; -return ; +return -EINVAL ; } - pfwinfo->cnt_h2c++; - ret =rtw89_fw_h2c_raw_with_hdr (rtwdev, h2c_class, h2c_func, param, len, false, true); -if (ret !=0 ) +if (ret) pfwinfo->cnt_h2c_fail++; +else + pfwinfo->cnt_h2c++; + +return ret; }static void _reset_btc_var (struct rtw89_dev *rtwdev,u8 type)
@@ -1938,6 +1945,7 @@ static void rtw89_btc_fw_en_rpt(struct rtw89_dev *rtwdev,struct rtw89_btc_btf_fwinfo *fwinfo = &btc->fwinfo;struct rtw89_btc_btf_set_report r = {0 };u32 val, bit_map; +int ret;if ((wl_smap->rf_off || wl_smap->lps !=BTC_LPS_OFF ) && rpt_state !=0 )return ;
@@ -1956,13 +1964,13 @@ static void rtw89_btc_fw_en_rpt(struct rtw89_dev *rtwdev,if (val == fwinfo->rpt_en_map)return ; - fwinfo->rpt_en_map = val; - r.fver =BTF_SET_REPORT_VER ; r.enable =cpu_to_le32 (val); r.para =cpu_to_le32 (rpt_state); -_send_fw_cmd (rtwdev,BTFC_SET ,SET_REPORT_EN , &r,sizeof (r)); + ret =_send_fw_cmd (rtwdev,BTFC_SET ,SET_REPORT_EN , &r,sizeof (r)); +if (!ret) + fwinfo->rpt_en_map = val; } static void rtw89_btc_fw_set_slots(struct rtw89_dev *rtwdev, u8 num,
@@ -2050,6 +2058,7 @@ static void _fw_set_policy(struct rtw89_dev *rtwdev, u16 policy_type, {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_dm *dm = &btc->dm; +int ret; dm->run_action = action;
@@ -2078,11 +2087,12 @@ static void _fw_set_policy(struct rtw89_dev *rtwdev, u16 policy_type,if (btc->lps ==1 )rtw89_set_coex_ctrl_lps (rtwdev, btc->lps); -_send_fw_cmd (rtwdev,BTFC_SET ,SET_CX_POLICY , - btc->policy, btc->policy_len); - -memcpy (&dm->tdma_now, &dm->tdma,sizeof (dm->tdma_now)); -memcpy (&dm->slot_now, &dm->slot,sizeof (dm->slot_now)); + ret =_send_fw_cmd (rtwdev,BTFC_SET ,SET_CX_POLICY , + btc->policy, btc->policy_len); +if (!ret) { +memcpy (&dm->tdma_now, &dm->tdma,sizeof (dm->tdma_now)); +memcpy (&dm->slot_now, &dm->slot,sizeof (dm->slot_now)); + }if (btc->update_policy_force) btc->update_policy_force = false;
@@ -2298,20 +2308,22 @@ static void _set_bt_tx_power(struct rtw89_dev *rtwdev, u8 level) {struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_info *bt = &btc->cx.bt; +int ret;u8 buf;if (bt->rf_para.tx_pwr_freerun == level)return ; - bt->rf_para.tx_pwr_freerun = level; - btc->dm.rf_trx_para.bt_tx_power = level; -rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], %s(): level = %d\n" , __func__, level); buf = (s8)(-level); -_send_fw_cmd (rtwdev,BTFC_SET ,SET_BT_TX_PWR , &buf,1 ); + ret =_send_fw_cmd (rtwdev,BTFC_SET ,SET_BT_TX_PWR , &buf,1 ); +if (!ret) { + bt->rf_para.tx_pwr_freerun = level; + btc->dm.rf_trx_para.bt_tx_power = level; + } }#define BTC_BT_RX_NORMAL_LVL 7
drivers/net/wireless/realtek/rtw89/coex.h +2 -0
@@ -7,6 +7,8 @@#include "core.h" +#define BTC_H2C_MAXLEN 2020 +enum btc_mode {BTC_MODE_NORMAL ,BTC_MODE_WL ,
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 7/8 wifi: rtw89: coex: When Bluetooth not available don't set power/gain
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
If Bluetooth is working, it will update their info regularly. And the code will increase the counters while the info updating. Use this counter to judge is Bluetooth working or not. Don't need to set Bluetooth power or gain when it is not working.
--- drivers/net/wireless/realtek/rtw89/coex.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/coex.c +6 -0
@@ -2311,6 +2311,9 @@ static void _set_bt_tx_power(struct rtw89_dev *rtwdev, u8 level)int ret;u8 buf; +if (btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE ] ==0 ) +return ; +if (bt->rf_para.tx_pwr_freerun == level)return ;
@@ -2333,6 +2336,9 @@ static void _set_bt_rx_gain(struct rtw89_dev *rtwdev, u8 level)struct rtw89_btc *btc = &rtwdev->btc;struct rtw89_btc_bt_info *bt = &btc->cx.bt; +if (btc->cx.cnt_bt[BTC_BCNT_INFOUPDATE ] ==0 ) +return ; +if ((bt->rf_para.rx_gain_freerun == level || level >BTC_BT_RX_NORMAL_LVL ) && (!rtwdev->chip->scbd || bt->lna_constrain == level))
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH 8/8 wifi: rtw89: coex: Add coexistence policy to decrease WiFi packet CRC-ERR
In reply to Ping-Ke ShihFrom: Ching-Te Ku <[email protected]>
The 2 Bluetooth profiles (Hands free profile & Human interface device) have high duty transmission, it will affect the traffic of WiFi packet frequently. And once the WiFi traffic down to B/G mode, it will need a better success rate to recover the transmission rate. Add new policy option to solve the above situation.
--- drivers/net/wireless/realtek/rtw89/coex.c | 44 +++++++++++++++++++---- drivers/net/wireless/realtek/rtw89/core.h | 1 + 2 files changed, 38 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +37 -7
@@ -358,17 +358,26 @@ enum btc_cx_poicy_type {/* TDMA off + pri: WL_Rx = BT, BT_HI > WL_Tx > BT_Lo */ BTC_CXP_OFF_EQ3 = (BTC_CXP_OFF <<8 ) |5 , +/* TDMA off + pri: WL_Rx = BT, BT_HI > WL_Tx > BT_Lo */ +BTC_CXP_OFF_EQ4 = (BTC_CXP_OFF <<8 ) |6 , + +/* TDMA off + pri: WL_Rx = BT, BT_HI > WL_Tx > BT_Lo */ +BTC_CXP_OFF_EQ5 = (BTC_CXP_OFF <<8 ) |7 , +/* TDMA off + pri: BT_Hi > WL > BT_Lo */ -BTC_CXP_OFF_BWB0 = (BTC_CXP_OFF <<8 ) |6 , +BTC_CXP_OFF_BWB0 = (BTC_CXP_OFF <<8 ) |8 ,/* TDMA off + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo */ -BTC_CXP_OFF_BWB1 = (BTC_CXP_OFF <<8 ) |7 , +BTC_CXP_OFF_BWB1 = (BTC_CXP_OFF <<8 ) |9 ,/* TDMA off + pri: WL_Hi-Tx > BT, BT_Hi > other-WL > BT_Lo */ -BTC_CXP_OFF_BWB2 = (BTC_CXP_OFF <<8 ) |8 , +BTC_CXP_OFF_BWB2 = (BTC_CXP_OFF <<8 ) |10 ,/* TDMA off + pri: WL_Hi-Tx = BT */ -BTC_CXP_OFF_BWB3 = (BTC_CXP_OFF <<8 ) |9 , +BTC_CXP_OFF_BWB3 = (BTC_CXP_OFF <<8 ) |11 , + +/* TDMA off + pri: WL > BT, Block-BT*/ +BTC_CXP_OFF_WL2 = (BTC_CXP_OFF <<8 ) |12 ,/* TDMA off+Bcn-Protect + pri: WL_Hi-Tx > BT_Hi_Rx, BT_Hi > WL > BT_Lo*/ BTC_CXP_OFFB_BWB0 = (BTC_CXP_OFFB << 8) | 0,
@@ -3086,6 +3095,7 @@ void rtw89_btc_set_policy_v1(struct rtw89_dev *rtwdev, u16 policy_type)struct rtw89_btc_wl_role_info_v1 *wl_rinfo = &btc->cx.wl.role_info_v1;struct rtw89_btc_bt_hid_desc *hid = &btc->cx.bt.link_info.hid_desc;struct rtw89_btc_bt_hfp_desc *hfp = &btc->cx.bt.link_info.hfp_desc; +struct rtw89_btc_wl_info *wl = &btc->cx.wl;u8 type, null_role;u32 tbl_w1, tbl_b1, tbl_b4;
@@ -3111,9 +3121,16 @@ void rtw89_btc_set_policy_v1(struct rtw89_dev *rtwdev, u16 policy_type) tbl_b4 = cxtbl[2 ]; } }else { - tbl_w1 = cxtbl[16 ]; tbl_b1 = cxtbl[17 ]; tbl_b4 = cxtbl[17 ]; + +if (wl->bg_mode) + tbl_w1 = cxtbl[8 ]; +else if ((wl->status.map.traffic_dir &BIT (RTW89_TFC_UL )) && + hid->exist) + tbl_w1 = cxtbl[19 ]; +else + tbl_w1 = cxtbl[16 ]; } btc->bt_req_en = false;
@@ -3727,7 +3744,12 @@ static void _action_bt_hfp(struct rtw89_dev *rtwdev)_set_policy (rtwdev,BTC_CXP_OFF_BWB1 ,BTC_ACT_BT_HFP ); } }else { -_set_policy (rtwdev,BTC_CXP_OFF_EQ2 ,BTC_ACT_BT_HFP ); +if (wl->bg_mode) +_set_policy (rtwdev,BTC_CXP_OFF_BWB1 ,BTC_ACT_BT_HFP ); +else if (wl->status.map.traffic_dir &BIT (RTW89_TFC_UL )) +_set_policy (rtwdev,BTC_CXP_OFF_EQ5 ,BTC_ACT_BT_HFP ); +else +_set_policy (rtwdev,BTC_CXP_OFF_EQ2 ,BTC_ACT_BT_HFP ); } }
@@ -3760,7 +3782,12 @@ static void _action_bt_hid(struct rtw89_dev *rtwdev) policy_type =BTC_CXP_OFF_BWB1 ; } }else {/* dedicated-antenna */ - policy_type =BTC_CXP_OFF_EQ3 ; +if (wl->bg_mode) + policy_type =BTC_CXP_OFF_BWB1 ; +else if (wl->status.map.traffic_dir &BIT (RTW89_TFC_UL )) + policy_type =BTC_CXP_OFF_EQ4 ; +else + policy_type =BTC_CXP_OFF_EQ3 ; }_set_policy (rtwdev, policy_type,BTC_ACT_BT_HID );
@@ -7049,10 +7076,13 @@ static const char *steps_to_str(u16 step)CASE_BTC_POLICY_STR (OFF_EQ1 );CASE_BTC_POLICY_STR (OFF_EQ2 );CASE_BTC_POLICY_STR (OFF_EQ3 ); +CASE_BTC_POLICY_STR (OFF_EQ4 ); +CASE_BTC_POLICY_STR (OFF_EQ5 );CASE_BTC_POLICY_STR (OFF_BWB0 );CASE_BTC_POLICY_STR (OFF_BWB1 );CASE_BTC_POLICY_STR (OFF_BWB2 );CASE_BTC_POLICY_STR (OFF_BWB3 ); +CASE_BTC_POLICY_STR (OFF_WL2 );CASE_BTC_POLICY_STR (OFFB_BWB0 );CASE_BTC_POLICY_STR (OFFE_DEF );CASE_BTC_POLICY_STR (OFFE_DEF2 );
drivers/net/wireless/realtek/rtw89/core.h +1 -0
@@ -1741,6 +1741,7 @@ struct rtw89_btc_wl_info {u8 cn_report;u8 coex_mode; +bool bg_mode;bool scbd_change;u32 scbd; };
Signature · 1 line
2.25.1