ath9k: disable radio when all devices are marked idle

This uses the new configuration changes indicated up by
mac80211 when all interfaces are marked idle. We need to do
a little more work as we have our own set of virtual
wiphys within ath9k.

Only when all virtual wiphys are inactive do we allow an idle
state change for a wiphy to trigger disabling the radio.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Luis R. Rodriguez
2009-07-14 20:22:53 -04:00
committed by John W. Linville
부모 709ade9eb8
커밋 64839170be
3개의 변경된 파일42개의 추가작업 그리고 0개의 파일을 삭제

파일 보기

@@ -2260,9 +2260,28 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
struct ath_softc *sc = aphy->sc;
struct ieee80211_conf *conf = &hw->conf;
struct ath_hw *ah = sc->sc_ah;
bool all_wiphys_idle = false, disable_radio = false;
mutex_lock(&sc->mutex);
/* Leave this as the first check */
if (changed & IEEE80211_CONF_CHANGE_IDLE) {
spin_lock_bh(&sc->wiphy_lock);
all_wiphys_idle = ath9k_all_wiphys_idle(sc);
spin_unlock_bh(&sc->wiphy_lock);
if (conf->flags & IEEE80211_CONF_IDLE){
if (all_wiphys_idle)
disable_radio = true;
}
else if (all_wiphys_idle) {
ath_radio_enable(sc);
DPRINTF(sc, ATH_DBG_CONFIG,
"not-idle: enabling radio\n");
}
}
if (changed & IEEE80211_CONF_CHANGE_PS) {
if (conf->flags & IEEE80211_CONF_PS) {
if (!(ah->caps.hw_caps &
@@ -2330,6 +2349,11 @@ skip_chan_change:
if (changed & IEEE80211_CONF_CHANGE_POWER)
sc->config.txpowlimit = 2 * conf->power_level;
if (disable_radio) {
DPRINTF(sc, ATH_DBG_CONFIG, "idle: disabling radio\n");
ath_radio_disable(sc);
}
mutex_unlock(&sc->mutex);
return 0;