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

ath9k: Add support for AR9565 v1.0.1 LNA diversity

Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6ac21509
...@@ -332,7 +332,7 @@ static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb, ...@@ -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 + 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; div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2;
else else
div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; 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, ...@@ -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; ant_conf->fast_div_bias = 0x1;
break; break;
case 0x10: /* LNA2 A-B */ case 0x10: /* LNA2 A-B */
if ((antcomb->scan == 0) && ant_conf->fast_div_bias = 0x2;
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
ant_conf->fast_div_bias = 0x3f;
} else {
ant_conf->fast_div_bias = 0x1;
}
break; break;
case 0x12: /* LNA2 LNA1 */ case 0x12: /* LNA2 LNA1 */
ant_conf->fast_div_bias = 0x39; ant_conf->fast_div_bias = 0x3f;
break; break;
case 0x13: /* LNA2 A+B */ case 0x13: /* LNA2 A+B */
if ((antcomb->scan == 0) && ant_conf->fast_div_bias = 0x2;
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
ant_conf->fast_div_bias = 0x3f;
} else {
ant_conf->fast_div_bias = 0x1;
}
break; break;
case 0x20: /* LNA1 A-B */ case 0x20: /* LNA1 A-B */
if ((antcomb->scan == 0) && ant_conf->fast_div_bias = 0x3;
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
ant_conf->fast_div_bias = 0x3f;
} else {
ant_conf->fast_div_bias = 0x4;
}
break; break;
case 0x21: /* LNA1 LNA2 */ case 0x21: /* LNA1 LNA2 */
ant_conf->fast_div_bias = 0x6; ant_conf->fast_div_bias = 0x3;
break; break;
case 0x23: /* LNA1 A+B */ case 0x23: /* LNA1 A+B */
if ((antcomb->scan == 0) && ant_conf->fast_div_bias = 0x3;
(alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) {
ant_conf->fast_div_bias = 0x3f;
} else {
ant_conf->fast_div_bias = 0x6;
}
break; break;
case 0x30: /* A+B A-B */ case 0x30: /* A+B A-B */
ant_conf->fast_div_bias = 0x1; ant_conf->fast_div_bias = 0x1;
...@@ -638,7 +618,7 @@ static void ath_ant_try_scan(struct ath_ant_comb *antcomb, ...@@ -638,7 +618,7 @@ static void ath_ant_try_scan(struct ath_ant_comb *antcomb,
antcomb->rssi_sub = alt_rssi_avg; antcomb->rssi_sub = alt_rssi_avg;
antcomb->scan = false; antcomb->scan = false;
if (antcomb->rssi_lna2 > 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 */ /* use LNA2 as main LNA */
if ((antcomb->rssi_add > antcomb->rssi_lna1) && if ((antcomb->rssi_add > antcomb->rssi_lna1) &&
(antcomb->rssi_add > antcomb->rssi_sub)) { (antcomb->rssi_add > antcomb->rssi_sub)) {
......
...@@ -532,6 +532,7 @@ static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah, ...@@ -532,6 +532,7 @@ static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah,
AR_PHY_9285_ANT_DIV_ALT_LNACONF_S; AR_PHY_9285_ANT_DIV_ALT_LNACONF_S;
antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >> antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >>
AR_PHY_9285_FAST_DIV_BIAS_S; AR_PHY_9285_FAST_DIV_BIAS_S;
antconf->lna1_lna2_switch_delta = -1;
antconf->lna1_lna2_delta = -3; antconf->lna1_lna2_delta = -3;
antconf->div_group = 0; antconf->div_group = 0;
} }
......
...@@ -1375,15 +1375,19 @@ static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah, ...@@ -1375,15 +1375,19 @@ static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah,
AR_PHY_ANT_FAST_DIV_BIAS_S; AR_PHY_ANT_FAST_DIV_BIAS_S;
if (AR_SREV_9330_11(ah)) { if (AR_SREV_9330_11(ah)) {
antconf->lna1_lna2_switch_delta = -1;
antconf->lna1_lna2_delta = -9; antconf->lna1_lna2_delta = -9;
antconf->div_group = 1; antconf->div_group = 1;
} else if (AR_SREV_9485(ah)) { } else if (AR_SREV_9485(ah)) {
antconf->lna1_lna2_switch_delta = -1;
antconf->lna1_lna2_delta = -9; antconf->lna1_lna2_delta = -9;
antconf->div_group = 2; antconf->div_group = 2;
} else if (AR_SREV_9565(ah)) { } 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; antconf->div_group = 3;
} else { } else {
antconf->lna1_lna2_switch_delta = -1;
antconf->lna1_lna2_delta = -3; antconf->lna1_lna2_delta = -3;
antconf->div_group = 0; antconf->div_group = 0;
} }
......
...@@ -581,7 +581,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc) ...@@ -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_RATIO_LOW_RSSI 50
#define ATH_ANT_DIV_COMB_ALT_ANT_RATIO2_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_HI -4
#define ATH_ANT_DIV_COMB_LNA1_DELTA_MID -2 #define ATH_ANT_DIV_COMB_LNA1_DELTA_MID -2
#define ATH_ANT_DIV_COMB_LNA1_DELTA_LOW 2 #define ATH_ANT_DIV_COMB_LNA1_DELTA_LOW 2
......
...@@ -558,6 +558,7 @@ struct ath_hw_antcomb_conf { ...@@ -558,6 +558,7 @@ struct ath_hw_antcomb_conf {
u8 main_gaintb; u8 main_gaintb;
u8 alt_gaintb; u8 alt_gaintb;
int lna1_lna2_delta; int lna1_lna2_delta;
int lna1_lna2_switch_delta;
u8 div_group; u8 div_group;
}; };
......
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