• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *****************************************************************************/
15 
16 #ifndef __HALPHYRF_H__
17 #define __HALPHYRF_H__
18 
19 #include "halrf/halrf_powertracking_ap.h"
20 #include "halrf/halrf_kfree.h"
21 
22 #if (RTL8814A_SUPPORT == 1)
23 	#include "halrf/rtl8814a/halrf_iqk_8814a.h"
24 #endif
25 
26 #if (RTL8822B_SUPPORT == 1)
27 	#include "halrf/rtl8822b/halrf_iqk_8822b.h"
28 #endif
29 
30 #if (RTL8821C_SUPPORT == 1)
31 	#include "halrf/rtl8821c/halrf_iqk_8821c.h"
32 #endif
33 
34 #if (RTL8195B_SUPPORT == 1)
35 //	#include "halrf/rtl8195b/halrf.h"
36 	#include "halrf/rtl8195b/halrf_iqk_8195b.h"
37 	#include "halrf/rtl8195b/halrf_txgapk_8195b.h"
38 	#include "halrf/rtl8195b/halrf_dpk_8195b.h"
39 #endif
40 
41 #if (RTL8198F_SUPPORT == 1)
42 	#include "halrf/rtl8198f/halrf_iqk_8198f.h"
43 	#include "halrf/rtl8198f/halrf_dpk_8198f.h"
44 #endif
45 
46 #if (RTL8812F_SUPPORT == 1)
47 	#include "halrf/rtl8812f/halrf_iqk_8812f.h"
48 	#include "halrf/rtl8812f/halrf_dpk_8812f.h"
49 	#include "halrf/rtl8812f/halrf_tssi_8812f.h"
50 #endif
51 
52 #if (RTL8814B_SUPPORT == 1)
53 	#include "halrf/rtl8814b/halrf_iqk_8814b.h"
54 	#include "halrf/rtl8814b/halrf_dpk_8814b.h"
55 	#include "halrf/rtl8814b/halrf_txgapk_8814b.h"
56 #endif
57 
58 #if (RTL8197G_SUPPORT == 1)
59 	#include "halrf/rtl8197g/halrf_iqk_8197g.h"
60 	#include "halrf/rtl8197g/halrf_dpk_8197g.h"
61 	#include "halrf/rtl8197g/halrf_tssi_8197g.h"
62 #endif
63 
64 enum pwrtrack_method {
65 	BBSWING,
66 	TXAGC,
67 	MIX_MODE,
68 	TSSI_MODE,
69 	MIX_2G_TSSI_5G_MODE,
70 	MIX_5G_TSSI_2G_MODE,
71 	CLEAN_MODE
72 };
73 
74 typedef void	(*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
75 typedef void(*func_iqk)(void *, u8, u8, u8);
76 typedef void	(*func_lck)(void *);
77 typedef void	(*func_tssi_dck)(void *, u8);
78 /* refine by YuChen for 8814A */
79 typedef void	(*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
80 typedef void	(*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
81 typedef void	(*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
82 typedef void	(*func_all_swing_ex)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
83 
84 struct txpwrtrack_cfg {
85 	u8		swing_table_size_cck;
86 	u8		swing_table_size_ofdm;
87 	u8		threshold_iqk;
88 	u8		threshold_dpk;
89 	u8		average_thermal_num;
90 	u8		rf_path_count;
91 	u32		thermal_reg_addr;
92 	func_set_pwr	odm_tx_pwr_track_set_pwr;
93 	func_iqk	do_iqk;
94 	func_lck		phy_lc_calibrate;
95 	func_tssi_dck	do_tssi_dck;
96 	func_swing	get_delta_swing_table;
97 	func_swing8814only	get_delta_swing_table8814only;
98 	func_all_swing		get_delta_all_swing_table;
99 	func_all_swing_ex	get_delta_all_swing_table_ex;
100 };
101 
102 void
103 odm_clear_txpowertracking_state(
104 	void *dm_void
105 );
106 
107 void
108 configure_txpower_track(
109 	void		*dm_void,
110 	struct txpwrtrack_cfg	*config
111 );
112 
113 
114 void
115 odm_txpowertracking_callback_thermal_meter(
116 	void		*dm_void
117 );
118 
119 #if (RTL8192E_SUPPORT == 1)
120 void
121 odm_txpowertracking_callback_thermal_meter_92e(
122 	void		*dm_void
123 );
124 #endif
125 
126 #if (RTL8814A_SUPPORT == 1)
127 void
128 odm_txpowertracking_callback_thermal_meter_jaguar_series2(
129 	void		*dm_void
130 );
131 
132 #elif ODM_IC_11AC_SERIES_SUPPORT
133 void
134 odm_txpowertracking_callback_thermal_meter_jaguar_series(
135 	void		*dm_void
136 );
137 
138 #elif (RTL8197F_SUPPORT == 1 || RTL8192F_SUPPORT == 1 || RTL8822B_SUPPORT == 1 ||\
139 	RTL8821C_SUPPORT == 1 || RTL8198F_SUPPORT == 1)
140 void
141 odm_txpowertracking_callback_thermal_meter_jaguar_series3(
142 	void		*dm_void
143 );
144 
145 #elif (RTL8814B_SUPPORT == 1 || RTL8812F_SUPPORT == 1 || RTL8822C_SUPPORT == 1 || RTL8197G_SUPPORT == 1)
146 void
147 odm_txpowertracking_callback_thermal_meter_jaguar_series4(
148 	void		*dm_void
149 );
150 
151 #endif
152 
153 #define IS_CCK_RATE(_rate)				(ODM_MGN_1M == _rate || _rate == ODM_MGN_2M || _rate == ODM_MGN_5_5M || _rate == ODM_MGN_11M)
154 
155 #define ODM_TARGET_CHNL_NUM_2G_5G	59
156 
157 
158 void
159 odm_reset_iqk_result(
160 	void		*dm_void
161 );
162 u8
163 odm_get_right_chnl_place_for_iqk(
164 	u8 chnl
165 );
166 
167 void phydm_rf_init(void		*dm_void);
168 void phydm_rf_watchdog(void		*dm_void);
169 
170 #endif	/*#ifndef __HALPHYRF_H__*/
171