2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2008 Atheros Communications, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * $Id: ar5312_power.c,v 1.4 2008/11/10 04:08:04 sam Exp $
22 #ifdef AH_SUPPORT_AR5312
25 #include "ah_internal.h"
27 #include "ar5312/ar5312.h"
28 #include "ar5312/ar5312reg.h"
29 #include "ar5212/ar5212desc.h"
32 * Notify Power Mgt is enabled in self-generated frames.
33 * If requested, force chip awake.
35 * Returns A_OK if chip is awake or successfully forced awake.
37 * WARNING WARNING WARNING
38 * There is a problem with the chip where sometimes it will not wake up.
41 ar5312SetPowerModeAwake(struct ath_hal *ah, int setChip)
43 /* No need for this at the moment for APs */
48 * Notify Power Mgt is disabled in self-generated frames.
49 * If requested, force chip to sleep.
52 ar5312SetPowerModeSleep(struct ath_hal *ah, int setChip)
54 /* No need for this at the moment for APs */
58 * Notify Power Management is enabled in self-generating
59 * fames. If request, set power mode of chip to
60 * auto/normal. Duration in units of 128us (1/8 TU).
63 ar5312SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
65 /* No need for this at the moment for APs */
69 * Set power mgt to the requested mode, and conditionally set
73 ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
75 struct ath_hal_5212 *ahp = AH5212(ah);
77 static const char* modes[] = {
86 HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
87 modes[ahp->ah_powerMode], modes[mode],
88 setChip ? "set chip " : "");
91 status = ar5312SetPowerModeAwake(ah, setChip);
93 case HAL_PM_FULL_SLEEP:
94 ar5312SetPowerModeSleep(ah, setChip);
96 case HAL_PM_NETWORK_SLEEP:
97 ar5312SetPowerModeNetworkSleep(ah, setChip);
100 HALDEBUG(ah, HAL_DEBUG_POWER, "%s: unknown power mode %u\n",
104 ahp->ah_powerMode = mode;
109 * Return the current sleep mode of the chip
112 ar5312GetPowerMode(struct ath_hal *ah)
118 * Return the current sleep state of the chip
122 ar5312GetPowerStatus(struct ath_hal *ah)
124 return 0; /* Currently, 5312 is never in sleep mode. */
126 #endif /* AH_SUPPORT_AR5312 */