]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: 8922a: update format of RFK pre-notify H2C command v2
authorChih-Kang Chang <gary.chang@realtek.com>
Fri, 6 Dec 2024 05:57:16 +0000 (13:57 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 12 Dec 2024 02:21:52 +0000 (10:21 +0800)
The RFK pre-notify H2C command is to tell firmware the channels driver is
using. Since the format is changed after 0.35.49.0, update it accordingly.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241206055716.18598-8-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h

index c2b5eeb4a4f14749d42ec0105b0e52da702e2b6b..155538370a898bc252945aae11a7bed729aae63b 100644 (file)
@@ -4462,6 +4462,7 @@ enum rtw89_fw_feature {
        RTW89_FW_FEATURE_SCAN_OFFLOAD_BE_V0,
        RTW89_FW_FEATURE_WOW_REASON_V1,
        RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V0,
+       RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V1,
        RTW89_FW_FEATURE_RFK_RXDCK_V0,
        RTW89_FW_FEATURE_NO_WOW_CPU_IO_RX,
        RTW89_FW_FEATURE_NOTIFY_AP_INFO,
index e5f3efe3a7e6e8028447a96aafb7e12649d3445d..90db1568572810e77e324f3fec3fef6f281d9bd5 100644 (file)
@@ -733,6 +733,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 42, 0, RFK_RXDCK_V0),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 35, 46, 0, NOTIFY_AP_INFO),
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 47, 0, CH_INFO_BE_V0),
+       __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 49, 0, RFK_PRE_NOTIFY_V1),
 };
 
 static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,
@@ -5540,7 +5541,9 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
                             enum rtw89_phy_idx phy_idx)
 {
        struct rtw89_rfk_mcc_info *rfk_mcc = &rtwdev->rfk_mcc;
+       struct rtw89_fw_h2c_rfk_pre_info_common *common;
        struct rtw89_fw_h2c_rfk_pre_info_v0 *h2c_v0;
+       struct rtw89_fw_h2c_rfk_pre_info_v1 *h2c_v1;
        struct rtw89_fw_h2c_rfk_pre_info *h2c;
        u8 tbl_sel[NUM_OF_RTW89_FW_RFK_PATH];
        u32 len = sizeof(*h2c);
@@ -5550,7 +5553,10 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
        u32 val32;
        int ret;
 
-       if (RTW89_CHK_FW_FEATURE(RFK_PRE_NOTIFY_V0, &rtwdev->fw)) {
+       if (RTW89_CHK_FW_FEATURE(RFK_PRE_NOTIFY_V1, &rtwdev->fw)) {
+               len = sizeof(*h2c_v1);
+               ver = 1;
+       } else if (RTW89_CHK_FW_FEATURE(RFK_PRE_NOTIFY_V0, &rtwdev->fw)) {
                len = sizeof(*h2c_v0);
                ver = 0;
        }
@@ -5562,17 +5568,18 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
        }
        skb_put(skb, len);
        h2c = (struct rtw89_fw_h2c_rfk_pre_info *)skb->data;
+       common = &h2c->base_v1.common;
 
-       h2c->common.mlo_mode = cpu_to_le32(rtwdev->mlo_dbcc_mode);
+       common->mlo_mode = cpu_to_le32(rtwdev->mlo_dbcc_mode);
 
        BUILD_BUG_ON(NUM_OF_RTW89_FW_RFK_TBL > RTW89_RFK_CHS_NR);
        BUILD_BUG_ON(ARRAY_SIZE(rfk_mcc->data) < NUM_OF_RTW89_FW_RFK_PATH);
 
        for (tbl = 0; tbl < NUM_OF_RTW89_FW_RFK_TBL; tbl++) {
                for (path = 0; path < NUM_OF_RTW89_FW_RFK_PATH; path++) {
-                       h2c->common.dbcc.ch[path][tbl] =
+                       common->dbcc.ch[path][tbl] =
                                cpu_to_le32(rfk_mcc->data[path].ch[tbl]);
-                       h2c->common.dbcc.band[path][tbl] =
+                       common->dbcc.band[path][tbl] =
                                cpu_to_le32(rfk_mcc->data[path].band[tbl]);
                }
        }
@@ -5580,13 +5587,19 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
        for (path = 0; path < NUM_OF_RTW89_FW_RFK_PATH; path++) {
                tbl_sel[path] = rfk_mcc->data[path].table_idx;
 
-               h2c->common.tbl.cur_ch[path] =
+               common->tbl.cur_ch[path] =
                        cpu_to_le32(rfk_mcc->data[path].ch[tbl_sel[path]]);
-               h2c->common.tbl.cur_band[path] =
+               common->tbl.cur_band[path] =
                        cpu_to_le32(rfk_mcc->data[path].band[tbl_sel[path]]);
+
+               if (ver <= 1)
+                       continue;
+
+               h2c->cur_bandwidth[path] =
+                       cpu_to_le32(rfk_mcc->data[path].bw[tbl_sel[path]]);
        }
 
-       h2c->common.phy_idx = cpu_to_le32(phy_idx);
+       common->phy_idx = cpu_to_le32(phy_idx);
 
        if (ver == 0) { /* RFK_PRE_NOTIFY_V0 */
                h2c_v0 = (struct rtw89_fw_h2c_rfk_pre_info_v0 *)skb->data;
@@ -5612,8 +5625,10 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
                goto done;
        }
 
-       if (rtw89_is_mlo_1_1(rtwdev))
-               h2c->mlo_1_1 = cpu_to_le32(1);
+       if (rtw89_is_mlo_1_1(rtwdev)) {
+               h2c_v1 = &h2c->base_v1;
+               h2c_v1->mlo_1_1 = cpu_to_le32(1);
+       }
 done:
        rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
                              H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK,
index 2dfc584da7d658fd5d4bbbb96086186e61d894e3..a3fe183c2ab081b4a376b60d469bff49bff3612b 100644 (file)
@@ -4293,11 +4293,16 @@ struct rtw89_fw_h2c_rfk_pre_info_v0 {
        } __packed mlo;
 } __packed;
 
-struct rtw89_fw_h2c_rfk_pre_info {
+struct rtw89_fw_h2c_rfk_pre_info_v1 {
        struct rtw89_fw_h2c_rfk_pre_info_common common;
        __le32 mlo_1_1;
 } __packed;
 
+struct rtw89_fw_h2c_rfk_pre_info {
+       struct rtw89_fw_h2c_rfk_pre_info_v1 base_v1;
+       __le32 cur_bandwidth[NUM_OF_RTW89_FW_RFK_PATH];
+} __packed;
+
 struct rtw89_h2c_rf_tssi {
        __le16 len;
        u8 phy;