Skip to contentSkip to conversation

wifi: rtw88: Increase the RX gain before scanning

PATCH In review Bitterblue Smith 2 participants 3 messages Dec 23, 2025 – Dec 26, 2025 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: rtw88: Increase the RX gain before scanning

From: Martin Hrůza <[email protected]>

The driver reduces the RX gain while connected to a network located close by. In this condition scans return few results because the more distant networks can't be heard.

Temporarily increase the RX gain before scanning in order to detect all available networks. Reset the RX gain back to the last recorded value once the scan finishes.

---
 drivers/net/wireless/realtek/rtw88/main.c |  3 +++
 drivers/net/wireless/realtek/rtw88/phy.c  | 20 ++++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/phy.h  |  2 ++
 3 files changed, 25 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +3 -0
index 361ce0d40956..dbec7724d6af 100644
@@ -1483,6 +1483,8 @@ void rtw_core_scan_start(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif,
 
 	set_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
 	set_bit(RTW_FLAG_SCANNING, rtwdev->flags);
+
+	rtw_phy_dig_set_max_coverage(rtwdev);
 }
 
 void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
@@ -1494,6 +1496,7 @@ void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
 	if (!rtwvif)
 		return;
 
+	rtw_phy_dig_reset(rtwdev);
 	clear_bit(RTW_FLAG_SCANNING, rtwdev->flags);
 	clear_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
 
drivers/net/wireless/realtek/rtw88/phy.c +20 -0
index 55be0d8e0c28..e2ac5c6fd500 100644
@@ -370,6 +370,26 @@ static void rtw_phy_statistics(struct rtw_dev *rtwdev)
 #define DIG_CVRG_MIN				0x1c
 #define DIG_RSSI_GAIN_OFFSET			15
 
+void rtw_phy_dig_set_max_coverage(struct rtw_dev *rtwdev)
+{
+	/* Lower values result in greater coverage. */
+	rtw_dbg(rtwdev, RTW_DBG_PHY, "Setting IGI=%#x for max coverage\n",
+		DIG_CVRG_MIN);
+
+	rtw_phy_dig_write(rtwdev, DIG_CVRG_MIN);
+}
+
+void rtw_phy_dig_reset(struct rtw_dev *rtwdev)
+{
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	u8 last_igi;
+
+	last_igi = dm_info->igi_history[0];
+	rtw_dbg(rtwdev, RTW_DBG_PHY, "Resetting IGI=%#x\n", last_igi);
+
+	rtw_phy_dig_write(rtwdev, last_igi);
+}
+
 static bool
 rtw_phy_dig_check_damping(struct rtw_dm_info *dm_info)
 {
drivers/net/wireless/realtek/rtw88/phy.h +2 -0
index c9e6b869661d..8449936497bb 100644
@@ -146,6 +146,8 @@ static inline int rtw_check_supported_rfe(struct rtw_dev *rtwdev)
 }
 
 void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi);
+void rtw_phy_dig_reset(struct rtw_dev *rtwdev);
+void rtw_phy_dig_set_max_coverage(struct rtw_dev *rtwdev);
 
 struct rtw_power_params {
 	u8 pwr_base;
Signature · 1 line
2.51.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bitterblue Smith

From: Martin Hrůza <[email protected]>

The driver reduces the RX gain while connected to a network located close by. In this condition scans return few results because the more distant networks can't be heard.

Quoted 7 lines

Temporarily increase the RX gain before scanning in order to detect all available networks. Reset the RX gain back to the last recorded value once the scan finishes.

maintainer
#2 lore raw
In reply to Bitterblue Smith
Quoted 6 lines · Bitterblue Smith

From: Martin Hrůza <[email protected]>

The driver reduces the RX gain while connected to a network located close by. In this condition scans return few results because the more distant networks can't be heard.

Quoted 8 lines

Temporarily increase the RX gain before scanning in order to detect all available networks. Reset the RX gain back to the last recorded value once the scan finishes.

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

3f90942473d2 wifi: rtw88: Increase the RX gain before scanning

---
https://github.com/pkshih/rtw.git