[source] mac80211: rt2x00: fix MT7620 LNA gain and VCO-after-ALC
LEDE Commits
lede-commits at lists.infradead.org
Mon Apr 17 12:40:17 PDT 2017
dangole pushed a commit to source.git, branch master:
https://git.lede-project.org/97d1c49cacfea2d9f69d8e20d9f60e837293b1ff
commit 97d1c49cacfea2d9f69d8e20d9f60e837293b1ff
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Apr 17 21:38:32 2017 +0200
mac80211: rt2x00: fix MT7620 LNA gain and VCO-after-ALC
This should fix issues with bad RX as well as AP not coming up and/or
scanning failing.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
...rt2800-fix-LNA-gain-assignment-for-MT7620.patch | 54 ++++++++++++++++++++++
...-do-VCO-calibration-after-programming-ALC.patch | 34 ++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch b/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
new file mode 100644
index 0000000..3270ea2
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-01-rt2800-fix-LNA-gain-assignment-for-MT7620.patch
@@ -0,0 +1,54 @@
+From 0109238d62a99ea779a7e28e21868118e7b8d69d Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 10 Apr 2017 14:28:14 +0200
+Subject: [PATCH 1/2] rt2800: fix LNA gain assignment for MT7620
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+ linux-wireless at vger.kernel.org,
+ Kalle Valo <kvalo at codeaurora.org>
+
+The base value used for MT7620 differs from Rt5392 which resulted in
+quite bad RX signal quality. Fix this by using the correct base value as
+well as the LNA calibration values for HT20.
+
+Reported-by: Tom Psyborg <pozega.tomislav at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index ba06ac2d876d..7135519a638c 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3806,11 +3806,25 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
+ }
+
+ if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) {
++ reg = 0x10;
++ if (!conf_is_ht40(conf)) {
++ if (rt2x00_rt(rt2x00dev, RT6352) &&
++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
++ reg |= 0x5;
++ } else {
++ reg |= 0xa;
++ }
++ }
+ rt2800_bbp_write(rt2x00dev, 195, 141);
+- rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
++ rt2800_bbp_write(rt2x00dev, 196, reg);
+
+ /* AGC init */
+- reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain;
++ if (rt2x00_rt(rt2x00dev, RT6352))
++ reg = 0x04;
++ else
++ reg = rf->channel <= 14 ? 0x1c : 0x24;
++
++ reg += 2 * rt2x00dev->lna_gain;
+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
+
+ rt2800_iq_calibrate(rt2x00dev, rf->channel);
+--
+2.12.2
+
diff --git a/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch b/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch
new file mode 100644
index 0000000..1dafb78
--- /dev/null
+++ b/package/kernel/mac80211/patches/021-02-rt2800-do-VCO-calibration-after-programming-ALC.patch
@@ -0,0 +1,34 @@
+From feb608c7986c14bab153f31f8e96f251072e6578 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 10 Apr 2017 15:33:20 +0200
+Subject: [PATCH 2/2] rt2800: do VCO calibration after programming ALC
+To: Stanislaw Gruszka <sgruszka at redhat.com>
+Cc: Helmut Schaa <helmut.schaa at googlemail.com>,
+ linux-wireless at vger.kernel.org,
+ Kalle Valo <kvalo at codeaurora.org>
+
+Scanning fails if we don't do VCO calibration every time.
+The vendor driver duplicates the VCO calibration function into the
+channel switching logic, we can do the same with less duplication.
+
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+index 7135519a638c..870bf315f98b 100644
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3407,6 +3407,8 @@ static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
+ rt2800_rfcsr_write(rt2x00dev, 42, 0x5b);
+ }
+ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl);
++
++ rt2800_vco_calibration(rt2x00dev);
+ }
+
+ static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
+--
+2.12.2
+
More information about the lede-commits
mailing list