xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8723ds/hal/phydm/halrf/halphyrf_win.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  *****************************************************************************/
15 
16 #ifndef __HALPHYRF_H__
17 #define __HALPHYRF_H__
18 
19 #if (RTL8814A_SUPPORT == 1)
20 	#include "halrf/rtl8814a/halrf_iqk_8814a.h"
21 #endif
22 
23 #if (RTL8822B_SUPPORT == 1)
24 	#include "halrf/rtl8822b/halrf_iqk_8822b.h"
25 	#include "../mac/Halmac_type.h"
26 #endif
27 #include "halrf/halrf_powertracking_win.h"
28 #include "halrf/halrf_kfree.h"
29 #include "halrf/halrf_txgapcal.h"
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 (RTL8814B_SUPPORT == 1)
42 	#include "halrf/rtl8814b/halrf_iqk_8814b.h"
43 	#include "halrf/rtl8814b/halrf_txgapk_8814b.h"
44 #endif
45 
46 enum spur_cal_method {
47 	PLL_RESET,
48 	AFE_PHASE_SEL
49 };
50 
51 enum pwrtrack_method {
52 	BBSWING,
53 	TXAGC,
54 	MIX_MODE,
55 	TSSI_MODE,
56 	MIX_2G_TSSI_5G_MODE,
57 	MIX_5G_TSSI_2G_MODE,
58 	CLEAN_MODE
59 };
60 
61 typedef void(*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
62 typedef void(*func_iqk)(void *, u8, u8, u8);
63 typedef void(*func_lck)(void *);
64 typedef void(*func_tssi_dck)(void *, u8);
65 typedef void(*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
66 typedef void(*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
67 typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
68 typedef void (*func_set_xtal)(void *);
69 typedef void(*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
70 
71 struct txpwrtrack_cfg {
72 	u8		swing_table_size_cck;
73 	u8		swing_table_size_ofdm;
74 	u8		threshold_iqk;
75 	u8		threshold_dpk;
76 	u8		average_thermal_num;
77 	u8		rf_path_count;
78 	u32		thermal_reg_addr;
79 	func_set_pwr	odm_tx_pwr_track_set_pwr;
80 	func_iqk	do_iqk;
81 	func_lck	phy_lc_calibrate;
82 	func_tssi_dck	do_tssi_dck;
83 	func_swing	get_delta_swing_table;
84 	func_swing8814only	get_delta_swing_table8814only;
85 	func_swing_xtal			get_delta_swing_xtal_table;
86 	func_set_xtal			odm_txxtaltrack_set_xtal;
87 	func_all_swing	get_delta_all_swing_table;
88 };
89 
90 void
91 configure_txpower_track(
92 	struct dm_struct		*dm,
93 	struct txpwrtrack_cfg	*config
94 );
95 
96 
97 void
98 odm_clear_txpowertracking_state(
99 	struct dm_struct		*dm
100 );
101 
102 void
103 odm_txpowertracking_callback_thermal_meter(
104 #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
105 	struct dm_struct		*dm
106 #else
107 	void	*adapter
108 #endif
109 );
110 
111 #if (RTL8822C_SUPPORT == 1 || RTL8814B_SUPPORT == 1)
112 void
113 odm_txpowertracking_new_callback_thermal_meter(void *dm_void);
114 #endif
115 
116 #define ODM_TARGET_CHNL_NUM_2G_5G	59
117 
118 
119 void
120 odm_reset_iqk_result(
121 	struct dm_struct	*dm
122 );
123 u8
124 odm_get_right_chnl_place_for_iqk(
125 	u8 chnl
126 );
127 
128 void odm_iq_calibrate(struct dm_struct	*dm);
129 void phydm_rf_init(struct dm_struct		*dm);
130 void phydm_rf_watchdog(struct dm_struct		*dm);
131 
132 #endif	/*#ifndef __HALPHYRF_H__*/
133