]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: rfk: support IQK firmware command v1
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 6 Jun 2025 02:02:59 +0000 (10:02 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 10 Jun 2025 02:04:13 +0000 (10:04 +0800)
Add new IQK firmware command format v1 (with suffix), and rename original
command format to v0 for older firmware.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250606020302.16873-4-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 ddd207326503bab80d7fd0e2fd13c065e7543cfd..c79164757bd9732bba2c6a8b7dbe7da2e0fe4d56 100644 (file)
@@ -4514,6 +4514,7 @@ enum rtw89_fw_feature {
        RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V0,
        RTW89_FW_FEATURE_RFK_PRE_NOTIFY_V1,
        RTW89_FW_FEATURE_RFK_RXDCK_V0,
+       RTW89_FW_FEATURE_RFK_IQK_V0,
        RTW89_FW_FEATURE_NO_WOW_CPU_IO_RX,
        RTW89_FW_FEATURE_NOTIFY_AP_INFO,
        RTW89_FW_FEATURE_CH_INFO_BE_V0,
index 1d37ea7f1391d40f832eec7c77e0e22d6c3430a7..0547eb11d37825ba8093d8d5ad64800b7038e0e4 100644 (file)
@@ -845,6 +845,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 21, 0, SCAN_OFFLOAD_BE_V0),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 35, 12, 0, BEACON_FILTER),
        __CFG_FW_FEAT(RTL8922A, ge, 0, 35, 22, 0, WOW_REASON_V1),
+       __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 28, 0, RFK_IQK_V0),
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 31, 0, RFK_PRE_NOTIFY_V0),
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 31, 0, LPS_CH_INFO),
        __CFG_FW_FEAT(RTL8922A, lt, 0, 35, 42, 0, RFK_RXDCK_V0),
@@ -6080,22 +6081,47 @@ fail:
 int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
                        const struct rtw89_chan *chan)
 {
+       struct rtw89_hal *hal = &rtwdev->hal;
+       struct rtw89_h2c_rf_iqk_v0 *h2c_v0;
        struct rtw89_h2c_rf_iqk *h2c;
        u32 len = sizeof(*h2c);
        struct sk_buff *skb;
+       u8 ver = U8_MAX;
        int ret;
 
+       if (RTW89_CHK_FW_FEATURE(RFK_IQK_V0, &rtwdev->fw)) {
+               len = sizeof(*h2c_v0);
+               ver = 0;
+       }
+
        skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
        if (!skb) {
                rtw89_err(rtwdev, "failed to alloc skb for h2c RF IQK\n");
                return -ENOMEM;
        }
        skb_put(skb, len);
+
+       if (ver == 0) {
+               h2c_v0 = (struct rtw89_h2c_rf_iqk_v0 *)skb->data;
+
+               h2c_v0->phy_idx = cpu_to_le32(phy_idx);
+               h2c_v0->dbcc = cpu_to_le32(rtwdev->dbcc_en);
+
+               goto done;
+       }
+
        h2c = (struct rtw89_h2c_rf_iqk *)skb->data;
 
-       h2c->phy_idx = cpu_to_le32(phy_idx);
-       h2c->dbcc = cpu_to_le32(rtwdev->dbcc_en);
+       h2c->len = sizeof(*h2c);
+       h2c->ktype = 0;
+       h2c->phy = phy_idx;
+       h2c->kpath = rtw89_phy_get_kpath(rtwdev, phy_idx);
+       h2c->band = chan->band_type;
+       h2c->bw = chan->band_width;
+       h2c->ch = chan->channel;
+       h2c->cv = hal->cv;
 
+done:
        rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
                              H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK,
                              H2C_FUNC_RFK_IQK_OFFLOAD, 0, 0, len);
index 2fc2d1d61e299e99cfed8234c95337bbf9a3a654..d4815bcce91bcbafca44236ebe44a05726e94b37 100644 (file)
@@ -4438,11 +4438,22 @@ struct rtw89_h2c_rf_tssi {
        u8 rfe_type;
 } __packed;
 
-struct rtw89_h2c_rf_iqk {
+struct rtw89_h2c_rf_iqk_v0 {
        __le32 phy_idx;
        __le32 dbcc;
 } __packed;
 
+struct rtw89_h2c_rf_iqk {
+       u8 len;
+       u8 ktype;
+       u8 phy;
+       u8 kpath;
+       u8 band;
+       u8 bw;
+       u8 ch;
+       u8 cv;
+} __packed;
+
 struct rtw89_h2c_rf_dpk {
        u8 len;
        u8 phy;