/* * Copyright (c) 2012 Qualcomm Atheros, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "ath9k.h" /* * AR9285 * ====== * * EEPROM has 2 4-bit fields containing the card configuration. * * antdiv_ctl1: * ------------ * bb_enable_ant_div_lnadiv : 1 * bb_ant_div_alt_gaintb : 1 * bb_ant_div_main_gaintb : 1 * bb_enable_ant_fast_div : 1 * * antdiv_ctl2: * ----------- * bb_ant_div_alt_lnaconf : 2 * bb_ant_div_main_lnaconf : 2 * * The EEPROM bits are used as follows: * ------------------------------------ * * bb_enable_ant_div_lnadiv - Enable LNA path rx antenna diversity/combining. * Set in AR_PHY_MULTICHAIN_GAIN_CTL. * * bb_ant_div_[alt/main]_gaintb - 0 -> Antenna config Alt/Main uses gaintable 0 * 1 -> Antenna config Alt/Main uses gaintable 1 * Set in AR_PHY_MULTICHAIN_GAIN_CTL. * * bb_enable_ant_fast_div - Enable fast antenna diversity. * Set in AR_PHY_CCK_DETECT. * * bb_ant_div_[alt/main]_lnaconf - Alt/Main LNA diversity/combining input config. * Set in AR_PHY_MULTICHAIN_GAIN_CTL. * 10=LNA1 * 01=LNA2 * 11=LNA1+LNA2 * 00=LNA1-LNA2 * * AR9485 / AR9565 / AR9331 * ======================== * * The same bits are present in the EEPROM, but the location in the * EEPROM is different (ant_div_control in ar9300_BaseExtension_1). * * ant_div_alt_lnaconf ==> bit 0~1 * ant_div_main_lnaconf ==> bit 2~3 * ant_div_alt_gaintb ==> bit 4 * ant_div_main_gaintb ==> bit 5 * enable_ant_div_lnadiv ==> bit 6 * enable_ant_fast_div ==> bit 7 */ static inline bool ath_is_alt_ant_ratio_better(struct ath_ant_comb *antcomb, int alt_ratio, int maxdelta, int mindelta, int main_rssi_avg, int alt_rssi_avg, int pkt_count) { … } static inline bool ath_ant_div_comb_alt_check(struct ath_hw_antcomb_conf *conf, struct ath_ant_comb *antcomb, int alt_ratio, int alt_rssi_avg, int main_rssi_avg) { … } static void ath_lnaconf_alt_good_scan(struct ath_ant_comb *antcomb, struct ath_hw_antcomb_conf ant_conf, int main_rssi_avg) { … } static void ath_ant_set_alt_ratio(struct ath_ant_comb *antcomb, struct ath_hw_antcomb_conf *conf) { … } static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb, struct ath_hw_antcomb_conf *div_ant_conf, int main_rssi_avg, int alt_rssi_avg, int alt_ratio) { … } static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf, struct ath_ant_comb *antcomb, int alt_ratio) { … } static void ath_ant_try_scan(struct ath_ant_comb *antcomb, struct ath_hw_antcomb_conf *conf, int curr_alt_set, int alt_rssi_avg, int main_rssi_avg) { … } static bool ath_ant_try_switch(struct ath_hw_antcomb_conf *div_ant_conf, struct ath_ant_comb *antcomb, int alt_ratio, int alt_rssi_avg, int main_rssi_avg, int curr_main_set, int curr_alt_set) { … } static bool ath_ant_short_scan_check(struct ath_ant_comb *antcomb) { … } void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) { … }