mirror of
https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git
synced 2025-10-19 17:11:09 +02:00
merge new version v4.3.14 from https://github.com/ptpt52/rtl8812au (#160)
This commit is contained in:
committed by
Harshavardhana
parent
c962f7a88d
commit
00aedbde5c
@@ -21,13 +21,13 @@
|
||||
#define __RTW_PWRCTRL_H_
|
||||
|
||||
|
||||
#define FW_PWR0 0
|
||||
#define FW_PWR0 0
|
||||
#define FW_PWR1 1
|
||||
#define FW_PWR2 2
|
||||
#define FW_PWR3 3
|
||||
|
||||
|
||||
#define HW_PWR0 7
|
||||
#define HW_PWR0 7
|
||||
#define HW_PWR1 6
|
||||
#define HW_PWR2 2
|
||||
#define HW_PWR3 0
|
||||
@@ -40,14 +40,16 @@
|
||||
#define RECV_ALIVE BIT(1)
|
||||
#define CMD_ALIVE BIT(2)
|
||||
#define EVT_ALIVE BIT(3)
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
#define BTCOEX_ALIVE BIT(4)
|
||||
#endif // CONFIG_BT_COEXIST
|
||||
|
||||
|
||||
enum Power_Mgnt
|
||||
{
|
||||
enum Power_Mgnt {
|
||||
PS_MODE_ACTIVE = 0 ,
|
||||
PS_MODE_MIN ,
|
||||
PS_MODE_MAX ,
|
||||
PS_MODE_DTIM ,
|
||||
PS_MODE_DTIM , //PS_MODE_SELF_DEFINED
|
||||
PS_MODE_VOIP ,
|
||||
PS_MODE_UAPSD_WMM ,
|
||||
PS_MODE_UAPSD ,
|
||||
@@ -58,9 +60,11 @@ enum Power_Mgnt
|
||||
PS_MODE_NUM,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_RTL8723B
|
||||
#define PS_MODE_SELF_DEFINED PS_MODE_DTIM
|
||||
#endif //
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
#define MAX_PNO_LIST_COUNT 16
|
||||
#define MAX_SCAN_LIST_COUNT 14 //2.4G only
|
||||
#define MAX_HIDDEN_AP 8 //8 hidden AP
|
||||
#endif
|
||||
|
||||
/*
|
||||
BIT[2:0] = HW state
|
||||
@@ -103,7 +107,7 @@ struct reportpwrstate_parm {
|
||||
unsigned char mode;
|
||||
unsigned char state; //the CPWM value
|
||||
unsigned short rsvd;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
typedef _sema _pwrlock;
|
||||
@@ -138,14 +142,13 @@ __inline static void _exit_pwrlock(_pwrlock *plock)
|
||||
#define EXE_PWR_LPS 0x04
|
||||
|
||||
// RF state.
|
||||
typedef enum _rt_rf_power_state
|
||||
{
|
||||
typedef enum _rt_rf_power_state {
|
||||
rf_on, // RF is on after RFSleep or RFOff
|
||||
rf_sleep, // 802.11 Power Save mode
|
||||
rf_off, // HW/SW Radio OFF or Inactive Power Save
|
||||
//=====Add the new RF state above this line=====//
|
||||
rf_max
|
||||
}rt_rf_power_state;
|
||||
} rt_rf_power_state;
|
||||
|
||||
// RF Off Level for IPS or HW/SW radio off
|
||||
#define RT_RF_OFF_LEVL_ASPM BIT(0) // PCI ASPM
|
||||
@@ -162,6 +165,11 @@ typedef enum _rt_rf_power_state
|
||||
#define RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG) (ppsc->cur_ps_level &= (~(_PS_FLAG)))
|
||||
#define RT_SET_PS_LEVEL(ppsc, _PS_FLAG) (ppsc->cur_ps_level |= _PS_FLAG)
|
||||
|
||||
// ASPM OSC Control bit, added by Roger, 2013.03.29.
|
||||
#define RT_PCI_ASPM_OSC_IGNORE 0 // PCI ASPM ignore OSC control in default
|
||||
#define RT_PCI_ASPM_OSC_ENABLE BIT0 // PCI ASPM controlled by OS according to ACPI Spec 5.0
|
||||
#define RT_PCI_ASPM_OSC_DISABLE BIT1 // PCI ASPM controlled by driver or BIOS, i.e., force enable ASPM
|
||||
|
||||
|
||||
enum _PS_BBRegBackup_ {
|
||||
PSBBREG_RF0 = 0,
|
||||
@@ -174,12 +182,69 @@ enum _PS_BBRegBackup_ {
|
||||
enum { // for ips_mode
|
||||
IPS_NONE=0,
|
||||
IPS_NORMAL,
|
||||
IPS_LEVEL_2,
|
||||
IPS_LEVEL_2,
|
||||
IPS_NUM
|
||||
};
|
||||
|
||||
struct pwrctrl_priv
|
||||
{
|
||||
// Design for pwrctrl_priv.ips_deny, 32 bits for 32 reasons at most
|
||||
typedef enum _PS_DENY_REASON {
|
||||
PS_DENY_DRV_INITIAL = 0,
|
||||
PS_DENY_SCAN,
|
||||
PS_DENY_JOIN,
|
||||
PS_DENY_DISCONNECT,
|
||||
PS_DENY_SUSPEND,
|
||||
PS_DENY_IOCTL,
|
||||
PS_DENY_MGNT_TX,
|
||||
PS_DENY_DRV_REMOVE = 30,
|
||||
PS_DENY_OTHERS = 31
|
||||
} PS_DENY_REASON;
|
||||
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
typedef struct pno_nlo_info {
|
||||
u32 fast_scan_period; //Fast scan period
|
||||
u8 ssid_num; //number of entry
|
||||
u8 hidden_ssid_num;
|
||||
u32 slow_scan_period; //slow scan period
|
||||
u32 fast_scan_iterations; //Fast scan iterations
|
||||
u8 ssid_length[MAX_PNO_LIST_COUNT]; //SSID Length Array
|
||||
u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; //Cipher information for security
|
||||
u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; //channel information
|
||||
u8 loc_probe_req[MAX_HIDDEN_AP]; //loc_probeReq
|
||||
} pno_nlo_info_t;
|
||||
|
||||
typedef struct pno_ssid {
|
||||
u32 SSID_len;
|
||||
u8 SSID[32];
|
||||
} pno_ssid_t;
|
||||
|
||||
typedef struct pno_ssid_list {
|
||||
pno_ssid_t node[MAX_PNO_LIST_COUNT];
|
||||
} pno_ssid_list_t;
|
||||
|
||||
typedef struct pno_scan_channel_info {
|
||||
u8 channel;
|
||||
u8 tx_power;
|
||||
u8 timeout;
|
||||
u8 active; //set 1 means active scan, or pasivite scan.
|
||||
} pno_scan_channel_info_t;
|
||||
|
||||
typedef struct pno_scan_info {
|
||||
u8 enableRFE; //Enable RFE
|
||||
u8 period_scan_time; //exclusive with fast_scan_period and slow_scan_period
|
||||
u8 periodScan; //exclusive with fast_scan_period and slow_scan_period
|
||||
u8 orig_80_offset; //original channel 80 offset
|
||||
u8 orig_40_offset; //original channel 40 offset
|
||||
u8 orig_bw; //original bandwidth
|
||||
u8 orig_ch; //original channel
|
||||
u8 channel_num; //number of channel
|
||||
u64 rfe_type; //rfe_type && 0x00000000000000ff
|
||||
pno_scan_channel_info_t ssid_channel_info[MAX_SCAN_LIST_COUNT];
|
||||
} pno_scan_info_t;
|
||||
#endif //CONFIG_PNO_SUPPORT
|
||||
|
||||
struct pwrctrl_priv {
|
||||
_pwrlock lock;
|
||||
_pwrlock check_32k_lock;
|
||||
volatile u8 rpwm; // requested power state for fw
|
||||
volatile u8 cpwm; // fw current power state. updated when 1. read from HCPWM 2. driver lowers power level
|
||||
volatile u8 tog; // toggling
|
||||
@@ -188,6 +253,7 @@ struct pwrctrl_priv
|
||||
u8 pwr_mode;
|
||||
u8 smart_ps;
|
||||
u8 bcn_ant_mode;
|
||||
u8 dtim;
|
||||
|
||||
u32 alives;
|
||||
_workitem cpwm_event;
|
||||
@@ -196,7 +262,7 @@ struct pwrctrl_priv
|
||||
_workitem rpwmtimeoutwi;
|
||||
_timer pwr_rpwm_timer;
|
||||
#endif // CONFIG_LPS_RPWM_TIMER
|
||||
u8 bpower_saving;
|
||||
u8 bpower_saving; //for LPS/IPS
|
||||
|
||||
u8 b_hw_radio_off;
|
||||
u8 reg_rfoff;
|
||||
@@ -207,30 +273,33 @@ struct pwrctrl_priv
|
||||
u32 cur_ps_level;
|
||||
u32 reg_rfps_level;
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
//just for PCIE ASPM
|
||||
u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00.
|
||||
u8 b_support_backdoor;
|
||||
|
||||
//just for PCIE ASPM
|
||||
u8 const_amdpci_aspm;
|
||||
#endif
|
||||
|
||||
uint ips_enter_cnts;
|
||||
uint ips_leave_cnts;
|
||||
uint lps_enter_cnts;
|
||||
uint lps_leave_cnts;
|
||||
|
||||
u8 ips_mode;
|
||||
u8 ips_mode;
|
||||
u8 ips_org_mode;
|
||||
u8 ips_mode_req; // used to accept the mode setting request, will update to ipsmode later
|
||||
uint bips_processing;
|
||||
u32 ips_deny_time; /* will deny IPS when system time is smaller than this */
|
||||
u8 pre_ips_type;// 0: default flow, 1: carddisbale flow
|
||||
|
||||
// ps_deny: if 0, power save is free to go; otherwise deny all kinds of power save.
|
||||
// Use PS_DENY_REASON to decide reason.
|
||||
// Don't access this variable directly without control function,
|
||||
// and this variable should be protected by lock.
|
||||
u32 ps_deny;
|
||||
|
||||
u8 ps_processing; /* temporarily used to mark whether in rtw_ps_processor */
|
||||
|
||||
u8 fw_psmode_iface_id;
|
||||
u8 bLeisurePs;
|
||||
u8 LpsIdleCount;
|
||||
u8 power_mgnt;
|
||||
u8 org_power_mgnt;
|
||||
u8 bFwCurrentInPSMode;
|
||||
u32 DelayLPSLastTimeStamp;
|
||||
u8 btcoex_rfon;
|
||||
s32 pnp_current_pwr_state;
|
||||
u8 pnp_bstop_trx;
|
||||
|
||||
@@ -241,74 +310,87 @@ struct pwrctrl_priv
|
||||
u8 bAutoResume;
|
||||
u8 autopm_cnt;
|
||||
#endif
|
||||
u8 bSupportRemoteWakeup;
|
||||
#ifdef CONFIG_WOWLAN
|
||||
u8 bSupportRemoteWakeup;
|
||||
u8 wowlan_wake_reason;
|
||||
u8 wowlan_ap_mode;
|
||||
u8 wowlan_mode;
|
||||
u8 wowlan_p2p_mode;
|
||||
u8 wowlan_pno_enable;
|
||||
#ifdef CONFIG_WOWLAN
|
||||
u8 wowlan_pattern;
|
||||
u8 wowlan_magic;
|
||||
u8 wowlan_unicast;
|
||||
u8 wowlan_pattern_idx;
|
||||
u8 wowlan_wake_reason;
|
||||
u8 wowlan_from_cmd;
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
u8 pno_in_resume;
|
||||
u8 pno_inited;
|
||||
pno_nlo_info_t *pnlo_info;
|
||||
pno_scan_info_t *pscan_info;
|
||||
pno_ssid_list_t *pno_ssid_list;
|
||||
#endif
|
||||
u32 wowlan_pattern_context[8][5];
|
||||
u64 wowlan_fw_iv;
|
||||
#endif // CONFIG_WOWLAN
|
||||
_timer pwr_state_check_timer;
|
||||
int pwr_state_check_interval;
|
||||
u8 pwr_state_check_cnts;
|
||||
|
||||
int ps_flag;
|
||||
|
||||
rt_rf_power_state rf_pwrstate;//cur power state
|
||||
int ps_flag; /* used by autosuspend */
|
||||
|
||||
rt_rf_power_state rf_pwrstate;//cur power state, only for IPS
|
||||
//rt_rf_power_state current_rfpwrstate;
|
||||
rt_rf_power_state change_rfpwrstate;
|
||||
|
||||
u8 wepkeymask;
|
||||
u8 bHWPowerdown;//if support hw power down
|
||||
u8 bHWPwrPindetect;
|
||||
u8 bkeepfwalive;
|
||||
u8 bHWPowerdown; /* power down mode selection. 0:radio off, 1:power down */
|
||||
u8 bHWPwrPindetect; /* come from registrypriv.hwpwrp_detect. enable power down function. 0:disable, 1:enable */
|
||||
u8 bkeepfwalive;
|
||||
u8 brfoffbyhw;
|
||||
unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
|
||||
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
||||
struct workqueue_struct *rtw_workqueue;
|
||||
_workitem resume_work;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
u8 do_late_resume;
|
||||
#endif //CONFIG_HAS_EARLYSUSPEND
|
||||
|
||||
#ifdef CONFIG_ANDROID_POWER
|
||||
#endif //CONFIG_HAS_EARLYSUSPEND
|
||||
|
||||
#ifdef CONFIG_ANDROID_POWER
|
||||
android_early_suspend_t early_suspend;
|
||||
u8 do_late_resume;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INTEL_PROXIM
|
||||
#ifdef CONFIG_INTEL_PROXIM
|
||||
u8 stored_power_mgnt;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#define rtw_get_ips_mode_req(pwrctrlpriv) \
|
||||
(pwrctrlpriv)->ips_mode_req
|
||||
#define rtw_get_ips_mode_req(pwrctl) \
|
||||
(pwrctl)->ips_mode_req
|
||||
|
||||
#define rtw_ips_mode_req(pwrctrlpriv, ips_mode) \
|
||||
(pwrctrlpriv)->ips_mode_req = (ips_mode)
|
||||
#define rtw_ips_mode_req(pwrctl, ips_mode) \
|
||||
(pwrctl)->ips_mode_req = (ips_mode)
|
||||
|
||||
#define RTW_PWR_STATE_CHK_INTERVAL 2000
|
||||
|
||||
#define _rtw_set_pwr_state_check_timer(pwrctrlpriv, ms) \
|
||||
#define _rtw_set_pwr_state_check_timer(pwrctl, ms) \
|
||||
do { \
|
||||
/*DBG_871X("%s _rtw_set_pwr_state_check_timer(%p, %d)\n", __FUNCTION__, (pwrctrlpriv), (ms));*/ \
|
||||
_set_timer(&(pwrctrlpriv)->pwr_state_check_timer, (ms)); \
|
||||
/*DBG_871X("%s _rtw_set_pwr_state_check_timer(%p, %d)\n", __FUNCTION__, (pwrctl), (ms));*/ \
|
||||
_set_timer(&(pwrctl)->pwr_state_check_timer, (ms)); \
|
||||
} while(0)
|
||||
|
||||
#define rtw_set_pwr_state_check_timer(pwrctrlpriv) \
|
||||
_rtw_set_pwr_state_check_timer((pwrctrlpriv), (pwrctrlpriv)->pwr_state_check_interval)
|
||||
|
||||
#define rtw_set_pwr_state_check_timer(pwrctl) \
|
||||
_rtw_set_pwr_state_check_timer((pwrctl), (pwrctl)->pwr_state_check_interval)
|
||||
|
||||
extern void rtw_init_pwrctrl_priv(_adapter *adapter);
|
||||
extern void rtw_free_pwrctrl_priv(_adapter * adapter);
|
||||
|
||||
#ifdef CONFIG_LPS_LCLK
|
||||
s32 rtw_register_task_alive(PADAPTER, u32 task);
|
||||
void rtw_unregister_task_alive(PADAPTER, u32 task);
|
||||
extern s32 rtw_register_tx_alive(PADAPTER padapter);
|
||||
extern void rtw_unregister_tx_alive(PADAPTER padapter);
|
||||
extern s32 rtw_register_rx_alive(PADAPTER padapter);
|
||||
@@ -321,11 +403,12 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp
|
||||
extern void LPS_Leave_check(PADAPTER padapter);
|
||||
#endif
|
||||
|
||||
extern void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode);
|
||||
extern void rtw_set_rpwm(_adapter * padapter, u8 val8);
|
||||
extern void LeaveAllPowerSaveMode(PADAPTER Adapter);
|
||||
extern void LeaveAllPowerSaveModeDirect(PADAPTER Adapter);
|
||||
#ifdef CONFIG_IPS
|
||||
void _ips_enter(_adapter * padapter);
|
||||
void ips_enter(_adapter * padapter);
|
||||
int _ips_leave(_adapter * padapter);
|
||||
int ips_leave(_adapter * padapter);
|
||||
#endif
|
||||
|
||||
@@ -339,10 +422,16 @@ rt_rf_power_state RfOnOffDetect(IN PADAPTER pAdapter );
|
||||
#endif
|
||||
|
||||
|
||||
int rtw_fw_ps_state(PADAPTER padapter);
|
||||
|
||||
#ifdef CONFIG_LPS
|
||||
s32 LPS_RF_ON_check(PADAPTER padapter, u32 delay_ms);
|
||||
void LPS_Enter(PADAPTER padapter);
|
||||
void LPS_Leave(PADAPTER padapter);
|
||||
void LPS_Enter(PADAPTER padapter, const char *msg);
|
||||
void LPS_Leave(PADAPTER padapter, const char *msg);
|
||||
void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets);
|
||||
void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg);
|
||||
void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable);
|
||||
void rtw_set_rpwm(_adapter * padapter, u8 val8);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
||||
@@ -371,5 +460,9 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller);
|
||||
int rtw_pm_set_ips(_adapter *padapter, u8 mode);
|
||||
int rtw_pm_set_lps(_adapter *padapter, u8 mode);
|
||||
|
||||
void rtw_ps_deny(PADAPTER padapter, PS_DENY_REASON reason);
|
||||
void rtw_ps_deny_cancel(PADAPTER padapter, PS_DENY_REASON reason);
|
||||
u32 rtw_ps_deny_get(PADAPTER padapter);
|
||||
|
||||
#endif //__RTL871X_PWRCTRL_H_
|
||||
|
||||
|
Reference in New Issue
Block a user