From: Stanislaw Gruszka <sgruszka@redhat.com>
To: stable@vger.kernel.org
Cc: Felix Fietkau <nbd@nbd.name>,
linux-wireless@vger.kernel.org,
Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Subject: [PATCH 4.20.x 4/7] mt76x02: assure we update gain after scan
Date: Tue, 22 Jan 2019 13:38:34 +0100 [thread overview]
Message-ID: <1548160717-4059-5-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1548160717-4059-1-git-send-email-sgruszka@redhat.com>
commit 4784a3cc3fffd0ba5ef6c7a23980ae0318fc1369 upstream.
Assure that after we initialize dev->cal.low_gain to -1 this
will cause update gain calibration. Otherwise this might or
might not happen depending on value of second bit of low_gain
and values read from registers in mt76x02_phy_adjust_vga_gain().
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 5 ++++-
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index 205c3afe2aeb..4126ac5d9a8a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -139,8 +139,11 @@ void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
clear_bit(MT76_SCANNING, &dev->mt76.state);
- if (dev->cal.gain_init_done)
+ if (dev->cal.gain_init_done) {
+ /* Restore AGC gain and resume calibration after scanning. */
+ dev->cal.low_gain = -1;
ieee80211_queue_delayed_work(hw, &dev->cal_work, 0);
+ }
}
EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index 771e54b39abf..f99097e265aa 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -834,7 +834,8 @@ static void mt76x0_phy_set_gain_val(struct mt76x02_dev *dev)
low_gain = (dev->cal.avg_rssi_all > mt76x02_get_rssi_gain_thresh(dev)) +
(dev->cal.avg_rssi_all > mt76x02_get_low_rssi_gain_thresh(dev));
- gain_change = (dev->cal.low_gain & 2) ^ (low_gain & 2);
+ gain_change = dev->cal.low_gain < 0 ||
+ (dev->cal.low_gain & 2) ^ (low_gain & 2);
dev->cal.low_gain = low_gain;
if (!gain_change) {
--
1.9.3
next prev parent reply other threads:[~2019-01-22 12:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 12:38 [PATCH 4.20.x 0/7] mt76x0 fixes for 4.20 stable Stanislaw Gruszka
2019-01-22 12:38 ` [PATCH 4.20.x 1/7] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields Stanislaw Gruszka
2019-01-22 12:38 ` [PATCH 4.20.x 2/7] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
2019-01-22 12:38 ` [PATCH 4.20.x 3/7] mt76x02: run calibration after scanning Stanislaw Gruszka
2019-01-22 12:38 ` Stanislaw Gruszka [this message]
2019-01-22 12:38 ` [PATCH 4.20.x 5/7] mt76x0: do not perform MCU calibration for MT7630 Stanislaw Gruszka
2019-01-22 12:38 ` [PATCH 4.20.x 6/7] mt76x0: antenna select corrections Stanislaw Gruszka
2019-01-22 12:38 ` [PATCH 4.20.x 7/7] mt76x0: phy: unify calibration between mt76x0u and mt76x0e Stanislaw Gruszka
2019-01-28 16:06 ` [PATCH 4.20.x 0/7] mt76x0 fixes for 4.20 stable Sid Hayn
2019-01-29 8:04 ` Kalle Valo
2019-01-29 9:43 ` Greg KH
2019-01-29 15:55 ` Sid Hayn
2019-01-29 16:09 ` Greg KH
2019-01-29 10:29 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1548160717-4059-5-git-send-email-sgruszka@redhat.com \
--to=sgruszka@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).