Skip to content

Commit

Permalink
ath9k_htc: reset sleep counters before overflow
Browse files Browse the repository at this point in the history
SLEEP_CNT and CYCLE_CNT counters are periodically reset for avoiding
an overflow.

When the card exists Power-Save mode out-of-nowhere
(see also qca/open-ath9k-htc-firmware#125)
the cycle_cnt keeps incrementing while the sleep_cnt stops
incrementing.

Signed-off-by: Doru Gucea <gucea.doru@gmail.com>
  • Loading branch information
dorugucea91 committed Feb 23, 2017
1 parent 64b370c commit 88d1387
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,17 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
struct ath9k_hw_capabilities *pCap = &ah->caps;
struct ath_common *common = ath9k_hw_common(ah);
u32 tsf, difference;
u32 sleep_cnt, cycle_cnt, threshold = 0xFFFFFFFF / 2;

sleep_cnt = REG_READ(ah, AR_SLP_CNT);
cycle_cnt = REG_READ(ah, AR_SLP_CYCLE_CNT);
printk(KERN_INFO "%s. sleep_cnt: %u, cycle_cnt: %u\n",
__func__, sleep_cnt, cycle_cnt);

if (sleep_cnt > threshold || cycle_cnt > threshold) {
printk(KERN_INFO "%s: clear AR_SLP_MIB_CTRL\n", __func__);
REG_SET_BIT(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR);
}

REG_RMW_FIELD(ah, AR_RSSI_THR,
AR_RSSI_THR_BM_THR, bs->bs_bmissthreshold);
Expand Down

0 comments on commit 88d1387

Please sign in to comment.