diff options
author | Senthil Balasubramanian <senthilkumar@atheros.com> | 2010-10-05 11:06:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-06 16:30:40 -0400 |
commit | 845d708e62f08a45ff716fdb270c52585cad31d0 (patch) | |
tree | a777f43c1b3a972f50ae11c31f80d83ba18bb757 /drivers/net/wireless | |
parent | fbab7390f954e3517c72d12cfd9a1502699aa368 (diff) |
ath9k: Introduce a wrapper for power save disable.
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index d0694cb685fa..74c2dc8a8b8a 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1498,13 +1498,32 @@ static void ath9k_enable_ps(struct ath_softc *sc) | |||
1498 | } | 1498 | } |
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | static void ath9k_disable_ps(struct ath_softc *sc) | ||
1502 | { | ||
1503 | struct ath_hw *ah = sc->sc_ah; | ||
1504 | |||
1505 | sc->ps_enabled = false; | ||
1506 | ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); | ||
1507 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { | ||
1508 | ath9k_hw_setrxabort(ah, 0); | ||
1509 | sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | | ||
1510 | PS_WAIT_FOR_CAB | | ||
1511 | PS_WAIT_FOR_PSPOLL_DATA | | ||
1512 | PS_WAIT_FOR_TX_ACK); | ||
1513 | if (ah->imask & ATH9K_INT_TIM_TIMER) { | ||
1514 | ah->imask &= ~ATH9K_INT_TIM_TIMER; | ||
1515 | ath9k_hw_set_interrupts(ah, ah->imask); | ||
1516 | } | ||
1517 | } | ||
1518 | |||
1519 | } | ||
1520 | |||
1501 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | 1521 | static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
1502 | { | 1522 | { |
1503 | struct ath_wiphy *aphy = hw->priv; | 1523 | struct ath_wiphy *aphy = hw->priv; |
1504 | struct ath_softc *sc = aphy->sc; | 1524 | struct ath_softc *sc = aphy->sc; |
1505 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1525 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1506 | struct ieee80211_conf *conf = &hw->conf; | 1526 | struct ieee80211_conf *conf = &hw->conf; |
1507 | struct ath_hw *ah = sc->sc_ah; | ||
1508 | bool disable_radio; | 1527 | bool disable_radio; |
1509 | 1528 | ||
1510 | mutex_lock(&sc->mutex); | 1529 | mutex_lock(&sc->mutex); |
@@ -1553,23 +1572,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1553 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 1572 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
1554 | if (conf->flags & IEEE80211_CONF_PS) | 1573 | if (conf->flags & IEEE80211_CONF_PS) |
1555 | ath9k_enable_ps(sc); | 1574 | ath9k_enable_ps(sc); |
1556 | else { | 1575 | else |
1557 | sc->ps_enabled = false; | 1576 | ath9k_disable_ps(sc); |
1558 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); | ||
1559 | if (!(ah->caps.hw_caps & | ||
1560 | ATH9K_HW_CAP_AUTOSLEEP)) { | ||
1561 | ath9k_hw_setrxabort(sc->sc_ah, 0); | ||
1562 | sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | | ||
1563 | PS_WAIT_FOR_CAB | | ||
1564 | PS_WAIT_FOR_PSPOLL_DATA | | ||
1565 | PS_WAIT_FOR_TX_ACK); | ||
1566 | if (ah->imask & ATH9K_INT_TIM_TIMER) { | ||
1567 | ah->imask &= ~ATH9K_INT_TIM_TIMER; | ||
1568 | ath9k_hw_set_interrupts(sc->sc_ah, | ||
1569 | ah->imask); | ||
1570 | } | ||
1571 | } | ||
1572 | } | ||
1573 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 1577 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
1574 | } | 1578 | } |
1575 | 1579 | ||