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_KFREE_H__ 27 #define __HALRF_KFREE_H__ 28 29 #define KFREE_VERSION "1.0" 30 31 #define KFREE_BAND_NUM 9 32 #define KFREE_CH_NUM 3 33 34 #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_AP)) 35 36 #define BB_GAIN_NUM 6 37 38 #endif 39 40 #define KFREE_FLAG_ON BIT(0) 41 #define KFREE_FLAG_THERMAL_K_ON BIT(1) 42 43 #define KFREE_FLAG_ON_2G BIT(2) 44 #define KFREE_FLAG_ON_5G BIT(3) 45 46 #define PA_BIAS_FLAG_ON BIT(4) 47 48 #define TSSI_TRIM_FLAG_ON BIT(5) 49 50 #define LNA_FLAG_ON BIT(6) 51 52 53 #define PPG_THERMAL_OFFSET_98F 0x50 54 #define PPG_2GM_TXAB_98F 0x51 55 #define PPG_2GM_TXCD_98F 0x52 56 #define PPG_2GL_TXAB_98F 0x53 57 #define PPG_2GL_TXCD_98F 0x54 58 #define PPG_2GH_TXAB_98F 0x55 59 #define PPG_2GH_TXCD_98F 0x56 60 61 #define PPG_PABIAS_2GAB_98F 0x57 62 #define PPG_PABIAS_2GCD_98F 0x58 63 64 #define PPG_LNA_2GA_98F 0x59 65 #define PPG_LNA_2GB_98F 0x5a 66 #define PPG_LNA_2GC_98F 0x5b 67 #define PPG_LNA_2GD_98F 0x5c 68 69 #define PPG_THERMAL_OFFSET_21C 0x1EF 70 #define PPG_2G_TXAB_21C 0x1EE 71 #define PPG_5GL1_TXA_21C 0x1EC 72 #define PPG_5GL2_TXA_21C 0x1E8 73 #define PPG_5GM1_TXA_21C 0x1E4 74 #define PPG_5GM2_TXA_21C 0x1E0 75 #define PPG_5GH1_TXA_21C 0x1DC 76 77 #define PPG_THERMAL_OFFSET_22B 0x3EF 78 #define PPG_2G_TXAB_22B 0x3EE 79 #define PPG_2G_TXCD_22B 0x3ED 80 #define PPG_5GL1_TXA_22B 0x3EC 81 #define PPG_5GL1_TXB_22B 0x3EB 82 #define PPG_5GL1_TXC_22B 0x3EA 83 #define PPG_5GL1_TXD_22B 0x3E9 84 #define PPG_5GL2_TXA_22B 0x3E8 85 #define PPG_5GL2_TXB_22B 0x3E7 86 #define PPG_5GL2_TXC_22B 0x3E6 87 #define PPG_5GL2_TXD_22B 0x3E5 88 #define PPG_5GM1_TXA_22B 0x3E4 89 #define PPG_5GM1_TXB_22B 0x3E3 90 #define PPG_5GM1_TXC_22B 0x3E2 91 #define PPG_5GM1_TXD_22B 0x3E1 92 #define PPG_5GM2_TXA_22B 0x3E0 93 #define PPG_5GM2_TXB_22B 0x3DF 94 #define PPG_5GM2_TXC_22B 0x3DE 95 #define PPG_5GM2_TXD_22B 0x3DD 96 #define PPG_5GH1_TXA_22B 0x3DC 97 #define PPG_5GH1_TXB_22B 0x3DB 98 #define PPG_5GH1_TXC_22B 0x3DA 99 #define PPG_5GH1_TXD_22B 0x3D9 100 101 #define PPG_PABIAS_2GA_22B 0x3D5 102 #define PPG_PABIAS_2GB_22B 0x3D6 103 104 #define PPG_THERMAL_A_OFFSET_22C 0x1ef 105 #define PPG_THERMAL_B_OFFSET_22C 0x1b0 106 #define PPG_2GL_TXAB_22C 0x1d4 107 #define PPG_2GM_TXAB_22C 0x1ee 108 #define PPG_2GH_TXAB_22C 0x1d2 109 #define PPG_5GL1_TXA_22C 0x1ec 110 #define PPG_5GL1_TXB_22C 0x1eb 111 #define PPG_5GL2_TXA_22C 0x1e8 112 #define PPG_5GL2_TXB_22C 0x1e7 113 #define PPG_5GM1_TXA_22C 0x1e4 114 #define PPG_5GM1_TXB_22C 0x1e3 115 #define PPG_5GM2_TXA_22C 0x1e0 116 #define PPG_5GM2_TXB_22C 0x1df 117 #define PPG_5GH1_TXA_22C 0x1dc 118 #define PPG_5GH1_TXB_22C 0x1db 119 120 #define PPG_PABIAS_2GA_22C 0x1d6 121 #define PPG_PABIAS_2GB_22C 0x1d5 122 #define PPG_PABIAS_5GA_22C 0x1d8 123 #define PPG_PABIAS_5GB_22C 0x1d7 124 125 #define TSSI_2GM_TXA_22C 0x1c0 126 #define TSSI_2GM_TXB_22C 0x1bf 127 #define TSSI_2GH_TXA_22C 0x1be 128 #define TSSI_2GH_TXB_22C 0x1bd 129 #define TSSI_5GL1_TXA_22C 0x1bc 130 #define TSSI_5GL1_TXB_22C 0x1bb 131 #define TSSI_5GL2_TXA_22C 0x1ba 132 #define TSSI_5GL2_TXB_22C 0x1b9 133 #define TSSI_5GM1_TXA_22C 0x1b8 134 #define TSSI_5GM1_TXB_22C 0x1b7 135 #define TSSI_5GM2_TXA_22C 0x1b6 136 #define TSSI_5GM2_TXB_22C 0x1b5 137 #define TSSI_5GH1_TXA_22C 0x1b4 138 #define TSSI_5GH1_TXB_22C 0x1b3 139 #define TSSI_5GH2_TXA_22C 0x1b2 140 #define TSSI_5GH2_TXB_22C 0x1b1 141 142 /*8195B*/ 143 #define PPG_THERMAL_OFFSET_95B 0x1ef 144 #define PPG_2GL_TXA_95B 0x1d4 145 #define PPG_2GM_TXA_95B 0x1ee 146 #define PPG_2GH_TXA_95B 0x1d2 147 #define PPG_5GL1_TXA_95B 0x1ec 148 #define PPG_5GL2_TXA_95B 0x1e8 149 #define PPG_5GM1_TXA_95B 0x1e4 150 #define PPG_5GM2_TXA_95B 0x1e0 151 #define PPG_5GH1_TXA_95B 0x1dc 152 153 #define PPG_PABIAS_2GA_95B 0x1d6 154 #define PPG_PABIAS_5GA_95B 0x1d8 155 156 /*8721D*/ 157 /*#define KFREE_BAND_NUM_8721D 6*/ 158 #define PPG_THERMAL_OFFSET_8721D 0x1EF 159 #define PPG_2G_TXA_8721D 0x1EE 160 #define PPG_5GL1_TXA_8721D 0x1ED 161 #define PPG_5GL2_TXA_8721D 0x1EC 162 #define PPG_5GM1_TXA_8721D 0x1EB 163 #define PPG_5GM2_TXA_8721D 0x1EA 164 #define PPG_5GH1_TXA_8721D 0x1E9 165 166 /*8723F*/ 167 /*#define KFREE_BAND_NUM_8723F*/ 168 #define PPG_THERMAL_OFFSET_8723F 0x1EF 169 #define PPG_S0_CH3_TSSIDE_8723F 0x1DD 170 #define PPG_S1_CH3_TSSIDE_8723F 0x1DC 171 #define PPG_S0_CH11_TSSIDE_8723F 0x1DB 172 #define PPG_S1_CH11_TSSIDE_8723F 0x1DA 173 #define PPG_S0_CH42_TSSIDE_8723F 0x1D9 174 #define PPG_S0_CH58_TSSIDE_8723F 0x1D8 175 #define PPG_S0_CH110_TSSIDE_8723F 0x1D7 176 #define PPG_S0_CH134_TSSIDE_8723F 0x1D6 177 #define PPG_S0_CH159_TSSIDE_8723F 0x1D5 178 #define PPG_S0_CH171_TSSIDE_8723F 0x1D4 179 180 /*8197G*/ 181 #define PPG_THERMAL_A_OFFSET_97G 0x50 182 #define PPG_THERMAL_B_OFFSET_97G 0x27 183 #define PPG_2GM_TXAB_97G 0x51 184 #define PPG_2GL_TXAB_97G 0x53 185 #define PPG_2GH_TXAB_97G 0x55 186 #define TSSI_2GL_TXA_97G 0x1c 187 #define TSSI_2GL_TXB_97G 0x1d 188 #define TSSI_2GH_TXA_97G 0x1e 189 #define TSSI_2GH_TXB_97G 0x1f 190 #define PPG_PABIAS_2GAB_97G 0x57 191 #define PPG_LNA_2GA_97G 0x21 192 #define PPG_LNA_2GB_97G 0x22 193 194 /*8710C Ameba Z2*/ 195 #define PPG_THERMAL_OFFSET_10C 0x1EF 196 #define PPG_2GL_TX_10C 0x1D4 197 #define PPG_2GM_TX_10C 0x1EE 198 #define PPG_2GH_TX_10C 0x1D2 199 #define PPG_PABIAS_10C 0x1D6 200 #define PPG_LNA_10C 0x1D0 201 202 /*8814B*/ 203 #define PPG_2GL_TXAB_14B 0x3ee 204 #define PPG_2GL_TXCD_14B 0x3ed 205 #define PPG_5GL1_TXA_14B 0x3ec 206 #define PPG_5GL1_TXB_14B 0x3eb 207 #define PPG_5GL1_TXC_14B 0x3ea 208 #define PPG_5GL1_TXD_14B 0x3e9 209 #define PPG_5GL2_TXA_14B 0x3e8 210 #define PPG_5GL2_TXB_14B 0x3e7 211 #define PPG_5GL2_TXC_14B 0x3e6 212 #define PPG_5GL2_TXD_14B 0x3e5 213 #define PPG_5GM1_TXA_14B 0x3e4 214 #define PPG_5GM1_TXB_14B 0x3e3 215 #define PPG_5GM1_TXC_14B 0x3e2 216 #define PPG_5GM1_TXD_14B 0x3e1 217 #define PPG_5GM2_TXA_14B 0x3e0 218 #define PPG_5GM2_TXB_14B 0x3df 219 #define PPG_5GM2_TXC_14B 0x3de 220 #define PPG_5GM2_TXD_14B 0x3dd 221 #define PPG_5GH1_TXA_14B 0x3dc 222 #define PPG_5GH1_TXB_14B 0x3db 223 #define PPG_5GH1_TXC_14B 0x3da 224 #define PPG_5GH1_TXD_14B 0x3d9 225 #define PPG_PABIAS_5GAC_14B 0x3d8 226 #define PPG_PABIAS_5GBD_14B 0x3d7 227 #define PPG_PABIAS_2GAC_14B 0x3d6 228 #define PPG_PABIAS_2GBD_14B 0x3d5 229 230 #define PPG_THERMAL_A_OFFSET_14B 0x3D4 231 #define PPG_THERMAL_B_OFFSET_14B 0x3D3 232 #define PPG_THERMAL_C_OFFSET_14B 0x3D2 233 #define PPG_THERMAL_D_OFFSET_14B 0x3D1 234 235 #define TSSI_2GM_TXA_14B 0x3c0 236 #define TSSI_2GM_TXB_14B 0x3bf 237 #define TSSI_2GM_TXC_14B 0x3be 238 #define TSSI_2GM_TXD_14B 0x3bd 239 #define TSSI_2GH_TXA_14B 0x3bc 240 #define TSSI_2GH_TXB_14B 0x3bb 241 #define TSSI_2GH_TXC_14B 0x3ba 242 #define TSSI_2GH_TXD_14B 0x3b9 243 #define TSSI_5GL1_TXA_14B 0x3b8 244 #define TSSI_5GL1_TXB_14B 0x3b7 245 #define TSSI_5GL1_TXC_14B 0x3b6 246 #define TSSI_5GL1_TXD_14B 0x3b5 247 #define TSSI_5GL2_TXA_14B 0x3b4 248 #define TSSI_5GL2_TXB_14B 0x3b3 249 #define TSSI_5GL2_TXC_14B 0x3b2 250 #define TSSI_5GL2_TXD_14B 0x3b1 251 #define TSSI_5GM1_TXA_14B 0x3b0 252 #define TSSI_5GM1_TXB_14B 0x3af 253 #define TSSI_5GM1_TXC_14B 0x3ae 254 #define TSSI_5GM1_TXD_14B 0x3ad 255 #define TSSI_5GM2_TXA_14B 0x3ac 256 #define TSSI_5GM2_TXB_14B 0x3ab 257 #define TSSI_5GM2_TXC_14B 0x3aa 258 #define TSSI_5GM2_TXD_14B 0x3a9 259 #define TSSI_5GH1_TXA_14B 0x3a8 260 #define TSSI_5GH1_TXB_14B 0x3a7 261 #define TSSI_5GH1_TXC_14B 0x3a6 262 #define TSSI_5GH1_TXD_14B 0x3a5 263 #define TSSI_5GH2_TXA_14B 0x3a4 264 #define TSSI_5GH2_TXB_14B 0x3a3 265 #define TSSI_5GH2_TXC_14B 0x3a2 266 #define TSSI_5GH2_TXD_14B 0x3a1 267 268 269 struct odm_power_trim_data { 270 u8 flag; 271 u8 pa_bias_flag; 272 u8 lna_flag; 273 s8 bb_gain[KFREE_BAND_NUM][MAX_RF_PATH]; 274 s8 tssi_trim[KFREE_BAND_NUM][MAX_RF_PATH]; 275 s8 pa_bias_trim[KFREE_BAND_NUM][MAX_RF_PATH]; 276 s8 lna_trim[MAX_RF_PATH]; 277 s8 thermal; 278 s8 multi_thermal[MAX_RF_PATH]; 279 }; 280 281 enum phydm_kfree_channeltosw { 282 PHYDM_2G = 0, 283 PHYDM_5GLB1 = 1, 284 PHYDM_5GLB2 = 2, 285 PHYDM_5GMB1 = 3, 286 PHYDM_5GMB2 = 4, 287 PHYDM_5GHB = 5, 288 }; 289 290 void phydm_get_thermal_trim_offset(void *dm_void); 291 292 void phydm_get_power_trim_offset(void *dm_void); 293 294 void phydm_get_pa_bias_offset(void *dm_void); 295 296 s8 phydm_get_thermal_offset(void *dm_void); 297 298 s8 phydm_get_multi_thermal_offset(void *dm_void, u8 path); 299 300 void phydm_clear_kfree_to_rf(void *dm_void, u8 e_rf_path, u8 data); 301 302 void phydm_config_new_kfree(void *dm_void); 303 304 s8 phydm_get_tssi_trim_de(void *dm_void, u8 path); 305 306 void phydm_config_kfree(void *dm_void, u8 channel_to_sw); 307 308 void phydm_set_lna_trim_offset (void *dm_void, u8 path, u8 cg_cs, u8 enable); 309 310 #endif /*__HALRF_KFREE_H__*/ 311