diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 29 |
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 b52f1cf8a603..25d3ef4c338e 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); |
@@ -1217,6 +1222,7 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1217 | ah->imask |= ATH9K_INT_CST; | 1222 | ah->imask |= ATH9K_INT_CST; |
1218 | 1223 | ||
1219 | sc->sc_flags &= ~SC_OP_INVALID; | 1224 | sc->sc_flags &= ~SC_OP_INVALID; |
1225 | sc->sc_ah->is_monitoring = false; | ||
1220 | 1226 | ||
1221 | /* Disable BMISS interrupt when we're not associated */ | 1227 | /* Disable BMISS interrupt when we're not associated */ |
1222 | ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); | 1228 | ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); |
@@ -1238,6 +1244,8 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1238 | ath9k_btcoex_timer_resume(sc); | 1244 | ath9k_btcoex_timer_resume(sc); |
1239 | } | 1245 | } |
1240 | 1246 | ||
1247 | pm_qos_update_request(&ath9k_pm_qos_req, 55); | ||
1248 | |||
1241 | mutex_unlock: | 1249 | mutex_unlock: |
1242 | mutex_unlock(&sc->mutex); | 1250 | mutex_unlock(&sc->mutex); |
1243 | 1251 | ||
@@ -1415,6 +1423,8 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1415 | 1423 | ||
1416 | sc->sc_flags |= SC_OP_INVALID; | 1424 | sc->sc_flags |= SC_OP_INVALID; |
1417 | 1425 | ||
1426 | pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE); | ||
1427 | |||
1418 | mutex_unlock(&sc->mutex); | 1428 | mutex_unlock(&sc->mutex); |
1419 | 1429 | ||
1420 | ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); | 1430 | ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); |
@@ -1493,8 +1503,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1493 | ath9k_hw_set_interrupts(ah, ah->imask); | 1503 | ath9k_hw_set_interrupts(ah, ah->imask); |
1494 | 1504 | ||
1495 | if (vif->type == NL80211_IFTYPE_AP || | 1505 | if (vif->type == NL80211_IFTYPE_AP || |
1496 | vif->type == NL80211_IFTYPE_ADHOC || | 1506 | vif->type == NL80211_IFTYPE_ADHOC) { |
1497 | vif->type == NL80211_IFTYPE_MONITOR) { | ||
1498 | sc->sc_flags |= SC_OP_ANI_RUN; | 1507 | sc->sc_flags |= SC_OP_ANI_RUN; |
1499 | ath_start_ani(common); | 1508 | ath_start_ani(common); |
1500 | } | 1509 | } |
@@ -1644,8 +1653,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1644 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | 1653 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { |
1645 | if (conf->flags & IEEE80211_CONF_MONITOR) { | 1654 | if (conf->flags & IEEE80211_CONF_MONITOR) { |
1646 | ath_print(common, ATH_DBG_CONFIG, | 1655 | ath_print(common, ATH_DBG_CONFIG, |
1647 | "HW opmode set to Monitor mode\n"); | 1656 | "Monitor mode is enabled\n"); |
1648 | sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; | 1657 | sc->sc_ah->is_monitoring = true; |
1658 | } else { | ||
1659 | ath_print(common, ATH_DBG_CONFIG, | ||
1660 | "Monitor mode is disabled\n"); | ||
1661 | sc->sc_ah->is_monitoring = false; | ||
1649 | } | 1662 | } |
1650 | } | 1663 | } |
1651 | 1664 | ||