Skip to content

Commit 590b51b

Browse files
author
Martin Hrůza
committed
Adjust gain before scanning
- This patch temporarily increases the rx gain before scanning and reset it back to the last recorded value once the scanning finishes. - Ref: #337
1 parent 0f261f9 commit 590b51b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,8 @@ void rtw_core_scan_start(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif,
15711571

15721572
set_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
15731573
set_bit(RTW_FLAG_SCANNING, rtwdev->flags);
1574+
1575+
rtw_phy_dig_set_max_coverage(rtwdev);
15741576
}
15751577

15761578
void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
@@ -1582,6 +1584,7 @@ void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
15821584
if (!rtwvif)
15831585
return;
15841586

1587+
rtw_phy_dig_reset(rtwdev);
15851588
clear_bit(RTW_FLAG_SCANNING, rtwdev->flags);
15861589
clear_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
15871590

phy.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,21 @@ static void rtw_phy_statistics(struct rtw_dev *rtwdev)
372372
#define DIG_CVRG_MIN 0x1c
373373
#define DIG_RSSI_GAIN_OFFSET 15
374374

375+
void rtw_phy_dig_set_max_coverage(struct rtw_dev *rtwdev) {
376+
rtw_dbg(rtwdev, RTW_DBG_PHY, "Setting IGI to max coverage\n");
377+
rtw_phy_dig_write(rtwdev, DIG_CVRG_MAX);
378+
}
379+
380+
void rtw_phy_dig_reset(struct rtw_dev *rtwdev) {
381+
struct rtw_dm_info *dm_info = &rtwdev->dm_info;
382+
u8 last_igi;
383+
384+
last_igi = dm_info->igi_history[0];
385+
rtw_dbg(rtwdev, RTW_DBG_PHY, "Resetting IGI=%u\n", last_igi);
386+
387+
rtw_phy_dig_write(rtwdev, last_igi);
388+
}
389+
375390
static bool
376391
rtw_phy_dig_check_damping(struct rtw_dm_info *dm_info)
377392
{

phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ static inline int rtw_check_supported_rfe(struct rtw_dev *rtwdev)
146146
}
147147

148148
void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi);
149+
void rtw_phy_dig_reset(struct rtw_dev *rtwdev);
150+
void rtw_phy_dig_set_max_coverage(struct rtw_dev *rtwdev);
149151

150152
struct rtw_power_params {
151153
u8 pwr_base;

0 commit comments

Comments
 (0)