Commit e5efc4d5 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtw89: 8852c: rfk: add TSSI

TSSI is transmitter signal strength indication, which is a close-loop
hardware circuit to feedback actual transmitting power as a reference for
next transmission.

When we setup channel to connect an AP, it does full calibration. When
switching bands or channels, it needs to reset hardware status to prevent
use wrong feedback of previous transmission.

To do TX power compensation reflecting current temperature, it loads tables
of compensation values into registers according to channel and band group.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220502235408.15052-5-pkshih@realtek.com
parent fb8177d7
...@@ -1754,6 +1754,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter, ...@@ -1754,6 +1754,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL); rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL);
rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false); rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
rtw8852c_dfs_en(rtwdev, false); rtw8852c_dfs_en(rtwdev, false);
rtw8852c_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0);
rtw8852c_adc_en(rtwdev, false); rtw8852c_adc_en(rtwdev, false);
fsleep(40); fsleep(40);
rtw8852c_bb_reset_en(rtwdev, phy_idx, false); rtw8852c_bb_reset_en(rtwdev, phy_idx, false);
...@@ -1761,6 +1762,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter, ...@@ -1761,6 +1762,7 @@ static void rtw8852c_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true); rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
rtw8852c_adc_en(rtwdev, true); rtw8852c_adc_en(rtwdev, true);
rtw8852c_dfs_en(rtwdev, true); rtw8852c_dfs_en(rtwdev, true);
rtw8852c_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0);
rtw8852c_bb_reset_en(rtwdev, phy_idx, true); rtw8852c_bb_reset_en(rtwdev, phy_idx, true);
rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en); rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en);
} }
...@@ -1770,6 +1772,8 @@ static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev) ...@@ -1770,6 +1772,8 @@ static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev)
{ {
struct rtw89_mcc_info *mcc_info = &rtwdev->mcc; struct rtw89_mcc_info *mcc_info = &rtwdev->mcc;
rtwdev->is_tssi_mode[RF_PATH_A] = false;
rtwdev->is_tssi_mode[RF_PATH_B] = false;
memset(mcc_info, 0, sizeof(*mcc_info)); memset(mcc_info, 0, sizeof(*mcc_info));
rtw8852c_lck_init(rtwdev); rtw8852c_lck_init(rtwdev);
...@@ -1778,9 +1782,22 @@ static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev) ...@@ -1778,9 +1782,22 @@ static void rtw8852c_rfk_init(struct rtw89_dev *rtwdev)
static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev) static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev)
{ {
enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
rtw8852c_tssi(rtwdev, phy_idx);
rtw89_fw_h2c_rf_ntfy_mcc(rtwdev); rtw89_fw_h2c_rf_ntfy_mcc(rtwdev);
} }
static void rtw8852c_rfk_band_changed(struct rtw89_dev *rtwdev)
{
rtw8852c_tssi_scan(rtwdev, RTW89_PHY_0);
}
static void rtw8852c_rfk_scan(struct rtw89_dev *rtwdev, bool start)
{
rtw8852c_wifi_scan_notify(rtwdev, start, RTW89_PHY_0);
}
static void rtw8852c_rfk_track(struct rtw89_dev *rtwdev) static void rtw8852c_rfk_track(struct rtw89_dev *rtwdev)
{ {
rtw8852c_lck_track(rtwdev); rtw8852c_lck_track(rtwdev);
...@@ -2714,6 +2731,8 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = { ...@@ -2714,6 +2731,8 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
.read_phycap = rtw8852c_read_phycap, .read_phycap = rtw8852c_read_phycap,
.rfk_init = rtw8852c_rfk_init, .rfk_init = rtw8852c_rfk_init,
.rfk_channel = rtw8852c_rfk_channel, .rfk_channel = rtw8852c_rfk_channel,
.rfk_band_changed = rtw8852c_rfk_band_changed,
.rfk_scan = rtw8852c_rfk_scan,
.rfk_track = rtw8852c_rfk_track, .rfk_track = rtw8852c_rfk_track,
.power_trim = rtw8852c_power_trim, .power_trim = rtw8852c_power_trim,
.set_txpwr = rtw8852c_set_txpwr, .set_txpwr = rtw8852c_set_txpwr,
......
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
#include "core.h" #include "core.h"
void rtw8852c_dack(struct rtw89_dev *rtwdev); void rtw8852c_dack(struct rtw89_dev *rtwdev);
void rtw8852c_tssi(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
void rtw8852c_tssi_scan(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
void rtw8852c_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en, u8 phy_idx);
void rtw8852c_wifi_scan_notify(struct rtw89_dev *rtwdev, bool scan_start,
enum rtw89_phy_idx phy_idx);
void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev, void rtw8852c_set_channel_rf(struct rtw89_dev *rtwdev,
struct rtw89_channel_params *param, struct rtw89_channel_params *param,
enum rtw89_phy_idx phy_idx); enum rtw89_phy_idx phy_idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment