]> www.infradead.org Git - linux.git/commitdiff
wifi: rtw89: coex: Bluetooth hopping map for Wi-Fi role version 7
authorChing-Te Ku <ku920601@realtek.com>
Fri, 16 Aug 2024 12:46:13 +0000 (20:46 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 22 Aug 2024 02:35:30 +0000 (10:35 +0800)
To get Wi-Fi channel & bandwidth information from new Wi-Fi role format.
Bluetooth will negotiate which channel to do TX/RX with connected device.
And Bluetooth will maintain a hopping map, that describe the usable
channels. To avoid the interference from Wi-Fi 2.4GHz/Bluetooth each other,
Bluetooth must not to hop into Wi-Fi channel.

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

index 0a8480644b0c110a69f8035c56c593ee387f0279..44e066a04b97e70697539f77d1bbcd1d0084cb62 100644 (file)
@@ -3045,10 +3045,12 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
        struct rtw89_btc_wl_role_info *wl_rinfo = &wl->role_info;
        struct rtw89_btc_wl_role_info_v1 *wl_rinfo_v1 = &wl->role_info_v1;
        struct rtw89_btc_wl_role_info_v2 *wl_rinfo_v2 = &wl->role_info_v2;
+       struct rtw89_btc_wl_role_info_v7 *wl_rinfo_v7 = &wl->role_info_v7;
        struct rtw89_btc_wl_role_info_v8 *wl_rinfo_v8 = &wl->role_info_v8;
        struct rtw89_btc_wl_active_role *r;
        struct rtw89_btc_wl_active_role_v1 *r1;
        struct rtw89_btc_wl_active_role_v2 *r2;
+       struct rtw89_btc_wl_active_role_v7 *r7;
        struct rtw89_btc_wl_rlink *rlink;
        u8 en = 0, i, ch = 0, bw = 0;
        u8 mode, connect_cnt;
@@ -3065,6 +3067,9 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
        } else if (ver->fwlrole == 2) {
                mode = wl_rinfo_v2->link_mode;
                connect_cnt = wl_rinfo_v2->connect_cnt;
+       } else if (ver->fwlrole == 7) {
+               mode = wl_rinfo_v7->link_mode;
+               connect_cnt = wl_rinfo_v7->connect_cnt;
        } else if (ver->fwlrole == 8) {
                mode = wl_rinfo_v8->link_mode;
                connect_cnt = wl_rinfo_v8->connect_cnt;
@@ -3083,6 +3088,7 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
                        r = &wl_rinfo->active_role[i];
                        r1 = &wl_rinfo_v1->active_role_v1[i];
                        r2 = &wl_rinfo_v2->active_role_v2[i];
+                       r7 = &wl_rinfo_v7->active_role[i];
                        rlink = &wl_rinfo_v8->rlink[i][0];
 
                        if (ver->fwlrole == 0 &&
@@ -3103,6 +3109,12 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
                                ch = r2->ch;
                                bw = r2->bw;
                                break;
+                       } else if (ver->fwlrole == 7 &&
+                                  (r7->role == RTW89_WIFI_ROLE_P2P_GO ||
+                                   r7->role == RTW89_WIFI_ROLE_P2P_CLIENT)) {
+                               ch = r7->ch;
+                               bw = r7->bw;
+                               break;
                        } else if (ver->fwlrole == 8 &&
                                   (rlink->role == RTW89_WIFI_ROLE_P2P_GO ||
                                    rlink->role == RTW89_WIFI_ROLE_P2P_CLIENT)) {
@@ -3118,6 +3130,7 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
                        r = &wl_rinfo->active_role[i];
                        r1 = &wl_rinfo_v1->active_role_v1[i];
                        r2 = &wl_rinfo_v2->active_role_v2[i];
+                       r7 = &wl_rinfo_v7->active_role[i];
                        rlink = &wl_rinfo_v8->rlink[i][0];
 
                        if (ver->fwlrole == 0 &&
@@ -3135,6 +3148,11 @@ static void _set_bt_afh_info(struct rtw89_dev *rtwdev)
                                ch = r2->ch;
                                bw = r2->bw;
                                break;
+                       } else if (ver->fwlrole == 7 &&
+                                  r7->connected && r7->band == RTW89_BAND_2G) {
+                               ch = r7->ch;
+                               bw = r7->bw;
+                               break;
                        } else if (ver->fwlrole == 8 &&
                                   rlink->connected && rlink->rf_band == RTW89_BAND_2G) {
                                ch = rlink->ch;