ath9k: make the regulatory override less intrusive - allow it to parse CTLs
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 520-ath9k_ps_survey_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -122,6 +122,7 @@ bool ath9k_setpower(struct ath_softc *sc
4
5 void ath9k_ps_wakeup(struct ath_softc *sc)
6 {
7 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
8 unsigned long flags;
9
10 spin_lock_irqsave(&sc->sc_pm_lock, flags);
11 @@ -130,18 +131,33 @@ void ath9k_ps_wakeup(struct ath_softc *s
12
13 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
14
15 + /*
16 + * While the hardware is asleep, the cycle counters contain no
17 + * useful data. Better clear them now so that they don't mess up the
18 + * ANI or survey data results.
19 + */
20 + spin_lock(&common->cc_lock);
21 + ath_hw_cycle_counters_update(common);
22 + memset(&common->cc_survey, 0, sizeof(common->cc_survey));
23 + spin_unlock(&common->cc_lock);
24 +
25 unlock:
26 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
27 }
28
29 void ath9k_ps_restore(struct ath_softc *sc)
30 {
31 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
32 unsigned long flags;
33
34 spin_lock_irqsave(&sc->sc_pm_lock, flags);
35 if (--sc->ps_usecount != 0)
36 goto unlock;
37
38 + spin_lock(&common->cc_lock);
39 + ath_hw_cycle_counters_update(common);
40 + spin_unlock(&common->cc_lock);
41 +
42 if (sc->ps_idle)
43 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
44 else if (sc->ps_enabled &&
45 @@ -197,7 +213,8 @@ static void ath_update_survey_stats(stru
46 struct ath_cycle_counters *cc = &common->cc_survey;
47 unsigned int div = common->clockrate * 1000;
48
49 - ath_hw_cycle_counters_update(common);
50 + if (ah->power_mode == ATH9K_PM_AWAKE)
51 + ath_hw_cycle_counters_update(common);
52
53 if (cc->cycles > 0) {
54 survey->filled |= SURVEY_INFO_CHANNEL_TIME |