From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 2/8] mt76: mt76x02: fix beacon timer drift adjustment
Date: Tue, 26 Feb 2019 10:29:39 +0100 [thread overview]
Message-ID: <20190226092945.54738-2-nbd@nbd.name> (raw)
In-Reply-To: <20190226092945.54738-1-nbd@nbd.name>
Check the count before incrementing it to match vendor code behavior.
This defers the adjustment by one more tick, which should improve accuracy
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
index 374bc9d91f12..f0198eea2bb8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
@@ -79,24 +79,24 @@ mt76x02_resync_beacon_timer(struct mt76x02_dev *dev)
* Beacon timer drifts by 1us every tick, the timer is configured
* in 1/16 TU (64us) units.
*/
- if (dev->tbtt_count < 62)
+ if (dev->tbtt_count < 63)
return;
- if (dev->tbtt_count >= 64) {
- dev->tbtt_count = 0;
- return;
- }
-
/*
* The updated beacon interval takes effect after two TBTT, because
* at this point the original interval has already been loaded into
* the next TBTT_TIMER value
*/
- if (dev->tbtt_count == 62)
+ if (dev->tbtt_count == 63)
timer_val -= 1;
mt76_rmw_field(dev, MT_BEACON_TIME_CFG,
MT_BEACON_TIME_CFG_INTVAL, timer_val);
+
+ if (dev->tbtt_count >= 64) {
+ dev->tbtt_count = 0;
+ return;
+ }
}
static void mt76x02_pre_tbtt_tasklet(unsigned long arg)
--
2.17.0
next prev parent reply other threads:[~2019-02-26 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 9:29 [PATCH 1/8] mt76: mt76x02: fix TSF sync mode Felix Fietkau
2019-02-26 9:29 ` Felix Fietkau [this message]
2019-02-26 9:29 ` [PATCH 3/8] mt76: mt76x02: fix beacon timer issue Felix Fietkau
2019-02-26 9:29 ` [PATCH 4/8] mt76: mt76x02: only reset beacon drift counter when enabling beacons Felix Fietkau
2019-02-26 9:29 ` [PATCH 5/8] mt76: mt76x02: issue watchdog reset on MCU request timeout Felix Fietkau
2019-02-26 9:29 ` [PATCH 6/8] mt76: mt76x02: fix ED/CCA enabling/disabling Felix Fietkau
2019-02-26 9:29 ` [PATCH 7/8] mt76: mt76x2: unify mt76x2[u]_mac_resume Felix Fietkau
2019-02-26 9:29 ` [PATCH 8/8] mt76: mt76x02: set MT_TXOP_HLDR_TX40M_BLK_EN for mt76x2 Felix Fietkau
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=20190226092945.54738-2-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@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