1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef __RTL871X_PWRCTRL_H_
15 #define __RTL871X_PWRCTRL_H_
16
17 #include "osdep_service.h"
18 #include "drv_types.h"
19
20
21 #define CMD_ALIVE BIT(2)
22
23 enum Power_Mgnt {
24 PS_MODE_ACTIVE = 0,
25 PS_MODE_MIN,
26 PS_MODE_MAX,
27 PS_MODE_DTIM,
28 PS_MODE_VOIP,
29 PS_MODE_UAPSD_WMM,
30 PS_MODE_UAPSD,
31 PS_MODE_IBSS,
32 PS_MODE_WWLAN,
33 PM_Radio_Off,
34 PM_Card_Disable,
35 PS_MODE_NUM
36 };
37
38
39
40
41
42
43
44
45 #define PS_DPS BIT(0)
46 #define PS_LCLK (PS_DPS)
47 #define PS_RF_OFF BIT(1)
48 #define PS_ALL_ON BIT(2)
49 #define PS_ST_ACTIVE BIT(3)
50 #define PS_LP BIT(4)
51
52 #define PS_STATE_MASK (0x0F)
53 #define PS_STATE_HW_MASK (0x07)
54 #define PS_SEQ_MASK (0xc0)
55
56 #define PS_STATE(x) (PS_STATE_MASK & (x))
57 #define PS_STATE_HW(x) (PS_STATE_HW_MASK & (x))
58 #define PS_SEQ(x) (PS_SEQ_MASK & (x))
59
60 #define PS_STATE_S0 (PS_DPS)
61 #define PS_STATE_S1 (PS_LCLK)
62 #define PS_STATE_S2 (PS_RF_OFF)
63 #define PS_STATE_S3 (PS_ALL_ON)
64 #define PS_STATE_S4 ((PS_ST_ACTIVE) | (PS_ALL_ON))
65
66
67 #define PS_IS_RF_ON(x) ((x) & (PS_ALL_ON))
68 #define PS_IS_ACTIVE(x) ((x) & (PS_ST_ACTIVE))
69 #define CLR_PS_STATE(x) ((x) = ((x) & (0xF0)))
70
71
72 struct reportpwrstate_parm {
73 unsigned char mode;
74 unsigned char state;
75 unsigned short rsvd;
76 };
77
78 struct pwrctrl_priv {
79 struct mutex mutex_lock;
80 u8 rpwm;
81
82
83
84 u8 cpwm;
85 u8 tog;
86 u8 cpwm_tog;
87 u8 tgt_rpwm;
88 uint pwr_mode;
89 uint smart_ps;
90 uint alives;
91 uint ImrContent;
92 uint bSleep;
93
94 struct work_struct SetPSModeWorkItem;
95 struct work_struct rpwm_workitem;
96 struct timer_list rpwm_check_timer;
97 u8 rpwm_retry;
98 uint bSetPSModeWorkItemInProgress;
99
100 spinlock_t pnp_pwr_mgnt_lock;
101 s32 pnp_current_pwr_state;
102 u8 pnp_bstop_trx;
103 u8 pnp_wwirp_pending;
104 };
105
106 void r8712_init_pwrctrl_priv(struct _adapter *adapter);
107 int r8712_register_cmd_alive(struct _adapter *padapter);
108 void r8712_unregister_cmd_alive(struct _adapter *padapter);
109 void r8712_cpwm_int_hdl(struct _adapter *padapter,
110 struct reportpwrstate_parm *preportpwrstate);
111 void r8712_set_ps_mode(struct _adapter *padapter, uint ps_mode,
112 uint smart_ps);
113 void r8712_set_rpwm(struct _adapter *padapter, u8 val8);
114
115 #endif