GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / rtlwifi / phydm / halphyrf_ce.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2016  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 __HAL_PHY_RF_H__
27 #define __HAL_PHY_RF_H__
28
29 #include "phydm_kfree.h"
30
31 #include "rtl8822b/phydm_iqk_8822b.h"
32
33 #include "phydm_powertracking_ce.h"
34
35 enum spur_cal_method { PLL_RESET, AFE_PHASE_SEL };
36
37 enum pwrtrack_method {
38         BBSWING,
39         TXAGC,
40         MIX_MODE,
41         TSSI_MODE,
42         MIX_2G_TSSI_5G_MODE,
43         MIX_5G_TSSI_2G_MODE
44 };
45
46 typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
47 typedef void (*func_iqk)(void *, u8, u8, u8);
48 typedef void (*func_lck)(void *);
49 typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
50 typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
51 typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
52 typedef void (*func_set_xtal)(void *);
53
54 struct txpwrtrack_cfg {
55         u8 swing_table_size_cck;
56         u8 swing_table_size_ofdm;
57         u8 threshold_iqk;
58         u8 threshold_dpk;
59         u8 average_thermal_num;
60         u8 rf_path_count;
61         u32 thermal_reg_addr;
62         func_set_pwr odm_tx_pwr_track_set_pwr;
63         func_iqk do_iqk;
64         func_lck phy_lc_calibrate;
65         func_swing get_delta_swing_table;
66         func_swing8814only get_delta_swing_table8814only;
67         func_swing_xtal get_delta_swing_xtal_table;
68         func_set_xtal odm_txxtaltrack_set_xtal;
69 };
70
71 void configure_txpower_track(void *dm_void, struct txpwrtrack_cfg *config);
72
73 void odm_clear_txpowertracking_state(void *dm_void);
74
75 void odm_txpowertracking_callback_thermal_meter(void *dm);
76
77 #define ODM_TARGET_CHNL_NUM_2G_5G 59
78
79 void odm_reset_iqk_result(void *dm_void);
80 u8 odm_get_right_chnl_place_for_iqk(u8 chnl);
81
82 void phydm_rf_init(void *dm_void);
83 void phydm_rf_watchdog(void *dm_void);
84
85 #endif /*  #ifndef __HAL_PHY_RF_H__ */