wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6628 / wlan / include / pwr_mgt.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/pwr_mgt.h#1 $
3 */
4
5 /*! \file   "pwr_mgt.h"
6     \brief  In this file we define the STATE and EVENT for Power Management FSM.
7
8     The SCAN FSM is responsible for performing SCAN behavior when the Arbiter enter
9     ARB_STATE_SCAN. The STATE and EVENT for SCAN FSM are defined here with detail
10     description.
11 */
12
13
14
15 /*
16 ** $Log: pwr_mgt.h $
17  *
18  * 07 09 2010 george.huang
19  * 
20  * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
21  *
22  * 07 08 2010 cp.wu
23  * 
24  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
25  *
26  * 06 06 2010 kevin.huang
27  * [WPD00003832][MT6620 5931] Create driver base 
28  * [MT6620 5931] Create driver base
29  *
30  * 04 20 2010 cp.wu
31  * [WPD00001943]Create WiFi test driver framework on WinXP 
32  * don't need SPIN_LOCK_PWR_CTRL anymore, it will raise IRQL 
33  * and cause SdBusSubmitRequest running at DISPATCH_LEVEL as well.
34
35  *
36  * 03 25 2010 cp.wu
37  * [WPD00001943]Create WiFi test driver framework on WinXP 
38  * firmware download load adress & start address are now configured from config.h
39  *  *  * due to the different configurations on FPGA and ASIC
40 **  \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-10 16:39:10 GMT mtk02752
41 **  disable PM macros temporally
42 **  \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-10-29 19:48:37 GMT mtk01084
43 **  temp remove power management macro
44 **  \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-08 16:51:11 GMT mtk01084
45 **  update for power management control macro
46 **  \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-03 14:59:58 GMT mtk01426
47 **  Add #if CFG_HIF_LOOPBACK_PRETEST
48 **  \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-23 16:53:10 GMT mtk01084
49 **  modify ACQUIRE_POWER_CONTROL_FROM_PM() and RECLAIM_POWER_CONTROL_TO_PM() macro
50 **  \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-19 18:32:47 GMT mtk01084
51 **  update for basic power management functions
52 **  \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-03-19 15:05:20 GMT mtk01084
53 **  Initial version
54 **
55 */
56
57 #ifndef _PWR_MGT_H
58 #define _PWR_MGT_H
59 /*******************************************************************************
60 *                         C O M P I L E R   F L A G S
61 ********************************************************************************
62 */
63
64 /*******************************************************************************
65 *                    E X T E R N A L   R E F E R E N C E S
66 ********************************************************************************
67 */
68
69 /*******************************************************************************
70 *                              C O N S T A N T S
71 ********************************************************************************
72 */
73 #define PM_UAPSD_AC0                        (BIT(0))
74 #define PM_UAPSD_AC1                        (BIT(1))
75 #define PM_UAPSD_AC2                        (BIT(2))
76 #define PM_UAPSD_AC3                        (BIT(3))
77
78 #define PM_UAPSD_ALL                        (PM_UAPSD_AC0 | PM_UAPSD_AC1 | PM_UAPSD_AC2 | PM_UAPSD_AC3)
79 #define PM_UAPSD_NONE                       0
80
81
82 /*******************************************************************************
83 *                             D A T A   T Y P E S
84 ********************************************************************************
85 */
86 typedef struct _PM_PROFILE_SETUP_INFO_T {
87     /* Profile setup */
88     UINT_8                  ucBmpDeliveryAC;        /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */
89     UINT_8                  ucBmpTriggerAC;        /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */
90
91     UINT_8      ucUapsdSp;          /* Number of triggered packets in UAPSD */
92     
93 } PM_PROFILE_SETUP_INFO_T, *P_PM_PROFILE_SETUP_INFO_T;
94
95
96 /*******************************************************************************
97 *                            P U B L I C   D A T A
98 ********************************************************************************
99 */
100
101 /*******************************************************************************
102 *                           P R I V A T E   D A T A
103 ********************************************************************************
104 */
105
106 /*******************************************************************************
107 *                                 M A C R O S
108 ********************************************************************************
109 */
110
111 #if !CFG_ENABLE_FULL_PM
112     #define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter)
113     #define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST)
114 #else
115     #define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter) \
116     { \
117         if (_prAdapter->fgIsFwOwn) { \
118             nicpmSetDriverOwn(_prAdapter); \
119         } \
120         /* Increase Block to Enter Low Power Semaphore count */ \
121         GLUE_INC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \
122     }
123
124     #define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST) \
125     { \
126         ASSERT(_prAdapter->u4PwrCtrlBlockCnt != 0); \
127         /* Decrease Block to Enter Low Power Semaphore count */ \
128         GLUE_DEC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \
129         if (_prAdapter->fgWiFiInSleepyState && (_prAdapter->u4PwrCtrlBlockCnt == 0)) { \
130             nicpmSetFWOwn(_prAdapter, _fgEnableGINT_in_IST); \
131         } \
132     }
133 #endif
134
135
136 /*******************************************************************************
137 *                   F U N C T I O N   D E C L A R A T I O N S
138 ********************************************************************************
139 */
140
141 /*******************************************************************************
142 *                              F U N C T I O N S
143 ********************************************************************************
144 */
145
146 #endif /* _PWR_MGT_H */
147