rtw_pwrctrl.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __RTW_PWRCTRL_H_
  21. #define __RTW_PWRCTRL_H_
  22. #define FW_PWR0 0
  23. #define FW_PWR1 1
  24. #define FW_PWR2 2
  25. #define FW_PWR3 3
  26. #define HW_PWR0 7
  27. #define HW_PWR1 6
  28. #define HW_PWR2 2
  29. #define HW_PWR3 0
  30. #define HW_PWR4 8
  31. #define FW_PWRMSK 0x7
  32. #define XMIT_ALIVE BIT(0)
  33. #define RECV_ALIVE BIT(1)
  34. #define CMD_ALIVE BIT(2)
  35. #define EVT_ALIVE BIT(3)
  36. #ifdef CONFIG_BT_COEXIST
  37. #define BTCOEX_ALIVE BIT(4)
  38. #endif /* CONFIG_BT_COEXIST */
  39. #ifdef CONFIG_WOWLAN
  40. #ifdef CONFIG_DEFAULT_PATTERNS_EN
  41. #ifdef CONFIG_PLATFORM_ANDROID_INTEL_X86
  42. /* TCP/ICMP/UDP multicast with specific IP addr */
  43. #define DEFAULT_PATTERN_NUM 3
  44. #else
  45. /* TCP/ICMP */
  46. #define DEFAULT_PATTERN_NUM 2
  47. #endif
  48. #else
  49. #define DEFAULT_PATTERN_NUM 0
  50. #endif /*CONFIG_DEFAULT_PATTERNS_EN*/
  51. #ifdef CONFIG_WOW_PATTERN_HW_CAM /* Frame Mask Cam number for pattern match */
  52. #define MAX_WKFM_CAM_NUM 12
  53. #else
  54. #define MAX_WKFM_CAM_NUM 16
  55. #endif
  56. #define MAX_WKFM_SIZE 16 /* (16 bytes for WKFM bit mask, 16*8 = 128 bits) */
  57. #define MAX_WKFM_PATTERN_SIZE 128
  58. #define WKFMCAM_ADDR_NUM 6
  59. #define WKFMCAM_SIZE 24 /* each entry need 6*4 bytes */
  60. enum pattern_type {
  61. PATTERN_BROADCAST = 0,
  62. PATTERN_MULTICAST,
  63. PATTERN_UNICAST,
  64. PATTERN_VALID,
  65. PATTERN_INVALID,
  66. };
  67. typedef struct rtl_priv_pattern {
  68. int len;
  69. char content[MAX_WKFM_PATTERN_SIZE];
  70. char mask[MAX_WKFM_SIZE];
  71. } rtl_priv_pattern_t;
  72. #endif /* CONFIG_WOWLAN */
  73. enum Power_Mgnt {
  74. PS_MODE_ACTIVE = 0 ,
  75. PS_MODE_MIN ,
  76. PS_MODE_MAX ,
  77. PS_MODE_DTIM , /* PS_MODE_SELF_DEFINED */
  78. PS_MODE_VOIP ,
  79. PS_MODE_UAPSD_WMM ,
  80. PS_MODE_UAPSD ,
  81. PS_MODE_IBSS ,
  82. PS_MODE_WWLAN ,
  83. PM_Radio_Off ,
  84. PM_Card_Disable ,
  85. PS_MODE_NUM,
  86. };
  87. enum lps_level {
  88. LPS_NORMAL = 0,
  89. LPS_LCLK,
  90. LPS_PG,
  91. LPS_LEVEL_MAX,
  92. };
  93. #ifdef CONFIG_PNO_SUPPORT
  94. #define MAX_PNO_LIST_COUNT 16
  95. #define MAX_SCAN_LIST_COUNT 14 /* 2.4G only */
  96. #define MAX_HIDDEN_AP 8 /* 8 hidden AP */
  97. #endif
  98. /*
  99. BIT[2:0] = HW state
  100. BIT[3] = Protocol PS state, 0: register active state , 1: register sleep state
  101. BIT[4] = sub-state
  102. */
  103. #define PS_DPS BIT(0)
  104. #define PS_LCLK (PS_DPS)
  105. #define PS_RF_OFF BIT(1)
  106. #define PS_ALL_ON BIT(2)
  107. #define PS_ST_ACTIVE BIT(3)
  108. #define PS_ISR_ENABLE BIT(4)
  109. #define PS_IMR_ENABLE BIT(5)
  110. #define PS_ACK BIT(6)
  111. #define PS_TOGGLE BIT(7)
  112. #define PS_STATE_MASK (0x0F)
  113. #define PS_STATE_HW_MASK (0x07)
  114. #define PS_SEQ_MASK (0xc0)
  115. #define PS_STATE(x) (PS_STATE_MASK & (x))
  116. #define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
  117. #define PS_SEQ(x) (PS_SEQ_MASK & (x))
  118. #define PS_STATE_S0 (PS_DPS)
  119. #define PS_STATE_S1 (PS_LCLK)
  120. #define PS_STATE_S2 (PS_RF_OFF)
  121. #define PS_STATE_S3 (PS_ALL_ON)
  122. #define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
  123. #define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
  124. #define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
  125. #define CLR_PS_STATE(x) ((x) = ((x) & (0xF0)))
  126. struct reportpwrstate_parm {
  127. unsigned char mode;
  128. unsigned char state; /* the CPWM value */
  129. unsigned short rsvd;
  130. };
  131. typedef _sema _pwrlock;
  132. __inline static void _init_pwrlock(_pwrlock *plock)
  133. {
  134. _rtw_init_sema(plock, 1);
  135. }
  136. __inline static void _free_pwrlock(_pwrlock *plock)
  137. {
  138. _rtw_free_sema(plock);
  139. }
  140. __inline static void _enter_pwrlock(_pwrlock *plock)
  141. {
  142. _rtw_down_sema(plock);
  143. }
  144. __inline static void _exit_pwrlock(_pwrlock *plock)
  145. {
  146. _rtw_up_sema(plock);
  147. }
  148. #define LPS_DELAY_TIME 1*HZ /* 1 sec */
  149. #define EXE_PWR_NONE 0x01
  150. #define EXE_PWR_IPS 0x02
  151. #define EXE_PWR_LPS 0x04
  152. /* RF state. */
  153. typedef enum _rt_rf_power_state {
  154. rf_on, /* RF is on after RFSleep or RFOff */
  155. rf_sleep, /* 802.11 Power Save mode */
  156. rf_off, /* HW/SW Radio OFF or Inactive Power Save */
  157. /* =====Add the new RF state above this line===== */
  158. rf_max
  159. } rt_rf_power_state;
  160. /* RF Off Level for IPS or HW/SW radio off */
  161. #define RT_RF_OFF_LEVL_ASPM BIT(0) /* PCI ASPM */
  162. #define RT_RF_OFF_LEVL_CLK_REQ BIT(1) /* PCI clock request */
  163. #define RT_RF_OFF_LEVL_PCI_D3 BIT(2) /* PCI D3 mode */
  164. #define RT_RF_OFF_LEVL_HALT_NIC BIT(3) /* NIC halt, re-initialize hw parameters */
  165. #define RT_RF_OFF_LEVL_FREE_FW BIT(4) /* FW free, re-download the FW */
  166. #define RT_RF_OFF_LEVL_FW_32K BIT(5) /* FW in 32k */
  167. #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) /* Always enable ASPM and Clock Req in initialization. */
  168. #define RT_RF_LPS_DISALBE_2R BIT(30) /* When LPS is on, disable 2R if no packet is received or transmittd. */
  169. #define RT_RF_LPS_LEVEL_ASPM BIT(31) /* LPS with ASPM */
  170. #define RT_IN_PS_LEVEL(ppsc, _PS_FLAG) ((ppsc->cur_ps_level & _PS_FLAG) ? _TRUE : _FALSE)
  171. #define RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG) (ppsc->cur_ps_level &= (~(_PS_FLAG)))
  172. #define RT_SET_PS_LEVEL(ppsc, _PS_FLAG) (ppsc->cur_ps_level |= _PS_FLAG)
  173. /* ASPM OSC Control bit, added by Roger, 2013.03.29. */
  174. #define RT_PCI_ASPM_OSC_IGNORE 0 /* PCI ASPM ignore OSC control in default */
  175. #define RT_PCI_ASPM_OSC_ENABLE BIT0 /* PCI ASPM controlled by OS according to ACPI Spec 5.0 */
  176. #define RT_PCI_ASPM_OSC_DISABLE BIT1 /* PCI ASPM controlled by driver or BIOS, i.e., force enable ASPM */
  177. enum _PS_BBRegBackup_ {
  178. PSBBREG_RF0 = 0,
  179. PSBBREG_RF1,
  180. PSBBREG_RF2,
  181. PSBBREG_AFE0,
  182. PSBBREG_TOTALCNT
  183. };
  184. enum { /* for ips_mode */
  185. IPS_NONE = 0,
  186. IPS_NORMAL,
  187. IPS_LEVEL_2,
  188. IPS_NUM
  189. };
  190. /* Design for pwrctrl_priv.ips_deny, 32 bits for 32 reasons at most */
  191. typedef enum _PS_DENY_REASON {
  192. PS_DENY_DRV_INITIAL = 0,
  193. PS_DENY_SCAN,
  194. PS_DENY_JOIN,
  195. PS_DENY_DISCONNECT,
  196. PS_DENY_SUSPEND,
  197. PS_DENY_IOCTL,
  198. PS_DENY_MGNT_TX,
  199. PS_DENY_MONITOR_MODE,
  200. PS_DENY_BEAMFORMING, /* Beamforming */
  201. PS_DENY_DRV_REMOVE = 30,
  202. PS_DENY_OTHERS = 31
  203. } PS_DENY_REASON;
  204. #ifdef CONFIG_PNO_SUPPORT
  205. typedef struct pno_nlo_info {
  206. u32 fast_scan_period; /* Fast scan period */
  207. u8 ssid_num; /* number of entry */
  208. u8 hidden_ssid_num;
  209. u32 slow_scan_period; /* slow scan period */
  210. u32 fast_scan_iterations; /* Fast scan iterations */
  211. u8 ssid_length[MAX_PNO_LIST_COUNT]; /* SSID Length Array */
  212. u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; /* Cipher information for security */
  213. u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; /* channel information */
  214. u8 loc_probe_req[MAX_HIDDEN_AP]; /* loc_probeReq */
  215. } pno_nlo_info_t;
  216. typedef struct pno_ssid {
  217. u32 SSID_len;
  218. u8 SSID[32];
  219. } pno_ssid_t;
  220. typedef struct pno_ssid_list {
  221. pno_ssid_t node[MAX_PNO_LIST_COUNT];
  222. } pno_ssid_list_t;
  223. typedef struct pno_scan_channel_info {
  224. u8 channel;
  225. u8 tx_power;
  226. u8 timeout;
  227. u8 active; /* set 1 means active scan, or pasivite scan. */
  228. } pno_scan_channel_info_t;
  229. typedef struct pno_scan_info {
  230. u8 enableRFE; /* Enable RFE */
  231. u8 period_scan_time; /* exclusive with fast_scan_period and slow_scan_period */
  232. u8 periodScan; /* exclusive with fast_scan_period and slow_scan_period */
  233. u8 orig_80_offset; /* original channel 80 offset */
  234. u8 orig_40_offset; /* original channel 40 offset */
  235. u8 orig_bw; /* original bandwidth */
  236. u8 orig_ch; /* original channel */
  237. u8 channel_num; /* number of channel */
  238. u64 rfe_type; /* rfe_type && 0x00000000000000ff */
  239. pno_scan_channel_info_t ssid_channel_info[MAX_SCAN_LIST_COUNT];
  240. } pno_scan_info_t;
  241. #endif /* CONFIG_PNO_SUPPORT */
  242. #ifdef CONFIG_LPS_POFF
  243. /* Driver context for LPS 32K Close IO Power */
  244. typedef struct lps_poff_info {
  245. bool bEn;
  246. u8 *pStaticFile;
  247. u8 *pDynamicFile;
  248. u32 ConfFileOffset;
  249. u32 tx_bndy_static;
  250. u32 tx_bndy_dynamic;
  251. u16 ConfLenForPTK;
  252. u16 ConfLenForGTK;
  253. ATOMIC_T bEnterPOFF;
  254. ATOMIC_T bTxBoundInProgress;
  255. ATOMIC_T bSetPOFFParm;
  256. } lps_poff_info_t;
  257. #endif /*CONFIG_LPS_POFF*/
  258. struct aoac_report {
  259. u8 iv[8];
  260. u8 replay_counter_eapol_key[8];
  261. u8 group_key[32];
  262. u8 key_index;
  263. u8 security_type;
  264. };
  265. struct pwrctrl_priv {
  266. _adapter *adapter;
  267. _pwrlock lock;
  268. _pwrlock check_32k_lock;
  269. volatile u8 rpwm; /* requested power state for fw */
  270. volatile u8 cpwm; /* fw current power state. updated when 1. read from HCPWM 2. driver lowers power level */
  271. volatile u8 tog; /* toggling */
  272. volatile u8 cpwm_tog; /* toggling */
  273. u8 pwr_mode;
  274. u8 smart_ps;
  275. u8 bcn_ant_mode;
  276. u8 dtim;
  277. u32 alives;
  278. _workitem cpwm_event;
  279. _workitem dma_event; /*for handle un-synchronized tx dma*/
  280. #ifdef CONFIG_LPS_RPWM_TIMER
  281. u8 brpwmtimeout;
  282. _workitem rpwmtimeoutwi;
  283. _timer pwr_rpwm_timer;
  284. #endif /* CONFIG_LPS_RPWM_TIMER */
  285. u8 bpower_saving; /* for LPS/IPS */
  286. u8 b_hw_radio_off;
  287. u8 reg_rfoff;
  288. u8 reg_pdnmode; /* powerdown mode */
  289. u32 rfoff_reason;
  290. /* RF OFF Level */
  291. u32 cur_ps_level;
  292. u32 reg_rfps_level;
  293. uint ips_enter_cnts;
  294. uint ips_leave_cnts;
  295. uint lps_enter_cnts;
  296. uint lps_leave_cnts;
  297. u8 ips_mode;
  298. u8 ips_org_mode;
  299. u8 ips_mode_req; /* used to accept the mode setting request, will update to ipsmode later */
  300. uint bips_processing;
  301. u32 ips_deny_time; /* will deny IPS when system time is smaller than this */
  302. u8 pre_ips_type;/* 0: default flow, 1: carddisbale flow */
  303. /* ps_deny: if 0, power save is free to go; otherwise deny all kinds of power save. */
  304. /* Use PS_DENY_REASON to decide reason. */
  305. /* Don't access this variable directly without control function, */
  306. /* and this variable should be protected by lock. */
  307. u32 ps_deny;
  308. u8 ps_processing; /* temporarily used to mark whether in rtw_ps_processor */
  309. u8 fw_psmode_iface_id;
  310. u8 bLeisurePs;
  311. u8 LpsIdleCount;
  312. u8 power_mgnt;
  313. u8 org_power_mgnt;
  314. u8 bFwCurrentInPSMode;
  315. u32 DelayLPSLastTimeStamp;
  316. s32 pnp_current_pwr_state;
  317. u8 pnp_bstop_trx;
  318. u8 bInternalAutoSuspend;
  319. u8 bInSuspend;
  320. #ifdef CONFIG_BT_COEXIST
  321. u8 bAutoResume;
  322. u8 autopm_cnt;
  323. #endif
  324. u8 bSupportRemoteWakeup;
  325. u8 wowlan_wake_reason;
  326. u8 wowlan_last_wake_reason;
  327. u8 wowlan_ap_mode;
  328. u8 wowlan_mode;
  329. u8 wowlan_p2p_mode;
  330. u8 wowlan_pno_enable;
  331. #ifdef CONFIG_GPIO_WAKEUP
  332. u8 is_high_active;
  333. #endif /* CONFIG_GPIO_WAKEUP */
  334. #ifdef CONFIG_WOWLAN
  335. u8 wowlan_txpause_status;
  336. u8 wowlan_pattern_idx;
  337. u8 wowlan_in_resume;
  338. u64 wowlan_fw_iv;
  339. struct rtl_priv_pattern patterns[MAX_WKFM_CAM_NUM];
  340. #ifdef CONFIG_PNO_SUPPORT
  341. u8 pno_inited;
  342. pno_nlo_info_t *pnlo_info;
  343. pno_scan_info_t *pscan_info;
  344. pno_ssid_list_t *pno_ssid_list;
  345. #endif /* CONFIG_PNO_SUPPORT */
  346. #ifdef CONFIG_WOW_PATTERN_HW_CAM
  347. _mutex wowlan_pattern_cam_mutex;
  348. #endif
  349. u8 wowlan_aoac_rpt_loc;
  350. struct aoac_report wowlan_aoac_rpt;
  351. #endif /* CONFIG_WOWLAN */
  352. _timer pwr_state_check_timer;
  353. int pwr_state_check_interval;
  354. u8 pwr_state_check_cnts;
  355. int ps_flag; /* used by autosuspend */
  356. rt_rf_power_state rf_pwrstate;/* cur power state, only for IPS */
  357. /* rt_rf_power_state current_rfpwrstate; */
  358. rt_rf_power_state change_rfpwrstate;
  359. u8 bHWPowerdown; /* power down mode selection. 0:radio off, 1:power down */
  360. u8 bHWPwrPindetect; /* come from registrypriv.hwpwrp_detect. enable power down function. 0:disable, 1:enable */
  361. u8 bkeepfwalive;
  362. u8 brfoffbyhw;
  363. unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
  364. #ifdef CONFIG_RESUME_IN_WORKQUEUE
  365. struct workqueue_struct *rtw_workqueue;
  366. _workitem resume_work;
  367. #endif
  368. #ifdef CONFIG_HAS_EARLYSUSPEND
  369. struct early_suspend early_suspend;
  370. u8 do_late_resume;
  371. #endif /* CONFIG_HAS_EARLYSUSPEND */
  372. #ifdef CONFIG_ANDROID_POWER
  373. android_early_suspend_t early_suspend;
  374. u8 do_late_resume;
  375. #endif
  376. #ifdef CONFIG_INTEL_PROXIM
  377. u8 stored_power_mgnt;
  378. #endif
  379. #ifdef CONFIG_LPS_POFF
  380. lps_poff_info_t *plps_poff_info;
  381. #endif
  382. u8 lps_level; /*LPS_NORMAL,LPA_CG,LPS_PG*/
  383. #ifdef CONFIG_LPS_PG
  384. u8 lpspg_rsvd_page_locate;
  385. u8 blpspg_info_up;
  386. #endif
  387. u8 current_lps_hw_port_id;
  388. };
  389. #define rtw_get_ips_mode_req(pwrctl) \
  390. (pwrctl)->ips_mode_req
  391. #define rtw_ips_mode_req(pwrctl, ips_mode) \
  392. (pwrctl)->ips_mode_req = (ips_mode)
  393. #define RTW_PWR_STATE_CHK_INTERVAL 2000
  394. #define _rtw_set_pwr_state_check_timer(pwrctl, ms) \
  395. do { \
  396. /*RTW_INFO("%s _rtw_set_pwr_state_check_timer(%p, %d)\n", __FUNCTION__, (pwrctl), (ms));*/ \
  397. _set_timer(&(pwrctl)->pwr_state_check_timer, (ms)); \
  398. } while (0)
  399. #define rtw_set_pwr_state_check_timer(pwrctl) \
  400. _rtw_set_pwr_state_check_timer((pwrctl), (pwrctl)->pwr_state_check_interval)
  401. extern void rtw_init_pwrctrl_priv(_adapter *adapter);
  402. extern void rtw_free_pwrctrl_priv(_adapter *adapter);
  403. #ifdef CONFIG_LPS_LCLK
  404. s32 rtw_register_task_alive(PADAPTER, u32 task);
  405. void rtw_unregister_task_alive(PADAPTER, u32 task);
  406. extern s32 rtw_register_tx_alive(PADAPTER padapter);
  407. extern void rtw_unregister_tx_alive(PADAPTER padapter);
  408. extern s32 rtw_register_rx_alive(PADAPTER padapter);
  409. extern void rtw_unregister_rx_alive(PADAPTER padapter);
  410. extern s32 rtw_register_cmd_alive(PADAPTER padapter);
  411. extern void rtw_unregister_cmd_alive(PADAPTER padapter);
  412. extern s32 rtw_register_evt_alive(PADAPTER padapter);
  413. extern void rtw_unregister_evt_alive(PADAPTER padapter);
  414. extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportpwrstate);
  415. extern void LPS_Leave_check(PADAPTER padapter);
  416. #endif
  417. extern void LeaveAllPowerSaveMode(PADAPTER Adapter);
  418. extern void LeaveAllPowerSaveModeDirect(PADAPTER Adapter);
  419. #ifdef CONFIG_IPS
  420. void _ips_enter(_adapter *padapter);
  421. void ips_enter(_adapter *padapter);
  422. int _ips_leave(_adapter *padapter);
  423. int ips_leave(_adapter *padapter);
  424. #endif
  425. void rtw_ps_processor(_adapter *padapter);
  426. #ifdef CONFIG_AUTOSUSPEND
  427. int autoresume_enter(_adapter *padapter);
  428. #endif
  429. #ifdef SUPPORT_HW_RFOFF_DETECTED
  430. rt_rf_power_state RfOnOffDetect(IN PADAPTER pAdapter);
  431. #endif
  432. int rtw_fw_ps_state(PADAPTER padapter);
  433. #ifdef CONFIG_LPS
  434. s32 LPS_RF_ON_check(PADAPTER padapter, u32 delay_ms);
  435. void LPS_Enter(PADAPTER padapter, const char *msg);
  436. void LPS_Leave(PADAPTER padapter, const char *msg);
  437. void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets);
  438. void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg);
  439. void rtw_set_fw_in_ips_mode(PADAPTER padapter, u8 enable);
  440. void rtw_set_rpwm(_adapter *padapter, u8 val8);
  441. #endif
  442. #ifdef CONFIG_RESUME_IN_WORKQUEUE
  443. void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv);
  444. #endif /* CONFIG_RESUME_IN_WORKQUEUE */
  445. #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
  446. bool rtw_is_earlysuspend_registered(struct pwrctrl_priv *pwrpriv);
  447. bool rtw_is_do_late_resume(struct pwrctrl_priv *pwrpriv);
  448. void rtw_set_do_late_resume(struct pwrctrl_priv *pwrpriv, bool enable);
  449. void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv);
  450. void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv);
  451. #else
  452. #define rtw_is_earlysuspend_registered(pwrpriv) _FALSE
  453. #define rtw_is_do_late_resume(pwrpriv) _FALSE
  454. #define rtw_set_do_late_resume(pwrpriv, enable) do {} while (0)
  455. #define rtw_register_early_suspend(pwrpriv) do {} while (0)
  456. #define rtw_unregister_early_suspend(pwrpriv) do {} while (0)
  457. #endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
  458. u8 rtw_interface_ps_func(_adapter *padapter, HAL_INTF_PS_FUNC efunc_id, u8 *val);
  459. void rtw_set_ips_deny(_adapter *padapter, u32 ms);
  460. int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller);
  461. #define rtw_pwr_wakeup(adapter) _rtw_pwr_wakeup(adapter, RTW_PWR_STATE_CHK_INTERVAL, __FUNCTION__)
  462. #define rtw_pwr_wakeup_ex(adapter, ips_deffer_ms) _rtw_pwr_wakeup(adapter, ips_deffer_ms, __FUNCTION__)
  463. int rtw_pm_set_ips(_adapter *padapter, u8 mode);
  464. int rtw_pm_set_lps(_adapter *padapter, u8 mode);
  465. int rtw_pm_set_lps_level(_adapter *padapter, u8 level);
  466. void rtw_ps_deny(PADAPTER padapter, PS_DENY_REASON reason);
  467. void rtw_ps_deny_cancel(PADAPTER padapter, PS_DENY_REASON reason);
  468. u32 rtw_ps_deny_get(PADAPTER padapter);
  469. #if defined(CONFIG_WOWLAN)
  470. void rtw_get_current_ip_address(PADAPTER padapter, u8 *pcurrentip);
  471. void rtw_get_sec_iv(PADAPTER padapter, u8 *pcur_dot11txpn, u8 *StaAddr);
  472. bool rtw_check_pattern_valid(u8 *input, u8 len);
  473. bool rtw_wowlan_parser_pattern_cmd(u8 *input, char *pattern,
  474. int *pattern_len, char *bit_mask);
  475. void rtw_wow_pattern_sw_reset(_adapter *adapter);
  476. u8 rtw_set_default_pattern(_adapter *adapter);
  477. void rtw_wow_pattern_sw_dump(_adapter *adapter);
  478. #endif /* CONFIG_WOWLAN */
  479. #endif /* __RTL871X_PWRCTRL_H_ */