• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __PHYDMSMTANT_H__
27 #define __PHYDMSMTANT_H__
28 
29 /*@#define SMT_ANT_VERSION	"1.1"*/ /*@2017.03.13*/
30 /*@#define SMT_ANT_VERSION	"1.2"*/ /*@2017.03.28*/
31 #define SMT_ANT_VERSION "2.0" /* @Add Cumitek SmtAnt 2017.05.25*/
32 
33 #define	SMTANT_RTK		1
34 #define	SMTANT_HON_BO	2
35 #define	SMTANT_CUMITEK	3
36 
37 #if (defined(CONFIG_SMART_ANTENNA))
38 
39 #if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
40 struct smt_ant_cumitek {
41 	u8	tx_ant_idx[2][ODM_ASSOCIATE_ENTRY_NUM]; /*@[pathA~B] [MACID 0~128]*/
42 	u8	rx_default_ant_idx[2]; /*@[pathA~B]*/
43 };
44 #endif
45 
46 #if (defined(CONFIG_HL_SMART_ANTENNA))
47 struct smt_ant_honbo {
48 	u32	latch_time;
49 	boolean	pkt_skip_statistic_en;
50 	u32	fix_beam_pattern_en;
51 	u32	fix_training_num_en;
52 	u32	fix_beam_pattern_codeword;
53 	u32	update_beam_codeword;
54 	u32	ant_num; /*number of "used" smart beam antenna*/
55 	u32	ant_num_total;/*number of "total" smart beam antenna*/
56 	u32	first_train_ant; /*@decide witch antenna to train first*/
57 
58 	#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
59 	u32	pkt_rssi_pre[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];/*@rssi of each path with a certain beam pattern*/
60 	u8	beam_train_rssi_diff[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];
61 	u8	beam_train_cnt[SUPPORT_RF_PATH_NUM][SUPPORT_BEAM_PATTERN_NUM];
62 	u32	rfu_codeword_table[4]; /*@2G beam truth table*/
63 	u32	rfu_codeword_table_5g[4]; /*@5G beam truth table*/
64 	u32	beam_patten_num_each_ant;/*@number of  beam can be switched in each antenna*/
65 	u32	rx_idle_beam[SUPPORT_RF_PATH_NUM];
66 	u32	pkt_rssi_sum[8][SUPPORT_BEAM_PATTERN_NUM];
67 	u32	pkt_rssi_cnt[8][SUPPORT_BEAM_PATTERN_NUM];
68 	#endif
69 
70 	u32	fast_training_beam_num;/*@current training beam_set index*/
71 	u32	pre_fast_training_beam_num;/*pre training beam_set index*/
72 	u32	rfu_codeword_total_bit_num; /* @total bit number of RFU protocol*/
73 	u32	rfu_each_ant_bit_num; /* @bit number of RFU protocol for each ant*/
74 	u8	per_beam_training_pkt_num;
75 	u8	decision_holding_period;
76 
77 
78 	u32	pre_codeword;
79 	boolean	force_update_beam_en;
80 	u32	beacon_counter;
81 	u32	pre_beacon_counter;
82 	u8	pkt_counter;		/*@packet number that each beam-set should be colected in training state*/
83 	u8	update_beam_idx;	/*@the index announce that the beam can be updated*/
84 	u8	rfu_protocol_type;
85 	u16	rfu_protocol_delay_time;
86 
87 	#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
88 	RT_WORK_ITEM	hl_smart_antenna_workitem;
89 	RT_WORK_ITEM	hl_smart_antenna_decision_workitem;
90 	#endif
91 
92 
93 	#ifdef CONFIG_HL_SMART_ANTENNA_TYPE2
94 	u8	beam_set_avg_rssi_pre[SUPPORT_BEAM_SET_PATTERN_NUM];		/*@avg pre_rssi of each beam set*/
95 	u8	beam_set_train_val_diff[SUPPORT_BEAM_SET_PATTERN_NUM];	/*@rssi of a beam pattern set, ex: a set = {ant1_beam=1, ant2_beam=3}*/
96 	u8	beam_set_train_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];			/*@training pkt num of each beam set*/
97 	u32	beam_set_rssi_avg_sum[SUPPORT_BEAM_SET_PATTERN_NUM];			/*@RSSI_sum of avg(pathA,pathB) for each beam-set)*/
98 	u32	beam_path_rssi_sum[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B];/*@RSSI_sum of each path for each beam-set)*/
99 
100 	u8	beam_set_avg_evm_2ss_pre[SUPPORT_BEAM_SET_PATTERN_NUM];
101 	u32	beam_path_evm_2ss_sum[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B];/*@2SS evm_sum of each path for each beam-set)*/
102 	u32	beam_path_evm_2ss_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];
103 
104 	u8	beam_set_avg_evm_1ss_pre[SUPPORT_BEAM_SET_PATTERN_NUM];
105 	u32	beam_path_evm_1ss_sum[SUPPORT_BEAM_SET_PATTERN_NUM];/*@1SS evm_sum of each path for each beam-set)*/
106 	u32	beam_path_evm_1ss_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];
107 
108 	u32	statistic_pkt_cnt[SUPPORT_BEAM_SET_PATTERN_NUM];				/*@statistic_pkt_cnt for SmtAnt make decision*/
109 
110 	u8	total_beam_set_num;	/*@number of  beam set can be switched*/
111 	u8	total_beam_set_num_2g;/*@number of  beam set can be switched in 2G*/
112 	u8	total_beam_set_num_5g;/*@number of  beam set can be switched in 5G*/
113 
114 	u8	rfu_codeword_table_2g[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B]; /*@2G beam truth table*/
115 	u8	rfu_codeword_table_5g[SUPPORT_BEAM_SET_PATTERN_NUM][MAX_PATH_NUM_8822B]; /*@5G beam truth table*/
116 	u8	rx_idle_beam_set_idx;	/*the filanl decsion result*/
117 	#endif
118 
119 
120 };
121 #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA))*/
122 
123 struct smt_ant {
124 	u8	smt_ant_vendor;
125 	u8	smt_ant_type;
126 	u8	tx_desc_mode; /*@0:3 bit mode, 1:2 bit mode*/
127 	#if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
128 	struct	smt_ant_cumitek	cumi_smtant_table;
129 	#endif
130 };
131 
132 #if (defined(CONFIG_CUMITEK_SMART_ANTENNA))
133 void phydm_cumitek_smt_tx_ant_update(
134 	void *dm_void,
135 	u8 tx_ant_idx_path_a,
136 	u8 tx_ant_idx_path_b,
137 	u32 mac_id);
138 
139 void phydm_cumitek_smt_rx_default_ant_update(
140 	void *dm_void,
141 	u8 rx_ant_idx_path_a,
142 	u8 rx_ant_idx_path_b);
143 
144 void phydm_cumitek_smt_ant_debug(
145 	void *dm_void,
146 	char input[][16],
147 	u32 *_used,
148 	char *output,
149 	u32 *_out_len);
150 
151 #endif
152 
153 #if (defined(CONFIG_HL_SMART_ANTENNA))
154 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
155 void phydm_beam_switch_workitem_callback(
156 	void *context);
157 
158 void phydm_beam_decision_workitem_callback(
159 	void *context);
160 #endif /*@#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
161 
162 #ifdef CONFIG_HL_SMART_ANTENNA_TYPE2
163 void phydm_hl_smart_ant_type2_init_8822b(
164 	void *dm_void);
165 
166 void phydm_update_beam_pattern_type2(
167 	void *dm_void,
168 	u32 codeword,
169 	u32 codeword_length);
170 
171 void phydm_set_rfu_beam_pattern_type2(
172 	void *dm_void);
173 
174 void phydm_hl_smt_ant_dbg_type2(
175 	void *dm_void,
176 	char input[][16],
177 	u32 *_used,
178 	char *output,
179 	u32 *_out_len);
180 
181 void phydm_process_rssi_for_hb_smtant_type2(
182 	void *dm_void,
183 	void *phy_info_void,
184 	void *pkt_info_void,
185 	u8 rssi_avg);
186 
187 #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA_TYPE2))*/
188 
189 #if (defined(CONFIG_HL_SMART_ANTENNA_TYPE1))
190 
191 void phydm_update_beam_pattern(
192 	void *dm_void,
193 	u32 codeword,
194 	u32 codeword_length);
195 
196 void phydm_set_all_ant_same_beam_num(
197 	void *dm_void);
198 
199 void phydm_hl_smart_ant_debug(
200 	void *dm_void,
201 	char input[][16],
202 	u32 *_used,
203 	char *output,
204 	u32 *_out_len);
205 
206 #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA_TYPE1))*/
207 #endif /*@#if (defined(CONFIG_HL_SMART_ANTENNA))*/
208 void phydm_smt_ant_init(void *dm_void);
209 #endif /*@#if (defined(CONFIG_SMART_ANTENNA))*/
210 #endif