linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue
@ 2023-09-23  1:01 Shiji Yang
  2023-09-28 16:18 ` Kalle Valo
  2023-10-03 11:42 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Shiji Yang @ 2023-09-23  1:01 UTC (permalink / raw)
  To: linux-wireless; +Cc: Stanislaw Gruszka, Helmut Schaa, Kalle Valo, Shiji Yang

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 <yangshiji66@outlook.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index e65cc00fa..a652379cd 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -856,6 +856,7 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2)
 	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;
@@ -880,9 +881,9 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2)
 	 * 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue
  2023-09-23  1:01 [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue Shiji Yang
@ 2023-09-28 16:18 ` Kalle Valo
  2023-10-02 18:29   ` Stanislaw Gruszka
  2023-10-03 11:42 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2023-09-28 16:18 UTC (permalink / raw)
  To: Shiji Yang; +Cc: linux-wireless, Stanislaw Gruszka, Helmut Schaa, Shiji Yang

Shiji Yang <yangshiji66@outlook.com> wrote:

> 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 <yangshiji66@outlook.com>

Can someone review this, please?

Patch set to Deferred.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/TYAP286MB031571CDB146C414A908A66DBCFEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue
  2023-09-28 16:18 ` Kalle Valo
@ 2023-10-02 18:29   ` Stanislaw Gruszka
  0 siblings, 0 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2023-10-02 18:29 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Shiji Yang, linux-wireless, Helmut Schaa

On Thu, Sep 28, 2023 at 04:18:36PM +0000, Kalle Valo wrote:
> Shiji Yang <yangshiji66@outlook.com> wrote:
> 
> > 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 <yangshiji66@outlook.com>
> 
> Can someone review this, please?

Yes. Sorry for late response. 

I think patch is fine.
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>


> Patch set to Deferred.
> 
> -- 
> https://patchwork.kernel.org/project/linux-wireless/patch/TYAP286MB031571CDB146C414A908A66DBCFEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue
  2023-09-23  1:01 [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue Shiji Yang
  2023-09-28 16:18 ` Kalle Valo
@ 2023-10-03 11:42 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-10-03 11:42 UTC (permalink / raw)
  To: Shiji Yang; +Cc: linux-wireless, Stanislaw Gruszka, Helmut Schaa, Shiji Yang

Shiji Yang <yangshiji66@outlook.com> wrote:

> 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 <yangshiji66@outlook.com>
> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

Patch applied to wireless-next.git, thanks.

2ecfe6f07e8e wifi: rt2x00: fix MT7620 low RSSI issue

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/TYAP286MB031571CDB146C414A908A66DBCFEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-03 11:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23  1:01 [PATCH] wifi: rt2x00: fix MT7620 low RSSI issue Shiji Yang
2023-09-28 16:18 ` Kalle Valo
2023-10-02 18:29   ` Stanislaw Gruszka
2023-10-03 11:42 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).