wifi: rtw89: coex: Re-order the index for the report from firmware
authorChing-Te Ku <ku920601@realtek.com>
Thu, 18 Apr 2024 02:12:07 +0000 (10:12 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 23 Apr 2024 11:52:51 +0000 (19:52 +0800)
The report index has changed, correct the index for the corresponding
firmware version.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-10-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/coex.c
drivers/net/wireless/realtek/rtw89/core.h

index 15f1c133c70af65675996c444fa7ebf7e3e30e32..1649cb2e217f51201a3ab62cc5276d925e83062f 100644 (file)
@@ -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 = 8,   .frptmap = 3,    .fcxctrl = 7,  .fcxinit = 7,
-        .drvinfo_type = 1, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 1, .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,
-        .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5,
+        .fwevntrptl = 0, .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,
-        .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5,
+        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5,
        },
 };
 
@@ -1205,6 +1205,22 @@ static void _update_bt_report(struct rtw89_dev *rtwdev, u8 rpt_type, u8 *pfinfo)
        }
 }
 
+static void rtw89_btc_fw_rpt_evnt_ver(struct rtw89_dev *rtwdev, u8 *index)
+{
+       struct rtw89_btc *btc = &rtwdev->btc;
+       const struct rtw89_btc_ver *ver = btc->ver;
+
+       if (ver->fwevntrptl == 1)
+               return;
+
+       if (*index <= __BTC_RPT_TYPE_V0_SAME)
+               return;
+       else if (*index <= __BTC_RPT_TYPE_V0_MAX)
+               (*index)++;
+       else
+               *index = BTC_RPT_TYPE_MAX;
+}
+
 #define BTC_LEAK_AP_TH 10
 #define BTC_CYSTA_CHK_PERIOD 100
 
@@ -1252,6 +1268,8 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev,
                    "[BTC], %s(): rpt_type:%d\n",
                    __func__, rpt_type);
 
+       rtw89_btc_fw_rpt_evnt_ver(rtwdev, &rpt_type);
+
        switch (rpt_type) {
        case BTC_RPT_TYPE_CTRL:
                pcinfo = &pfwinfo->rpt_ctrl.cinfo;
index 774050aa21c7854f3ecda47add88e0e325b98bcc..9da8be9927d3f824a55730c3c1fd511d8e14fdd5 100644 (file)
@@ -2856,6 +2856,7 @@ enum btf_fw_event_report {
        BTC_RPT_TYPE_CYSTA,
        BTC_RPT_TYPE_STEP,
        BTC_RPT_TYPE_NULLSTA,
+       BTC_RPT_TYPE_FDDT, /* added by ver->fwevntrptl == 1 */
        BTC_RPT_TYPE_MREG,
        BTC_RPT_TYPE_GPIO_DBG,
        BTC_RPT_TYPE_BT_VER,
@@ -2863,7 +2864,10 @@ enum btf_fw_event_report {
        BTC_RPT_TYPE_BT_AFH,
        BTC_RPT_TYPE_BT_DEVICE,
        BTC_RPT_TYPE_TEST,
-       BTC_RPT_TYPE_MAX = 31
+       BTC_RPT_TYPE_MAX = 31,
+
+       __BTC_RPT_TYPE_V0_SAME = BTC_RPT_TYPE_NULLSTA,
+       __BTC_RPT_TYPE_V0_MAX = 12,
 };
 
 enum rtw_btc_btf_reg_type {
@@ -3005,6 +3009,7 @@ struct rtw89_btc_ver {
        u8 fcxctrl;
        u8 fcxinit;
 
+       u8 fwevntrptl;
        u8 drvinfo_type;
        u16 info_buf;
        u8 max_role_num;