BT firmware will report BLE-HID and BLE-RCU in different profile.
We can distinguish the two profile from BT info now.
Add the coexistence for BLE-HID coexistence,
it can make BLE HID work more smoothly.
BLE-HID need to Tx/Rx packet more frequently to respond
user operation, but RCU doesn't.
In the case of RCU coexistence, it will make Wi-Fi have a
higher priority to earn more Wi-Fi throughput.
If BLE-HID go for the same case,
it will make user feel mouse is lagging.
Desired BT firmware BT-COEX version: 0x1c
Desired WL firmware version: 9.9
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201030055506.6560-1-pkshih@realtek.com
                        } else {
                                /* for 4/18 HID */
                                if (coex_stat->bt_418_hid_exist &&
-                                   coex_stat->wl_gl_busy)
+                                   coex_stat->wl_gl_busy) {
                                        table_case = 12;
-                               else
+                                       tdma_case = 4;
+                               } else if (coex_stat->bt_ble_hid_exist &&
+                                          coex_stat->wl_gl_busy) {
+                                       table_case = 32;
+                                       tdma_case = 9;
+                               } else {
                                        table_case = 10;
-                               tdma_case = 4;
+                                       tdma_case = 4;
+                               }
                        }
                }
        } else {
                                                     4 * HZ);
        }
        coex_stat->bt_acl_busy = ((coex_stat->bt_info_lb2 & BIT(3)) == BIT(3));
+       if (coex_stat->bt_info_lb2 & BIT(5)) {
+               if (coex_stat->bt_info_hb1 & BIT(0)) {
+                       /*BLE HID*/
+                       coex_stat->bt_ble_hid_exist = true;
+               } else {
+                       coex_stat->bt_ble_hid_exist = false;
+               }
+               coex_stat->bt_ble_exist = false;
+       } else if (coex_stat->bt_info_hb1 & BIT(0)) {
+               /*RCU*/
+               coex_stat->bt_ble_hid_exist = false;
+               coex_stat->bt_ble_exist = true;
+       } else {
+               coex_stat->bt_ble_hid_exist = false;
+               coex_stat->bt_ble_exist = false;
+       }
+
        coex_stat->cnt_bt[COEX_CNT_BT_RETRY] = coex_stat->bt_info_lb3 & 0xf;
        if (coex_stat->cnt_bt[COEX_CNT_BT_RETRY] >= 1)
                coex_stat->cnt_bt[COEX_CNT_BT_POPEVENT]++;
                        coex_stat->bt_rssi = 0;
        }
 
-       coex_stat->bt_ble_exist = ((coex_stat->bt_info_hb1 & BIT(0)) == BIT(0));
        if (coex_stat->bt_info_hb1 & BIT(1))
                coex_stat->cnt_bt[COEX_CNT_BT_REINIT]++;
 
                   coex_stat->bt_hid_exist ?
                   (coex_stat->bt_ble_exist ? "HID(RCU)," :
                    coex_stat->bt_hid_slot >= 2 ? "HID(4/18)" :
+                   coex_stat->bt_ble_hid_exist ? "HID(BLE)" :
                    "HID(2/18),") : "",
                   coex_stat->bt_pan_exist ? coex_stat->bt_opp_exist ?
                   "OPP," : "PAN," : "",
 
        bool bt_init_scan;
        bool bt_slave;
        bool bt_418_hid_exist;
+       bool bt_ble_hid_exist;
        bool bt_mailbox_reply;
 
        bool wl_under_lps;
 
        {0x55555555, 0x5a5a5a5a},
        {0x55555555, 0xaaaaaaaa},
        {0x55555555, 0x6a6a6a6a},
-       {0x656a656a, 0x656a656a}
+       {0x656a656a, 0x656a656a},
+       {0x66556aaa, 0x6a5a6aaa}, /* case-30 */
+       {0xffffffff, 0x5aaa5aaa},
+       {0x56555555, 0x5a5a5aaa},
 };
 
 /* Non-Shared-Antenna Coex Table */
 
        {0x55555555, 0x5a5a5a5a},
        {0x55555555, 0xaaaaaaaa},
        {0x55555555, 0x6a5a6a5a},
-       {0x66556655, 0x66556655}
+       {0x66556655, 0x66556655},
+       {0x66556aaa, 0x6a5a6aaa}, /* case-30 */
+       {0xffffffff, 0x5aaa5aaa},
+       {0x56555555, 0x5a5a5aaa},
 };
 
 /* Non-Shared-Antenna Coex Table */
 
        {0x55555555, 0x5a5a5a5a},
        {0x55555555, 0xaaaaaaaa},
        {0x55555555, 0x6a5a6a5a},
-       {0x66556655, 0x66556655}
+       {0x66556655, 0x66556655},
+       {0x66556aaa, 0x6a5a6aaa}, /* case-30 */
+       {0xffffffff, 0x5aaa5aaa},
+       {0x56555555, 0x5a5a5aaa},
 };
 
 /* Non-Shared-Antenna Coex Table */
        .wowlan_stub = &rtw_wowlan_stub_8822c,
        .max_sched_scan_ssids = 4,
 #endif
-       .coex_para_ver = 0x20070217,
-       .bt_desired_ver = 0x17,
+       .coex_para_ver = 0x201029,
+       .bt_desired_ver = 0x1c,
        .scbd_support = true,
        .new_scbd10_def = true,
        .pstdma_type = COEX_PSTDMA_FORCE_LPSOFF,