aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index dede9a9aa689..50bdb5db23b4 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/nl80211.h> 17#include <linux/nl80211.h>
18#include <linux/pm_qos_params.h>
18#include "ath9k.h" 19#include "ath9k.h"
19#include "btcoex.h" 20#include "btcoex.h"
20 21
@@ -93,11 +94,13 @@ void ath9k_ps_wakeup(struct ath_softc *sc)
93{ 94{
94 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 95 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
95 unsigned long flags; 96 unsigned long flags;
97 enum ath9k_power_mode power_mode;
96 98
97 spin_lock_irqsave(&sc->sc_pm_lock, flags); 99 spin_lock_irqsave(&sc->sc_pm_lock, flags);
98 if (++sc->ps_usecount != 1) 100 if (++sc->ps_usecount != 1)
99 goto unlock; 101 goto unlock;
100 102
103 power_mode = sc->sc_ah->power_mode;
101 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); 104 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
102 105
103 /* 106 /*
@@ -105,10 +108,12 @@ void ath9k_ps_wakeup(struct ath_softc *sc)
105 * useful data. Better clear them now so that they don't mess up 108 * useful data. Better clear them now so that they don't mess up
106 * survey data results. 109 * survey data results.
107 */ 110 */
108 spin_lock(&common->cc_lock); 111 if (power_mode != ATH9K_PM_AWAKE) {
109 ath_hw_cycle_counters_update(common); 112 spin_lock(&common->cc_lock);
110 memset(&common->cc_survey, 0, sizeof(common->cc_survey)); 113 ath_hw_cycle_counters_update(common);
111 spin_unlock(&common->cc_lock); 114 memset(&common->cc_survey, 0, sizeof(common->cc_survey));
115 spin_unlock(&common->cc_lock);
116 }
112 117
113 unlock: 118 unlock:
114 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); 119 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
@@ -1157,6 +1162,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1157 ah->imask |= ATH9K_INT_CST; 1162 ah->imask |= ATH9K_INT_CST;
1158 1163
1159 sc->sc_flags &= ~SC_OP_INVALID; 1164 sc->sc_flags &= ~SC_OP_INVALID;
1165 sc->sc_ah->is_monitoring = false;
1160 1166
1161 /* Disable BMISS interrupt when we're not associated */ 1167 /* Disable BMISS interrupt when we're not associated */
1162 ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); 1168 ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
@@ -1178,6 +1184,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1178 ath9k_btcoex_timer_resume(sc); 1184 ath9k_btcoex_timer_resume(sc);
1179 } 1185 }
1180 1186
1187 pm_qos_update_request(&ath9k_pm_qos_req, 55);
1188
1181mutex_unlock: 1189mutex_unlock:
1182 mutex_unlock(&sc->mutex); 1190 mutex_unlock(&sc->mutex);
1183 1191
@@ -1331,6 +1339,8 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1331 1339
1332 sc->sc_flags |= SC_OP_INVALID; 1340 sc->sc_flags |= SC_OP_INVALID;
1333 1341
1342 pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE);
1343
1334 mutex_unlock(&sc->mutex); 1344 mutex_unlock(&sc->mutex);
1335 1345
1336 ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); 1346 ath_print(common, ATH_DBG_CONFIG, "Driver halt\n");
@@ -1409,8 +1419,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1409 ath9k_hw_set_interrupts(ah, ah->imask); 1419 ath9k_hw_set_interrupts(ah, ah->imask);
1410 1420
1411 if (vif->type == NL80211_IFTYPE_AP || 1421 if (vif->type == NL80211_IFTYPE_AP ||
1412 vif->type == NL80211_IFTYPE_ADHOC || 1422 vif->type == NL80211_IFTYPE_ADHOC) {
1413 vif->type == NL80211_IFTYPE_MONITOR) {
1414 sc->sc_flags |= SC_OP_ANI_RUN; 1423 sc->sc_flags |= SC_OP_ANI_RUN;
1415 ath_start_ani(common); 1424 ath_start_ani(common);
1416 } 1425 }
@@ -1560,8 +1569,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1560 if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1569 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
1561 if (conf->flags & IEEE80211_CONF_MONITOR) { 1570 if (conf->flags & IEEE80211_CONF_MONITOR) {
1562 ath_print(common, ATH_DBG_CONFIG, 1571 ath_print(common, ATH_DBG_CONFIG,
1563 "HW opmode set to Monitor mode\n"); 1572 "Monitor mode is enabled\n");
1564 sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; 1573 sc->sc_ah->is_monitoring = true;
1574 } else {
1575 ath_print(common, ATH_DBG_CONFIG,
1576 "Monitor mode is disabled\n");
1577 sc->sc_ah->is_monitoring = false;
1565 } 1578 }
1566 } 1579 }
1567 1580