1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2017 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 __HALRF_DPK_H__ 27 #define __HALRF_DPK_H__ 28 29 /*@--------------------------Define Parameters-------------------------------*/ 30 #define GAIN_LOSS 1 31 #define DO_DPK 2 32 #define DPK_ON 3 33 #define GAIN_LOSS_PULSE 4 34 #define DPK_PAS 5 35 #define DPK_LMS 6 36 #define DPK_LOK 4 37 #define DPK_TXK 5 38 #define DAGC 4 39 #define LOSS_CHK 0 40 #define GAIN_CHK 1 41 #define PAS_READ 2 42 #define AVG_THERMAL_NUM 8 43 #define AVG_THERMAL_NUM_DPK 8 44 #define THERMAL_DPK_AVG_NUM 4 45 46 /*define RF path numer*/ 47 #if (RTL8198F_SUPPORT == 1 || RTL8814B_SUPPORT == 1|| RTL8814C_SUPPORT == 1) 48 #define KPATH 4 49 #elif (RTL8192F_SUPPORT == 1 || RTL8197F_SUPPORT == 1 ||RTL8197G_SUPPORT == 1 ||\ 50 RTL8822C_SUPPORT == 1 || RTL8812F_SUPPORT == 1 || RTL8723F_SUPPORT == 1) 51 #define KPATH 2 52 #else 53 #define KPATH 1 54 #endif 55 56 #if (RTL8814B_SUPPORT == 1 || RTL8721D_SUPPORT == 1) 57 #define GROUP_5G 6 58 #elif (RTL8195B_SUPPORT == 1) 59 #define GROUP_5G 13 60 #endif 61 62 /*@---------------------------End Define Parameters---------------------------*/ 63 64 struct dm_dpk_info { 65 66 boolean is_dpk_enable; 67 boolean is_dpk_pwr_on; 68 boolean is_dpk_by_channel; 69 boolean is_tssi_mode; 70 u8 dpk_status; /*bit[0]:reload;bit[1]:cal;bit[2]:cal_ok*/ 71 u16 dpk_path_ok; 72 /*@BIT(15)~BIT(12) : 5G reserved, BIT(11)~BIT(8) 5G_S3~5G_S0*/ 73 /*@BIT(7)~BIT(4) : 2G reserved, BIT(3)~BIT(0) 2G_S3~2G_S0*/ 74 u8 thermal_dpk[KPATH]; /*path*/ 75 u8 thermal_dpk_avg[KPATH][AVG_THERMAL_NUM_DPK]; /*path*/ 76 u8 pre_pwsf[KPATH]; 77 u8 thermal_dpk_avg_index; 78 u32 gnt_control; 79 u32 gnt_value; 80 u8 dpk_ch; 81 u8 dpk_band; 82 u8 dpk_bw; 83 u32 dpk_rf18[2]; 84 u32 dpk_cal_cnt; 85 u32 dpk_ok_cnt; 86 u32 dpk_reload_cnt; 87 88 #if (RTL8822C_SUPPORT == 1 || RTL8812F_SUPPORT == 1 || RTL8197G_SUPPORT == 1) 89 u16 dc_i[2]; /*MDPD DC I path*/ 90 u16 dc_q[2]; /*MDPD DC Q path*/ 91 u8 corr_val[2]; /*Corr value path*/ 92 u8 corr_idx[2]; /*Corr index path*/ 93 #endif 94 95 #if (RTL8822C_SUPPORT == 1 || RTL8812F_SUPPORT == 1) 96 u8 result[2]; /*path*/ 97 u8 dpk_txagc[2]; /*path*/ 98 u32 coef[2][20]; /*path/MDPD coefficient*/ 99 u16 dpk_gs[2]; /*MDPD coef gs*/ 100 u8 thermal_dpk_delta[2]; /*path*/ 101 #endif 102 103 #if (RTL8198F_SUPPORT == 1 || RTL8192F_SUPPORT == 1 || RTL8197F_SUPPORT == 1 ||\ 104 RTL8814B_SUPPORT == 1 || RTL8197G_SUPPORT == 1) 105 /*2G DPK data*/ 106 u8 dpk_result[KPATH][3]; /*path/group*/ 107 u8 pwsf_2g[KPATH][3]; /*path/group*/ 108 u32 lut_2g_even[KPATH][3][64]; /*path/group/LUT data*/ 109 u32 lut_2g_odd[KPATH][3][64]; /*path/group/LUT data*/ 110 s16 tmp_pas_i[32]; /*PAScan I data*/ 111 s16 tmp_pas_q[32]; /*PAScan Q data*/ 112 #endif 113 114 #if (RTL8814B_SUPPORT == 1) 115 /*5G DPK data*/ 116 u8 dpk_5g_result[KPATH][GROUP_5G]; /*path/group*/ 117 u8 pwsf_5g[KPATH][GROUP_5G]; /*path/group*/ 118 u32 lut_5g[KPATH][GROUP_5G][64]; /*path/group/LUT data*/ 119 u32 lut_2g[KPATH][3][64]; /*path/group/LUT data*/ 120 u8 rxbb[4]; /*path/group*/ 121 u8 txbb[4]; /*path/group*/ 122 u8 tx_gain; 123 #endif 124 125 #if (RTL8814C_SUPPORT == 1) 126 u8 thr_pwsf[KPATH]; 127 #endif 128 129 130 #if (RTL8195B_SUPPORT == 1) 131 u8 dpk_txagc; 132 /*2G DPK data*/ 133 u8 dpk_2g_result[KPATH][3]; /*path/group*/ 134 u8 pwsf_2g[KPATH][3]; /*path/group*/ 135 u32 lut_2g_even[KPATH][3][16]; /*path/group/LUT data*/ 136 u32 lut_2g_odd[KPATH][3][16]; /*path/group/LUT data*/ 137 /*5G DPK data*/ 138 u8 dpk_5g_result[KPATH][GROUP_5G]; /*path/group*/ 139 u8 pwsf_5g[KPATH][GROUP_5G]; /*path/group*/ 140 u32 lut_5g_even[KPATH][GROUP_5G][16]; /*path/group/LUT data*/ 141 u32 lut_5g_odd[KPATH][GROUP_5G][16]; /*path/group/LUT data*/ 142 #endif 143 144 #if (RTL8721D_SUPPORT == 1) 145 s16 tmp_pas_i[32]; /*PAScan I data*/ 146 s16 tmp_pas_q[32]; /*PAScan Q data*/ 147 u8 dpk_txagc; /*path*/ 148 #if (DPK_BY_GROUP_K_8721D) 149 /*2G DPK data*/ 150 u8 dpk_2g_result[1][3]; /*path/group*/ 151 u8 pwsf_2g[1][3]; /*path/group*/ 152 u32 lut_2g_even[1][3][16]; /*path/group/LUT data*/ 153 u32 lut_2g_odd[1][3][16]; /*path/group/LUT data*/ 154 /*5G DPK data*/ 155 u8 dpk_5g_result[1][6]; /*path/group*/ 156 u8 pwsf_5g[1][6]; /*path/group*/ 157 u32 lut_5g_even[1][6][16]; /*path/group/LUT data*/ 158 u32 lut_5g_odd[1][6][16]; /*path/group/LUT data*/ 159 #else 160 u8 dpk_2g_result[1][1]; /*path/group*/ 161 u8 pwsf_2g[1][1]; /*path/group*/ 162 u32 lut_2g_even[1][1][16]; /*path/group/LUT data*/ 163 u32 lut_2g_odd[1][1][16]; /*path/group/LUT data*/ 164 u8 dpk_5g_result[1][1]; /*path/group*/ 165 u8 pwsf_5g[1][1]; /*path/group*/ 166 u32 lut_5g_even[1][1][16]; /*path/group/LUT data*/ 167 u32 lut_5g_odd[1][1][16]; /*path/group/LUT data*/ 168 #endif 169 #endif 170 171 #if(RTL8723F_SUPPORT == 1) 172 u8 one_shot_cnt; 173 u8 dpk_current_path; 174 u8 thermal_init[KPATH]; 175 u8 dpk_delta_thermal[KPATH]; /*path*/ 176 s8 last_offset[KPATH]; /*path*/ 177 u8 txagc[KPATH]; /*path*/ 178 u8 tssi_txagc[KPATH][2]; /*path/0:txagc_rf,1:tssi_offset*/ 179 u16 digital_bbgain[KPATH]; /*path*/ 180 u16 pwsf[KPATH]; /*path*/ 181 182 #endif 183 }; 184 185 #if (RTL8822C_SUPPORT == 1) 186 struct dm_dpk_c2h_report { 187 u8 result[2]; /*ch0_result/ch1_result*/ 188 u8 therm[2][2]; /*therm0_s0/therm0_s1/therm1_s0/therm1_s1*/ 189 u8 therm_delta[2][2]; /*therm_delta0_s0/therm_delta0_s1/therm_delta1_s0/therm_delta1_s1*/ 190 u32 dpk_rf18[2]; /*dpk_ch0/dpk_ch1*/ 191 u8 dpk_status; /*dpk_status*/ 192 }; 193 #endif 194 195 #endif /*__HALRF_DPK_H__*/ 196