diff options
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 85e05329a607..47e0fc1aaba3 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -28,6 +28,33 @@ static inline bool ath_is_alt_ant_ratio_better(int alt_ratio, int maxdelta, | |||
28 | (alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50); | 28 | (alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50); |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline bool ath_ant_div_comb_alt_check(u8 div_group, int alt_ratio, | ||
32 | int curr_main_set, int curr_alt_set, | ||
33 | int alt_rssi_avg, int main_rssi_avg) | ||
34 | { | ||
35 | bool result = false; | ||
36 | switch (div_group) { | ||
37 | case 0: | ||
38 | if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) | ||
39 | result = true; | ||
40 | break; | ||
41 | case 1: | ||
42 | if ((((curr_main_set == ATH_ANT_DIV_COMB_LNA2) && | ||
43 | (curr_alt_set == ATH_ANT_DIV_COMB_LNA1) && | ||
44 | (alt_rssi_avg >= (main_rssi_avg - 5))) || | ||
45 | ((curr_main_set == ATH_ANT_DIV_COMB_LNA1) && | ||
46 | (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) && | ||
47 | (alt_rssi_avg >= (main_rssi_avg - 2)))) && | ||
48 | (alt_rssi_avg >= 4)) | ||
49 | result = true; | ||
50 | else | ||
51 | result = false; | ||
52 | break; | ||
53 | } | ||
54 | |||
55 | return result; | ||
56 | } | ||
57 | |||
31 | static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) | 58 | static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) |
32 | { | 59 | { |
33 | return sc->ps_enabled && | 60 | return sc->ps_enabled && |
@@ -1413,7 +1440,9 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1413 | } | 1440 | } |
1414 | 1441 | ||
1415 | if (!antcomb->scan) { | 1442 | if (!antcomb->scan) { |
1416 | if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) { | 1443 | if (ath_ant_div_comb_alt_check(div_ant_conf.div_group, |
1444 | alt_ratio, curr_main_set, curr_alt_set, | ||
1445 | alt_rssi_avg, main_rssi_avg)) { | ||
1417 | if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) { | 1446 | if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) { |
1418 | /* Switch main and alt LNA */ | 1447 | /* Switch main and alt LNA */ |
1419 | div_ant_conf.main_lna_conf = | 1448 | div_ant_conf.main_lna_conf = |