Lines Matching +full:pre +full:- +full:calibration

20  * TX polling - checks if the TX engine is stuck somewhere
28 if (sc->tx99_state) in ath_tx_complete_check()
32 txq = sc->tx.txq_map[i]; in ath_tx_complete_check()
35 if (txq->axq_depth) { in ath_tx_complete_check()
36 if (txq->axq_tx_inprogress) { in ath_tx_complete_check()
41 txq->axq_tx_inprogress = true; in ath_tx_complete_check()
49 ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, in ath_tx_complete_check()
65 ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work, in ath_hw_check_work()
74 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_check()
80 is_alive = ath9k_hw_check_alive(sc->sc_ah); in ath_hw_check()
95 * PLL-WAR for AR9485/AR9340
100 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_pll_rx_hang_check()
122 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_pll_work()
129 if (!test_bit(ATH_OP_BEACONS, &common->op_flags)) in ath_hw_pll_work()
132 if (sc->tx99_state) in ath_hw_pll_work()
136 pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah); in ath_hw_pll_work()
141 ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, in ath_hw_pll_work()
146 * PA Pre-distortion.
150 struct ath_hw *ah = sc->sc_ah; in ath_paprd_activate()
152 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath_paprd_activate()
155 if (!caldata || !test_bit(PAPRD_DONE, &caldata->cal_flags)) { in ath_paprd_activate()
162 if (!(ah->txchainmask & BIT(chain))) in ath_paprd_activate()
174 struct ieee80211_hw *hw = sc->hw; in ath_paprd_send_frame()
176 struct ath_hw *ah = sc->sc_ah; in ath_paprd_send_frame()
182 txctl.txq = sc->tx.txq_map[IEEE80211_AC_BE]; in ath_paprd_send_frame()
185 tx_info->band = sc->cur_chandef.chan->band; in ath_paprd_send_frame()
186 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; in ath_paprd_send_frame()
187 tx_info->control.rates[0].idx = 0; in ath_paprd_send_frame()
188 tx_info->control.rates[0].count = 1; in ath_paprd_send_frame()
189 tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS; in ath_paprd_send_frame()
190 tx_info->control.rates[1].idx = -1; in ath_paprd_send_frame()
192 init_completion(&sc->paprd_complete); in ath_paprd_send_frame()
201 time_left = wait_for_completion_timeout(&sc->paprd_complete, in ath_paprd_send_frame()
215 struct ieee80211_hw *hw = sc->hw; in ath_paprd_calibrate()
216 struct ath_hw *ah = sc->sc_ah; in ath_paprd_calibrate()
219 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath_paprd_calibrate()
228 !test_bit(PAPRD_PACKET_SENT, &caldata->cal_flags) || in ath_paprd_calibrate()
229 test_bit(PAPRD_DONE, &caldata->cal_flags)) { in ath_paprd_calibrate()
230 ath_dbg(common, CALIBRATE, "Skipping PAPRD calibration\n"); in ath_paprd_calibrate()
244 memset(skb->data, 0, len); in ath_paprd_calibrate()
245 hdr = (struct ieee80211_hdr *)skb->data; in ath_paprd_calibrate()
247 hdr->frame_control = cpu_to_le16(ftype); in ath_paprd_calibrate()
248 hdr->duration_id = cpu_to_le16(10); in ath_paprd_calibrate()
249 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
250 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
251 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
254 if (!(ah->txchainmask & BIT(chain))) in ath_paprd_calibrate()
272 if (ret == -EINPROGRESS) { in ath_paprd_calibrate()
274 "PAPRD curve on chain %d needs to be re-trained\n", in ath_paprd_calibrate()
289 set_bit(PAPRD_DONE, &caldata->cal_flags); in ath_paprd_calibrate()
298 * ANI performs periodic noise floor calibration
307 struct ath_softc *sc = (struct ath_softc *)common->priv; in ath_ani_calibrate()
308 struct ath_hw *ah = sc->sc_ah; in ath_ani_calibrate()
316 if (ah->caldata && test_bit(NFCAL_INTF, &ah->caldata->cal_flags)) in ath_ani_calibrate()
321 short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? in ath_ani_calibrate()
325 if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) { in ath_ani_calibrate()
326 if (++ah->ani_skip_count >= ATH_ANI_MAX_SKIP_COUNT) { in ath_ani_calibrate()
327 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
328 sc->ps_flags |= PS_WAIT_FOR_ANI; in ath_ani_calibrate()
329 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
333 ah->ani_skip_count = 0; in ath_ani_calibrate()
334 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
335 sc->ps_flags &= ~PS_WAIT_FOR_ANI; in ath_ani_calibrate()
336 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
340 /* Long calibration runs independently of short calibration. */ in ath_ani_calibrate()
341 if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) { in ath_ani_calibrate()
343 common->ani.longcal_timer = timestamp; in ath_ani_calibrate()
346 /* Short calibration applies only while caldone is false */ in ath_ani_calibrate()
347 if (!common->ani.caldone) { in ath_ani_calibrate()
348 if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { in ath_ani_calibrate()
350 common->ani.shortcal_timer = timestamp; in ath_ani_calibrate()
351 common->ani.resetcal_timer = timestamp; in ath_ani_calibrate()
354 if ((timestamp - common->ani.resetcal_timer) >= in ath_ani_calibrate()
356 common->ani.caldone = ath9k_hw_reset_calvalid(ah); in ath_ani_calibrate()
357 if (common->ani.caldone) in ath_ani_calibrate()
358 common->ani.resetcal_timer = timestamp; in ath_ani_calibrate()
363 if ((timestamp - common->ani.checkani_timer) >= ah->config.ani_poll_interval) { in ath_ani_calibrate()
365 common->ani.checkani_timer = timestamp; in ath_ani_calibrate()
370 spin_lock_irqsave(&common->cc_lock, flags); in ath_ani_calibrate()
371 ath9k_hw_ani_monitor(ah, ah->curchan); in ath_ani_calibrate()
373 spin_unlock_irqrestore(&common->cc_lock, flags); in ath_ani_calibrate()
376 /* Perform calibration if necessary */ in ath_ani_calibrate()
378 int ret = ath9k_hw_calibrate(ah, ah->curchan, ah->rxchainmask, in ath_ani_calibrate()
381 common->ani.caldone = 0; in ath_ani_calibrate()
386 common->ani.caldone = ret; in ath_ani_calibrate()
390 "Calibration @%lu finished: %s %s %s, caldone: %s\n", in ath_ani_calibrate()
393 aniflag ? "ani" : "", common->ani.caldone ? "true" : "false"); in ath_ani_calibrate()
401 * short calibration and long calibration. in ath_ani_calibrate()
404 cal_interval = min(cal_interval, (u32)ah->config.ani_poll_interval); in ath_ani_calibrate()
405 if (!common->ani.caldone) in ath_ani_calibrate()
408 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); in ath_ani_calibrate()
410 if (ar9003_is_paprd_enabled(ah) && ah->caldata) { in ath_ani_calibrate()
411 if (!test_bit(PAPRD_DONE, &ah->caldata->cal_flags)) { in ath_ani_calibrate()
412 ieee80211_queue_work(sc->hw, &sc->paprd_work); in ath_ani_calibrate()
413 } else if (!ah->paprd_table_write_done) { in ath_ani_calibrate()
423 struct ath_hw *ah = sc->sc_ah; in ath_start_ani()
427 if (common->disable_ani || in ath_start_ani()
428 !test_bit(ATH_OP_ANI_RUN, &common->op_flags) || in ath_start_ani()
429 sc->cur_chan->offchannel) in ath_start_ani()
432 common->ani.longcal_timer = timestamp; in ath_start_ani()
433 common->ani.shortcal_timer = timestamp; in ath_start_ani()
434 common->ani.checkani_timer = timestamp; in ath_start_ani()
437 mod_timer(&common->ani.timer, in ath_start_ani()
438 jiffies + msecs_to_jiffies((u32)ah->config.ani_poll_interval)); in ath_start_ani()
443 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_stop_ani()
446 del_timer_sync(&common->ani.timer); in ath_stop_ani()
451 struct ath_hw *ah = sc->sc_ah; in ath_check_ani()
452 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_check_ani()
453 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath_check_ani()
459 if (ah->opmode == NL80211_IFTYPE_ADHOC) { in ath_check_ani()
460 if (!cur_conf->enable_beacon) in ath_check_ani()
462 } else if (ah->opmode == NL80211_IFTYPE_AP) { in ath_check_ani()
463 if (!cur_conf->enable_beacon) { in ath_check_ani()
468 if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) in ath_check_ani()
471 } else if (ah->opmode == NL80211_IFTYPE_STATION) { in ath_check_ani()
472 if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) in ath_check_ani()
476 if (!test_bit(ATH_OP_ANI_RUN, &common->op_flags)) { in ath_check_ani()
477 set_bit(ATH_OP_ANI_RUN, &common->op_flags); in ath_check_ani()
484 clear_bit(ATH_OP_ANI_RUN, &common->op_flags); in ath_check_ani()
490 struct ath_hw *ah = sc->sc_ah; in ath_update_survey_nf()
491 struct ath9k_channel *chan = &ah->channels[channel]; in ath_update_survey_nf()
492 struct survey_info *survey = &sc->survey[channel]; in ath_update_survey_nf()
494 if (chan->noisefloor) { in ath_update_survey_nf()
495 survey->filled |= SURVEY_INFO_NOISE_DBM; in ath_update_survey_nf()
496 survey->noise = ath9k_hw_getchan_noise(ah, chan, in ath_update_survey_nf()
497 chan->noisefloor); in ath_update_survey_nf()
504 * result to be useful, -1 otherwise.
508 struct ath_hw *ah = sc->sc_ah; in ath_update_survey_stats()
510 int pos = ah->curchan - &ah->channels[0]; in ath_update_survey_stats()
511 struct survey_info *survey = &sc->survey[pos]; in ath_update_survey_stats()
512 struct ath_cycle_counters *cc = &common->cc_survey; in ath_update_survey_stats()
513 unsigned int div = common->clockrate * 1000; in ath_update_survey_stats()
516 if (!ah->curchan) in ath_update_survey_stats()
517 return -1; in ath_update_survey_stats()
519 if (ah->power_mode == ATH9K_PM_AWAKE) in ath_update_survey_stats()
522 if (cc->cycles > 0) { in ath_update_survey_stats()
523 survey->filled |= SURVEY_INFO_TIME | in ath_update_survey_stats()
527 survey->time += cc->cycles / div; in ath_update_survey_stats()
528 survey->time_busy += cc->rx_busy / div; in ath_update_survey_stats()
529 survey->time_rx += cc->rx_frame / div; in ath_update_survey_stats()
530 survey->time_tx += cc->tx_frame / div; in ath_update_survey_stats()
533 if (cc->cycles < div) in ath_update_survey_stats()
534 return -1; in ath_update_survey_stats()
536 if (cc->cycles > 0) in ath_update_survey_stats()
537 ret = cc->rx_busy * 100 / cc->cycles; in ath_update_survey_stats()