Lines Matching +full:- +full:alt

23  * EEPROM has 2 4-bit fields containing the card configuration.
26 * ------------
33 * -----------
38 * ------------------------------------
40 * bb_enable_ant_div_lnadiv - Enable LNA path rx antenna diversity/combining.
43 * bb_ant_div_[alt/main]_gaintb - 0 -> Antenna config Alt/Main uses gaintable 0
44 * 1 -> Antenna config Alt/Main uses gaintable 1
47 * bb_enable_ant_fast_div - Enable fast antenna diversity.
50 * bb_ant_div_[alt/main]_lnaconf - Alt/Main LNA diversity/combining input config.
55 * 00=LNA1-LNA2
82 if (alt_ratio >= antcomb->ant_ratio2 && in ath_is_alt_ant_ratio_better()
83 alt_rssi_avg >= antcomb->low_rssi_thresh && in ath_is_alt_ant_ratio_better()
99 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2 && in ath_ant_div_comb_alt_check()
100 conf->alt_lna_conf == ATH_ANT_DIV_COMB_LNA1) in ath_ant_div_comb_alt_check()
103 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA1 && in ath_ant_div_comb_alt_check()
104 conf->alt_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_div_comb_alt_check()
107 switch (conf->div_group) { in ath_ant_div_comb_alt_check()
114 if (alt_rssi_avg < 4 || alt_rssi_avg < antcomb->low_rssi_thresh) in ath_ant_div_comb_alt_check()
117 if ((set1 && (alt_rssi_avg >= (main_rssi_avg - 5))) || in ath_ant_div_comb_alt_check()
118 (set2 && (alt_rssi_avg >= (main_rssi_avg - 2))) || in ath_ant_div_comb_alt_check()
119 (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_comb_alt_check()
124 if (alt_rssi_avg < 4 || alt_rssi_avg < antcomb->low_rssi_thresh) in ath_ant_div_comb_alt_check()
127 if ((set1 && (alt_rssi_avg >= (main_rssi_avg - 3))) || in ath_ant_div_comb_alt_check()
129 (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_comb_alt_check()
142 antcomb->quick_scan_cnt = 0; in ath_lnaconf_alt_good_scan()
145 antcomb->rssi_lna2 = main_rssi_avg; in ath_lnaconf_alt_good_scan()
147 antcomb->rssi_lna1 = main_rssi_avg; in ath_lnaconf_alt_good_scan()
150 case 0x10: /* LNA2 A-B */ in ath_lnaconf_alt_good_scan()
151 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; in ath_lnaconf_alt_good_scan()
152 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
154 antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA1; in ath_lnaconf_alt_good_scan()
156 case 0x20: /* LNA1 A-B */ in ath_lnaconf_alt_good_scan()
157 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; in ath_lnaconf_alt_good_scan()
158 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
160 antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA2; in ath_lnaconf_alt_good_scan()
163 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA2; in ath_lnaconf_alt_good_scan()
164 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
166 antcomb->second_quick_scan_conf = in ath_lnaconf_alt_good_scan()
170 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1; in ath_lnaconf_alt_good_scan()
171 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
173 antcomb->second_quick_scan_conf = in ath_lnaconf_alt_good_scan()
177 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_lnaconf_alt_good_scan()
178 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
180 antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA1; in ath_lnaconf_alt_good_scan()
183 antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_lnaconf_alt_good_scan()
184 antcomb->first_quick_scan_conf = in ath_lnaconf_alt_good_scan()
186 antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA2; in ath_lnaconf_alt_good_scan()
196 /* set alt to the conf with maximun ratio */ in ath_ant_set_alt_ratio()
197 if (antcomb->first_ratio && antcomb->second_ratio) { in ath_ant_set_alt_ratio()
198 if (antcomb->rssi_second > antcomb->rssi_third) { in ath_ant_set_alt_ratio()
199 /* first alt*/ in ath_ant_set_alt_ratio()
200 if ((antcomb->first_quick_scan_conf == ATH_ANT_DIV_COMB_LNA1) || in ath_ant_set_alt_ratio()
201 (antcomb->first_quick_scan_conf == ATH_ANT_DIV_COMB_LNA2)) in ath_ant_set_alt_ratio()
202 /* Set alt LNA1 or LNA2*/ in ath_ant_set_alt_ratio()
203 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_set_alt_ratio()
204 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_set_alt_ratio()
206 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_set_alt_ratio()
208 /* Set alt to A+B or A-B */ in ath_ant_set_alt_ratio()
209 conf->alt_lna_conf = in ath_ant_set_alt_ratio()
210 antcomb->first_quick_scan_conf; in ath_ant_set_alt_ratio()
211 } else if ((antcomb->second_quick_scan_conf == ATH_ANT_DIV_COMB_LNA1) || in ath_ant_set_alt_ratio()
212 (antcomb->second_quick_scan_conf == ATH_ANT_DIV_COMB_LNA2)) { in ath_ant_set_alt_ratio()
213 /* Set alt LNA1 or LNA2 */ in ath_ant_set_alt_ratio()
214 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_set_alt_ratio()
215 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_set_alt_ratio()
217 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_set_alt_ratio()
219 /* Set alt to A+B or A-B */ in ath_ant_set_alt_ratio()
220 conf->alt_lna_conf = antcomb->second_quick_scan_conf; in ath_ant_set_alt_ratio()
222 } else if (antcomb->first_ratio) { in ath_ant_set_alt_ratio()
223 /* first alt */ in ath_ant_set_alt_ratio()
224 if ((antcomb->first_quick_scan_conf == ATH_ANT_DIV_COMB_LNA1) || in ath_ant_set_alt_ratio()
225 (antcomb->first_quick_scan_conf == ATH_ANT_DIV_COMB_LNA2)) in ath_ant_set_alt_ratio()
226 /* Set alt LNA1 or LNA2 */ in ath_ant_set_alt_ratio()
227 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_set_alt_ratio()
228 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_set_alt_ratio()
230 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_set_alt_ratio()
232 /* Set alt to A+B or A-B */ in ath_ant_set_alt_ratio()
233 conf->alt_lna_conf = antcomb->first_quick_scan_conf; in ath_ant_set_alt_ratio()
234 } else if (antcomb->second_ratio) { in ath_ant_set_alt_ratio()
235 /* second alt */ in ath_ant_set_alt_ratio()
236 if ((antcomb->second_quick_scan_conf == ATH_ANT_DIV_COMB_LNA1) || in ath_ant_set_alt_ratio()
237 (antcomb->second_quick_scan_conf == ATH_ANT_DIV_COMB_LNA2)) in ath_ant_set_alt_ratio()
238 /* Set alt LNA1 or LNA2 */ in ath_ant_set_alt_ratio()
239 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_set_alt_ratio()
240 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_set_alt_ratio()
242 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_set_alt_ratio()
244 /* Set alt to A+B or A-B */ in ath_ant_set_alt_ratio()
245 conf->alt_lna_conf = antcomb->second_quick_scan_conf; in ath_ant_set_alt_ratio()
248 if ((antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) || in ath_ant_set_alt_ratio()
249 (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2)) in ath_ant_set_alt_ratio()
250 /* Set alt LNA1 or LNA2 */ in ath_ant_set_alt_ratio()
251 if (conf->main_lna_conf == ATH_ANT_DIV_COMB_LNA2) in ath_ant_set_alt_ratio()
252 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_set_alt_ratio()
254 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_set_alt_ratio()
256 /* Set alt to A+B or A-B */ in ath_ant_set_alt_ratio()
257 conf->alt_lna_conf = antcomb->main_conf; in ath_ant_set_alt_ratio()
267 switch (antcomb->quick_scan_cnt) { in ath_select_ant_div_from_quick_scan()
269 /* set alt to main, and alt to first conf */ in ath_select_ant_div_from_quick_scan()
270 div_ant_conf->main_lna_conf = antcomb->main_conf; in ath_select_ant_div_from_quick_scan()
271 div_ant_conf->alt_lna_conf = antcomb->first_quick_scan_conf; in ath_select_ant_div_from_quick_scan()
274 /* set alt to main, and alt to first conf */ in ath_select_ant_div_from_quick_scan()
275 div_ant_conf->main_lna_conf = antcomb->main_conf; in ath_select_ant_div_from_quick_scan()
276 div_ant_conf->alt_lna_conf = antcomb->second_quick_scan_conf; in ath_select_ant_div_from_quick_scan()
277 antcomb->rssi_first = main_rssi_avg; in ath_select_ant_div_from_quick_scan()
278 antcomb->rssi_second = alt_rssi_avg; in ath_select_ant_div_from_quick_scan()
280 if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) { in ath_select_ant_div_from_quick_scan()
286 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
287 antcomb->first_ratio = true; in ath_select_ant_div_from_quick_scan()
289 antcomb->first_ratio = false; in ath_select_ant_div_from_quick_scan()
290 } else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) { in ath_select_ant_div_from_quick_scan()
295 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
296 antcomb->first_ratio = true; in ath_select_ant_div_from_quick_scan()
298 antcomb->first_ratio = false; in ath_select_ant_div_from_quick_scan()
304 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
305 antcomb->first_ratio = true; in ath_select_ant_div_from_quick_scan()
307 antcomb->first_ratio = false; in ath_select_ant_div_from_quick_scan()
311 antcomb->alt_good = false; in ath_select_ant_div_from_quick_scan()
312 antcomb->scan_not_start = false; in ath_select_ant_div_from_quick_scan()
313 antcomb->scan = false; in ath_select_ant_div_from_quick_scan()
314 antcomb->rssi_first = main_rssi_avg; in ath_select_ant_div_from_quick_scan()
315 antcomb->rssi_third = alt_rssi_avg; in ath_select_ant_div_from_quick_scan()
317 switch(antcomb->second_quick_scan_conf) { in ath_select_ant_div_from_quick_scan()
319 antcomb->rssi_lna1 = alt_rssi_avg; in ath_select_ant_div_from_quick_scan()
322 antcomb->rssi_lna2 = alt_rssi_avg; in ath_select_ant_div_from_quick_scan()
325 if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) in ath_select_ant_div_from_quick_scan()
326 antcomb->rssi_lna2 = main_rssi_avg; in ath_select_ant_div_from_quick_scan()
327 else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) in ath_select_ant_div_from_quick_scan()
328 antcomb->rssi_lna1 = main_rssi_avg; in ath_select_ant_div_from_quick_scan()
334 if (antcomb->rssi_lna2 > antcomb->rssi_lna1 + in ath_select_ant_div_from_quick_scan()
335 div_ant_conf->lna1_lna2_switch_delta) in ath_select_ant_div_from_quick_scan()
336 div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_select_ant_div_from_quick_scan()
338 div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_select_ant_div_from_quick_scan()
340 if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) { in ath_select_ant_div_from_quick_scan()
345 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
346 antcomb->second_ratio = true; in ath_select_ant_div_from_quick_scan()
348 antcomb->second_ratio = false; in ath_select_ant_div_from_quick_scan()
349 } else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) { in ath_select_ant_div_from_quick_scan()
354 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
355 antcomb->second_ratio = true; in ath_select_ant_div_from_quick_scan()
357 antcomb->second_ratio = false; in ath_select_ant_div_from_quick_scan()
363 antcomb->total_pkt_count)) in ath_select_ant_div_from_quick_scan()
364 antcomb->second_ratio = true; in ath_select_ant_div_from_quick_scan()
366 antcomb->second_ratio = false; in ath_select_ant_div_from_quick_scan()
381 ant_conf->main_gaintb = 0; in ath_ant_div_conf_fast_divbias()
382 ant_conf->alt_gaintb = 0; in ath_ant_div_conf_fast_divbias()
384 if (ant_conf->div_group == 0) { in ath_ant_div_conf_fast_divbias()
385 /* Adjust the fast_div_bias based on main and alt lna conf */ in ath_ant_div_conf_fast_divbias()
386 switch ((ant_conf->main_lna_conf << 4) | in ath_ant_div_conf_fast_divbias()
387 ant_conf->alt_lna_conf) { in ath_ant_div_conf_fast_divbias()
388 case 0x01: /* A-B LNA2 */ in ath_ant_div_conf_fast_divbias()
389 ant_conf->fast_div_bias = 0x3b; in ath_ant_div_conf_fast_divbias()
391 case 0x02: /* A-B LNA1 */ in ath_ant_div_conf_fast_divbias()
392 ant_conf->fast_div_bias = 0x3d; in ath_ant_div_conf_fast_divbias()
394 case 0x03: /* A-B A+B */ in ath_ant_div_conf_fast_divbias()
395 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
397 case 0x10: /* LNA2 A-B */ in ath_ant_div_conf_fast_divbias()
398 ant_conf->fast_div_bias = 0x7; in ath_ant_div_conf_fast_divbias()
401 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
404 ant_conf->fast_div_bias = 0x7; in ath_ant_div_conf_fast_divbias()
406 case 0x20: /* LNA1 A-B */ in ath_ant_div_conf_fast_divbias()
407 ant_conf->fast_div_bias = 0x6; in ath_ant_div_conf_fast_divbias()
410 ant_conf->fast_div_bias = 0x0; in ath_ant_div_conf_fast_divbias()
413 ant_conf->fast_div_bias = 0x6; in ath_ant_div_conf_fast_divbias()
415 case 0x30: /* A+B A-B */ in ath_ant_div_conf_fast_divbias()
416 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
419 ant_conf->fast_div_bias = 0x3b; in ath_ant_div_conf_fast_divbias()
422 ant_conf->fast_div_bias = 0x3d; in ath_ant_div_conf_fast_divbias()
427 } else if (ant_conf->div_group == 1) { in ath_ant_div_conf_fast_divbias()
429 switch ((ant_conf->main_lna_conf << 4) | in ath_ant_div_conf_fast_divbias()
430 ant_conf->alt_lna_conf) { in ath_ant_div_conf_fast_divbias()
431 case 0x01: /* A-B LNA2 */ in ath_ant_div_conf_fast_divbias()
432 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
434 case 0x02: /* A-B LNA1 */ in ath_ant_div_conf_fast_divbias()
435 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
437 case 0x03: /* A-B A+B */ in ath_ant_div_conf_fast_divbias()
438 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
440 case 0x10: /* LNA2 A-B */ in ath_ant_div_conf_fast_divbias()
441 if (!(antcomb->scan) && in ath_ant_div_conf_fast_divbias()
443 ant_conf->fast_div_bias = 0x3f; in ath_ant_div_conf_fast_divbias()
445 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
448 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
451 if (!(antcomb->scan) && in ath_ant_div_conf_fast_divbias()
453 ant_conf->fast_div_bias = 0x3f; in ath_ant_div_conf_fast_divbias()
455 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
457 case 0x20: /* LNA1 A-B */ in ath_ant_div_conf_fast_divbias()
458 if (!(antcomb->scan) && in ath_ant_div_conf_fast_divbias()
460 ant_conf->fast_div_bias = 0x3f; in ath_ant_div_conf_fast_divbias()
462 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
465 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
468 if (!(antcomb->scan) && in ath_ant_div_conf_fast_divbias()
470 ant_conf->fast_div_bias = 0x3f; in ath_ant_div_conf_fast_divbias()
472 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
474 case 0x30: /* A+B A-B */ in ath_ant_div_conf_fast_divbias()
475 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
478 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
481 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
486 } else if (ant_conf->div_group == 2) { in ath_ant_div_conf_fast_divbias()
488 switch ((ant_conf->main_lna_conf << 4) | in ath_ant_div_conf_fast_divbias()
489 ant_conf->alt_lna_conf) { in ath_ant_div_conf_fast_divbias()
490 case 0x01: /* A-B LNA2 */ in ath_ant_div_conf_fast_divbias()
491 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
493 case 0x02: /* A-B LNA1 */ in ath_ant_div_conf_fast_divbias()
494 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
496 case 0x03: /* A-B A+B */ in ath_ant_div_conf_fast_divbias()
497 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
499 case 0x10: /* LNA2 A-B */ in ath_ant_div_conf_fast_divbias()
500 if (!antcomb->scan && (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_conf_fast_divbias()
501 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
503 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
506 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
509 if (!antcomb->scan && (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_conf_fast_divbias()
510 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
512 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
514 case 0x20: /* LNA1 A-B */ in ath_ant_div_conf_fast_divbias()
515 if (!antcomb->scan && (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_conf_fast_divbias()
516 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
518 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
521 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
524 if (!antcomb->scan && (alt_ratio > antcomb->ant_ratio)) in ath_ant_div_conf_fast_divbias()
525 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
527 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
529 case 0x30: /* A+B A-B */ in ath_ant_div_conf_fast_divbias()
530 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
533 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
536 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
542 if (antcomb->fast_div_bias) in ath_ant_div_conf_fast_divbias()
543 ant_conf->fast_div_bias = antcomb->fast_div_bias; in ath_ant_div_conf_fast_divbias()
544 } else if (ant_conf->div_group == 3) { in ath_ant_div_conf_fast_divbias()
545 switch ((ant_conf->main_lna_conf << 4) | in ath_ant_div_conf_fast_divbias()
546 ant_conf->alt_lna_conf) { in ath_ant_div_conf_fast_divbias()
547 case 0x01: /* A-B LNA2 */ in ath_ant_div_conf_fast_divbias()
548 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
550 case 0x02: /* A-B LNA1 */ in ath_ant_div_conf_fast_divbias()
551 ant_conf->fast_div_bias = 0x39; in ath_ant_div_conf_fast_divbias()
553 case 0x03: /* A-B A+B */ in ath_ant_div_conf_fast_divbias()
554 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
556 case 0x10: /* LNA2 A-B */ in ath_ant_div_conf_fast_divbias()
557 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
560 ant_conf->fast_div_bias = 0x3f; in ath_ant_div_conf_fast_divbias()
563 ant_conf->fast_div_bias = 0x2; in ath_ant_div_conf_fast_divbias()
565 case 0x20: /* LNA1 A-B */ in ath_ant_div_conf_fast_divbias()
566 ant_conf->fast_div_bias = 0x3; in ath_ant_div_conf_fast_divbias()
569 ant_conf->fast_div_bias = 0x3; in ath_ant_div_conf_fast_divbias()
572 ant_conf->fast_div_bias = 0x3; in ath_ant_div_conf_fast_divbias()
574 case 0x30: /* A+B A-B */ in ath_ant_div_conf_fast_divbias()
575 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
578 ant_conf->fast_div_bias = 0x6; in ath_ant_div_conf_fast_divbias()
581 ant_conf->fast_div_bias = 0x1; in ath_ant_div_conf_fast_divbias()
596 antcomb->rssi_lna2 = alt_rssi_avg; in ath_ant_try_scan()
597 antcomb->rssi_lna1 = main_rssi_avg; in ath_ant_try_scan()
598 antcomb->scan = true; in ath_ant_try_scan()
600 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_scan()
601 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_ant_try_scan()
604 antcomb->rssi_lna1 = alt_rssi_avg; in ath_ant_try_scan()
605 antcomb->rssi_lna2 = main_rssi_avg; in ath_ant_try_scan()
606 antcomb->scan = true; in ath_ant_try_scan()
608 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_scan()
609 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_ant_try_scan()
612 antcomb->rssi_add = alt_rssi_avg; in ath_ant_try_scan()
613 antcomb->scan = true; in ath_ant_try_scan()
614 /* set to A-B */ in ath_ant_try_scan()
615 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; in ath_ant_try_scan()
618 antcomb->rssi_sub = alt_rssi_avg; in ath_ant_try_scan()
619 antcomb->scan = false; in ath_ant_try_scan()
620 if (antcomb->rssi_lna2 > in ath_ant_try_scan()
621 (antcomb->rssi_lna1 + conf->lna1_lna2_switch_delta)) { in ath_ant_try_scan()
623 if ((antcomb->rssi_add > antcomb->rssi_lna1) && in ath_ant_try_scan()
624 (antcomb->rssi_add > antcomb->rssi_sub)) { in ath_ant_try_scan()
626 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_scan()
627 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_ant_try_scan()
628 } else if (antcomb->rssi_sub > in ath_ant_try_scan()
629 antcomb->rssi_lna1) { in ath_ant_try_scan()
630 /* set to A-B */ in ath_ant_try_scan()
631 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_scan()
632 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; in ath_ant_try_scan()
635 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_scan()
636 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_scan()
640 if ((antcomb->rssi_add > antcomb->rssi_lna2) && in ath_ant_try_scan()
641 (antcomb->rssi_add > antcomb->rssi_sub)) { in ath_ant_try_scan()
643 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_scan()
644 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; in ath_ant_try_scan()
645 } else if (antcomb->rssi_sub > in ath_ant_try_scan()
646 antcomb->rssi_lna1) { in ath_ant_try_scan()
647 /* set to A-B */ in ath_ant_try_scan()
648 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_scan()
649 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; in ath_ant_try_scan()
652 conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_scan()
653 conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_scan()
674 * Switch main and alt LNA. in ath_ant_try_switch()
676 div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_switch()
677 div_ant_conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_switch()
679 div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_switch()
680 div_ant_conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_switch()
687 Set alt to another LNA. in ath_ant_try_switch()
690 div_ant_conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1; in ath_ant_try_switch()
692 div_ant_conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA2; in ath_ant_try_switch()
704 if (!antcomb->scan || !antcomb->alt_good) in ath_ant_short_scan_check()
707 if (time_after(jiffies, antcomb->scan_start_time + in ath_ant_short_scan_check()
711 if (antcomb->total_pkt_count == ATH_ANT_DIV_COMB_SHORT_SCAN_PKTCOUNT) { in ath_ant_short_scan_check()
712 alt_ratio = ((antcomb->alt_recv_cnt * 100) / in ath_ant_short_scan_check()
713 antcomb->total_pkt_count); in ath_ant_short_scan_check()
714 if (alt_ratio < antcomb->ant_ratio) in ath_ant_short_scan_check()
724 struct ath_ant_comb *antcomb = &sc->ant_comb; in ath_ant_comb_scan()
727 int main_rssi = rs->rs_rssi_ctl[0]; in ath_ant_comb_scan()
728 int alt_rssi = rs->rs_rssi_ctl[1]; in ath_ant_comb_scan()
732 rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) & in ath_ant_comb_scan()
734 main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) & in ath_ant_comb_scan()
737 if (alt_rssi >= antcomb->low_rssi_thresh) { in ath_ant_comb_scan()
738 antcomb->ant_ratio = ATH_ANT_DIV_COMB_ALT_ANT_RATIO; in ath_ant_comb_scan()
739 antcomb->ant_ratio2 = ATH_ANT_DIV_COMB_ALT_ANT_RATIO2; in ath_ant_comb_scan()
741 antcomb->ant_ratio = ATH_ANT_DIV_COMB_ALT_ANT_RATIO_LOW_RSSI; in ath_ant_comb_scan()
742 antcomb->ant_ratio2 = ATH_ANT_DIV_COMB_ALT_ANT_RATIO2_LOW_RSSI; in ath_ant_comb_scan()
747 antcomb->total_pkt_count++; in ath_ant_comb_scan()
748 antcomb->main_total_rssi += main_rssi; in ath_ant_comb_scan()
749 antcomb->alt_total_rssi += alt_rssi; in ath_ant_comb_scan()
752 antcomb->main_recv_cnt++; in ath_ant_comb_scan()
754 antcomb->alt_recv_cnt++; in ath_ant_comb_scan()
768 if (((antcomb->total_pkt_count < ATH_ANT_DIV_COMB_MAX_PKTCOUNT) || in ath_ant_comb_scan()
769 rs->rs_moreaggr) && !short_scan) in ath_ant_comb_scan()
772 if (antcomb->total_pkt_count) { in ath_ant_comb_scan()
773 alt_ratio = ((antcomb->alt_recv_cnt * 100) / in ath_ant_comb_scan()
774 antcomb->total_pkt_count); in ath_ant_comb_scan()
775 main_rssi_avg = (antcomb->main_total_rssi / in ath_ant_comb_scan()
776 antcomb->total_pkt_count); in ath_ant_comb_scan()
777 alt_rssi_avg = (antcomb->alt_total_rssi / in ath_ant_comb_scan()
778 antcomb->total_pkt_count); in ath_ant_comb_scan()
781 ath9k_hw_antdiv_comb_conf_get(sc->sc_ah, &div_ant_conf); in ath_ant_comb_scan()
784 antcomb->count++; in ath_ant_comb_scan()
786 if (antcomb->count == ATH_ANT_DIV_COMB_MAX_COUNT) { in ath_ant_comb_scan()
787 if (alt_ratio > antcomb->ant_ratio) { in ath_ant_comb_scan()
790 antcomb->alt_good = true; in ath_ant_comb_scan()
792 antcomb->alt_good = false; in ath_ant_comb_scan()
795 antcomb->count = 0; in ath_ant_comb_scan()
796 antcomb->scan = true; in ath_ant_comb_scan()
797 antcomb->scan_not_start = true; in ath_ant_comb_scan()
800 if (!antcomb->scan) { in ath_ant_comb_scan()
808 if (!antcomb->scan && in ath_ant_comb_scan()
812 if (!antcomb->scan_not_start) { in ath_ant_comb_scan()
816 if (!antcomb->alt_good) { in ath_ant_comb_scan()
817 antcomb->scan_not_start = false; in ath_ant_comb_scan()
818 /* Set alt to another LNA */ in ath_ant_comb_scan()
835 antcomb->quick_scan_cnt++; in ath_ant_comb_scan()
840 ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf); in ath_ant_comb_scan()
843 antcomb->scan_start_time = jiffies; in ath_ant_comb_scan()
844 antcomb->total_pkt_count = 0; in ath_ant_comb_scan()
845 antcomb->main_total_rssi = 0; in ath_ant_comb_scan()
846 antcomb->alt_total_rssi = 0; in ath_ant_comb_scan()
847 antcomb->main_recv_cnt = 0; in ath_ant_comb_scan()
848 antcomb->alt_recv_cnt = 0; in ath_ant_comb_scan()