rtw89: 8852c: rfk: get calibrated channels to notify firmware
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 3 May 2022 11:59:54 +0000 (19:59 +0800)
committerKalle Valo <kvalo@kernel.org>
Wed, 4 May 2022 05:32:04 +0000 (08:32 +0300)
The commit 16b44ed0ffd3 ("rtw89: add RF H2C to notify firmware") is to
add firmware command, and this commit is to prepare the channels. Then,
firmware can get proper channels.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220503120001.79272-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/rtw8852c.c
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.h

index 4fb3de71d032f192e500b283dfb9270e445b6f08..44b694ccada9f0f565e2a01fc7188c28438176d0 100644 (file)
@@ -1786,6 +1786,7 @@ static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev)
 {
        enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
 
+       rtw8852c_mcc_get_ch_info(rtwdev, phy_idx);
        rtw8852c_rx_dck(rtwdev, phy_idx, false);
        rtw8852c_iqk(rtwdev, phy_idx);
        rtw8852c_tssi(rtwdev, phy_idx);
index ffc71ad249270a09c6eb2b31d9fb802b37b596cf..dfb9caba9bc418a869f70cd8d11f8dfa5905d4b9 100644 (file)
@@ -3809,6 +3809,24 @@ void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,
                            param->bandwidth);
 }
 
+void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
+{
+       struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
+       u8 idx = mcc_info->table_idx;
+       int i;
+
+       for (i = 0; i < RTW89_IQK_CHS_NR; i++) {
+               if (mcc_info->ch[idx] == 0)
+                       break;
+               if (++idx >= RTW89_IQK_CHS_NR)
+                       idx = 0;
+       }
+
+       mcc_info->table_idx = idx;
+       mcc_info->ch[idx] = rtwdev->hal.current_channel;
+       mcc_info->band[idx] = rtwdev->hal.current_band_type;
+}
+
 void rtw8852c_rck(struct rtw89_dev *rtwdev)
 {
        u8 path;
index e42fb1a4965ef2f55fe882fdcaaf489e33fdb001..c32756f0c01a9a551f03736cc0e78e958e8fd95c 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "core.h"
 
+void rtw8852c_mcc_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
 void rtw8852c_rck(struct rtw89_dev *rtwdev);
 void rtw8852c_dack(struct rtw89_dev *rtwdev);
 void rtw8852c_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);