1 /******************************************************************************
3 * Copyright(c) 2007 - 2017 Realtek Corporation.
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.
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
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
22 * Larry Finger <Larry.Finger@lwfinger.net>
24 *****************************************************************************/
26 /*@************************************************************
28 ************************************************************/
30 #include "mp_precomp.h"
31 #include "phydm_precomp.h"
33 #define READ_AND_CONFIG_MP(ic, txt) (odm_read_and_config_mp_##ic##txt(dm))
34 #define READ_AND_CONFIG_TC(ic, txt) (odm_read_and_config_tc_##ic##txt(dm))
36 #if (PHYDM_TESTCHIP_SUPPORT == 1)
37 #define READ_AND_CONFIG(ic, txt) \
40 READ_AND_CONFIG_MP(ic, txt); \
42 READ_AND_CONFIG_TC(ic, txt); \
45 #define READ_AND_CONFIG READ_AND_CONFIG_MP
48 #define GET_VERSION_MP(ic, txt) (odm_get_version_mp_##ic##txt())
49 #define GET_VERSION_TC(ic, txt) (odm_get_version_tc_##ic##txt())
51 #if (PHYDM_TESTCHIP_SUPPORT == 1)
52 #define GET_VERSION(ic, txt) (dm->is_mp_chip ? GET_VERSION_MP(ic, txt) : GET_VERSION_TC(ic, txt))
54 #define GET_VERSION(ic, txt) GET_VERSION_MP(ic, txt)
58 odm_config_rf_with_header_file(struct dm_struct *dm,
59 enum odm_rf_config_type config_type,
62 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
63 void *adapter = dm->adapter;
64 PMGNT_INFO mgnt_info = &((PADAPTER)adapter)->MgntInfo;
66 enum hal_status result = HAL_STATUS_SUCCESS;
68 PHYDM_DBG(dm, ODM_COMP_INIT, "===>%s (%s)\n", __func__,
69 (dm->is_mp_chip) ? "MPChip" : "TestChip");
70 PHYDM_DBG(dm, ODM_COMP_INIT,
71 "support_platform: 0x%X, support_interface: 0x%X, board_type: 0x%X\n",
72 dm->support_platform, dm->support_interface, dm->board_type);
74 /* @1 AP doesn't use PHYDM power tracking table in these ICs */
75 #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
76 #if (RTL8812A_SUPPORT == 1)
77 if (dm->support_ic_type == ODM_RTL8812) {
78 if (config_type == CONFIG_RF_RADIO) {
79 if (e_rf_path == RF_PATH_A)
80 READ_AND_CONFIG_MP(8812a, _radioa);
81 else if (e_rf_path == RF_PATH_B)
82 READ_AND_CONFIG_MP(8812a, _radiob);
83 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
84 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN) && (DEV_BUS_TYPE == RT_PCI_INTERFACE)
85 HAL_DATA_TYPE * hal_data = GET_HAL_DATA(((PADAPTER)adapter));
86 if ((hal_data->EEPROMSVID == 0x17AA && hal_data->EEPROMSMID == 0xA811) ||
87 (hal_data->EEPROMSVID == 0x10EC && hal_data->EEPROMSMID == 0xA812) ||
88 (hal_data->EEPROMSVID == 0x10EC && hal_data->EEPROMSMID == 0x8812))
89 READ_AND_CONFIG_MP(8812a, _txpwr_lmt_hm812a03);
92 READ_AND_CONFIG_MP(8812a, _txpwr_lmt);
96 #if (RTL8821A_SUPPORT == 1)
97 if (dm->support_ic_type == ODM_RTL8821) {
98 if (config_type == CONFIG_RF_RADIO) {
99 if (e_rf_path == RF_PATH_A)
100 READ_AND_CONFIG_MP(8821a, _radioa);
101 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
102 if (dm->support_interface == ODM_ITRF_USB) {
103 if (dm->ext_pa_5g || dm->ext_lna_5g)
104 READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8811a_u_fem);
106 READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8811a_u_ipa);
108 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
109 if (mgnt_info->CustomerID == RT_CID_8821AE_ASUS_MB)
110 READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a_sar_8mm);
111 else if (mgnt_info->CustomerID == RT_CID_ASUS_NB)
112 READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a_sar_5mm);
115 READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a);
120 #if (RTL8192E_SUPPORT == 1)
121 if (dm->support_ic_type == ODM_RTL8192E) {
122 if (config_type == CONFIG_RF_RADIO) {
123 if (e_rf_path == RF_PATH_A)
124 READ_AND_CONFIG_MP(8192e, _radioa);
125 else if (e_rf_path == RF_PATH_B)
126 READ_AND_CONFIG_MP(8192e, _radiob);
127 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
128 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN) && (DEV_BUS_TYPE == RT_PCI_INTERFACE) /*Refine by Vincent Lan for 5mm SAR pwr limit*/
129 HAL_DATA_TYPE * hal_data = GET_HAL_DATA(((PADAPTER)adapter));
131 if ((hal_data->EEPROMSVID == 0x11AD && hal_data->EEPROMSMID == 0x8192) ||
132 (hal_data->EEPROMSVID == 0x11AD && hal_data->EEPROMSMID == 0x8193))
133 READ_AND_CONFIG_MP(8192e, _txpwr_lmt_8192e_sar_5mm);
136 READ_AND_CONFIG_MP(8192e, _txpwr_lmt);
140 #if (RTL8723D_SUPPORT == 1)
141 if (dm->support_ic_type == ODM_RTL8723D) {
142 if (config_type == CONFIG_RF_RADIO) {
143 if (e_rf_path == RF_PATH_A)
144 READ_AND_CONFIG_MP(8723d, _radioa);
145 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
146 READ_AND_CONFIG_MP(8723d, _txpwr_lmt);
150 /* @JJ ADD 20161014 */
151 #if (RTL8710B_SUPPORT == 1)
152 if (dm->support_ic_type == ODM_RTL8710B) {
153 if (config_type == CONFIG_RF_RADIO) {
154 if (e_rf_path == RF_PATH_A)
155 READ_AND_CONFIG_MP(8710b, _radioa);
156 } else if (config_type == CONFIG_RF_TXPWR_LMT)
157 READ_AND_CONFIG_MP(8710b, _txpwr_lmt);
161 #endif /* @(DM_ODM_SUPPORT_TYPE != ODM_AP) */
162 /* @1 All platforms support */
163 #if (RTL8188E_SUPPORT == 1)
164 if (dm->support_ic_type == ODM_RTL8188E) {
165 if (config_type == CONFIG_RF_RADIO) {
166 if (e_rf_path == RF_PATH_A)
167 READ_AND_CONFIG_MP(8188e, _radioa);
168 } else if (config_type == CONFIG_RF_TXPWR_LMT)
169 READ_AND_CONFIG_MP(8188e, _txpwr_lmt);
172 #if (RTL8723B_SUPPORT == 1)
173 if (dm->support_ic_type == ODM_RTL8723B) {
174 if (config_type == CONFIG_RF_RADIO)
175 READ_AND_CONFIG_MP(8723b, _radioa);
176 else if (config_type == CONFIG_RF_TXPWR_LMT)
177 READ_AND_CONFIG_MP(8723b, _txpwr_lmt);
180 #if (RTL8814A_SUPPORT == 1)
181 if (dm->support_ic_type == ODM_RTL8814A) {
182 if (config_type == CONFIG_RF_RADIO) {
183 if (e_rf_path == RF_PATH_A)
184 READ_AND_CONFIG_MP(8814a, _radioa);
185 else if (e_rf_path == RF_PATH_B)
186 READ_AND_CONFIG_MP(8814a, _radiob);
187 else if (e_rf_path == RF_PATH_C)
188 READ_AND_CONFIG_MP(8814a, _radioc);
189 else if (e_rf_path == RF_PATH_D)
190 READ_AND_CONFIG_MP(8814a, _radiod);
191 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
192 if (dm->rfe_type == 0)
193 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type0);
194 else if (dm->rfe_type == 1)
195 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type1);
196 else if (dm->rfe_type == 2)
197 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type2);
198 else if (dm->rfe_type == 3)
199 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type3);
200 else if (dm->rfe_type == 5)
201 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type5);
202 else if (dm->rfe_type == 7)
203 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type7);
204 else if (dm->rfe_type == 8)
205 READ_AND_CONFIG_MP(8814a, _txpwr_lmt_type8);
207 READ_AND_CONFIG_MP(8814a, _txpwr_lmt);
211 #if (RTL8703B_SUPPORT == 1)
212 if (dm->support_ic_type == ODM_RTL8703B) {
213 if (config_type == CONFIG_RF_RADIO) {
214 if (e_rf_path == RF_PATH_A)
215 READ_AND_CONFIG_MP(8703b, _radioa);
219 #if (RTL8188F_SUPPORT == 1)
220 if (dm->support_ic_type == ODM_RTL8188F) {
221 if (config_type == CONFIG_RF_RADIO) {
222 if (e_rf_path == RF_PATH_A)
223 READ_AND_CONFIG_MP(8188f, _radioa);
224 } else if (config_type == CONFIG_RF_TXPWR_LMT)
225 READ_AND_CONFIG_MP(8188f, _txpwr_lmt);
228 #if (RTL8822B_SUPPORT == 1)
229 if (dm->support_ic_type == ODM_RTL8822B) {
230 if (config_type == CONFIG_RF_RADIO) {
231 if (e_rf_path == RF_PATH_A)
232 READ_AND_CONFIG_MP(8822b, _radioa);
233 else if (e_rf_path == RF_PATH_B)
234 READ_AND_CONFIG_MP(8822b, _radiob);
235 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
236 if (dm->rfe_type == 5)
237 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type5);
238 else if (dm->rfe_type == 2)
239 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type2);
240 else if (dm->rfe_type == 3)
241 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type3);
242 else if (dm->rfe_type == 4)
243 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type4);
244 else if (dm->rfe_type == 12)
245 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type12);
246 else if (dm->rfe_type == 15)
247 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type15);
248 else if (dm->rfe_type == 16)
249 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type16);
250 else if (dm->rfe_type == 17)
251 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type17);
252 else if (dm->rfe_type == 18)
253 READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type18);
255 READ_AND_CONFIG_MP(8822b, _txpwr_lmt);
260 #if (RTL8197F_SUPPORT == 1)
261 if (dm->support_ic_type == ODM_RTL8197F) {
262 if (config_type == CONFIG_RF_RADIO) {
263 if (e_rf_path == RF_PATH_A)
264 READ_AND_CONFIG_MP(8197f, _radioa);
265 else if (e_rf_path == RF_PATH_B)
266 READ_AND_CONFIG_MP(8197f, _radiob);
271 #if (RTL8192F_SUPPORT == 1)
272 if (dm->support_ic_type == ODM_RTL8192F) {
273 if (config_type == CONFIG_RF_RADIO) {
274 if (e_rf_path == RF_PATH_A)
275 READ_AND_CONFIG_MP(8192f, _radioa);
276 else if (e_rf_path == RF_PATH_B)
277 READ_AND_CONFIG_MP(8192f, _radiob);
278 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
279 if (dm->rfe_type == 0)
280 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type0);
281 else if (dm->rfe_type == 1)
282 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type1);
283 else if (dm->rfe_type == 2)
284 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type2);
285 else if (dm->rfe_type == 3)
286 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type3);
287 else if (dm->rfe_type == 4)
288 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type4);
289 else if (dm->rfe_type == 5)
290 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type5);
291 else if (dm->rfe_type == 6)
292 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type6);
293 else if (dm->rfe_type == 7)
294 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type7);
295 else if (dm->rfe_type == 8)
296 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type8);
297 else if (dm->rfe_type == 9)
298 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type9);
299 else if (dm->rfe_type == 10)
300 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type10);
301 else if (dm->rfe_type == 11)
302 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type11);
303 else if (dm->rfe_type == 12)
304 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type12);
305 else if (dm->rfe_type == 13)
306 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type13);
307 else if (dm->rfe_type == 14)
308 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type14);
309 else if (dm->rfe_type == 15)
310 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type15);
311 else if (dm->rfe_type == 16)
312 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type16);
313 else if (dm->rfe_type == 17)
314 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type17);
315 else if (dm->rfe_type == 18)
316 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type18);
317 else if (dm->rfe_type == 19)
318 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type19);
319 else if (dm->rfe_type == 20)
320 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type20);
321 else if (dm->rfe_type == 21)
322 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type21);
323 else if (dm->rfe_type == 22)
324 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type22);
325 else if (dm->rfe_type == 23)
326 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type23);
327 else if (dm->rfe_type == 24)
328 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type24);
329 else if (dm->rfe_type == 25)
330 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type25);
331 else if (dm->rfe_type == 26)
332 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type26);
333 else if (dm->rfe_type == 27)
334 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type27);
335 else if (dm->rfe_type == 28)
336 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type28);
337 else if (dm->rfe_type == 29)
338 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type29);
339 else if (dm->rfe_type == 30)
340 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type30);
341 else if (dm->rfe_type == 31)
342 READ_AND_CONFIG_MP(8192f, _txpwr_lmt_type31);
344 READ_AND_CONFIG_MP(8192f, _txpwr_lmt);
348 #if (RTL8821C_SUPPORT == 1)
349 if (dm->support_ic_type == ODM_RTL8821C) {
350 if (config_type == CONFIG_RF_RADIO) {
351 if (e_rf_path == RF_PATH_A)
352 READ_AND_CONFIG(8821c, _radioa);
353 } else if (config_type == CONFIG_RF_TXPWR_LMT) {
354 READ_AND_CONFIG(8821c, _txpwr_lmt);
358 #if (RTL8195B_SUPPORT == 1)
359 if (dm->support_ic_type == ODM_RTL8195B) {
360 if (config_type == CONFIG_RF_RADIO) {
361 if (e_rf_path == RF_PATH_A)
362 READ_AND_CONFIG(8195b, _radioa);
365 else if (config_type == CONFIG_RF_TXPWR_LMT) {
366 READ_AND_CONFIG(8821c, _txpwr_lmt);
372 #if (RTL8198F_SUPPORT == 1)
373 if (dm->support_ic_type == ODM_RTL8198F) {
374 if (config_type == CONFIG_RF_RADIO) {
375 if (e_rf_path == RF_PATH_A)
376 READ_AND_CONFIG_MP(8198f, _radioa);
377 else if (e_rf_path == RF_PATH_B)
378 READ_AND_CONFIG_MP(8198f, _radiob);
379 else if (e_rf_path == RF_PATH_C)
380 READ_AND_CONFIG_MP(8198f, _radioc);
381 else if (e_rf_path == RF_PATH_D)
382 READ_AND_CONFIG_MP(8198f, _radiod);
387 if (config_type == CONFIG_RF_RADIO) {
388 if (dm->fw_offload_ability & PHYDM_PHY_PARAM_OFFLOAD) {
389 result = phydm_set_reg_by_fw(dm,
390 PHYDM_HALMAC_CMD_END,
396 PHYDM_DBG(dm, ODM_COMP_INIT,
397 "rf param offload end!result = %d", result);
405 odm_config_rf_with_tx_pwr_track_header_file(struct dm_struct *dm)
407 PHYDM_DBG(dm, ODM_COMP_INIT, "===>%s (%s)\n", __func__,
408 (dm->is_mp_chip) ? "MPChip" : "TestChip");
409 PHYDM_DBG(dm, ODM_COMP_INIT,
410 "support_platform: 0x%X, support_interface: 0x%X, board_type: 0x%X\n",
411 dm->support_platform, dm->support_interface, dm->board_type);
413 /* @1 AP doesn't use PHYDM power tracking table in these ICs */
414 #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
416 if (dm->support_ic_type == ODM_RTL8821) {
417 if (dm->support_interface == ODM_ITRF_PCIE)
418 READ_AND_CONFIG_MP(8821a, _txpowertrack_pcie);
419 else if (dm->support_interface == ODM_ITRF_USB)
420 READ_AND_CONFIG_MP(8821a, _txpowertrack_usb);
421 else if (dm->support_interface == ODM_ITRF_SDIO)
422 READ_AND_CONFIG_MP(8821a, _txpowertrack_sdio);
426 if (dm->support_ic_type == ODM_RTL8812) {
427 if (dm->support_interface == ODM_ITRF_PCIE)
428 READ_AND_CONFIG_MP(8812a, _txpowertrack_pcie);
429 else if (dm->support_interface == ODM_ITRF_USB) {
430 if (dm->rfe_type == 3 && dm->is_mp_chip)
431 READ_AND_CONFIG_MP(8812a, _txpowertrack_rfe3);
433 READ_AND_CONFIG_MP(8812a, _txpowertrack_usb);
438 if (dm->support_ic_type == ODM_RTL8192E) {
439 if (dm->support_interface == ODM_ITRF_PCIE)
440 READ_AND_CONFIG_MP(8192e, _txpowertrack_pcie);
441 else if (dm->support_interface == ODM_ITRF_USB)
442 READ_AND_CONFIG_MP(8192e, _txpowertrack_usb);
443 else if (dm->support_interface == ODM_ITRF_SDIO)
444 READ_AND_CONFIG_MP(8192e, _txpowertrack_sdio);
448 if (dm->support_ic_type == ODM_RTL8723D) {
449 if (dm->support_interface == ODM_ITRF_PCIE)
450 READ_AND_CONFIG_MP(8723d, _txpowertrack_pcie);
451 else if (dm->support_interface == ODM_ITRF_USB)
452 READ_AND_CONFIG_MP(8723d, _txpowertrack_usb);
453 else if (dm->support_interface == ODM_ITRF_SDIO)
454 READ_AND_CONFIG_MP(8723d, _txpowertrack_sdio);
456 READ_AND_CONFIG_MP(8723d, _txxtaltrack);
459 /* @JJ ADD 20161014 */
461 if (dm->support_ic_type == ODM_RTL8710B) {
462 if (dm->package_type == 1)
463 READ_AND_CONFIG_MP(8710b, _txpowertrack_qfn48m_smic);
464 else if (dm->package_type == 5)
465 READ_AND_CONFIG_MP(8710b, _txpowertrack_qfn48m_umc);
467 READ_AND_CONFIG_MP(8710b, _txxtaltrack);
471 if (dm->support_ic_type == ODM_RTL8188E) {
472 if (odm_get_mac_reg(dm, R_0xf0, 0xF000) >= 8) { /*@if 0xF0[15:12] >= 8, SMIC*/
473 if (dm->support_interface == ODM_ITRF_PCIE)
474 READ_AND_CONFIG_MP(8188e, _txpowertrack_pcie_icut);
475 else if (dm->support_interface == ODM_ITRF_USB)
476 READ_AND_CONFIG_MP(8188e, _txpowertrack_usb_icut);
477 else if (dm->support_interface == ODM_ITRF_SDIO)
478 READ_AND_CONFIG_MP(8188e, _txpowertrack_sdio_icut);
479 } else { /*@else 0xF0[15:12] < 8, TSMC*/
480 if (dm->support_interface == ODM_ITRF_PCIE)
481 READ_AND_CONFIG_MP(8188e, _txpowertrack_pcie);
482 else if (dm->support_interface == ODM_ITRF_USB)
483 READ_AND_CONFIG_MP(8188e, _txpowertrack_usb);
484 else if (dm->support_interface == ODM_ITRF_SDIO)
485 READ_AND_CONFIG_MP(8188e, _txpowertrack_sdio);
489 #endif /* @(DM_ODM_SUPPORT_TYPE != ODM_AP) */
490 /* @1 All platforms support */
492 if (dm->support_ic_type == ODM_RTL8723B) {
493 if (dm->support_interface == ODM_ITRF_PCIE)
494 READ_AND_CONFIG_MP(8723b, _txpowertrack_pcie);
495 else if (dm->support_interface == ODM_ITRF_USB)
496 READ_AND_CONFIG_MP(8723b, _txpowertrack_usb);
497 else if (dm->support_interface == ODM_ITRF_SDIO)
498 READ_AND_CONFIG_MP(8723b, _txpowertrack_sdio);
502 if (dm->support_ic_type == ODM_RTL8814A) {
503 if (dm->rfe_type == 0)
504 READ_AND_CONFIG_MP(8814a, _txpowertrack_type0);
505 else if (dm->rfe_type == 2)
506 READ_AND_CONFIG_MP(8814a, _txpowertrack_type2);
507 else if (dm->rfe_type == 5)
508 READ_AND_CONFIG_MP(8814a, _txpowertrack_type5);
509 else if (dm->rfe_type == 7)
510 READ_AND_CONFIG_MP(8814a, _txpowertrack_type7);
511 else if (dm->rfe_type == 8)
512 READ_AND_CONFIG_MP(8814a, _txpowertrack_type8);
514 READ_AND_CONFIG_MP(8814a, _txpowertrack);
516 READ_AND_CONFIG_MP(8814a, _txpowertssi);
520 if (dm->support_ic_type == ODM_RTL8703B) {
521 if (dm->support_interface == ODM_ITRF_USB)
522 READ_AND_CONFIG_MP(8703b, _txpowertrack_usb);
523 else if (dm->support_interface == ODM_ITRF_SDIO)
524 READ_AND_CONFIG_MP(8703b, _txpowertrack_sdio);
526 READ_AND_CONFIG_MP(8703b, _txxtaltrack);
530 if (dm->support_ic_type == ODM_RTL8188F) {
531 if (dm->support_interface == ODM_ITRF_USB)
532 READ_AND_CONFIG_MP(8188f, _txpowertrack_usb);
533 else if (dm->support_interface == ODM_ITRF_SDIO)
534 READ_AND_CONFIG_MP(8188f, _txpowertrack_sdio);
538 if (dm->support_ic_type == ODM_RTL8822B) {
539 if (dm->rfe_type == 0)
540 READ_AND_CONFIG_MP(8822b, _txpowertrack_type0);
541 else if (dm->rfe_type == 1)
542 READ_AND_CONFIG_MP(8822b, _txpowertrack_type1);
543 else if (dm->rfe_type == 2)
544 READ_AND_CONFIG_MP(8822b, _txpowertrack_type2);
545 else if ((dm->rfe_type == 3) || (dm->rfe_type == 5))
546 READ_AND_CONFIG_MP(8822b, _txpowertrack_type3_type5);
547 else if (dm->rfe_type == 4)
548 READ_AND_CONFIG_MP(8822b, _txpowertrack_type4);
549 else if (dm->rfe_type == 6)
550 READ_AND_CONFIG_MP(8822b, _txpowertrack_type6);
551 else if (dm->rfe_type == 7)
552 READ_AND_CONFIG_MP(8822b, _txpowertrack_type7);
553 else if (dm->rfe_type == 8)
554 READ_AND_CONFIG_MP(8822b, _txpowertrack_type8);
555 else if (dm->rfe_type == 9)
556 READ_AND_CONFIG_MP(8822b, _txpowertrack_type9);
557 else if (dm->rfe_type == 10)
558 READ_AND_CONFIG_MP(8822b, _txpowertrack_type10);
559 else if (dm->rfe_type == 11)
560 READ_AND_CONFIG_MP(8822b, _txpowertrack_type11);
561 else if (dm->rfe_type == 12)
562 READ_AND_CONFIG_MP(8822b, _txpowertrack_type12);
563 else if (dm->rfe_type == 13)
564 READ_AND_CONFIG_MP(8822b, _txpowertrack_type13);
565 else if (dm->rfe_type == 14)
566 READ_AND_CONFIG_MP(8822b, _txpowertrack_type14);
567 else if (dm->rfe_type == 15)
568 READ_AND_CONFIG_MP(8822b, _txpowertrack_type15);
569 else if (dm->rfe_type == 16)
570 READ_AND_CONFIG_MP(8822b, _txpowertrack_type16);
571 else if (dm->rfe_type == 17)
572 READ_AND_CONFIG_MP(8822b, _txpowertrack_type17);
573 else if (dm->rfe_type == 18)
574 READ_AND_CONFIG_MP(8822b, _txpowertrack_type18);
576 READ_AND_CONFIG_MP(8822b, _txpowertrack);
580 if (dm->support_ic_type == ODM_RTL8197F) {
581 if (dm->rfe_type == 0)
582 READ_AND_CONFIG_MP(8197f, _txpowertrack_type0);
583 else if (dm->rfe_type == 1)
584 READ_AND_CONFIG_MP(8197f, _txpowertrack_type1);
586 READ_AND_CONFIG_MP(8197f, _txpowertrack);
591 if (dm->support_ic_type == ODM_RTL8192F) {
592 if (dm->rfe_type == 0)
593 READ_AND_CONFIG_MP(8192f, _txpowertrack_type0);
594 else if (dm->rfe_type == 1)
595 READ_AND_CONFIG_MP(8192f, _txpowertrack_type1);
596 else if (dm->rfe_type == 2)
597 READ_AND_CONFIG_MP(8192f, _txpowertrack_type2);
598 else if (dm->rfe_type == 3)
599 READ_AND_CONFIG_MP(8192f, _txpowertrack_type3);
600 else if (dm->rfe_type == 4)
601 READ_AND_CONFIG_MP(8192f, _txpowertrack_type4);
602 else if (dm->rfe_type == 5)
603 READ_AND_CONFIG_MP(8192f, _txpowertrack_type5);
604 else if (dm->rfe_type == 6)
605 READ_AND_CONFIG_MP(8192f, _txpowertrack_type6);
606 else if (dm->rfe_type == 7)
607 READ_AND_CONFIG_MP(8192f, _txpowertrack_type7);
608 else if (dm->rfe_type == 8)
609 READ_AND_CONFIG_MP(8192f, _txpowertrack_type8);
610 else if (dm->rfe_type == 9)
611 READ_AND_CONFIG_MP(8192f, _txpowertrack_type9);
612 else if (dm->rfe_type == 10)
613 READ_AND_CONFIG_MP(8192f, _txpowertrack_type10);
614 else if (dm->rfe_type == 11)
615 READ_AND_CONFIG_MP(8192f, _txpowertrack_type11);
616 else if (dm->rfe_type == 12)
617 READ_AND_CONFIG_MP(8192f, _txpowertrack_type12);
618 else if (dm->rfe_type == 13)
619 READ_AND_CONFIG_MP(8192f, _txpowertrack_type13);
620 else if (dm->rfe_type == 14)
621 READ_AND_CONFIG_MP(8192f, _txpowertrack_type14);
622 else if (dm->rfe_type == 15)
623 READ_AND_CONFIG_MP(8192f, _txpowertrack_type15);
624 else if (dm->rfe_type == 16)
625 READ_AND_CONFIG_MP(8192f, _txpowertrack_type16);
626 else if (dm->rfe_type == 17)
627 READ_AND_CONFIG_MP(8192f, _txpowertrack_type17);
628 else if (dm->rfe_type == 18)
629 READ_AND_CONFIG_MP(8192f, _txpowertrack_type18);
630 else if (dm->rfe_type == 19)
631 READ_AND_CONFIG_MP(8192f, _txpowertrack_type19);
632 else if (dm->rfe_type == 20)
633 READ_AND_CONFIG_MP(8192f, _txpowertrack_type20);
634 else if (dm->rfe_type == 21)
635 READ_AND_CONFIG_MP(8192f, _txpowertrack_type21);
636 else if (dm->rfe_type == 22)
637 READ_AND_CONFIG_MP(8192f, _txpowertrack_type22);
638 else if (dm->rfe_type == 23)
639 READ_AND_CONFIG_MP(8192f, _txpowertrack_type23);
640 else if (dm->rfe_type == 24)
641 READ_AND_CONFIG_MP(8192f, _txpowertrack_type24);
642 else if (dm->rfe_type == 25)
643 READ_AND_CONFIG_MP(8192f, _txpowertrack_type25);
644 else if (dm->rfe_type == 26)
645 READ_AND_CONFIG_MP(8192f, _txpowertrack_type26);
646 else if (dm->rfe_type == 27)
647 READ_AND_CONFIG_MP(8192f, _txpowertrack_type27);
648 else if (dm->rfe_type == 28)
649 READ_AND_CONFIG_MP(8192f, _txpowertrack_type28);
650 else if (dm->rfe_type == 29)
651 READ_AND_CONFIG_MP(8192f, _txpowertrack_type29);
652 else if (dm->rfe_type == 30)
653 READ_AND_CONFIG_MP(8192f, _txpowertrack_type30);
654 else if (dm->rfe_type == 31)
655 READ_AND_CONFIG_MP(8192f, _txpowertrack_type31);
657 READ_AND_CONFIG_MP(8192f, _txpowertrack);
659 READ_AND_CONFIG_MP(8192f, _txxtaltrack);
663 if (dm->support_ic_type == ODM_RTL8821C) {
664 if (dm->rfe_type == 0x5)
665 READ_AND_CONFIG(8821c, _txpowertrack_type0x28);
666 else if (dm->rfe_type == 0x4)
667 READ_AND_CONFIG(8821c, _txpowertrack_type0x20);
669 READ_AND_CONFIG(8821c, _txpowertrack);
674 if (dm->support_ic_type == ODM_RTL8198F)
675 READ_AND_CONFIG_MP(8198f, _txpowertrack);
679 if (dm->support_ic_type == ODM_RTL8195B) {
680 READ_AND_CONFIG_MP(8195b, _txpowertrack);
681 READ_AND_CONFIG_MP(8195b, _txxtaltrack);
685 return HAL_STATUS_SUCCESS;
689 odm_config_bb_with_header_file(struct dm_struct *dm,
690 enum odm_bb_config_type config_type)
692 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
693 void *adapter = dm->adapter;
694 PMGNT_INFO mgnt_info = &((PADAPTER)adapter)->MgntInfo;
696 enum hal_status result = HAL_STATUS_SUCCESS;
698 /* @1 AP doesn't use PHYDM initialization in these ICs */
699 #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
700 #if (RTL8812A_SUPPORT == 1)
701 if (dm->support_ic_type == ODM_RTL8812) {
702 if (config_type == CONFIG_BB_PHY_REG)
703 READ_AND_CONFIG_MP(8812a, _phy_reg);
704 else if (config_type == CONFIG_BB_AGC_TAB)
705 READ_AND_CONFIG_MP(8812a, _agc_tab);
706 else if (config_type == CONFIG_BB_PHY_REG_PG) {
707 if (dm->rfe_type == 3 && dm->is_mp_chip)
708 READ_AND_CONFIG_MP(8812a, _phy_reg_pg_asus);
709 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
710 else if (mgnt_info->CustomerID == RT_CID_WNC_NEC && dm->is_mp_chip)
711 READ_AND_CONFIG_MP(8812a, _phy_reg_pg_nec);
712 #if RT_PLATFORM == PLATFORM_MACOSX
713 /*@{1827}{1024} for BUFFALO power by rate table. Isaiah 2013-11-29*/
714 else if (mgnt_info->CustomerID == RT_CID_DNI_BUFFALO)
715 READ_AND_CONFIG_MP(8812a, _phy_reg_pg_dni);
716 /* TP-Link T4UH, Isaiah 2015-03-16*/
717 else if (mgnt_info->CustomerID == RT_CID_TPLINK_HPWR) {
718 pr_debug("RT_CID_TPLINK_HPWR:: _PHY_REG_PG_TPLINK\n");
719 READ_AND_CONFIG_MP(8812a, _phy_reg_pg_tplink);
724 READ_AND_CONFIG_MP(8812a, _phy_reg_pg);
725 } else if (config_type == CONFIG_BB_PHY_REG_MP)
726 READ_AND_CONFIG_MP(8812a, _phy_reg_mp);
727 else if (config_type == CONFIG_BB_AGC_TAB_DIFF) {
728 dm->fw_offload_ability &= ~PHYDM_PHY_PARAM_OFFLOAD;
729 /*@AGC_TAB DIFF dont support FW offload*/
730 if ((*dm->channel >= 36) && (*dm->channel <= 64))
731 AGC_DIFF_CONFIG_MP(8812a, lb);
732 else if (*dm->channel >= 100)
733 AGC_DIFF_CONFIG_MP(8812a, hb);
737 #if (RTL8821A_SUPPORT == 1)
738 if (dm->support_ic_type == ODM_RTL8821) {
739 if (config_type == CONFIG_BB_PHY_REG)
740 READ_AND_CONFIG_MP(8821a, _phy_reg);
741 else if (config_type == CONFIG_BB_AGC_TAB)
742 READ_AND_CONFIG_MP(8821a, _agc_tab);
743 else if (config_type == CONFIG_BB_PHY_REG_PG) {
744 #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
745 #if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
746 HAL_DATA_TYPE * hal_data = GET_HAL_DATA(((PADAPTER)adapter));
748 if ((hal_data->EEPROMSVID == 0x1043 && hal_data->EEPROMSMID == 0x207F))
749 READ_AND_CONFIG_MP(8821a, _phy_reg_pg_e202_sa);
752 #if (RT_PLATFORM == PLATFORM_MACOSX)
753 /*@ for BUFFALO pwr by rate table */
754 if (mgnt_info->CustomerID == RT_CID_DNI_BUFFALO) {
755 /*@ for BUFFALO pwr by rate table (JP/US)*/
756 if (mgnt_info->ChannelPlan == RT_CHANNEL_DOMAIN_US_2G_CANADA_5G)
757 READ_AND_CONFIG_MP(8821a, _phy_reg_pg_dni_us);
759 READ_AND_CONFIG_MP(8821a, _phy_reg_pg_dni_jp);
763 READ_AND_CONFIG_MP(8821a, _phy_reg_pg);
767 #if (RTL8192E_SUPPORT == 1)
768 if (dm->support_ic_type == ODM_RTL8192E) {
769 if (config_type == CONFIG_BB_PHY_REG)
770 READ_AND_CONFIG_MP(8192e, _phy_reg);
771 else if (config_type == CONFIG_BB_AGC_TAB)
772 READ_AND_CONFIG_MP(8192e, _agc_tab);
773 else if (config_type == CONFIG_BB_PHY_REG_PG)
774 READ_AND_CONFIG_MP(8192e, _phy_reg_pg);
777 #if (RTL8723D_SUPPORT == 1)
778 if (dm->support_ic_type == ODM_RTL8723D) {
779 if (config_type == CONFIG_BB_PHY_REG)
780 READ_AND_CONFIG_MP(8723d, _phy_reg);
781 else if (config_type == CONFIG_BB_AGC_TAB)
782 READ_AND_CONFIG_MP(8723d, _agc_tab);
783 else if (config_type == CONFIG_BB_PHY_REG_PG)
784 READ_AND_CONFIG_MP(8723d, _phy_reg_pg);
787 /* @JJ ADD 20161014 */
788 #if (RTL8710B_SUPPORT == 1)
789 if (dm->support_ic_type == ODM_RTL8710B) {
790 if (config_type == CONFIG_BB_PHY_REG)
791 READ_AND_CONFIG_MP(8710b, _phy_reg);
792 else if (config_type == CONFIG_BB_AGC_TAB)
793 READ_AND_CONFIG_MP(8710b, _agc_tab);
794 else if (config_type == CONFIG_BB_PHY_REG_PG)
795 READ_AND_CONFIG_MP(8710b, _phy_reg_pg);
799 #endif /* @(DM_ODM_SUPPORT_TYPE != ODM_AP) */
800 /* @1 All platforms support */
801 #if (RTL8188E_SUPPORT == 1)
802 if (dm->support_ic_type == ODM_RTL8188E) {
803 if (config_type == CONFIG_BB_PHY_REG)
804 READ_AND_CONFIG_MP(8188e, _phy_reg);
805 else if (config_type == CONFIG_BB_AGC_TAB)
806 READ_AND_CONFIG_MP(8188e, _agc_tab);
807 else if (config_type == CONFIG_BB_PHY_REG_PG)
808 READ_AND_CONFIG_MP(8188e, _phy_reg_pg);
811 #if (RTL8723B_SUPPORT == 1)
812 if (dm->support_ic_type == ODM_RTL8723B) {
813 if (config_type == CONFIG_BB_PHY_REG)
814 READ_AND_CONFIG_MP(8723b, _phy_reg);
815 else if (config_type == CONFIG_BB_AGC_TAB)
816 READ_AND_CONFIG_MP(8723b, _agc_tab);
817 else if (config_type == CONFIG_BB_PHY_REG_PG)
818 READ_AND_CONFIG_MP(8723b, _phy_reg_pg);
821 #if (RTL8814A_SUPPORT == 1)
822 if (dm->support_ic_type == ODM_RTL8814A) {
823 if (config_type == CONFIG_BB_PHY_REG)
824 READ_AND_CONFIG_MP(8814a, _phy_reg);
825 else if (config_type == CONFIG_BB_AGC_TAB)
826 READ_AND_CONFIG_MP(8814a, _agc_tab);
827 else if (config_type == CONFIG_BB_PHY_REG_PG) {
828 if (dm->rfe_type == 0)
829 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type0);
830 else if (dm->rfe_type == 2)
831 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type2);
832 else if (dm->rfe_type == 3)
833 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type3);
834 else if (dm->rfe_type == 4)
835 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type4);
836 else if (dm->rfe_type == 5)
837 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type5);
838 else if (dm->rfe_type == 7)
839 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type7);
840 else if (dm->rfe_type == 8)
841 READ_AND_CONFIG_MP(8814a, _phy_reg_pg_type8);
843 READ_AND_CONFIG_MP(8814a, _phy_reg_pg);
844 } else if (config_type == CONFIG_BB_PHY_REG_MP)
845 READ_AND_CONFIG_MP(8814a, _phy_reg_mp);
848 #if (RTL8703B_SUPPORT == 1)
849 if (dm->support_ic_type == ODM_RTL8703B) {
850 if (config_type == CONFIG_BB_PHY_REG)
851 READ_AND_CONFIG_MP(8703b, _phy_reg);
852 else if (config_type == CONFIG_BB_AGC_TAB)
853 READ_AND_CONFIG_MP(8703b, _agc_tab);
854 else if (config_type == CONFIG_BB_PHY_REG_PG)
855 READ_AND_CONFIG_MP(8703b, _phy_reg_pg);
858 #if (RTL8188F_SUPPORT == 1)
859 if (dm->support_ic_type == ODM_RTL8188F) {
860 if (config_type == CONFIG_BB_PHY_REG)
861 READ_AND_CONFIG_MP(8188f, _phy_reg);
862 else if (config_type == CONFIG_BB_AGC_TAB)
863 READ_AND_CONFIG_MP(8188f, _agc_tab);
864 else if (config_type == CONFIG_BB_PHY_REG_PG)
865 READ_AND_CONFIG_MP(8188f, _phy_reg_pg);
868 #if (RTL8822B_SUPPORT == 1)
869 if (dm->support_ic_type == ODM_RTL8822B) {
870 if (config_type == CONFIG_BB_PHY_REG) {
871 READ_AND_CONFIG_MP(8822b, _phy_reg);
872 } else if (config_type == CONFIG_BB_AGC_TAB) {
873 READ_AND_CONFIG_MP(8822b, _agc_tab);
874 } else if (config_type == CONFIG_BB_PHY_REG_PG) {
875 if (dm->rfe_type == 2)
876 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type2);
877 else if (dm->rfe_type == 3)
878 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type3);
879 else if (dm->rfe_type == 4)
880 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type4);
881 else if (dm->rfe_type == 5)
882 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type5);
883 else if (dm->rfe_type == 12)
884 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type12);
885 else if (dm->rfe_type == 15)
886 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type15);
887 else if (dm->rfe_type == 16)
888 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type16);
889 else if (dm->rfe_type == 17)
890 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type17);
891 else if (dm->rfe_type == 18)
892 READ_AND_CONFIG_MP(8822b, _phy_reg_pg_type18);
894 READ_AND_CONFIG_MP(8822b, _phy_reg_pg);
899 #if (RTL8197F_SUPPORT == 1)
900 if (dm->support_ic_type == ODM_RTL8197F) {
901 if (config_type == CONFIG_BB_PHY_REG) {
902 READ_AND_CONFIG_MP(8197f, _phy_reg);
903 if (dm->cut_version == ODM_CUT_A)
904 phydm_phypara_a_cut(dm);
905 } else if (config_type == CONFIG_BB_AGC_TAB)
906 READ_AND_CONFIG_MP(8197f, _agc_tab);
910 #if (RTL8192F_SUPPORT == 1)
911 if (dm->support_ic_type == ODM_RTL8192F) {
912 if (config_type == CONFIG_BB_PHY_REG) {
913 READ_AND_CONFIG_MP(8192f, _phy_reg);
914 } else if (config_type == CONFIG_BB_AGC_TAB) {
915 READ_AND_CONFIG_MP(8192f, _agc_tab);
916 } else if (config_type == CONFIG_BB_PHY_REG_PG) {
917 if (dm->rfe_type == 0)
918 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type0);
919 else if (dm->rfe_type == 1)
920 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type1);
921 else if (dm->rfe_type == 2)
922 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type2);
923 else if (dm->rfe_type == 3)
924 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type3);
925 else if (dm->rfe_type == 4)
926 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type4);
927 else if (dm->rfe_type == 5)
928 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type5);
929 else if (dm->rfe_type == 6)
930 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type6);
931 else if (dm->rfe_type == 7)
932 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type7);
933 else if (dm->rfe_type == 8)
934 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type8);
935 else if (dm->rfe_type == 9)
936 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type9);
937 else if (dm->rfe_type == 10)
938 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type10);
939 else if (dm->rfe_type == 11)
940 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type11);
941 else if (dm->rfe_type == 12)
942 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type12);
943 else if (dm->rfe_type == 13)
944 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type13);
945 else if (dm->rfe_type == 14)
946 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type14);
947 else if (dm->rfe_type == 15)
948 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type15);
949 else if (dm->rfe_type == 16)
950 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type16);
951 else if (dm->rfe_type == 17)
952 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type17);
953 else if (dm->rfe_type == 18)
954 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type18);
955 else if (dm->rfe_type == 19)
956 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type19);
957 else if (dm->rfe_type == 20)
958 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type20);
959 else if (dm->rfe_type == 21)
960 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type21);
961 else if (dm->rfe_type == 22)
962 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type22);
963 else if (dm->rfe_type == 23)
964 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type23);
965 else if (dm->rfe_type == 24)
966 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type24);
967 else if (dm->rfe_type == 25)
968 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type25);
969 else if (dm->rfe_type == 26)
970 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type26);
971 else if (dm->rfe_type == 27)
972 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type27);
973 else if (dm->rfe_type == 28)
974 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type28);
975 else if (dm->rfe_type == 29)
976 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type29);
977 else if (dm->rfe_type == 30)
978 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type30);
979 else if (dm->rfe_type == 31)
980 READ_AND_CONFIG_MP(8192f, _phy_reg_pg_type31);
982 READ_AND_CONFIG_MP(8192f, _phy_reg_pg);
986 #if (RTL8821C_SUPPORT == 1)
987 if (dm->support_ic_type == ODM_RTL8821C) {
988 if (config_type == CONFIG_BB_PHY_REG) {
989 READ_AND_CONFIG(8821c, _phy_reg);
990 } else if (config_type == CONFIG_BB_AGC_TAB) {
991 READ_AND_CONFIG(8821c, _agc_tab);
992 /* @According to RFEtype, choosing correct AGC table*/
993 if (dm->default_rf_set_8821c == SWITCH_TO_BTG)
994 AGC_DIFF_CONFIG_MP(8821c, btg);
995 } else if (config_type == CONFIG_BB_PHY_REG_PG) {
996 if (dm->rfe_type == 0x5)
997 READ_AND_CONFIG(8821c, _phy_reg_pg_type0x28);
999 READ_AND_CONFIG(8821c, _phy_reg_pg);
1000 } else if (config_type == CONFIG_BB_AGC_TAB_DIFF) {
1001 dm->fw_offload_ability &= ~PHYDM_PHY_PARAM_OFFLOAD;
1002 /*@AGC_TAB DIFF dont support FW offload*/
1003 if (dm->current_rf_set_8821c == SWITCH_TO_BTG)
1004 AGC_DIFF_CONFIG_MP(8821c, btg);
1005 else if (dm->current_rf_set_8821c == SWITCH_TO_WLG)
1006 AGC_DIFF_CONFIG_MP(8821c, wlg);
1007 } else if (config_type == CONFIG_BB_PHY_REG_MP) {
1008 READ_AND_CONFIG(8821c, _phy_reg_mp);
1013 #if (RTL8195A_SUPPORT == 1)
1014 if (dm->support_ic_type == ODM_RTL8195A) {
1015 if (config_type == CONFIG_BB_PHY_REG)
1016 READ_AND_CONFIG(8195a, _phy_reg);
1017 else if (config_type == CONFIG_BB_AGC_TAB)
1018 READ_AND_CONFIG(8195a, _agc_tab);
1019 else if (config_type == CONFIG_BB_PHY_REG_PG)
1020 READ_AND_CONFIG(8195a, _phy_reg_pg);
1023 #if (RTL8195B_SUPPORT == 1)
1024 if (dm->support_ic_type == ODM_RTL8195B) {
1025 if (config_type == CONFIG_BB_PHY_REG)
1026 READ_AND_CONFIG(8195b, _phy_reg);
1027 else if (config_type == CONFIG_BB_AGC_TAB)
1028 READ_AND_CONFIG(8195b, _agc_tab);
1029 /*@else if (config_type == CONFIG_BB_PHY_REG_PG)*/
1030 /* READ_AND_CONFIG(8195b, _phy_reg_pg);*/
1033 #if (RTL8198F_SUPPORT == 1)
1034 if (dm->support_ic_type == ODM_RTL8198F) {
1035 if (config_type == CONFIG_BB_PHY_REG)
1036 READ_AND_CONFIG_MP(8198f, _phy_reg);
1037 else if (config_type == CONFIG_BB_AGC_TAB)
1038 READ_AND_CONFIG_MP(8198f, _agc_tab);
1042 if (config_type == CONFIG_BB_PHY_REG ||
1043 config_type == CONFIG_BB_AGC_TAB)
1044 if (dm->fw_offload_ability & PHYDM_PHY_PARAM_OFFLOAD) {
1045 result = phydm_set_reg_by_fw(dm,
1046 PHYDM_HALMAC_CMD_END,
1052 PHYDM_DBG(dm, ODM_COMP_INIT,
1053 "phy param offload end!result = %d", result);
1060 odm_config_mac_with_header_file(struct dm_struct *dm)
1062 enum hal_status result = HAL_STATUS_SUCCESS;
1064 PHYDM_DBG(dm, ODM_COMP_INIT, "===>%s (%s)\n", __func__,
1065 (dm->is_mp_chip) ? "MPChip" : "TestChip");
1066 PHYDM_DBG(dm, ODM_COMP_INIT,
1067 "support_platform: 0x%X, support_interface: 0x%X, board_type: 0x%X\n",
1068 dm->support_platform, dm->support_interface, dm->board_type);
1070 /* @1 AP doesn't use PHYDM initialization in these ICs */
1071 #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
1072 #if (RTL8812A_SUPPORT == 1)
1073 if (dm->support_ic_type == ODM_RTL8812)
1074 READ_AND_CONFIG_MP(8812a, _mac_reg);
1076 #if (RTL8821A_SUPPORT == 1)
1077 if (dm->support_ic_type == ODM_RTL8821)
1078 READ_AND_CONFIG_MP(8821a, _mac_reg);
1080 #if (RTL8192E_SUPPORT == 1)
1081 if (dm->support_ic_type == ODM_RTL8192E)
1082 READ_AND_CONFIG_MP(8192e, _mac_reg);
1084 #if (RTL8723D_SUPPORT == 1)
1085 if (dm->support_ic_type == ODM_RTL8723D)
1086 READ_AND_CONFIG_MP(8723d, _mac_reg);
1088 /* @JJ ADD 20161014 */
1089 #if (RTL8710B_SUPPORT == 1)
1090 if (dm->support_ic_type == ODM_RTL8710B)
1091 READ_AND_CONFIG_MP(8710b, _mac_reg);
1093 #endif /* @(DM_ODM_SUPPORT_TYPE != ODM_AP) */
1094 /* @1 All platforms support */
1095 #if (RTL8188E_SUPPORT == 1)
1096 if (dm->support_ic_type == ODM_RTL8188E)
1097 READ_AND_CONFIG_MP(8188e, _mac_reg);
1099 #if (RTL8723B_SUPPORT == 1)
1100 if (dm->support_ic_type == ODM_RTL8723B)
1101 READ_AND_CONFIG_MP(8723b, _mac_reg);
1103 #if (RTL8814A_SUPPORT == 1)
1104 if (dm->support_ic_type == ODM_RTL8814A)
1105 READ_AND_CONFIG_MP(8814a, _mac_reg);
1107 #if (RTL8703B_SUPPORT == 1)
1108 if (dm->support_ic_type == ODM_RTL8703B)
1109 READ_AND_CONFIG_MP(8703b, _mac_reg);
1111 #if (RTL8188F_SUPPORT == 1)
1112 if (dm->support_ic_type == ODM_RTL8188F)
1113 READ_AND_CONFIG_MP(8188f, _mac_reg);
1115 #if (RTL8822B_SUPPORT == 1)
1116 if (dm->support_ic_type == ODM_RTL8822B)
1117 READ_AND_CONFIG_MP(8822b, _mac_reg);
1119 #if (RTL8197F_SUPPORT == 1)
1120 if (dm->support_ic_type == ODM_RTL8197F)
1121 READ_AND_CONFIG_MP(8197f, _mac_reg);
1124 /*@jj add 20170822*/
1125 #if (RTL8192F_SUPPORT == 1)
1126 if (dm->support_ic_type == ODM_RTL8192F)
1127 READ_AND_CONFIG_MP(8192f, _mac_reg);
1129 #if (RTL8821C_SUPPORT == 1)
1130 if (dm->support_ic_type == ODM_RTL8821C)
1131 READ_AND_CONFIG(8821c, _mac_reg);
1133 #if (RTL8195A_SUPPORT == 1)
1134 if (dm->support_ic_type == ODM_RTL8195A)
1135 READ_AND_CONFIG_MP(8195a, _mac_reg);
1137 #if (RTL8195B_SUPPORT == 1)
1138 if (dm->support_ic_type == ODM_RTL8195B)
1139 READ_AND_CONFIG_MP(8195b, _mac_reg);
1141 #if (RTL8198F_SUPPORT == 1)
1142 if (dm->support_ic_type == ODM_RTL8198F)
1143 READ_AND_CONFIG_MP(8198f, _mac_reg);
1146 if (dm->fw_offload_ability & PHYDM_PHY_PARAM_OFFLOAD) {
1147 result = phydm_set_reg_by_fw(dm,
1148 PHYDM_HALMAC_CMD_END,
1154 PHYDM_DBG(dm, ODM_COMP_INIT,
1155 "mac param offload end!result = %d", result);
1161 u32 odm_get_hw_img_version(struct dm_struct *dm)
1165 /* @1 AP doesn't use PHYDM initialization in these ICs */
1166 #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
1167 #if (RTL8821A_SUPPORT == 1)
1168 if (dm->support_ic_type == ODM_RTL8821)
1169 version = GET_VERSION_MP(8821a, _mac_reg);
1171 #if (RTL8192E_SUPPORT == 1)
1172 if (dm->support_ic_type == ODM_RTL8192E)
1173 version = GET_VERSION_MP(8192e, _mac_reg);
1175 #if (RTL8812A_SUPPORT == 1)
1176 if (dm->support_ic_type == ODM_RTL8812)
1177 version = GET_VERSION_MP(8812a, _mac_reg);
1179 #if (RTL8723D_SUPPORT == 1)
1180 if (dm->support_ic_type == ODM_RTL8723D)
1181 version = GET_VERSION_MP(8723d, _mac_reg);
1183 /* @JJ ADD 20161014 */
1184 #if (RTL8710B_SUPPORT == 1)
1185 if (dm->support_ic_type == ODM_RTL8710B)
1186 version = GET_VERSION_MP(8710b, _mac_reg);
1188 #endif /* @(DM_ODM_SUPPORT_TYPE != ODM_AP) */
1190 /*@1 All platforms support*/
1191 #if (RTL8188E_SUPPORT == 1)
1192 if (dm->support_ic_type == ODM_RTL8188E)
1193 version = GET_VERSION_MP(8188e, _mac_reg);
1195 #if (RTL8723B_SUPPORT == 1)
1196 if (dm->support_ic_type == ODM_RTL8723B)
1197 version = GET_VERSION_MP(8723b, _mac_reg);
1199 #if (RTL8814A_SUPPORT == 1)
1200 if (dm->support_ic_type == ODM_RTL8814A)
1201 version = GET_VERSION_MP(8814a, _mac_reg);
1203 #if (RTL8703B_SUPPORT == 1)
1204 if (dm->support_ic_type == ODM_RTL8703B)
1205 version = GET_VERSION_MP(8703b, _mac_reg);
1207 #if (RTL8188F_SUPPORT == 1)
1208 if (dm->support_ic_type == ODM_RTL8188F)
1209 version = GET_VERSION_MP(8188f, _mac_reg);
1211 #if (RTL8822B_SUPPORT == 1)
1212 if (dm->support_ic_type == ODM_RTL8822B)
1213 version = GET_VERSION_MP(8822b, _mac_reg);
1215 #if (RTL8197F_SUPPORT == 1)
1216 if (dm->support_ic_type == ODM_RTL8197F)
1217 version = GET_VERSION_MP(8197f, _mac_reg);
1220 /*@jj add 20170822*/
1221 #if (RTL8192F_SUPPORT == 1)
1222 if (dm->support_ic_type == ODM_RTL8192F)
1223 version = GET_VERSION_MP(8192f, _mac_reg);
1225 #if (RTL8821C_SUPPORT == 1)
1226 if (dm->support_ic_type == ODM_RTL8821C)
1227 version = GET_VERSION(8821c, _mac_reg);
1229 #if (RTL8195B_SUPPORT == 1)
1230 if (dm->support_ic_type == ODM_RTL8195B)
1231 version = GET_VERSION(8195b, _mac_reg);
1233 #if (RTL8198F_SUPPORT == 1)
1234 if (dm->support_ic_type == ODM_RTL8198F)
1235 version = GET_VERSION_MP(8198f, _mac_reg);
1241 u32 query_phydm_trx_capability(struct dm_struct *dm)
1243 u32 value32 = 0xFFFFFFFF;
1245 #if (RTL8821C_SUPPORT == 1)
1246 if (dm->support_ic_type == ODM_RTL8821C)
1247 value32 = query_phydm_trx_capability_8821c(dm);
1249 #if (RTL8195B_SUPPORT == 1)
1250 if (dm->support_ic_type == ODM_RTL8195B)
1251 value32 = query_phydm_trx_capability_8195b(dm);
1256 u32 query_phydm_stbc_capability(struct dm_struct *dm)
1258 u32 value32 = 0xFFFFFFFF;
1260 #if (RTL8821C_SUPPORT == 1)
1261 if (dm->support_ic_type == ODM_RTL8821C)
1262 value32 = query_phydm_stbc_capability_8821c(dm);
1264 #if (RTL8195B_SUPPORT == 1)
1265 if (dm->support_ic_type == ODM_RTL8195B)
1266 value32 = query_phydm_stbc_capability_8195b(dm);
1272 u32 query_phydm_ldpc_capability(struct dm_struct *dm)
1274 u32 value32 = 0xFFFFFFFF;
1276 #if (RTL8821C_SUPPORT == 1)
1277 if (dm->support_ic_type == ODM_RTL8821C)
1278 value32 = query_phydm_ldpc_capability_8821c(dm);
1280 #if (RTL8195B_SUPPORT == 1)
1281 if (dm->support_ic_type == ODM_RTL8195B)
1282 value32 = query_phydm_ldpc_capability_8195b(dm);
1287 u32 query_phydm_txbf_parameters(struct dm_struct *dm)
1289 u32 value32 = 0xFFFFFFFF;
1291 #if (RTL8821C_SUPPORT == 1)
1292 if (dm->support_ic_type == ODM_RTL8821C)
1293 value32 = query_phydm_txbf_parameters_8821c(dm);
1295 #if (RTL8195B_SUPPORT == 1)
1296 if (dm->support_ic_type == ODM_RTL8195B)
1297 value32 = query_phydm_txbf_parameters_8195b(dm);
1302 u32 query_phydm_txbf_capability(struct dm_struct *dm)
1304 u32 value32 = 0xFFFFFFFF;
1306 #if (RTL8821C_SUPPORT == 1)
1307 if (dm->support_ic_type == ODM_RTL8821C)
1308 value32 = query_phydm_txbf_capability_8821c(dm);
1310 #if (RTL8195B_SUPPORT == 1)
1311 if (dm->support_ic_type == ODM_RTL8195B)
1312 value32 = query_phydm_txbf_capability_8195b(dm);