net: wireless: rockchip_wlan: add rtl8723cs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / hal / phydm / halphyrf_ap.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
21 #ifndef __HAL_PHY_RF_H__
22 #define __HAL_PHY_RF_H__
23
24 #include "phydm_powertracking_ap.h"
25 #if (RTL8814A_SUPPORT == 1)
26         #include "rtl8814a/phydm_iqk_8814a.h"
27 #endif
28
29 #if (RTL8822B_SUPPORT == 1)
30         #include "rtl8822b/phydm_iqk_8822b.h"
31 #endif
32
33 #if (RTL8821C_SUPPORT == 1)
34         #include "rtl8822b/phydm_iqk_8821c.h"
35 #endif
36
37 enum pwrtrack_method {
38         BBSWING,
39         TXAGC,
40         MIX_MODE,
41         TSSI_MODE
42 };
43
44 typedef void    (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
45 typedef void(*func_iqk)(void *, u8, u8, u8);
46 typedef void    (*func_lck)(void *);
47 /* refine by YuChen for 8814A */
48 typedef void    (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
49 typedef void    (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
50 typedef void    (*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
51
52
53 struct _TXPWRTRACK_CFG {
54         u8              swing_table_size_cck;
55         u8              swing_table_size_ofdm;
56         u8              threshold_iqk;
57         u8              threshold_dpk;
58         u8              average_thermal_num;
59         u8              rf_path_count;
60         u32             thermal_reg_addr;
61         func_set_pwr    odm_tx_pwr_track_set_pwr;
62         func_iqk        do_iqk;
63         func_lck                phy_lc_calibrate;
64         func_swing      get_delta_swing_table;
65         func_swing8814only      get_delta_swing_table8814only;
66         func_all_swing  get_delta_all_swing_table;
67 };
68
69 void
70 configure_txpower_track(
71         void            *p_dm_void,
72         struct _TXPWRTRACK_CFG  *p_config
73 );
74
75
76 void
77 odm_txpowertracking_callback_thermal_meter(
78 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
79         void            *p_dm_void
80 #else
81         struct _ADAPTER *adapter
82 #endif
83 );
84
85 #if (RTL8192E_SUPPORT == 1)
86 void
87 odm_txpowertracking_callback_thermal_meter_92e(
88 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
89         void            *p_dm_void
90 #else
91         struct _ADAPTER *adapter
92 #endif
93 );
94 #endif
95
96 #if (RTL8814A_SUPPORT == 1)
97 void
98 odm_txpowertracking_callback_thermal_meter_jaguar_series2(
99 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
100         void            *p_dm_void
101 #else
102         struct _ADAPTER *adapter
103 #endif
104 );
105
106 #elif ODM_IC_11AC_SERIES_SUPPORT
107 void
108 odm_txpowertracking_callback_thermal_meter_jaguar_series(
109 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
110         void            *p_dm_void
111 #else
112         struct _ADAPTER *adapter
113 #endif
114 );
115
116 #elif (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
117 void
118 odm_txpowertracking_callback_thermal_meter_jaguar_series3(
119 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
120         void            *p_dm_void
121 #else
122         struct _ADAPTER *adapter
123 #endif
124 );
125
126 #endif
127
128 #define IS_CCK_RATE(_rate)                              (ODM_MGN_1M == _rate || _rate == ODM_MGN_2M || _rate == ODM_MGN_5_5M || _rate == ODM_MGN_11M)
129
130
131 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
132 #define MAX_TOLERANCE          5
133 #define IQK_DELAY_TIME         1               /* ms */
134
135 /*
136 * BB/MAC/RF other monitor API
137 *   */
138
139 void    phy_set_monitor_mode8192c(struct _ADAPTER       *p_adapter,
140                                   boolean               is_enable_monitor_mode);
141
142 /*
143  * IQ calibrate
144  *   */
145 void
146 phy_iq_calibrate_8192c(struct _ADAPTER  *p_adapter,
147                        boolean  is_recovery);
148
149 /*
150  * LC calibrate
151  *   */
152 void
153 phy_lc_calibrate_8192c(struct _ADAPTER  *p_adapter);
154
155 /*
156  * AP calibrate
157  *   */
158 void
159 phy_ap_calibrate_8192c(struct _ADAPTER  *p_adapter,
160                        s8               delta);
161 #endif
162
163 #define ODM_TARGET_CHNL_NUM_2G_5G       59
164
165
166 void
167 odm_reset_iqk_result(
168         void            *p_dm_void
169 );
170 u8
171 odm_get_right_chnl_place_for_iqk(
172         u8 chnl
173 );
174
175 void phydm_rf_init(void         *p_dm_void);
176 void phydm_rf_watchdog(void             *p_dm_void);
177
178 #endif  /*  #ifndef __HAL_PHY_RF_H__ */