From: Shiji Yang <yangshij...@qq.com> Introducing SoC specific RSSI base value to fix the low RSSI issue on MT7620. With this fix[1], the RSSI value reported by MT7620 will increase by 10 dB.
[1] https://lore.kernel.org/linux-wireless/tyap286mb031571cdb146c414a908a66dbc...@tyap286mb0315.jpnp286.prod.outlook.com/ Fixes: https://github.com/openwrt/openwrt/issues/11036 Signed-off-by: Shiji Yang <yangshij...@qq.com> --- The relevant code can be found here. It's not a permanent link so I don't want to add it to the commit message. https://github.com/hanwckf/rt-n56u/blob/23387b278a7cf728748af606760758f5d59d1451/trunk/proprietary/rt_wifi/rtsoc/2.7.X.X/rt2860v2/common/cmm_sync.c#L470 ...ifi-rt2x00-fix-MT7620-low-RSSI-issue.patch | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch diff --git a/package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch b/package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch new file mode 100644 index 0000000000..8f7343d14e --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/999-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch @@ -0,0 +1,39 @@ +From: Shiji Yang <yangshij...@outlook.com> +Date: Sat, 23 Sep 2023 07:51:39 +0800 +Subject: [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue + +On Mediatek vendor driver[1], MT7620 (RT6352) uses different RSSI +base value '-2' compared to the other RT2x00 chips. This patch +introduces the SoC specific base value to fix the low RSSI value +reports on MT7620. + +[1] Found on MT76x2E_MT7620_LinuxAP_V3.0.4.0_P3 ConvertToRssi(). + +Signed-off-by: Shiji Yang <yangshij...@outlook.com> +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -875,6 +875,7 @@ static int rt2800_agc_to_rssi(struct rt2 + s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); + s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); + s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); ++ s8 base_val = rt2x00_rt(rt2x00dev, RT6352) ? -2 : -12; + u16 eeprom; + u8 offset0; + u8 offset1; +@@ -899,9 +900,9 @@ static int rt2800_agc_to_rssi(struct rt2 + * If the value in the descriptor is 0, it is considered invalid + * and the default (extremely low) rssi value is assumed + */ +- rssi0 = (rssi0) ? (-12 - offset0 - rt2x00dev->lna_gain - rssi0) : -128; +- rssi1 = (rssi1) ? (-12 - offset1 - rt2x00dev->lna_gain - rssi1) : -128; +- rssi2 = (rssi2) ? (-12 - offset2 - rt2x00dev->lna_gain - rssi2) : -128; ++ rssi0 = (rssi0) ? (base_val - offset0 - rt2x00dev->lna_gain - rssi0) : -128; ++ rssi1 = (rssi1) ? (base_val - offset1 - rt2x00dev->lna_gain - rssi1) : -128; ++ rssi2 = (rssi2) ? (base_val - offset2 - rt2x00dev->lna_gain - rssi2) : -128; + + /* + * mac80211 only accepts a single RSSI value. Calculating the -- 2.39.2 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel