]> Git Repo - linux.git/commitdiff
wifi: rtw89: coex: Add function to reorder Wi-Fi firmware report index
authorChing-Te Ku <[email protected]>
Thu, 3 Oct 2024 10:51:40 +0000 (18:51 +0800)
committerPing-Ke Shih <[email protected]>
Thu, 10 Oct 2024 00:37:33 +0000 (08:37 +0800)
To parsing firmware report correctly, driver need to re-order the report
index to match with different chips and different Wi-Fi firmware version.
Use wrong index to parse the report will lead the coexistence run into
wrong mechanism.

Signed-off-by: Ching-Te Ku <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Link: https://patch.msgid.link/[email protected]
drivers/net/wireless/realtek/rtw89/coex.c
drivers/net/wireless/realtek/rtw89/core.h

index 3350e982ca5a2a6cca8c02cf040b80830320e30d..989e6e882c6e73ccc483ffb31d54092a0770bd80 100644 (file)
@@ -137,77 +137,88 @@ 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 = 7,   .frptmap = 3,    .fcxctrl = 7,  .fcxinit = 7,
-        .fwevntrptl = 1, .drvinfo_type = 1, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 1, .fwc2hfunc = 2, .drvinfo_type = 1, .info_buf = 1800,
+        .max_role_num = 6,
        },
        {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 = 8,   .frptmap = 3,    .fcxctrl = 7,  .fcxinit = 7,
-        .fwevntrptl = 1, .drvinfo_type = 1, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 1, .fwc2hfunc = 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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1800, .max_role_num = 6,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1280, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 0, .drvinfo_type = 0, .info_buf = 1024,
+        .max_role_num = 5,
        },
 
        /* keep it to be the last as default entry */
@@ -216,7 +227,8 @@ 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,
-        .fwevntrptl = 0, .drvinfo_type = 0, .info_buf = 1024, .max_role_num = 5,
+        .fwevntrptl = 0, .fwc2hfunc = 1, .drvinfo_type = 0, .info_buf = 1024,
+        .max_role_num = 5,
        },
 };
 
@@ -8029,6 +8041,53 @@ void rtw89_btc_ntfy_wl_sta(struct rtw89_dev *rtwdev)
        }
 }
 
+static u8 rtw89_btc_c2h_get_index_by_ver(struct rtw89_dev *rtwdev, u8 func)
+{
+       struct rtw89_btc *btc = &rtwdev->btc;
+       const struct rtw89_btc_ver *ver = btc->ver;
+
+       switch (func) {
+       case BTF_EVNT_RPT:
+       case BTF_EVNT_BT_INFO:
+       case BTF_EVNT_BT_SCBD:
+       case BTF_EVNT_BT_REG:
+       case BTF_EVNT_CX_RUNINFO:
+       case BTF_EVNT_BT_PSD:
+               return func;
+       case BTF_EVNT_BT_DEV_INFO:
+               if (ver->fwc2hfunc == 0)
+                       return BTF_EVNT_BUF_OVERFLOW;
+               else
+                       return BTF_EVNT_BT_DEV_INFO;
+       case BTF_EVNT_BT_LEAUDIO_INFO:
+               if (ver->fwc2hfunc == 0)
+                       return BTF_EVNT_C2H_LOOPBACK;
+               else if (ver->fwc2hfunc == 1)
+                       return BTF_EVNT_BUF_OVERFLOW;
+               else if (ver->fwc2hfunc == 2)
+                       return func;
+               else
+                       return BTF_EVNT_MAX;
+       case BTF_EVNT_BUF_OVERFLOW:
+               if (ver->fwc2hfunc == 0)
+                       return BTF_EVNT_MAX;
+               else if (ver->fwc2hfunc == 1)
+                       return BTF_EVNT_C2H_LOOPBACK;
+               else if (ver->fwc2hfunc == 2)
+                       return func;
+               else
+                       return BTF_EVNT_MAX;
+       case BTF_EVNT_C2H_LOOPBACK:
+               if (ver->fwc2hfunc == 2)
+                       return func;
+               else
+                       return BTF_EVNT_MAX;
+       case BTF_EVNT_MAX:
+       default:
+               return BTF_EVNT_MAX;
+       }
+}
+
 void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
                          u32 len, u8 class, u8 func)
 {
@@ -8045,6 +8104,8 @@ void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
        if (class != BTFC_FW_EVENT)
                return;
 
+       func = rtw89_btc_c2h_get_index_by_ver(rtwdev, func);
+
        switch (func) {
        case BTF_EVNT_BUF_OVERFLOW:
                pfwinfo->event[func]++;
index c89c380f28710d50c7245064d1b230dba1ea10db..ff7c90533c621fad9ef0ea53f486035b22aca85b 100644 (file)
@@ -2977,7 +2977,8 @@ enum rtw89_btc_btf_fw_event {
        BTF_EVNT_BT_REG = 3,
        BTF_EVNT_CX_RUNINFO = 4,
        BTF_EVNT_BT_PSD = 5,
-       BTF_EVNT_BT_DEV_INFO = 6,
+       BTF_EVNT_BT_DEV_INFO = 6, /* fwc2hfunc > 0 */
+       BTF_EVNT_BT_LEAUDIO_INFO = 7, /* fwc2hfunc > 1 */
        BTF_EVNT_BUF_OVERFLOW,
        BTF_EVNT_C2H_LOOPBACK,
        BTF_EVNT_MAX,
@@ -3144,6 +3145,7 @@ struct rtw89_btc_ver {
        u8 fcxinit;
 
        u8 fwevntrptl;
+       u8 fwc2hfunc;
        u8 drvinfo_type;
        u16 info_buf;
        u8 max_role_num;
This page took 0.111079 seconds and 4 git commands to generate.