diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-28 09:44:56 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-28 09:44:56 -0700 |
commit | e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7 (patch) | |
tree | ea51b391f7d74ca695dcb9f5e46eb02688a92ed9 /drivers/staging/rtl8712/rtl871x_pwrctrl.h | |
parent | 81280572ca6f54009edfa4deee563e8678784218 (diff) | |
parent | a4ac0d847af9dd34d5953a5e264400326144b6b2 (diff) | |
download | op-kernel-dev-e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7.zip op-kernel-dev-e4c5bf8e3dca827a1b3a6fac494eae8c74b7e1e7.tar.gz |
Merge 'staging-next' to Linus's tree
This merges the staging-next tree to Linus's tree and resolves
some conflicts that were present due to changes in other trees that were
affected by files here.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rtl8712/rtl871x_pwrctrl.h')
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_pwrctrl.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.h b/drivers/staging/rtl8712/rtl871x_pwrctrl.h new file mode 100644 index 0000000..34f074ae --- /dev/null +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.h @@ -0,0 +1,127 @@ +#ifndef __RTL871X_PWRCTRL_H_ +#define __RTL871X_PWRCTRL_H_ + +#include "osdep_service.h" +#include "drv_types.h" + + +#define FW_PWR0 0 +#define FW_PWR1 1 +#define FW_PWR2 2 +#define FW_PWR3 3 + + +#define HW_PWR0 7 +#define HW_PWR1 6 +#define HW_PWR2 2 +#define HW_PWR3 0 +#define HW_PWR4 8 + +#define FW_PWRMSK 0x7 + + +#define XMIT_ALIVE BIT(0) +#define RECV_ALIVE BIT(1) +#define CMD_ALIVE BIT(2) +#define EVT_ALIVE BIT(3) + + +enum Power_Mgnt { + PS_MODE_ACTIVE = 0 , + PS_MODE_MIN , + PS_MODE_MAX , + PS_MODE_DTIM , + PS_MODE_VOIP , + PS_MODE_UAPSD_WMM , + PS_MODE_UAPSD , + PS_MODE_IBSS , + PS_MODE_WWLAN , + PM_Radio_Off , + PM_Card_Disable , + PS_MODE_NUM +}; + + +/* + BIT[2:0] = HW state + BIT[3] = Protocol PS state, 0: register active state, + 1: register sleep state + BIT[4] = sub-state +*/ + +#define PS_DPS BIT(0) +#define PS_LCLK (PS_DPS) +#define PS_RF_OFF BIT(1) +#define PS_ALL_ON BIT(2) +#define PS_ST_ACTIVE BIT(3) +#define PS_LP BIT(4) /* low performance */ + +#define PS_STATE_MASK (0x0F) +#define PS_STATE_HW_MASK (0x07) +#define PS_SEQ_MASK (0xc0) + +#define PS_STATE(x) (PS_STATE_MASK & (x)) +#define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x)) +#define PS_SEQ(x) (PS_SEQ_MASK & (x)) + +#define PS_STATE_S0 (PS_DPS) +#define PS_STATE_S1 (PS_LCLK) +#define PS_STATE_S2 (PS_RF_OFF) +#define PS_STATE_S3 (PS_ALL_ON) +#define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON)) + + +#define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON)) +#define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE)) +#define CLR_PS_STATE(x) ((x) = ((x) & (0xF0))) + + +struct reportpwrstate_parm { + unsigned char mode; + unsigned char state; /* the CPWM value */ + unsigned short rsvd; +}; + +static inline void _enter_pwrlock(struct semaphore *plock) +{ + _down_sema(plock); +} + +struct pwrctrl_priv { + struct semaphore lock; + /*volatile*/ u8 rpwm; /* requested power state for fw */ + /* fw current power state. updated when 1. read from HCPWM or + * 2. driver lowers power level */ + /*volatile*/ u8 cpwm; + /*volatile*/ u8 tog; /* toggling */ + /*volatile*/ u8 cpwm_tog; /* toggling */ + /*volatile*/ u8 tgt_rpwm; /* wanted power state */ + uint pwr_mode; + uint smart_ps; + uint alives; + uint ImrContent; /* used to store original imr. */ + uint bSleep; /* sleep -> active is different from active -> sleep. */ + + _workitem SetPSModeWorkItem; + _workitem rpwm_workitem; + struct timer_list rpwm_check_timer; + u8 rpwm_retry; + uint bSetPSModeWorkItemInProgress; + + struct semaphore pnp_pwr_mgnt_sema; + spinlock_t pnp_pwr_mgnt_lock; + s32 pnp_current_pwr_state; + u8 pnp_bstop_trx; + u8 pnp_wwirp_pending; +}; + +void r8712_init_pwrctrl_priv(struct _adapter *adapter); +sint r8712_register_cmd_alive(struct _adapter *padapter); +void r8712_unregister_cmd_alive(struct _adapter *padapter); +void r8712_cpwm_int_hdl(struct _adapter *padapter, + struct reportpwrstate_parm *preportpwrstate); +void r8712_set_ps_mode(struct _adapter *padapter, uint ps_mode, + uint smart_ps); +void r8712_set_rpwm(struct _adapter *padapter, u8 val8); + +#endif /* __RTL871X_PWRCTRL_H_ */ |