19 static inline bool ath_is_alt_ant_ratio_better(
int alt_ratio,
int maxdelta,
20 int mindelta,
int main_rssi_avg,
21 int alt_rssi_avg,
int pkt_count)
24 (alt_rssi_avg > main_rssi_avg + maxdelta)) ||
25 (alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50);
28 static inline bool ath_ant_div_comb_alt_check(
u8 div_group,
int alt_ratio,
29 int curr_main_set,
int curr_alt_set,
30 int alt_rssi_avg,
int main_rssi_avg)
42 (alt_rssi_avg >= (main_rssi_avg - 5))) ||
45 (alt_rssi_avg >= (main_rssi_avg - 2)))) &&
56 static void ath_lnaconf_alt_good_scan(
struct ath_ant_comb *antcomb,
111 static void ath_select_ant_div_from_quick_scan(
struct ath_ant_comb *antcomb,
113 int main_rssi_avg,
int alt_rssi_avg,
132 if (ath_is_alt_ant_ratio_better(alt_ratio,
135 main_rssi_avg, alt_rssi_avg,
141 if (ath_is_alt_ant_ratio_better(alt_ratio,
144 main_rssi_avg, alt_rssi_avg,
151 (alt_rssi_avg > main_rssi_avg +
153 (alt_rssi_avg > main_rssi_avg)) &&
163 antcomb->
scan =
false;
187 if (ath_is_alt_ant_ratio_better(alt_ratio,
190 main_rssi_avg, alt_rssi_avg,
196 if (ath_is_alt_ant_ratio_better(alt_ratio,
199 main_rssi_avg, alt_rssi_avg,
206 (alt_rssi_avg > main_rssi_avg +
208 (alt_rssi_avg > main_rssi_avg)) &&
374 if (!(antcomb->
scan) &&
384 if (!(antcomb->
scan) &&
391 if (!(antcomb->
scan) &&
401 if (!(antcomb->
scan) &&
433 if (!(antcomb->
scan) &&
443 if (!(antcomb->
scan) &&
450 if (!(antcomb->
scan) &&
460 if (!(antcomb->
scan) &&
491 if ((antcomb->
scan == 0) &&
502 if ((antcomb->
scan == 0) &&
510 if ((antcomb->
scan == 0) &&
521 if ((antcomb->
scan == 0) &&
547 int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set;
551 int rx_ant_conf, main_ant_conf;
552 bool short_scan =
false;
560 if (main_rssi > 0 && alt_rssi > 0) {
564 if (main_ant_conf == rx_ant_conf)
599 ath9k_hw_antdiv_comb_conf_get(sc->
sc_ah, &div_ant_conf);
607 ath_lnaconf_alt_good_scan(antcomb, div_ant_conf,
615 antcomb->
scan =
true;
619 if (!antcomb->
scan) {
620 if (ath_ant_div_comb_alt_check(div_ant_conf.
div_group,
621 alt_ratio, curr_main_set, curr_alt_set,
622 alt_rssi_avg, main_rssi_avg)) {
650 if ((alt_rssi_avg < (main_rssi_avg +
656 switch (curr_alt_set) {
660 antcomb->
scan =
true;
670 antcomb->
scan =
true;
678 antcomb->
scan =
true;
685 antcomb->
scan =
false;
758 ath_select_ant_div_from_quick_scan(antcomb, &div_ant_conf,
759 main_rssi_avg, alt_rssi_avg,
765 ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio);
766 ath9k_hw_antdiv_comb_conf_set(sc->
sc_ah, &div_ant_conf);
783 ath9k_hw_antdiv_comb_conf_get(ah, &div_ant_conf);
793 ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf);
796 ath9k_hw_antctrl_shared_chain_lnadiv(ah,
true);