summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath9k/core.h
diff options
context:
space:
mode:
authorVivek Natarajan <vivek.natraj@gmail.com>2009-01-20 05:47:08 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 21:01:03 (GMT)
commit3cbb5dd73697b3f1c677daffe29f00ace22b71e9 (patch)
tree39fcb371ef37b9a2a53a4cdf72a8e98c64d9e98e /drivers/net/wireless/ath9k/core.h
parentc5d0569882b9c264be31dcb0758961bfc479deea (diff)
downloadlinux-fsl-qoriq-3cbb5dd73697b3f1c677daffe29f00ace22b71e9.tar.xz
ath9k: Enable dynamic power save in ath9k.
This patch implements dynamic power save feature for ath9k. Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/core.h')
-rw-r--r--drivers/net/wireless/ath9k/core.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index f65933d..0f50767 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -676,6 +676,7 @@ enum PROT_MODE {
#define SC_OP_RFKILL_REGISTERED BIT(11)
#define SC_OP_RFKILL_SW_BLOCKED BIT(12)
#define SC_OP_RFKILL_HW_BLOCKED BIT(13)
+#define SC_OP_WAIT_FOR_BEACON BIT(14)
struct ath_bus_ops {
void (*read_cachesize)(struct ath_softc *sc, int *csz);
@@ -709,6 +710,7 @@ struct ath_softc {
u32 sc_keymax;
DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);
u8 sc_splitmic;
+ atomic_t ps_usecount;
enum ath9k_int sc_imask;
enum PROT_MODE sc_protmode;
enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
@@ -777,4 +779,20 @@ static inline int ath_ahb_init(void) { return 0; };
static inline void ath_ahb_exit(void) {};
#endif
+static inline void ath9k_ps_wakeup(struct ath_softc *sc)
+{
+ if (atomic_inc_return(&sc->ps_usecount) == 1)
+ if (sc->sc_ah->ah_power_mode != ATH9K_PM_AWAKE) {
+ sc->sc_ah->ah_restore_mode = sc->sc_ah->ah_power_mode;
+ ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
+ }
+}
+
+static inline void ath9k_ps_restore(struct ath_softc *sc)
+{
+ if (atomic_dec_and_test(&sc->ps_usecount))
+ if (sc->hw->conf.flags & IEEE80211_CONF_PS)
+ ath9k_hw_setpower(sc->sc_ah,
+ sc->sc_ah->ah_restore_mode);
+}
#endif /* CORE_H */