ath9k: fix missing chip wakeups causing instability issues on at least AR5416 (probab...
[openwrt.git] / package / mac80211 / patches / 580-ath9k_fix_ps_wakeup.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -324,7 +324,6 @@ static void ath_paprd_activate(struct at
4         if (!caldata || !caldata->paprd_done)
5                 return;
6  
7 -       ath9k_ps_wakeup(sc);
8         ar9003_paprd_enable(ah, false);
9         for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
10                 if (!(common->tx_chainmask & BIT(chain)))
11 @@ -334,7 +333,6 @@ static void ath_paprd_activate(struct at
12         }
13  
14         ar9003_paprd_enable(ah, true);
15 -       ath9k_ps_restore(sc);
16  }
17  
18  static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
19 @@ -554,8 +552,11 @@ set_timer:
20         if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) {
21                 if (!ah->caldata->paprd_done)
22                         ieee80211_queue_work(sc->hw, &sc->paprd_work);
23 -               else if (!ah->paprd_table_write_done)
24 +               else if (!ah->paprd_table_write_done) {
25 +                       ath9k_ps_wakeup(sc);
26                         ath_paprd_activate(sc);
27 +                       ath9k_ps_restore(sc);
28 +               }
29         }
30  }
31  
32 @@ -1376,7 +1377,6 @@ static void ath9k_calculate_summary_stat
33  
34         ath9k_calculate_iter_data(hw, vif, &iter_data);
35  
36 -       ath9k_ps_wakeup(sc);
37         /* Set BSSID mask. */
38         memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
39         ath_hw_setbssidmask(common);
40 @@ -1411,7 +1411,6 @@ static void ath9k_calculate_summary_stat
41         }
42  
43         ath9k_hw_set_interrupts(ah, ah->imask);
44 -       ath9k_ps_restore(sc);
45  
46         /* Set up ANI */
47         if ((iter_data.naps + iter_data.nadhocs) > 0) {
48 @@ -1457,6 +1456,7 @@ static int ath9k_add_interface(struct ie
49         struct ath_vif *avp = (void *)vif->drv_priv;
50         int ret = 0;
51  
52 +       ath9k_ps_wakeup(sc);
53         mutex_lock(&sc->mutex);
54  
55         switch (vif->type) {
56 @@ -1503,6 +1503,7 @@ static int ath9k_add_interface(struct ie
57         ath9k_do_vif_add_setup(hw, vif);
58  out:
59         mutex_unlock(&sc->mutex);
60 +       ath9k_ps_restore(sc);
61         return ret;
62  }
63  
64 @@ -1517,6 +1518,7 @@ static int ath9k_change_interface(struct
65  
66         ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
67         mutex_lock(&sc->mutex);
68 +       ath9k_ps_wakeup(sc);
69  
70         /* See if new interface type is valid. */
71         if ((new_type == NL80211_IFTYPE_ADHOC) &&
72 @@ -1546,6 +1548,7 @@ static int ath9k_change_interface(struct
73  
74         ath9k_do_vif_add_setup(hw, vif);
75  out:
76 +       ath9k_ps_restore(sc);
77         mutex_unlock(&sc->mutex);
78         return ret;
79  }
80 @@ -1558,6 +1561,7 @@ static void ath9k_remove_interface(struc
81  
82         ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
83  
84 +       ath9k_ps_wakeup(sc);
85         mutex_lock(&sc->mutex);
86  
87         sc->nvifs--;
88 @@ -1569,6 +1573,7 @@ static void ath9k_remove_interface(struc
89         ath9k_calculate_summary_state(hw, NULL);
90  
91         mutex_unlock(&sc->mutex);
92 +       ath9k_ps_restore(sc);
93  }
94  
95  static void ath9k_enable_ps(struct ath_softc *sc)
96 @@ -1830,6 +1835,7 @@ static int ath9k_conf_tx(struct ieee8021
97  
98         txq = sc->tx.txq_map[queue];
99  
100 +       ath9k_ps_wakeup(sc);
101         mutex_lock(&sc->mutex);
102  
103         memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
104 @@ -1853,6 +1859,7 @@ static int ath9k_conf_tx(struct ieee8021
105                         ath_beaconq_config(sc);
106  
107         mutex_unlock(&sc->mutex);
108 +       ath9k_ps_restore(sc);
109  
110         return ret;
111  }
112 @@ -1929,6 +1936,7 @@ static void ath9k_bss_info_changed(struc
113         int slottime;
114         int error;
115  
116 +       ath9k_ps_wakeup(sc);
117         mutex_lock(&sc->mutex);
118  
119         if (changed & BSS_CHANGED_BSSID) {
120 @@ -2029,6 +2037,7 @@ static void ath9k_bss_info_changed(struc
121         }
122  
123         mutex_unlock(&sc->mutex);
124 +       ath9k_ps_restore(sc);
125  }
126  
127  static u64 ath9k_get_tsf(struct ieee80211_hw *hw)