aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Shafi Shajakhan <mshajakhan@atheros.com>2011-05-13 11:01:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-16 14:10:46 -0400
commitb85c5734f00886ee0f33ef4d0038ed9a278eefce (patch)
tree8243a908c73cd799d45fb703e98a8ff60daca045
parent8afbcc8bfb549a522298fa4a31ee5155c2b5f7a0 (diff)
ath9k: Implement an API to swap main/ALT LNA's
for the diversity group 2(AR9485) we swap the LNA's of main/ALT antenna based on alternate antenna's rssi average in comparision with main antenna's rssi, while for AR9285(antenna diversity group 0)we still follow the older method of looking at the packet count in alternate antenna Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com> Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com> Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c31
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
31static 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
31static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) 58static 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 =