ath9k: Add support for AR9565 v1.0.1 LNA diversity
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Mon, 2 Sep 2013 08:29:03 +0000 (13:59 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 26 Sep 2013 19:13:28 +0000 (15:13 -0400)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/antenna.c
drivers/net/wireless/ath/ath9k/ar9002_phy.c
drivers/net/wireless/ath/ath9k/ar9003_phy.c
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/hw.h

index dd1cc73d7946104d2353a777586c6da4bf3c6f67..bd048cc69a334d6234b6967ecff5e1aec8b75fbe 100644 (file)
@@ -332,7 +332,7 @@ static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb,
                }
 
                if (antcomb->rssi_lna2 > antcomb->rssi_lna1 +
-                   ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA)
+                   div_ant_conf->lna1_lna2_switch_delta)
                        div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2;
                else
                        div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1;
@@ -554,42 +554,22 @@ static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf,
                        ant_conf->fast_div_bias = 0x1;
                        break;
                case 0x10: /* LNA2 A-B */
-                       if ((antcomb->scan == 0) &&
-                           (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
-                               ant_conf->fast_div_bias = 0x3f;
-                       } else {
-                               ant_conf->fast_div_bias = 0x1;
-                       }
+                       ant_conf->fast_div_bias = 0x2;
                        break;
                case 0x12: /* LNA2 LNA1 */
-                       ant_conf->fast_div_bias = 0x39;
+                       ant_conf->fast_div_bias = 0x3f;
                        break;
                case 0x13: /* LNA2 A+B */
-                       if ((antcomb->scan == 0) &&
-                           (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
-                               ant_conf->fast_div_bias = 0x3f;
-                       } else {
-                               ant_conf->fast_div_bias = 0x1;
-                       }
+                       ant_conf->fast_div_bias = 0x2;
                        break;
                case 0x20: /* LNA1 A-B */
-                       if ((antcomb->scan == 0) &&
-                           (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
-                               ant_conf->fast_div_bias = 0x3f;
-                       } else {
-                               ant_conf->fast_div_bias = 0x4;
-                       }
+                       ant_conf->fast_div_bias = 0x3;
                        break;
                case 0x21: /* LNA1 LNA2 */
-                       ant_conf->fast_div_bias = 0x6;
+                       ant_conf->fast_div_bias = 0x3;
                        break;
                case 0x23: /* LNA1 A+B */
-                       if ((antcomb->scan == 0) &&
-                           (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
-                               ant_conf->fast_div_bias = 0x3f;
-                       } else {
-                               ant_conf->fast_div_bias = 0x6;
-                       }
+                       ant_conf->fast_div_bias = 0x3;
                        break;
                case 0x30: /* A+B A-B */
                        ant_conf->fast_div_bias = 0x1;
@@ -638,7 +618,7 @@ static void ath_ant_try_scan(struct ath_ant_comb *antcomb,
                antcomb->rssi_sub = alt_rssi_avg;
                antcomb->scan = false;
                if (antcomb->rssi_lna2 >
-                   (antcomb->rssi_lna1 + ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA)) {
+                   (antcomb->rssi_lna1 + conf->lna1_lna2_switch_delta)) {
                        /* use LNA2 as main LNA */
                        if ((antcomb->rssi_add > antcomb->rssi_lna1) &&
                            (antcomb->rssi_add > antcomb->rssi_sub)) {
index 1fc1fa955d44fff8ddd60e7f231701f873df5473..7a5569b679b2c07b64a855062d9eecc5240b9cd5 100644 (file)
@@ -532,6 +532,7 @@ static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah,
                                 AR_PHY_9285_ANT_DIV_ALT_LNACONF_S;
        antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >>
                                  AR_PHY_9285_FAST_DIV_BIAS_S;
+       antconf->lna1_lna2_switch_delta = -1;
        antconf->lna1_lna2_delta = -3;
        antconf->div_group = 0;
 }
index 9ca9b2cd9cb6adb4a2e1dd41849472d3e46e67bc..b8a279e889c18a8025d33e571c13518233a880fb 100644 (file)
@@ -1375,15 +1375,19 @@ static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah,
                                  AR_PHY_ANT_FAST_DIV_BIAS_S;
 
        if (AR_SREV_9330_11(ah)) {
+               antconf->lna1_lna2_switch_delta = -1;
                antconf->lna1_lna2_delta = -9;
                antconf->div_group = 1;
        } else if (AR_SREV_9485(ah)) {
+               antconf->lna1_lna2_switch_delta = -1;
                antconf->lna1_lna2_delta = -9;
                antconf->div_group = 2;
        } else if (AR_SREV_9565(ah)) {
-               antconf->lna1_lna2_delta = -3;
+               antconf->lna1_lna2_switch_delta = 3;
+               antconf->lna1_lna2_delta = -9;
                antconf->div_group = 3;
        } else {
+               antconf->lna1_lna2_switch_delta = -1;
                antconf->lna1_lna2_delta = -3;
                antconf->div_group = 0;
        }
index 2ee35f677c0e8843cdc66534fd40cde15755275b..74a87702979ab14725c9f7f16aaf1a16627564c7 100644 (file)
@@ -581,7 +581,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc)
 #define ATH_ANT_DIV_COMB_ALT_ANT_RATIO_LOW_RSSI 50
 #define ATH_ANT_DIV_COMB_ALT_ANT_RATIO2_LOW_RSSI 50
 
-#define ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA -1
 #define ATH_ANT_DIV_COMB_LNA1_DELTA_HI -4
 #define ATH_ANT_DIV_COMB_LNA1_DELTA_MID -2
 #define ATH_ANT_DIV_COMB_LNA1_DELTA_LOW 2
index 69a907b55a73b129fae1171f2d9859a3303ec3e7..88f67c39f94c2539ba5efe2f6f4c3552357f88ec 100644 (file)
@@ -558,6 +558,7 @@ struct ath_hw_antcomb_conf {
        u8 main_gaintb;
        u8 alt_gaintb;
        int lna1_lna2_delta;
+       int lna1_lna2_switch_delta;
        u8 div_group;
 };