Author: adrian
Date: Wed Apr 30 02:03:13 2014
New Revision: 265112
URL: http://svnweb.freebsd.org/changeset/base/265112

Log:
  * Only update ah_powerMode if we're setting the chip sleep state.
    Some code will appear soon that is actually setting the chip powerstate
    separate from the self-generated frames power state.
  * Allow the AR5416 family chips to actually have the power state changed
    from the self generated state change.
  
  Tested (STA mode):
  
  * AR5210
  * AR5211
  * AR5412
  * AR5413
  * AR5416
  * AR9285

Modified:
  head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c      Tue Apr 29 23:29:28 
2014        (r265111)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c      Wed Apr 30 02:03:13 
2014        (r265112)
@@ -108,16 +108,19 @@ ar5210SetPowerMode(struct ath_hal *ah, H
                setChip ? "set chip " : "");
        switch (mode) {
        case HAL_PM_AWAKE:
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                status = ar5210SetPowerModeAwake(ah, setChip);
                break;
        case HAL_PM_FULL_SLEEP:
                ar5210SetPowerModeSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        case HAL_PM_NETWORK_SLEEP:
                ar5210SetPowerModeAuto(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        default:
                HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c      Tue Apr 29 23:29:28 
2014        (r265111)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c      Wed Apr 30 02:03:13 
2014        (r265112)
@@ -110,16 +110,19 @@ ar5211SetPowerMode(struct ath_hal *ah, H
                setChip ? "set chip " : "");
        switch (mode) {
        case HAL_PM_AWAKE:
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                status = ar5211SetPowerModeAwake(ah, setChip);
                break;
        case HAL_PM_FULL_SLEEP:
                ar5211SetPowerModeSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        case HAL_PM_NETWORK_SLEEP:
                ar5211SetPowerModeNetworkSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        default:
                HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c      Tue Apr 29 23:29:28 
2014        (r265111)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c      Wed Apr 30 02:03:13 
2014        (r265112)
@@ -134,16 +134,19 @@ ar5212SetPowerMode(struct ath_hal *ah, H
                setChip ? "set chip " : "");
        switch (mode) {
        case HAL_PM_AWAKE:
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                status = ar5212SetPowerModeAwake(ah, setChip);
                break;
        case HAL_PM_FULL_SLEEP:
                ar5212SetPowerModeSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        case HAL_PM_NETWORK_SLEEP:
                ar5212SetPowerModeNetworkSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        default:
                HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c      Tue Apr 29 23:29:28 
2014        (r265111)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c      Wed Apr 30 02:03:13 
2014        (r265112)
@@ -133,23 +133,29 @@ ar5416SetPowerMode(struct ath_hal *ah, H
        };
 #endif
        int status = AH_TRUE;
+
+#if 0
        if (!setChip)
                return AH_TRUE;
+#endif
 
        HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
            modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : "");
        switch (mode) {
        case HAL_PM_AWAKE:
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                status = ar5416SetPowerModeAwake(ah, setChip);
                break;
        case HAL_PM_FULL_SLEEP:
                ar5416SetPowerModeSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        case HAL_PM_NETWORK_SLEEP:
                ar5416SetPowerModeNetworkSleep(ah, setChip);
-               ah->ah_powerMode = mode;
+               if (setChip)
+                       ah->ah_powerMode = mode;
                break;
        default:
                HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode 0x%x\n",
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to