Release 4.11 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.
*
* 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 | 125 | 71.02% | 1 | 8.33% |
Malcolm Priestley | 34 | 19.32% | 4 | 33.33% |
Nicholas Parkanyi | 9 | 5.11% | 1 | 8.33% |
Charles Clément | 6 | 3.41% | 4 | 33.33% |
Joe Perches | 1 | 0.57% | 1 | 8.33% |
Guillaume Clement | 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 | 45 | 70.31% | 1 | 14.29% |
Malcolm Priestley | 12 | 18.75% | 3 | 42.86% |
Nicholas Parkanyi | 4 | 6.25% | 1 | 14.29% |
Charles Clément | 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 | 59 | 63.44% | 6 | 60.00% |
Forest Bond | 30 | 32.26% | 1 | 10.00% |
Charles Clément | 4 | 4.30% | 3 | 30.00% |
Total | 93 | 100.00% | 10 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Forest Bond | 217 | 61.30% | 1 | 5.00% |
Malcolm Priestley | 105 | 29.66% | 8 | 40.00% |
Charles Clément | 13 | 3.67% | 6 | 30.00% |
Nicholas Parkanyi | 13 | 3.67% | 1 | 5.00% |
Anson Jacob | 3 | 0.85% | 1 | 5.00% |
Joe Perches | 1 | 0.28% | 1 | 5.00% |
Guillaume Clement | 1 | 0.28% | 1 | 5.00% |
Varsha Rao | 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.