1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __RTL8822BE_PHY_H__
16#define __RTL8822BE_PHY_H__
17
18
19
20
21#define MAX_TX_COUNT 4
22#define TX_1S 0
23#define TX_2S 1
24#define TX_3S 2
25#define TX_4S 3
26
27#define MAX_POWER_INDEX 0x3F
28
29#define MAX_PRECMD_CNT 16
30#define MAX_RFDEPENDCMD_CNT 16
31#define MAX_POSTCMD_CNT 16
32
33#define MAX_DOZE_WAITING_TIMES_9x 64
34
35#define RT_CANNOT_IO(hw) false
36#define HIGHPOWER_RADIOA_ARRAYLEN 22
37
38#define IQK_ADDA_REG_NUM 16
39#define IQK_BB_REG_NUM 9
40#define MAX_TOLERANCE 5
41#define IQK_DELAY_TIME 10
42#define index_mapping_NUM 15
43
44#define APK_BB_REG_NUM 5
45#define APK_AFE_REG_NUM 16
46#define APK_CURVE_REG_NUM 4
47#define PATH_NUM 2
48
49#define LOOP_LIMIT 5
50#define MAX_STALL_TIME 50
51#define ANTENNA_DIVERSITY_VALUE 0x80
52#define MAX_TXPWR_IDX_NMODE_92S 63
53#define RESET_CNT_LIMIT 3
54
55#define IQK_ADDA_REG_NUM 16
56#define IQK_MAC_REG_NUM 4
57
58#define RF6052_MAX_PATH 2
59
60#define CT_OFFSET_MAC_ADDR 0X16
61
62#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A
63#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60
64#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF 0x66
65#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69
66#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C
67
68#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F
69#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72
70
71#define CT_OFFSET_CHANNEL_PLAH 0x75
72#define CT_OFFSET_THERMAL_METER 0x78
73#define CT_OFFSET_RF_OPTION 0x79
74#define CT_OFFSET_VERSION 0x7E
75#define CT_OFFSET_CUSTOMER_ID 0x7F
76
77#define RTL8822BE_MAX_PATH_NUM 2
78
79#define TARGET_CHNL_NUM_2G_5G_8822B 59
80
81u32 rtl8822be_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
82 u32 bitmask);
83void rtl8822be_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
84 u32 data);
85u32 rtl8822be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
86 u32 regaddr, u32 bitmask);
87void rtl8822be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
88 u32 regaddr, u32 bitmask, u32 data);
89bool rtl8822be_phy_bb_config(struct ieee80211_hw *hw);
90bool rtl8822be_phy_rf_config(struct ieee80211_hw *hw);
91bool rtl8822be_halmac_cb_init_mac_register(struct rtl_priv *rtlpriv);
92bool rtl8822be_halmac_cb_init_bb_rf_register(struct rtl_priv *rtlpriv);
93void rtl8822be_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel);
94void rtl8822be_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
95void rtl8822be_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
96void rtl8822be_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
97void rtl8822be_phy_set_bw_mode(struct ieee80211_hw *hw,
98 enum nl80211_channel_type ch_type);
99u8 rtl8822be_phy_sw_chnl(struct ieee80211_hw *hw);
100void rtl8822be_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
101void rtl8822be_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
102void rtl8822be_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
103void rtl8822be_phy_lc_calibrate(struct ieee80211_hw *hw);
104void rtl8822be_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
105bool rtl8822be_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
106 enum radio_path rfpath);
107bool rtl8822be_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
108 enum radio_path rfpath);
109bool rtl8822be_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
110bool rtl8822be_phy_set_rf_power_state(struct ieee80211_hw *hw,
111 enum rf_pwrstate rfpwr_state);
112void rtl8822be_phy_set_txpower_level_by_path(struct ieee80211_hw *hw,
113 u8 channel, u8 path);
114void rtl8822be_do_iqk(struct ieee80211_hw *hw, u8 delta_thermal_index,
115 u8 thermal_value, u8 threshold);
116void rtl8822be_do_iqk(struct ieee80211_hw *hw, u8 delta_thermal_index,
117 u8 thermal_value, u8 threshold);
118void rtl8822be_reset_iqk_result(struct ieee80211_hw *hw);
119
120u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
121 u8 bandwidth, u8 channel);
122void rtl8822be_phy_set_tx_power_index_by_rs(struct ieee80211_hw *hw, u8 channel,
123 u8 path, enum rate_section rs);
124void rtl8822be_store_tx_power_by_rate(struct ieee80211_hw *hw, u32 band,
125 u32 rfpath, u32 txnum, u32 regaddr,
126 u32 bitmask, u32 data);
127void rtl8822be_phy_set_txpower_limit(struct ieee80211_hw *hw, u8 *pregulation,
128 u8 *pband, u8 *pbandwidth,
129 u8 *prate_section, u8 *prf_path,
130 u8 *pchannel, u8 *ppower_limit);
131bool rtl8822be_load_txpower_by_rate(struct ieee80211_hw *hw);
132bool rtl8822be_load_txpower_limit(struct ieee80211_hw *hw);
133
134#endif
135