wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtl8723au / include / rtl8192d_dm.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 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 __RTL8192D_DM_H__
21 #define __RTL8192D_DM_H__
22 //============================================================
23 // Description:
24 //
25 // This file is for 92CE/92CU dynamic mechanism only
26 //
27 //
28 //============================================================
29 enum{
30         UP_LINK,
31         DOWN_LINK,      
32 };
33 /*------------------------Export global variable----------------------------*/
34 /*------------------------Export global variable----------------------------*/
35 /*------------------------Export Marco Definition---------------------------*/
36 //#define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;}
37 //============================================================
38 // structure and define
39 //============================================================
40
41 //###### duplicate code,will move to ODM #########
42 #define IQK_MAC_REG_NUM         4
43 #define IQK_ADDA_REG_NUM                16
44 #define IQK_BB_REG_NUM                  10
45 #define IQK_BB_REG_NUM_92C      9
46 #define IQK_BB_REG_NUM_92D      10
47 #define IQK_BB_REG_NUM_test     6
48 #define index_mapping_NUM               13
49 #define Rx_index_mapping_NUM    15
50 #define AVG_THERMAL_NUM         8
51 #define IQK_Matrix_REG_NUM      8
52 #define IQK_Matrix_Settings_NUM 1+24+21
53 //###### duplicate code,will move to ODM #########
54 struct  dm_priv 
55 {
56         u8      DM_Type;
57         u8      DMFlag;
58         u8      InitDMFlag;
59         u32     InitODMFlag;
60         
61         //* Upper and Lower Signal threshold for Rate Adaptive*/
62         int     UndecoratedSmoothedPWDB;
63         int     EntryMinUndecoratedSmoothedPWDB;
64         int     EntryMaxUndecoratedSmoothedPWDB;
65         int     MinUndecoratedPWDBForDM;
66         int     LastMinUndecoratedPWDBForDM;
67 //###### duplicate code,will move to ODM #########
68 /*
69         //for DIG
70         u8      bDMInitialGainEnable;
71         //u8    binitialized; // for dm_initial_gain_Multi_STA use.
72         DIG_T   DM_DigTable;
73
74         PS_T    DM_PSTable;
75
76         FALSE_ALARM_STATISTICS  FalseAlmCnt;    
77         
78         //for rate adaptive, in fact,  88c/92c fw will handle this
79         u8      bUseRAMask;
80         RATE_ADAPTIVE   RateAdaptive;
81 */
82         
83         //for High Power
84         u8      bDynamicTxPowerEnable;
85         u8      LastDTPLvl;
86         u8      DynamicTxHighPowerLvl;//Add by Jacken Tx Power Control for Near/Far Range 2008/03/06
87                 
88         //for tx power tracking
89         u8      bTXPowerTracking;
90         u8      TXPowercount;
91         u8      bTXPowerTrackingInit;   
92         u8      TxPowerTrackControl;    //for mp mode, turn off txpwrtracking as default
93         u8      TM_Trigger;
94
95         u8      ThermalMeter[2];        // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
96         u8      ThermalValue;
97         u8      ThermalValue_LCK;
98         u8      ThermalValue_IQK;
99         u8      ThermalValue_AVG[AVG_THERMAL_NUM];
100         u8      ThermalValue_AVG_index;
101         u8      ThermalValue_RxGain;
102         u8      ThermalValue_Crystal;
103         u8      Delta_IQK;
104         u8      Delta_LCK;
105         u8      bRfPiEnable;
106         u8      bReloadtxpowerindex;
107         u8      bDoneTxpower;
108
109         //for APK
110         u32     APKoutput[2][2];        //path A/B; output1_1a/output1_2a
111         u8      bAPKdone;
112         u8      bAPKThermalMeterIgnore;
113         u32     RegA24;
114         
115         //for IQK
116         u32     Reg874;
117         u32     RegC08;
118         u32     Reg88C;
119         u8      Reg522;
120         u8      Reg550;
121         u8      Reg551;
122         u32     Reg870;
123         u32     ADDA_backup[IQK_ADDA_REG_NUM];
124         u32     IQK_MAC_backup[IQK_MAC_REG_NUM];
125         u32     IQK_BB_backup[IQK_BB_REG_NUM];
126
127         u8      bCCKinCH14;
128         
129         char    CCK_index;
130         //u8 Record_CCK_20Mindex;
131         //u8 Record_CCK_40Mindex;
132         char    OFDM_index[2];
133         
134         BOOLEAN bDPKdone[2];
135
136         u8      PowerIndex_backup[6];
137         
138         //for Antenna diversity
139 //#ifdef CONFIG_ANTENNA_DIVERSITY
140         //SWAT_T DM_SWAT_Table;
141 //#endif
142        //Neil Chen----2011--06--23-----
143        //3 Path Diversity 
144         BOOLEAN         bPathDiv_Enable;        //For 92D Non-interrupt Antenna Diversity by Neil ,add by wl.2011.07.19
145         BOOLEAN         RSSI_test;
146         s32                     RSSI_sum_A;
147         s32                     RSSI_cnt_A;
148         s32                     RSSI_sum_B;
149         s32                     RSSI_cnt_B;
150         struct sta_info *RSSI_target;
151         _timer          PathDivSwitchTimer;
152
153         //for TxPwrTracking
154         int     RegE94;
155         int     RegE9C;
156         int     RegEB4;
157         int     RegEBC;
158 #if MP_DRIVER == 1
159         u8      RegC04_MP;
160         u32     RegD04_MP;
161 #endif
162         u32     TXPowerTrackingCallbackCnt;     //cosa add for debug
163
164         u32     prv_traffic_idx; // edca turbo
165
166         u32     RegRF3C[2];     //pathA / pathB
167 //###### duplicate code,will move to ODM #########
168         // Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas
169         u8      INIDATA_RATE[32];
170 };
171
172
173 //============================================================
174 // function prototype
175 //============================================================
176 void rtl8192d_init_dm_priv(IN PADAPTER Adapter);
177 void rtl8192d_deinit_dm_priv(IN PADAPTER Adapter);
178
179 void    rtl8192d_InitHalDm(IN PADAPTER Adapter);
180 void    rtl8192d_HalDmWatchDog(IN PADAPTER Adapter);
181
182 #endif  //__HAL8190PCIDM_H__
183