Release 4.7 drivers/staging/vt6655/power.c
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: power.c
*
* Purpose: Handles 802.11 power management functions
*
* Author: Lyndon Chen
*
* Date: July 17, 2002
*
* Functions:
* PSvEnablePowerSaving - Enable Power Saving Mode
* PSvDiasblePowerSaving - Disable Power Saving Mode
* PSbConsiderPowerDown - Decide if we can Power Down
* PSvSendPSPOLL - Send PS-POLL packet
* PSbSendNullPacket - Send Null packet
* PSbIsNextTBTTWakeUp - Decide if we need to wake up at next Beacon
*
* Revision History:
*
*/
#include "mac.h"
#include "device.h"
#include "power.h"
#include "card.h"
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
/*+
*
* Routine Description:
* Enable hw power saving functions
*
* Return Value:
* None.
*
-*/
void
PSvEnablePowerSaving(
struct vnt_private *priv,
unsigned short wListenInterval
)
{
u16 wAID = priv->current_aid | BIT(14) | BIT(15);
/* set period of power up before TBTT */
VNSvOutPortW(priv->PortOffset + MAC_REG_PWBT, C_PWBT);
if (priv->op_mode != NL80211_IFTYPE_ADHOC) {
/* set AID */
VNSvOutPortW(priv->PortOffset + MAC_REG_AIDATIM, wAID);
} else {
/* set ATIM Window */
#if 0 /* TODO atim window */
MACvWriteATIMW(priv->PortOffset, pMgmt->wCurrATIMWindow);
#endif
}
/* Set AutoSleep */
MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
/* Set HWUTSF */
MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
if (wListenInterval >= 2) {
/* clear always listen beacon */
MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
/* first time set listen next beacon */
MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
} else {
/* always listen beacon */
MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
}
/* enable power saving hw function */
MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
priv->bEnablePSMode = true;
priv->bPWBitOn = true;
pr_debug("PS:Power Saving Mode Enable...\n");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 125 | 71.02% | 1 | 8.33% |
malcolm priestley | malcolm priestley | 34 | 19.32% | 4 | 33.33% |
nicholas parkanyi | nicholas parkanyi | 9 | 5.11% | 1 | 8.33% |
charles clement | charles clement | 6 | 3.41% | 4 | 33.33% |
guillaume clement | guillaume clement | 1 | 0.57% | 1 | 8.33% |
joe perches | joe perches | 1 | 0.57% | 1 | 8.33% |
| Total | 176 | 100.00% | 12 | 100.00% |
/*+
*
* Routine Description:
* Disable hw power saving functions
*
* Return Value:
* None.
*
-*/
void
PSvDisablePowerSaving(
struct vnt_private *priv
)
{
/* disable power saving hw function */
MACbPSWakeup(priv);
/* clear AutoSleep */
MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
/* clear HWUTSF */
MACvRegBitsOff(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
/* set always listen beacon */
MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
priv->bEnablePSMode = false;
priv->bPWBitOn = false;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 45 | 70.31% | 1 | 14.29% |
malcolm priestley | malcolm priestley | 12 | 18.75% | 3 | 42.86% |
nicholas parkanyi | nicholas parkanyi | 4 | 6.25% | 1 | 14.29% |
charles clement | charles clement | 3 | 4.69% | 2 | 28.57% |
| Total | 64 | 100.00% | 7 | 100.00% |
/*+
*
* Routine Description:
* Check if Next TBTT must wake up
*
* Return Value:
* None.
*
-*/
bool
PSbIsNextTBTTWakeUp(
struct vnt_private *priv
)
{
struct ieee80211_hw *hw = priv->hw;
struct ieee80211_conf *conf = &hw->conf;
bool wake_up = false;
if (conf->listen_interval > 1) {
if (!priv->wake_up_count)
priv->wake_up_count = conf->listen_interval;
--priv->wake_up_count;
if (priv->wake_up_count == 1) {
/* Turn on wake up to listen next beacon */
MACvRegBitsOn(priv->PortOffset,
MAC_REG_PSCTL, PSCTL_LNBCN);
wake_up = true;
}
}
return wake_up;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
malcolm priestley | malcolm priestley | 59 | 63.44% | 6 | 60.00% |
forest bond | forest bond | 30 | 32.26% | 1 | 10.00% |
charles clement | charles clement | 4 | 4.30% | 3 | 30.00% |
| Total | 93 | 100.00% | 10 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
forest bond | forest bond | 217 | 61.30% | 1 | 5.00% |
malcolm priestley | malcolm priestley | 105 | 29.66% | 8 | 40.00% |
nicholas parkanyi | nicholas parkanyi | 13 | 3.67% | 1 | 5.00% |
charles clement | charles clement | 13 | 3.67% | 6 | 30.00% |
joe perches | joe perches | 4 | 1.13% | 2 | 10.00% |
jim lieb | jim lieb | 1 | 0.28% | 1 | 5.00% |
guillaume clement | guillaume clement | 1 | 0.28% | 1 | 5.00% |
| Total | 354 | 100.00% | 20 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.