]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ath9k: fix assumptions for idle calls on suspend/resume
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 7 Dec 2010 23:13:20 +0000 (15:13 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 13 Dec 2010 20:23:27 +0000 (15:23 -0500)
mac80211 will notify drivers when to go idle and ath9k
assumed that it would get further notifications for idle
states after a device stop() config call but as per agreed
semantics the idle state of the radio is left up to driver
after mac80211 issues the stop() callback. The driver is
resposnbile for ensuring the device remains idle after
that even between suspend / resume calls.

This fixes suspend/resume when you issue suspend and resume
twice on ath9k when ath9k_stop() was already called. We need
to put the radio to full sleep in order for resume to work
correctly.

What might seem fishy is we are turning the radio off
after resume. The reason why we do this is because we know
we should not have anything enabled after a mac80211 tells
us to stop(), if we resume and never get a start() we won't
get another stop() by mac80211 so to be safe always bring
the 802.11 device with the radio disabled after resume,
this ensures that if we suspend we already have the radio
disabled and only a start() will ever trigger it on.

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/pci.c

index ef298f41ab4a5e5257374664b2bb20221e7fbfa3..ef87637e4245043ecb47cfd7aa94c20797b746ec 100644 (file)
@@ -1333,8 +1333,8 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 
        ath9k_ps_restore(sc);
 
-       /* Finally, put the chip in FULL SLEEP mode */
-       ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP);
+       sc->ps_idle = true;
+       ath_radio_disable(sc, hw);
 
        sc->sc_flags |= SC_OP_INVALID;
 
index 747b2871e48f86d838fbdf2da011bc1898a42783..7ca8499249ecfa13f36fddd9f6cb9411ca2a3239 100644 (file)
@@ -309,6 +309,9 @@ static int ath_pci_resume(struct device *device)
                            AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
        ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
 
+       sc->ps_idle = true;
+       ath_radio_disable(sc, hw);
+
        return 0;
 }