1
0

021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 0109238d62a99ea779a7e28e21868118e7b8d69d Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <daniel@makrotopia.org>
  3. Date: Mon, 10 Apr 2017 14:28:14 +0200
  4. Subject: [PATCH 1/2] rt2800: fix LNA gain assignment for MT7620
  5. To: Stanislaw Gruszka <sgruszka@redhat.com>
  6. Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
  7. linux-wireless@vger.kernel.org,
  8. Kalle Valo <kvalo@codeaurora.org>
  9. The base value used for MT7620 differs from Rt5392 which resulted in
  10. quite bad RX signal quality. Fix this by using the correct base value as
  11. well as the LNA calibration values for HT20.
  12. Reported-by: Tom Psyborg <pozega.tomislav@gmail.com>
  13. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  14. ---
  15. drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++++++--
  16. 1 file changed, 16 insertions(+), 2 deletions(-)
  17. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  18. index ba06ac2d876d..7135519a638c 100644
  19. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  20. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21. @@ -3806,11 +3806,25 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  22. }
  23. if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
  24. + reg = 0x10;
  25. + if (!conf_is_ht40(conf)) {
  26. + if (rt2x00_rt(rt2x00dev, RT6352) &&
  27. + rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  28. + reg |= 0x5;
  29. + } else {
  30. + reg |= 0xa;
  31. + }
  32. + }
  33. rt2800_bbp_write(rt2x00dev, 195, 141);
  34. - rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
  35. + rt2800_bbp_write(rt2x00dev, 196, reg);
  36. /* AGC init */
  37. - reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain;
  38. + if (rt2x00_rt(rt2x00dev, RT6352))
  39. + reg = 0x04;
  40. + else
  41. + reg = rf->channel <= 14 ? 0x1c : 0x24;
  42. +
  43. + reg += 2 * rt2x00dev->lna_gain;
  44. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  45. rt2800_iq_calibrate(rt2x00dev, rf->channel);
  46. --
  47. 2.12.2