Lines Matching refs:ah

66 ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)  in ath5k_ani_set_noise_immunity_level()  argument
86 ATH5K_ERR(ah, "noise immunity level %d out of range", in ath5k_ani_set_noise_immunity_level()
91 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, in ath5k_ani_set_noise_immunity_level()
93 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE, in ath5k_ani_set_noise_immunity_level()
95 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE, in ath5k_ani_set_noise_immunity_level()
97 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG, in ath5k_ani_set_noise_immunity_level()
100 ah->ani_state.noise_imm_level = level; in ath5k_ani_set_noise_immunity_level()
101 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); in ath5k_ani_set_noise_immunity_level()
111 ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level) in ath5k_ani_set_spur_immunity_level() argument
116 level > ah->ani_state.max_spur_level) { in ath5k_ani_set_spur_immunity_level()
117 ATH5K_ERR(ah, "spur immunity level %d out of range", in ath5k_ani_set_spur_immunity_level()
122 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR, in ath5k_ani_set_spur_immunity_level()
125 ah->ani_state.spur_level = level; in ath5k_ani_set_spur_immunity_level()
126 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); in ath5k_ani_set_spur_immunity_level()
135 ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level) in ath5k_ani_set_firstep_level() argument
140 ATH5K_ERR(ah, "firstep level %d out of range", level); in ath5k_ani_set_firstep_level()
144 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG, in ath5k_ani_set_firstep_level()
147 ah->ani_state.firstep_level = level; in ath5k_ani_set_firstep_level()
148 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); in ath5k_ani_set_firstep_level()
157 ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on) in ath5k_ani_set_ofdm_weak_signal_detection() argument
166 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
168 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
170 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
172 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
174 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
176 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
180 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
183 AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, in ath5k_ani_set_ofdm_weak_signal_detection()
186 ah->ani_state.ofdm_weak_sig = on; in ath5k_ani_set_ofdm_weak_signal_detection()
187 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s", in ath5k_ani_set_ofdm_weak_signal_detection()
197 ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on) in ath5k_ani_set_cck_weak_signal_detection() argument
200 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_CCK_CROSSCORR, in ath5k_ani_set_cck_weak_signal_detection()
202 ah->ani_state.cck_weak_sig = on; in ath5k_ani_set_cck_weak_signal_detection()
203 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s", in ath5k_ani_set_cck_weak_signal_detection()
223 ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as, in ath5k_ani_raise_immunity() argument
226 int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg); in ath5k_ani_raise_immunity()
228 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)", in ath5k_ani_raise_immunity()
233 ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level + 1); in ath5k_ani_raise_immunity()
239 as->spur_level < ah->ani_state.max_spur_level) { in ath5k_ani_raise_immunity()
240 ath5k_ani_set_spur_immunity_level(ah, as->spur_level + 1); in ath5k_ani_raise_immunity()
245 if (ah->opmode == NL80211_IFTYPE_AP) { in ath5k_ani_raise_immunity()
247 ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); in ath5k_ani_raise_immunity()
258 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_raise_immunity()
263 ath5k_ani_set_ofdm_weak_signal_detection(ah, false); in ath5k_ani_raise_immunity()
264 ath5k_ani_set_spur_immunity_level(ah, 0); in ath5k_ani_raise_immunity()
269 ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); in ath5k_ani_raise_immunity()
275 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_raise_immunity()
278 ath5k_ani_set_ofdm_weak_signal_detection(ah, true); in ath5k_ani_raise_immunity()
280 ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); in ath5k_ani_raise_immunity()
282 } else if (ah->ah_current_channel->band == NL80211_BAND_2GHZ) { in ath5k_ani_raise_immunity()
285 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_raise_immunity()
288 ath5k_ani_set_ofdm_weak_signal_detection(ah, false); in ath5k_ani_raise_immunity()
290 ath5k_ani_set_firstep_level(ah, 0); in ath5k_ani_raise_immunity()
310 ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as) in ath5k_ani_lower_immunity() argument
312 int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg); in ath5k_ani_lower_immunity()
314 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity"); in ath5k_ani_lower_immunity()
316 if (ah->opmode == NL80211_IFTYPE_AP) { in ath5k_ani_lower_immunity()
319 ath5k_ani_set_firstep_level(ah, as->firstep_level - 1); in ath5k_ani_lower_immunity()
332 ath5k_ani_set_ofdm_weak_signal_detection(ah, in ath5k_ani_lower_immunity()
337 ath5k_ani_set_firstep_level(ah, in ath5k_ani_lower_immunity()
344 ath5k_ani_set_firstep_level(ah, in ath5k_ani_lower_immunity()
353 ath5k_ani_set_spur_immunity_level(ah, as->spur_level - 1); in ath5k_ani_lower_immunity()
359 ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level - 1); in ath5k_ani_lower_immunity()
374 ath5k_hw_ani_get_listen_time(struct ath5k_hw *ah, struct ath5k_ani_state *as) in ath5k_hw_ani_get_listen_time() argument
376 struct ath_common *common = ath5k_hw_common(ah); in ath5k_hw_ani_get_listen_time()
406 ath5k_ani_save_and_clear_phy_errors(struct ath5k_hw *ah, in ath5k_ani_save_and_clear_phy_errors() argument
411 if (!ah->ah_capabilities.cap_has_phyerr_counters) in ath5k_ani_save_and_clear_phy_errors()
414 ofdm_err = ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1); in ath5k_ani_save_and_clear_phy_errors()
415 cck_err = ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2); in ath5k_ani_save_and_clear_phy_errors()
418 ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_OFDM_TRIG_HIGH, in ath5k_ani_save_and_clear_phy_errors()
420 ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_CCK_TRIG_HIGH, in ath5k_ani_save_and_clear_phy_errors()
475 ath5k_ani_calibration(struct ath5k_hw *ah) in ath5k_ani_calibration() argument
477 struct ath5k_ani_state *as = &ah->ani_state; in ath5k_ani_calibration()
483 listen = ath5k_hw_ani_get_listen_time(ah, as); in ath5k_ani_calibration()
489 ath5k_ani_save_and_clear_phy_errors(ah, as); in ath5k_ani_calibration()
496 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_calibration()
498 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_calibration()
505 ath5k_ani_raise_immunity(ah, as, ofdm_flag); in ath5k_ani_calibration()
511 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_calibration()
516 ath5k_ani_lower_immunity(ah, as); in ath5k_ani_calibration()
539 ath5k_ani_mib_intr(struct ath5k_hw *ah) in ath5k_ani_mib_intr() argument
541 struct ath5k_ani_state *as = &ah->ani_state; in ath5k_ani_mib_intr()
545 if (!ah->ah_capabilities.cap_has_phyerr_counters) in ath5k_ani_mib_intr()
549 ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); in ath5k_ani_mib_intr()
550 ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); in ath5k_ani_mib_intr()
552 if (ah->ani_state.ani_mode != ATH5K_ANI_MODE_AUTO) in ath5k_ani_mib_intr()
558 if (ath5k_ani_save_and_clear_phy_errors(ah, as) == 0) in ath5k_ani_mib_intr()
563 tasklet_schedule(&ah->ani_tasklet); in ath5k_ani_mib_intr()
576 ath5k_ani_phy_error_report(struct ath5k_hw *ah, in ath5k_ani_phy_error_report() argument
579 struct ath5k_ani_state *as = &ah->ani_state; in ath5k_ani_phy_error_report()
584 tasklet_schedule(&ah->ani_tasklet); in ath5k_ani_phy_error_report()
588 tasklet_schedule(&ah->ani_tasklet); in ath5k_ani_phy_error_report()
604 ath5k_enable_phy_err_counters(struct ath5k_hw *ah) in ath5k_enable_phy_err_counters() argument
606 ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_OFDM_TRIG_HIGH, in ath5k_enable_phy_err_counters()
608 ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_CCK_TRIG_HIGH, in ath5k_enable_phy_err_counters()
610 ath5k_hw_reg_write(ah, AR5K_PHY_ERR_FIL_OFDM, AR5K_PHYERR_CNT1_MASK); in ath5k_enable_phy_err_counters()
611 ath5k_hw_reg_write(ah, AR5K_PHY_ERR_FIL_CCK, AR5K_PHYERR_CNT2_MASK); in ath5k_enable_phy_err_counters()
614 ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); in ath5k_enable_phy_err_counters()
615 ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); in ath5k_enable_phy_err_counters()
625 ath5k_disable_phy_err_counters(struct ath5k_hw *ah) in ath5k_disable_phy_err_counters() argument
627 ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT1); in ath5k_disable_phy_err_counters()
628 ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT2); in ath5k_disable_phy_err_counters()
629 ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT1_MASK); in ath5k_disable_phy_err_counters()
630 ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT2_MASK); in ath5k_disable_phy_err_counters()
633 ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); in ath5k_disable_phy_err_counters()
634 ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); in ath5k_disable_phy_err_counters()
645 ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode) in ath5k_ani_init() argument
648 if (ah->ah_version < AR5K_AR5212) in ath5k_ani_init()
652 ATH5K_ERR(ah, "ANI mode %d out of range", mode); in ath5k_ani_init()
657 memset(&ah->ani_state, 0, sizeof(ah->ani_state)); in ath5k_ani_init()
660 if (ah->ah_mac_srev < AR5K_SREV_AR2414) in ath5k_ani_init()
661 ah->ani_state.max_spur_level = 7; in ath5k_ani_init()
663 ah->ani_state.max_spur_level = 2; in ath5k_ani_init()
667 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI off\n"); in ath5k_ani_init()
669 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_init()
671 ath5k_ani_set_noise_immunity_level(ah, 0); in ath5k_ani_init()
672 ath5k_ani_set_spur_immunity_level(ah, 0); in ath5k_ani_init()
673 ath5k_ani_set_firstep_level(ah, 0); in ath5k_ani_init()
674 ath5k_ani_set_ofdm_weak_signal_detection(ah, true); in ath5k_ani_init()
675 ath5k_ani_set_cck_weak_signal_detection(ah, true); in ath5k_ani_init()
677 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, in ath5k_ani_init()
679 ath5k_ani_set_noise_immunity_level(ah, in ath5k_ani_init()
681 ath5k_ani_set_spur_immunity_level(ah, in ath5k_ani_init()
682 ah->ani_state.max_spur_level); in ath5k_ani_init()
683 ath5k_ani_set_firstep_level(ah, ATH5K_ANI_MAX_FIRSTEP_LVL); in ath5k_ani_init()
684 ath5k_ani_set_ofdm_weak_signal_detection(ah, false); in ath5k_ani_init()
685 ath5k_ani_set_cck_weak_signal_detection(ah, false); in ath5k_ani_init()
687 ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI auto\n"); in ath5k_ani_init()
688 ath5k_ani_set_noise_immunity_level(ah, 0); in ath5k_ani_init()
689 ath5k_ani_set_spur_immunity_level(ah, 0); in ath5k_ani_init()
690 ath5k_ani_set_firstep_level(ah, 0); in ath5k_ani_init()
691 ath5k_ani_set_ofdm_weak_signal_detection(ah, true); in ath5k_ani_init()
692 ath5k_ani_set_cck_weak_signal_detection(ah, false); in ath5k_ani_init()
700 if (ah->ah_capabilities.cap_has_phyerr_counters) in ath5k_ani_init()
701 ath5k_enable_phy_err_counters(ah); in ath5k_ani_init()
703 ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) | in ath5k_ani_init()
706 if (ah->ah_capabilities.cap_has_phyerr_counters) in ath5k_ani_init()
707 ath5k_disable_phy_err_counters(ah); in ath5k_ani_init()
709 ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) & in ath5k_ani_init()
713 ah->ani_state.ani_mode = mode; in ath5k_ani_init()
730 ath5k_ani_print_counters(struct ath5k_hw *ah) in ath5k_ani_print_counters() argument
733 pr_notice("ACK fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_ACK_FAIL)); in ath5k_ani_print_counters()
734 pr_notice("RTS fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_FAIL)); in ath5k_ani_print_counters()
735 pr_notice("RTS success\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_OK)); in ath5k_ani_print_counters()
736 pr_notice("FCS error\t%d\n", ath5k_hw_reg_read(ah, AR5K_FCS_FAIL)); in ath5k_ani_print_counters()
739 pr_notice("tx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_TX)); in ath5k_ani_print_counters()
740 pr_notice("rx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RX)); in ath5k_ani_print_counters()
741 pr_notice("busy\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RXCLR)); in ath5k_ani_print_counters()
742 pr_notice("cycles\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_CYCLE)); in ath5k_ani_print_counters()
745 ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1)); in ath5k_ani_print_counters()
747 ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2)); in ath5k_ani_print_counters()
749 ath5k_hw_reg_read(ah, AR5K_OFDM_FIL_CNT)); in ath5k_ani_print_counters()
751 ath5k_hw_reg_read(ah, AR5K_CCK_FIL_CNT)); in ath5k_ani_print_counters()