0001
0002
0003
0004 #ifndef __RTL92C_PHY_H__
0005 #define __RTL92C_PHY_H__
0006
0007 #define MAX_PRECMD_CNT 16
0008 #define MAX_RFDEPENDCMD_CNT 16
0009 #define MAX_POSTCMD_CNT 16
0010
0011 #define MAX_DOZE_WAITING_TIMES_9x 64
0012
0013 #define RT_CANNOT_IO(hw) false
0014 #define HIGHPOWER_RADIOA_ARRAYLEN 22
0015
0016 #define MAX_TOLERANCE 5
0017
0018 #define APK_BB_REG_NUM 5
0019 #define APK_AFE_REG_NUM 16
0020 #define APK_CURVE_REG_NUM 4
0021 #define PATH_NUM 2
0022
0023 #define LOOP_LIMIT 5
0024 #define MAX_STALL_TIME 50
0025 #define ANTENNADIVERSITYVALUE 0x80
0026 #define MAX_TXPWR_IDX_NMODE_92S 63
0027 #define RESET_CNT_LIMIT 3
0028
0029 #define IQK_ADDA_REG_NUM 16
0030 #define IQK_MAC_REG_NUM 4
0031
0032 #define IQK_DELAY_TIME 1
0033
0034 #define RF90_PATH_MAX 2
0035
0036 #define CT_OFFSET_MAC_ADDR 0X16
0037
0038 #define CT_OFFSET_CCK_TX_PWR_IDX 0x5A
0039 #define CT_OFFSET_HT401S_TX_PWR_IDX 0x60
0040 #define CT_OFFSET_HT402S_TX_PWR_IDX_DIF 0x66
0041 #define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69
0042 #define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C
0043
0044 #define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F
0045 #define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72
0046
0047 #define CT_OFFSET_CHANNEL_PLAH 0x75
0048 #define CT_OFFSET_THERMAL_METER 0x78
0049 #define CT_OFFSET_RF_OPTION 0x79
0050 #define CT_OFFSET_VERSION 0x7E
0051 #define CT_OFFSET_CUSTOMER_ID 0x7F
0052
0053 #define RTL92C_MAX_PATH_NUM 2
0054
0055 bool rtl92c_phy_bb_config(struct ieee80211_hw *hw);
0056 u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
0057 void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
0058 u32 data);
0059 u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
0060 u32 regaddr, u32 bitmask);
0061 void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
0062 u32 regaddr, u32 bitmask, u32 data);
0063 bool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
0064 bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw);
0065 bool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
0066 bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
0067 enum radio_path rfpath);
0068 void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
0069 void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel);
0070 void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
0071 bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
0072 long power_indbm);
0073 void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
0074 enum nl80211_channel_type ch_type);
0075 void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
0076 u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
0077 void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
0078 void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval);
0079 void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
0080 void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
0081 void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
0082 void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
0083 bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
0084 enum radio_path rfpath);
0085 bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
0086 u32 rfpath);
0087 bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
0088 enum rf_pwrstate rfpwr_state);
0089 void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
0090 bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
0091 void rtl92c_phy_set_io(struct ieee80211_hw *hw);
0092 void rtl92c_bb_block_on(struct ieee80211_hw *hw);
0093 u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath,
0094 u32 offset);
0095 u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
0096 enum radio_path rfpath, u32 offset);
0097 u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
0098 void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
0099 enum radio_path rfpath, u32 offset, u32 data);
0100 void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
0101 enum radio_path rfpath, u32 offset,
0102 u32 data);
0103 void _rtl92c_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
0104 u32 regaddr, u32 bitmask, u32 data);
0105 bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
0106 void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
0107 bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
0108 void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw);
0109 bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
0110 enum rf_pwrstate rfpwr_state);
0111 bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
0112 u8 configtype);
0113 bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
0114 u8 configtype);
0115 void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
0116
0117 #endif