hc
2023-11-06 15ade055295d13f95d49e3d99b09f3bbfb4a43e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/******************************************************************************
 *
 * Copyright(c) 2007 - 2017 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
 
 
#ifndef    _HALRF_H__
#define _HALRF_H__
 
/*============================================================*/
/*include files*/
/*============================================================*/
 
 
 
/*============================================================*/
/*Definition */
/*============================================================*/
/*IQK version*/
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
#define IQK_VERSION_8188E    "0x14"
#define IQK_VERSION_8192E    "0x01"
#define IQK_VERSION_8723B    "0x1d"
#define IQK_VERSION_8812A    "0x01"
#define IQK_VERSION_8821A    "0x01"
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
#define IQK_VERSION_8188E    "0x01"
#define IQK_VERSION_8192E    "0x01"
#define IQK_VERSION_8723B    "0x19"
#define IQK_VERSION_8812A    "0x01"
#define IQK_VERSION_8821A    "0x01"
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
#define IQK_VERSION_8188E    "0x01"
#define IQK_VERSION_8192E    "0x01"
#define IQK_VERSION_8723B    "0x01"
#define IQK_VERSION_8812A    "0x01"
#define IQK_VERSION_8821A    "0x01"
#endif
#define IQK_VERSION_8814A    "0x0f"
#define IQK_VERSION_8188F    "0x01"
#define IQK_VERSION_8197F    "0x01"
#define IQK_VERSION_8703B    "0x04"
#define IQK_VERSION_8710B    "0x01"
#define IQK_VERSION_8723D    "0x01"
#define IQK_VERSION_8822B    "0x2e"
#define IQK_VERSION_8821C    "0x23"
 
/*LCK version*/
#define LCK_VERSION_8188E    "0x01"
#define LCK_VERSION_8192E    "0x01"
#define LCK_VERSION_8723B    "0x01"
#define LCK_VERSION_8812A    "0x01"
#define LCK_VERSION_8821A    "0x01"
#define LCK_VERSION_8814A    "0x01"
#define LCK_VERSION_8188F    "0x01"
#define LCK_VERSION_8197F    "0x01"
#define LCK_VERSION_8703B    "0x01"
#define LCK_VERSION_8710B    "0x01"
#define LCK_VERSION_8723D    "0x01"
#define LCK_VERSION_8822B    "0x01"
#define LCK_VERSION_8821C    "0x01"
 
 
#define HALRF_IQK_VER    (p_dm->support_ic_type == ODM_RTL8188E)? IQK_VERSION_8188E :\
                       (p_dm->support_ic_type == ODM_RTL8192E)? IQK_VERSION_8192E :\
                       (p_dm->support_ic_type == ODM_RTL8723B)? IQK_VERSION_8723B :\
                       (p_dm->support_ic_type == ODM_RTL8812)? IQK_VERSION_8812A :\
                       (p_dm->support_ic_type == ODM_RTL8821)? IQK_VERSION_8821A :\
                       (p_dm->support_ic_type == ODM_RTL8814A)? IQK_VERSION_8814A :\
                       (p_dm->support_ic_type == ODM_RTL8188F)? IQK_VERSION_8188F :\
                       (p_dm->support_ic_type == ODM_RTL8197F)? IQK_VERSION_8197F :\
                       (p_dm->support_ic_type == ODM_RTL8703B)? IQK_VERSION_8703B :\
                       (p_dm->support_ic_type == ODM_RTL8710B)? IQK_VERSION_8710B :\
                       (p_dm->support_ic_type == ODM_RTL8723D)? IQK_VERSION_8723D :\
                       (p_dm->support_ic_type == ODM_RTL8822B)? IQK_VERSION_8822B :\
                       (p_dm->support_ic_type == ODM_RTL8821C)? IQK_VERSION_8821C :"unknown"
 
 
#define HALRF_LCK_VER    (p_dm->support_ic_type == ODM_RTL8188E)? LCK_VERSION_8188E :\
                       (p_dm->support_ic_type == ODM_RTL8192E)? LCK_VERSION_8192E :\
                       (p_dm->support_ic_type == ODM_RTL8723B)? LCK_VERSION_8723B :\
                       (p_dm->support_ic_type == ODM_RTL8812)? LCK_VERSION_8812A :\
                       (p_dm->support_ic_type == ODM_RTL8821)? LCK_VERSION_8821A :\
                       (p_dm->support_ic_type == ODM_RTL8814A)? LCK_VERSION_8814A :\
                       (p_dm->support_ic_type == ODM_RTL8188F)? LCK_VERSION_8188F :\
                       (p_dm->support_ic_type == ODM_RTL8197F)? LCK_VERSION_8197F :\
                       (p_dm->support_ic_type == ODM_RTL8703B)? LCK_VERSION_8703B :\
                       (p_dm->support_ic_type == ODM_RTL8710B)? LCK_VERSION_8710B :\
                       (p_dm->support_ic_type == ODM_RTL8723D)? LCK_VERSION_8723D :\
                       (p_dm->support_ic_type == ODM_RTL8822B)? LCK_VERSION_8822B :\
                       (p_dm->support_ic_type == ODM_RTL8821C)? LCK_VERSION_8821C :"unknown"
#define HALRF_DPK_VER    "0x02"
 
#define IQK_THRESHOLD            8
#define DPK_THRESHOLD            4
 
/*============================================================*/
/* enumeration */
/*============================================================*/
enum halrf_ability_e {
 
   HAL_RF_TX_PWR_TRACK    = BIT(0),
   HAL_RF_IQK                = BIT(1),
   HAL_RF_LCK                = BIT(2),
   HAL_RF_DPK                = BIT(3),
   HAL_RF_TXGAPK            = BIT(4)
};
 
enum halrf_cmninfo_init_e {
   HALRF_CMNINFO_ABILITY = 0,
   HALRF_CMNINFO_DPK_EN = 1,
   HALRF_CMNINFO_EEPROM_THERMAL_VALUE,
   HALRF_CMNINFO_FW_VER,
   HALRF_CMNINFO_RFK_FORBIDDEN,
   HALRF_CMNINFO_IQK_SEGMENT
};
 
enum halrf_cmninfo_hook_e {
   HALRF_CMNINFO_CON_TX,
   HALRF_CMNINFO_SINGLE_TONE,
   HALRF_CMNINFO_CARRIER_SUPPRESSION,    
   HALRF_CMNINFO_MP_RATE_INDEX
};
 
enum phydm_lna_set {
   phydm_lna_disable        = 0,
   phydm_lna_enable        = 1,
};
 
 
/*============================================================*/
/* structure */
/*============================================================*/
 
struct _hal_rf_ {
   /*hook*/
   u8        *test1;
 
   /*update*/
   u32        rf_supportability;
 
   u8        eeprom_thermal;
   u8        dpk_en;            /*Enable Function DPK OFF/ON = 0/1*/
   boolean    dpk_done;
   u32        fw_ver;
 
   boolean    *p_is_con_tx;
   boolean    *p_is_single_tone;
   boolean    *p_is_carrier_suppresion;
 
   u8        *p_mp_rate_index;
   u8        *p_rate_index;
};
 
/*============================================================*/
/* function prototype */
/*============================================================*/
 
void halrf_basic_profile(
   void            *p_dm_void,
   u32            *_used,
   char            *output,
   u32            *_out_len
);
#if (RTL8822B_SUPPORT == 1 || RTL8821C_SUPPORT == 1)
void halrf_iqk_info_dump(
   void *p_dm_void,
   u32 *_used,
   char *output,
   u32 *_out_len
);
 
void
halrf_iqk_hwtx_check(
   void *p_dm_void,
   boolean        is_check
);
#endif
 
void
halrf_support_ability_debug(
   void        *p_dm_void,
   char        input[][16],
   u32        *_used,
   char        *output,
   u32        *_out_len
);
 
void
halrf_cmn_info_init(
   void        *p_dm_void,
   enum halrf_cmninfo_init_e    cmn_info,
   u32        value
);
 
void
halrf_cmn_info_hook(
   void        *p_dm_void,
   u32        cmn_info,
   void        *p_value
);
 
void
halrf_cmn_info_set(
   void        *p_dm_void,
   u32            cmn_info,
   u64            value
);
 
u64
halrf_cmn_info_get(
   void        *p_dm_void,
   u32            cmn_info
);
 
void
halrf_watchdog(
   void            *p_dm_void
);
 
void
halrf_supportability_init(
   void        *p_dm_void
);
 
void
halrf_init(
   void            *p_dm_void
);
 
void
halrf_iqk_trigger(
   void            *p_dm_void,
   boolean        is_recovery
);
 
void
halrf_segment_iqk_trigger(
   void            *p_dm_void,
   boolean        clear,
   boolean        segment_iqk
);
 
void
halrf_lck_trigger(
   void            *p_dm_void
);
 
void
halrf_iqk_debug(
   void        *p_dm_void,
   u32        *const dm_value,
   u32        *_used,
   char        *output,
   u32        *_out_len
);
 
void
phydm_get_iqk_cfir(
   void        *p_dm_void,
   u8 idx,
   u8 path,
   boolean debug
);
 
void 
halrf_iqk_xym_read(
   void *p_dm_void,
   u8 path,
   u8 xym_type
 );
 
void
halrf_rf_lna_setting(
   void    *p_dm_void,
   enum phydm_lna_set type
);
 
 
void
halrf_do_imr_test(
   void    *p_dm_void,
   u8 data
);
 
u32
halrf_psd_log2base(
   IN u32 val
);
 
 
#if (RTL8822B_SUPPORT == 1 || RTL8821C_SUPPORT == 1)
void halrf_iqk_dbg(void    *p_dm_void);
#endif
#endif