xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8189fs/hal/phydm/halrf/halphyrf_ce.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017  Realtek Corporation.
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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 
26 #ifndef __HALPHYRF_H__
27 #define __HALPHYRF_H__
28 
29 #include "halrf/halrf_kfree.h"
30 #if (RTL8814A_SUPPORT == 1)
31 #include "halrf/rtl8814a/halrf_iqk_8814a.h"
32 #endif
33 
34 #if (RTL8822B_SUPPORT == 1)
35 #include "halrf/rtl8822b/halrf_iqk_8822b.h"
36 #endif
37 
38 #if (RTL8821C_SUPPORT == 1)
39 #include "halrf/rtl8821c/halrf_iqk_8821c.h"
40 #endif
41 
42 #if (RTL8195B_SUPPORT == 1)
43 /* #include "halrf/rtl8195b/halrf.h" */
44 #include "halrf/rtl8195b/halrf_iqk_8195b.h"
45 #include "halrf/rtl8195b/halrf_txgapk_8195b.h"
46 #include "halrf/rtl8195b/halrf_dpk_8195b.h"
47 #endif
48 
49 #if (RTL8814B_SUPPORT == 1)
50 	#include "halrf/rtl8814b/halrf_iqk_8814b.h"
51 	#include "halrf/rtl8814b/halrf_dpk_8814b.h"
52 	#include "halrf/rtl8814b/halrf_txgapk_8814b.h"
53 #endif
54 
55 #include "halrf/halrf_powertracking_ce.h"
56 
57 enum spur_cal_method {
58 	PLL_RESET,
59 	AFE_PHASE_SEL
60 };
61 
62 enum pwrtrack_method {
63 	BBSWING,
64 	TXAGC,
65 	MIX_MODE,
66 	TSSI_MODE,
67 	MIX_2G_TSSI_5G_MODE,
68 	MIX_5G_TSSI_2G_MODE,
69 	CLEAN_MODE
70 };
71 
72 typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
73 typedef void (*func_iqk)(void *, u8, u8, u8);
74 typedef void (*func_lck)(void *);
75 typedef void (*func_tssi_dck)(void *, u8);
76 typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
77 typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
78 typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
79 typedef void (*func_set_xtal)(void *);
80 
81 struct txpwrtrack_cfg {
82 	u8 swing_table_size_cck;
83 	u8 swing_table_size_ofdm;
84 	u8 threshold_iqk;
85 	u8 threshold_dpk;
86 	u8 average_thermal_num;
87 	u8 rf_path_count;
88 	u32 thermal_reg_addr;
89 	func_set_pwr odm_tx_pwr_track_set_pwr;
90 	func_iqk do_iqk;
91 	func_lck phy_lc_calibrate;
92 	func_tssi_dck do_tssi_dck;
93 	func_swing get_delta_swing_table;
94 	func_swing8814only get_delta_swing_table8814only;
95 	func_swing_xtal get_delta_swing_xtal_table;
96 	func_set_xtal odm_txxtaltrack_set_xtal;
97 };
98 
99 void configure_txpower_track(void *dm_void, struct txpwrtrack_cfg *config);
100 
101 void odm_clear_txpowertracking_state(void *dm_void);
102 
103 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
104 void odm_txpowertracking_callback_thermal_meter(void *dm_void);
105 #elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
106 void odm_txpowertracking_callback_thermal_meter(void *dm);
107 #else
108 void odm_txpowertracking_callback_thermal_meter(void *adapter);
109 #endif
110 
111 #if (RTL8822C_SUPPORT == 1 || RTL8814B_SUPPORT == 1)
112 void odm_txpowertracking_new_callback_thermal_meter(void *dm_void);
113 #endif
114 
115 #define ODM_TARGET_CHNL_NUM_2G_5G 59
116 
117 void odm_reset_iqk_result(void *dm_void);
118 u8 odm_get_right_chnl_place_for_iqk(u8 chnl);
119 
120 void phydm_rf_init(void *dm_void);
121 void phydm_rf_watchdog(void *dm_void);
122 
123 #endif /*__HALPHYRF_H__*/
124