diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-05-21 19:01:42 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-05-21 19:01:42 +0000 |
commit | daf5e16c9c0498069e4e5e5e4b9d51be1d3c6aed (patch) | |
tree | 532b7fc52c31843bb7b1e98b4267c2cf305f5d6c /sys | |
parent | 46b230207cc84bc82f0cd18d81d2c57e55ea8a4f (diff) |
improve power saving mode
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ar5212.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c index b2da7f077a0..7e4812e43cd 100644 --- a/sys/dev/ic/ar5212.c +++ b/sys/dev/ic/ar5212.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5212.c,v 1.16 2005/05/08 14:46:50 reyk Exp $ */ +/* $OpenBSD: ar5212.c,v 1.17 2005/05/21 19:01:41 reyk Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net> @@ -1232,9 +1232,10 @@ ar5k_ar5212_stop_tx_dma(hal, queue) */ AR5K_REG_WRITE_Q(AR5K_AR5212_QCU_TXD, queue); - ret = ar5k_register_timeout(hal, - AR5K_AR5212_QCU_STS(queue), AR5K_AR5212_QCU_STS_FRMPENDCNT, - 0, AH_FALSE); + if (queue <= HAL_TX_QUEUE_ID_DATA_MAX) + ret = ar5k_register_timeout(hal, + AR5K_AR5212_QCU_STS(queue), AR5K_AR5212_QCU_STS_FRMPENDCNT, + 0, AH_FALSE); /* Clear register */ AR5K_REG_WRITE(AR5K_AR5212_QCU_TXD, 0); @@ -2411,14 +2412,18 @@ ar5k_ar5212_set_power(hal, mode, set_chip, sleep_duration) HAL_BOOL set_chip; u_int16_t sleep_duration; { + u_int32_t staid; int i; + staid = AR5K_REG_READ(AR5K_AR5212_STA_ID1); + switch (mode) { - case HAL_PM_AUTO: + case HAL_PM_NETWORK_SLEEP: if (set_chip == AH_TRUE) { AR5K_REG_WRITE(AR5K_AR5212_SCR, AR5K_AR5212_SCR_SLE | sleep_duration); } + staid |= AR5K_AR5212_STA_ID1_PWR_SV; break; case HAL_PM_FULL_SLEEP: @@ -2426,6 +2431,7 @@ ar5k_ar5212_set_power(hal, mode, set_chip, sleep_duration) AR5K_REG_WRITE(AR5K_AR5212_SCR, AR5K_AR5212_SCR_SLE_SLP); } + staid |= AR5K_AR5212_STA_ID1_PWR_SV; break; case HAL_PM_AWAKE: @@ -2449,10 +2455,10 @@ ar5k_ar5212_set_power(hal, mode, set_chip, sleep_duration) /* Fail if the AR5212 didn't wake up */ if (i <= 0) return (AH_FALSE); + + staid &= ~AR5K_AR5212_STA_ID1_PWR_SV; break; - case HAL_PM_NETWORK_SLEEP: - case HAL_PM_UNDEFINED: default: return (AH_FALSE); } @@ -2460,10 +2466,7 @@ ar5k_ar5212_set_power(hal, mode, set_chip, sleep_duration) commit: hal->ah_power_mode = mode; - AR5K_REG_DISABLE_BITS(AR5K_AR5212_STA_ID1, - AR5K_AR5212_STA_ID1_DEFAULT_ANTENNA); - AR5K_REG_ENABLE_BITS(AR5K_AR5212_STA_ID1, - AR5K_AR5212_STA_ID1_PWR_SV); + AR5K_REG_WRITE(AR5K_AR5212_STA_ID1, staid); return (AH_TRUE); } |