net: wireless: rockchip_wlan: add rtl8723cs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / hal / phydm / halphyrf_win.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_kfree.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         #include "../mac/Halmac_type.h"
32 #endif
33 #include "phydm_powertracking_win.h"
34
35 #if (RTL8821C_SUPPORT == 1)
36         #include "rtl8821c/phydm_iqk_8821c.h"
37 #endif
38
39 enum spur_cal_method {
40         PLL_RESET,
41         AFE_PHASE_SEL
42 };
43
44 enum pwrtrack_method {
45         BBSWING,
46         TXAGC,
47         MIX_MODE,
48         TSSI_MODE,
49         MIX_2G_TSSI_5G_MODE,
50         MIX_5G_TSSI_2G_MODE
51 };
52
53 typedef void(*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
54 typedef void(*func_iqk)(void *, u8, u8, u8);
55 typedef void(*func_lck)(void *);
56 typedef void(*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
57 typedef void(*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
58 typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
59 typedef void (*func_set_xtal)(void *);
60 typedef void(*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
61
62 struct _TXPWRTRACK_CFG {
63         u8              swing_table_size_cck;
64         u8              swing_table_size_ofdm;
65         u8              threshold_iqk;
66         u8              threshold_dpk;
67         u8              average_thermal_num;
68         u8              rf_path_count;
69         u32             thermal_reg_addr;
70         func_set_pwr    odm_tx_pwr_track_set_pwr;
71         func_iqk        do_iqk;
72         func_lck                phy_lc_calibrate;
73         func_swing      get_delta_swing_table;
74         func_swing8814only      get_delta_swing_table8814only;
75         func_swing_xtal                 get_delta_swing_xtal_table;
76         func_set_xtal                   odm_txxtaltrack_set_xtal;
77         func_all_swing  get_delta_all_swing_table;
78 };
79
80 void
81 configure_txpower_track(
82         struct PHY_DM_STRUCT            *p_dm_odm,
83         struct _TXPWRTRACK_CFG  *p_config
84 );
85
86
87 void
88 odm_clear_txpowertracking_state(
89         struct PHY_DM_STRUCT            *p_dm_odm
90 );
91
92 void
93 odm_txpowertracking_callback_thermal_meter(
94 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
95         struct PHY_DM_STRUCT            *p_dm_odm
96 #else
97         struct _ADAPTER *adapter
98 #endif
99 );
100
101
102
103 #define ODM_TARGET_CHNL_NUM_2G_5G       59
104
105
106 void
107 odm_reset_iqk_result(
108         struct PHY_DM_STRUCT    *p_dm_odm
109 );
110 u8
111 odm_get_right_chnl_place_for_iqk(
112         u8 chnl
113 );
114
115 void odm_iq_calibrate(struct PHY_DM_STRUCT      *p_dm_odm);
116 void phydm_rf_init(struct PHY_DM_STRUCT         *p_dm_odm);
117 void phydm_rf_watchdog(struct PHY_DM_STRUCT             *p_dm_odm);
118
119 #endif  /*  #ifndef __HAL_PHY_RF_H__ */