Migrate the chip power mode status to public ath_hal, rather than the
private per-chip HAL. This allows the ah_osdep.[ch] code to check whether the power state is valid for doing chip programming. It should be a no-op for normal driver work but it does require a clean kernel/module rebuild, as the size of HAL structures have changed. Now, this doesn't track whether the hardware is ACTUALLY awake, as NETWORK_SLEEP wakes the chip up for a short period when traffic is received. This doesn't actually set the power mode to AWAKE, so we have to be careful about how we touch things. But it's enough to start down the path of implementing station mode chipset power savings, as a large part of the silliness is making sure the chip is awake during periodic calibration / ANI and random places where transmit may be occuring. I'd rather not a repeat of debugging power save on ath9k, where races with calibration and transmit path stuff took a couple years to shake out. Tested: * AR5416, STA mode
This commit is contained in:
parent
cd309dac82
commit
8a67b42a74
@ -1297,6 +1297,9 @@ struct ath_hal {
|
||||
uint32_t ah_intrstate[8]; /* last int state */
|
||||
uint32_t ah_syncstate; /* last sync intr state */
|
||||
|
||||
/* Current powerstate from HAL calls */
|
||||
HAL_POWER_MODE ah_powerMode;
|
||||
|
||||
HAL_OPS_CONFIG ah_config;
|
||||
const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *,
|
||||
u_int mode);
|
||||
|
@ -108,7 +108,6 @@ struct ath_hal_5210 {
|
||||
uint32_t ah_txDescInterruptMask;
|
||||
uint32_t ah_txEolInterruptMask;
|
||||
uint32_t ah_txUrnInterruptMask;
|
||||
HAL_POWER_MODE ah_powerMode;
|
||||
uint8_t ah_bssid[IEEE80211_ADDR_LEN];
|
||||
HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES]; /* beacon+cab+data */
|
||||
/*
|
||||
|
@ -219,7 +219,7 @@ ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
|
||||
AH_PRIVATE(ah)->ah_powerLimit = AR5210_MAX_RATE_POWER;
|
||||
AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
|
||||
|
||||
ahp->ah_powerMode = HAL_PM_UNDEFINED;
|
||||
ah->ah_powerMode = HAL_PM_UNDEFINED;
|
||||
ahp->ah_staId1Defaults = 0;
|
||||
ahp->ah_rssiThr = INIT_RSSI_THR;
|
||||
ahp->ah_sifstime = (u_int) -1;
|
||||
|
@ -93,7 +93,6 @@ ar5210SetPowerModeSleep(struct ath_hal *ah, int setChip)
|
||||
HAL_BOOL
|
||||
ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
{
|
||||
struct ath_hal_5210 *ahp = AH5210(ah);
|
||||
#ifdef AH_DEBUG
|
||||
static const char* modes[] = {
|
||||
"AWAKE",
|
||||
@ -105,7 +104,7 @@ ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
int status = AH_TRUE;
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
|
||||
modes[ahp->ah_powerMode], modes[mode],
|
||||
modes[ah->ah_powerMode], modes[mode],
|
||||
setChip ? "set chip " : "");
|
||||
switch (mode) {
|
||||
case HAL_PM_AWAKE:
|
||||
@ -122,7 +121,7 @@ ar5210SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
__func__, mode);
|
||||
return AH_FALSE;
|
||||
}
|
||||
ahp->ah_powerMode = mode;
|
||||
ah->ah_powerMode = mode;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,6 @@ struct ath_hal_5211 {
|
||||
uint32_t ah_txEolInterruptMask;
|
||||
uint32_t ah_txUrnInterruptMask;
|
||||
HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES];
|
||||
HAL_POWER_MODE ah_powerMode;
|
||||
HAL_ANT_SETTING ah_diversityControl; /* antenna setting */
|
||||
uint32_t ah_calibrationTime;
|
||||
HAL_BOOL ah_bIQCalibration;
|
||||
|
@ -95,7 +95,6 @@ ar5211SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
|
||||
HAL_BOOL
|
||||
ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
{
|
||||
struct ath_hal_5211 *ahp = AH5211(ah);
|
||||
#ifdef AH_DEBUG
|
||||
static const char* modes[] = {
|
||||
"AWAKE",
|
||||
@ -107,7 +106,7 @@ ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
int status = AH_TRUE;
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
|
||||
modes[ahp->ah_powerMode], modes[mode],
|
||||
modes[ah->ah_powerMode], modes[mode],
|
||||
setChip ? "set chip " : "");
|
||||
switch (mode) {
|
||||
case HAL_PM_AWAKE:
|
||||
@ -124,7 +123,7 @@ ar5211SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
__func__, mode);
|
||||
return AH_FALSE;
|
||||
}
|
||||
ahp->ah_powerMode = mode;
|
||||
ah->ah_powerMode = mode;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,6 @@ struct ath_hal_5212 {
|
||||
uint32_t ah_intrTxqs; /* tx q interrupt state */
|
||||
/* decomp mask array */
|
||||
uint8_t ah_decompMask[HAL_DECOMP_MASK_SIZE];
|
||||
HAL_POWER_MODE ah_powerMode;
|
||||
HAL_ANT_SETTING ah_antControl; /* antenna setting */
|
||||
HAL_BOOL ah_diversity; /* fast diversity setting */
|
||||
enum {
|
||||
|
@ -119,7 +119,6 @@ ar5212SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
|
||||
HAL_BOOL
|
||||
ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
{
|
||||
struct ath_hal_5212 *ahp = AH5212(ah);
|
||||
#ifdef AH_DEBUG
|
||||
static const char* modes[] = {
|
||||
"AWAKE",
|
||||
@ -131,7 +130,7 @@ ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
int status = AH_TRUE;
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
|
||||
modes[ahp->ah_powerMode], modes[mode],
|
||||
modes[ah->ah_powerMode], modes[mode],
|
||||
setChip ? "set chip " : "");
|
||||
switch (mode) {
|
||||
case HAL_PM_AWAKE:
|
||||
@ -148,7 +147,7 @@ ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
__func__, mode);
|
||||
return AH_FALSE;
|
||||
}
|
||||
ahp->ah_powerMode = mode;
|
||||
ah->ah_powerMode = mode;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ ar5312SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
|
||||
HAL_BOOL
|
||||
ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
{
|
||||
struct ath_hal_5212 *ahp = AH5212(ah);
|
||||
#ifdef AH_DEBUG
|
||||
static const char* modes[] = {
|
||||
"AWAKE",
|
||||
@ -83,7 +82,7 @@ ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
int status = AH_TRUE;
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
|
||||
modes[ahp->ah_powerMode], modes[mode],
|
||||
modes[ah->ah_powerMode], modes[mode],
|
||||
setChip ? "set chip " : "");
|
||||
switch (mode) {
|
||||
case HAL_PM_AWAKE:
|
||||
@ -100,7 +99,7 @@ ar5312SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
__func__, mode);
|
||||
return AH_FALSE;
|
||||
}
|
||||
ahp->ah_powerMode = mode;
|
||||
ah->ah_powerMode = mode;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ ar5416SetPowerModeNetworkSleep(struct ath_hal *ah, int setChip)
|
||||
HAL_BOOL
|
||||
ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
{
|
||||
struct ath_hal_5212 *ahp = AH5212(ah);
|
||||
#ifdef AH_DEBUG
|
||||
static const char* modes[] = {
|
||||
"AWAKE",
|
||||
@ -138,7 +137,7 @@ ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
return AH_TRUE;
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_POWER, "%s: %s -> %s (%s)\n", __func__,
|
||||
modes[ahp->ah_powerMode], modes[mode], setChip ? "set chip " : "");
|
||||
modes[ah->ah_powerMode], modes[mode], setChip ? "set chip " : "");
|
||||
switch (mode) {
|
||||
case HAL_PM_AWAKE:
|
||||
status = ar5416SetPowerModeAwake(ah, setChip);
|
||||
@ -154,7 +153,7 @@ ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip)
|
||||
__func__, mode);
|
||||
return AH_FALSE;
|
||||
}
|
||||
ahp->ah_powerMode = mode;
|
||||
ah->ah_powerMode = mode;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user