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_IQK_H__ 27 #define __HALRF_IQK_H__ 28 29 /*@--------------------------Define Parameters-------------------------------*/ 30 #define LOK_delay 1 31 #define WBIQK_delay 10 32 #define TX_IQK 0 33 #define RX_IQK 1 34 #define TXIQK 0 35 #define RXIQK1 1 36 #define RXIQK2 2 37 #define kcount_limit_80m 2 38 #define kcount_limit_others 4 39 #define rxiqk_gs_limit 6 40 #define TXWBIQK_EN 1 41 #define RXWBIQK_EN 1 42 #if (RTL8814A_SUPPORT == 1 || RTL8198F_SUPPORT == 1 ||\ 43 RTL8814B_SUPPORT ||RTL8814C_SUPPORT == 1) 44 #define NUM 4 45 #elif (RTL8822B_SUPPORT == 1 || RTL8822C_SUPPORT == 1 ||\ 46 RTL8812F_SUPPORT == 1 || RTL8197G_SUPPORT == 1 ||\ 47 RTL8723F_SUPPORT == 1) 48 #define NUM 2 49 #else 50 #define NUM 1 51 #endif 52 53 /*@-----------------------End Define Parameters-----------------------*/ 54 55 struct dm_dack_info { 56 boolean dack_en; 57 u16 msbk_d[2][2][15]; 58 u8 dck_d[2][2][2]; 59 u16 biask_d[2][2]; 60 }; 61 62 struct dm_iqk_info { 63 boolean lok_fail[NUM]; 64 boolean iqk_fail[2][NUM]; 65 u32 iqc_matrix[2][NUM]; 66 u8 iqk_times; 67 u32 rf_reg18; 68 u32 rf_reg08; 69 u32 lna_idx; 70 u8 iqk_step; 71 u8 rxiqk_step; 72 u8 tmp1bcc; 73 u8 txgain; 74 u32 txgain56; 75 u8 kcount; 76 u8 rfk_ing; /*bit0:IQKing, bit1:LCKing, bit2:DPKing*/ 77 boolean rfk_forbidden; 78 u8 rxbb; 79 u32 rf_reg58; 80 boolean segment_iqk; 81 boolean is_tssi_mode; 82 u8 iqk_band; 83 u8 iqk_ch; 84 u8 iqk_bw; 85 #if (RTL8814A_SUPPORT == 1 || RTL8822B_SUPPORT == 1 || RTL8821C_SUPPORT == 1 ||\ 86 RTL8195B_SUPPORT == 1 || RTL8198F_SUPPORT == 1 ||\ 87 RTL8814B_SUPPORT == 1 || RTL8822C_SUPPORT == 1 ||\ 88 RTL8812F_SUPPORT == 1 || RTL8197G_SUPPORT == 1 ||\ 89 RTL8710C_SUPPORT == 1 || RTL8723F_SUPPORT == 1 ||\ 90 RTL8814C_SUPPORT == 1) 91 u32 iqk_channel[2]; 92 boolean iqk_fail_report[2][NUM][2]; /*channel/path/TRX(TX:0, RX:1) */ 93 /*channel / path / TRX(TX:0, RX:1) / CFIR_real*/ 94 /*channel index = 2 is just for debug*/ 95 #if (RTL8814B_SUPPORT == 1||RTL8814C_SUPPORT == 1) 96 u16 iqk_cfir_real[3][NUM][2][19]; 97 u16 iqk_cfir_imag[3][NUM][2][19]; 98 u32 rx_cfir_real[2][NUM][17]; 99 u32 rx_cfir_imag[2][NUM][17]; 100 u32 rx_cfir[2][NUM]; 101 #elif (RTL8812F_SUPPORT == 1 || RTL8822C_SUPPORT == 1 ) 102 u16 iqk_cfir_real[3][2][2][17]; 103 /*channel / path / TRX(TX:0, RX:1) / CFIR_imag*/ 104 /*channel index = 2 is just for debug*/ 105 u16 iqk_cfir_imag[3][2][2][17]; 106 u32 rx_cfir_real[2][2][17]; 107 u32 rx_cfir_imag[2][2][17]; 108 u32 rx_cfir[2][2]; 109 /*times/path*/ 110 #elif (RTL8195B_SUPPORT == 1) 111 u32 iqk_cfir_real[3][NUM][2][9]; 112 u32 iqk_cfir_imag[3][NUM][2][9]; 113 /*channel / path / TRX(TX:0, RX:1) / CFIR_imag*/ 114 /*channel index = 2 is just for debug*/ 115 #else 116 u32 iqk_cfir_real[3][NUM][2][8]; 117 /*channel / path / TRX(TX:0, RX:1) / CFIR_imag*/ 118 /*channel index = 2 is just for debug*/ 119 u32 iqk_cfir_imag[3][NUM][2][8]; 120 #endif 121 122 u8 retry_count[2][NUM][3]; /* channel / path / (TXK:0, RXK1:1, RXK2:2) */ 123 u8 gs_retry_count[2][NUM][2]; /* channel / path / (GSRXK1:0, GSRXK2:1) */ 124 /* channel / path 0:SRXK1 fail, 1:RXK1 fail 2:RXK2 fail */ 125 u8 rxiqk_fail_code[2][NUM]; 126 u32 lok_idac[2][NUM]; /*channel / path*/ 127 u16 rxiqk_agc[2][NUM]; /*channel / path*/ 128 u32 bypass_iqk[2][NUM]; /*channel / 0xc94/0xe94*/ 129 u32 txgap_result[8]; /*txagpK result */ 130 u32 tmp_gntwl; 131 boolean is_btg; 132 boolean isbnd; 133 boolean is_reload; 134 boolean is_hwtx; 135 boolean xym_read; 136 boolean trximr_enable; 137 #if (RTL8822B_SUPPORT == 1 || RTL8821C_SUPPORT == 1 ||\ 138 RTL8814B_SUPPORT == 1 || RTL8822C_SUPPORT == 1) 139 u32 rx_xym[2][10]; 140 u32 tx_xym[2][10]; 141 u32 gs1_xym[2][6]; 142 u32 gs2_xym[2][6]; 143 u32 rxk1_xym[2][6]; 144 u32 nbtxk_1b38[2]; 145 u32 nbrxk_1b3c[2]; 146 #endif 147 #if (RTL8710C_SUPPORT == 1 || RTL8197G_SUPPORT == 1 ) 148 u32 txxy[2][2]; 149 u32 rxxy[2][2]; 150 #endif 151 #if (RTL8723F_SUPPORT == 1) 152 u32 txxy[2][2]; 153 u32 rxxy[2][2][2]; 154 #endif 155 156 #endif 157 }; 158 159 #endif /*__HALRF_IQK_H__*/ 160