Commit 552bde40 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Add ALT check for cards with GROUP-3 config

Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9383be42
...@@ -25,28 +25,45 @@ static inline bool ath_is_alt_ant_ratio_better(int alt_ratio, int maxdelta, ...@@ -25,28 +25,45 @@ static inline bool ath_is_alt_ant_ratio_better(int alt_ratio, int maxdelta,
(alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50); (alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50);
} }
static inline bool ath_ant_div_comb_alt_check(u8 div_group, int alt_ratio, static inline bool ath_ant_div_comb_alt_check(struct ath_hw_antcomb_conf conf,
int curr_main_set, int curr_alt_set, int alt_ratio, int alt_rssi_avg,
int alt_rssi_avg, int main_rssi_avg) int main_rssi_avg)
{ {
bool result = false; bool result, set1, set2;
switch (div_group) {
result = set1 = set2 = false;
if (conf.main_lna_conf == ATH_ANT_DIV_COMB_LNA2 &&
conf.alt_lna_conf == ATH_ANT_DIV_COMB_LNA1)
set1 = true;
if (conf.main_lna_conf == ATH_ANT_DIV_COMB_LNA1 &&
conf.alt_lna_conf == ATH_ANT_DIV_COMB_LNA2)
set2 = true;
switch (conf.div_group) {
case 0: case 0:
if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)
result = true; result = true;
break; break;
case 1: case 1:
case 2: case 2:
if ((((curr_main_set == ATH_ANT_DIV_COMB_LNA2) && if (alt_rssi_avg < 4)
(curr_alt_set == ATH_ANT_DIV_COMB_LNA1) && break;
(alt_rssi_avg >= (main_rssi_avg - 5))) ||
((curr_main_set == ATH_ANT_DIV_COMB_LNA1) && if ((set1 && (alt_rssi_avg >= (main_rssi_avg - 5))) ||
(curr_alt_set == ATH_ANT_DIV_COMB_LNA2) && (set2 && (alt_rssi_avg >= (main_rssi_avg - 2))))
(alt_rssi_avg >= (main_rssi_avg - 2)))) &&
(alt_rssi_avg >= 4))
result = true; result = true;
else
result = false; break;
case 3:
if (alt_rssi_avg < 4)
break;
if ((set1 && (alt_rssi_avg >= (main_rssi_avg - 3))) ||
(set2 && (alt_rssi_avg >= (main_rssi_avg + 3))))
result = true;
break; break;
} }
...@@ -632,8 +649,7 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) ...@@ -632,8 +649,7 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
} }
if (!antcomb->scan) { if (!antcomb->scan) {
if (ath_ant_div_comb_alt_check(div_ant_conf.div_group, if (ath_ant_div_comb_alt_check(div_ant_conf, alt_ratio,
alt_ratio, curr_main_set, curr_alt_set,
alt_rssi_avg, main_rssi_avg)) { alt_rssi_avg, main_rssi_avg)) {
if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) { if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) {
/* Switch main and alt LNA */ /* Switch main and alt LNA */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment