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()
59 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_rx_inactive_check()
62 interval = jiffies_to_msecs(jiffies - sc->rx_active_check_time); in ath_hw_rx_inactive_check()
63 count = sc->rx_active_count; in ath_hw_rx_inactive_check()
68 sc->rx_active_count = 0; in ath_hw_rx_inactive_check()
69 sc->rx_active_check_time = jiffies; in ath_hw_rx_inactive_check()
94 ieee80211_queue_delayed_work(sc->hw, &sc->hw_check_work, in ath_hw_check_work()
103 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_check()
109 is_alive = ath9k_hw_check_alive(sc->sc_ah); in ath_hw_check()
124 * PLL-WAR for AR9485/AR9340
129 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_pll_rx_hang_check()
151 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_hw_pll_work()
158 if (!test_bit(ATH_OP_BEACONS, &common->op_flags)) in ath_hw_pll_work()
161 if (sc->tx99_state) in ath_hw_pll_work()
165 pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah); in ath_hw_pll_work()
170 ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, in ath_hw_pll_work()
175 * PA Pre-distortion.
179 struct ath_hw *ah = sc->sc_ah; in ath_paprd_activate()
181 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath_paprd_activate()
184 if (!caldata || !test_bit(PAPRD_DONE, &caldata->cal_flags)) { in ath_paprd_activate()
191 if (!(ah->txchainmask & BIT(chain))) in ath_paprd_activate()
203 struct ieee80211_hw *hw = sc->hw; in ath_paprd_send_frame()
205 struct ath_hw *ah = sc->sc_ah; in ath_paprd_send_frame()
211 txctl.txq = sc->tx.txq_map[IEEE80211_AC_BE]; in ath_paprd_send_frame()
214 tx_info->band = sc->cur_chandef.chan->band; in ath_paprd_send_frame()
215 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; in ath_paprd_send_frame()
216 tx_info->control.rates[0].idx = 0; in ath_paprd_send_frame()
217 tx_info->control.rates[0].count = 1; in ath_paprd_send_frame()
218 tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS; in ath_paprd_send_frame()
219 tx_info->control.rates[1].idx = -1; in ath_paprd_send_frame()
221 init_completion(&sc->paprd_complete); in ath_paprd_send_frame()
230 time_left = wait_for_completion_timeout(&sc->paprd_complete, in ath_paprd_send_frame()
244 struct ieee80211_hw *hw = sc->hw; in ath_paprd_calibrate()
245 struct ath_hw *ah = sc->sc_ah; in ath_paprd_calibrate()
248 struct ath9k_hw_cal_data *caldata = ah->caldata; in ath_paprd_calibrate()
257 !test_bit(PAPRD_PACKET_SENT, &caldata->cal_flags) || in ath_paprd_calibrate()
258 test_bit(PAPRD_DONE, &caldata->cal_flags)) { in ath_paprd_calibrate()
259 ath_dbg(common, CALIBRATE, "Skipping PAPRD calibration\n"); in ath_paprd_calibrate()
273 memset(skb->data, 0, len); in ath_paprd_calibrate()
274 hdr = (struct ieee80211_hdr *)skb->data; in ath_paprd_calibrate()
276 hdr->frame_control = cpu_to_le16(ftype); in ath_paprd_calibrate()
277 hdr->duration_id = cpu_to_le16(10); in ath_paprd_calibrate()
278 memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
279 memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
280 memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); in ath_paprd_calibrate()
283 if (!(ah->txchainmask & BIT(chain))) in ath_paprd_calibrate()
301 if (ret == -EINPROGRESS) { in ath_paprd_calibrate()
303 "PAPRD curve on chain %d needs to be re-trained\n", in ath_paprd_calibrate()
318 set_bit(PAPRD_DONE, &caldata->cal_flags); in ath_paprd_calibrate()
327 * ANI performs periodic noise floor calibration
336 struct ath_softc *sc = common->priv; in ath_ani_calibrate()
337 struct ath_hw *ah = sc->sc_ah; in ath_ani_calibrate()
345 if (ah->caldata && test_bit(NFCAL_INTF, &ah->caldata->cal_flags)) in ath_ani_calibrate()
350 short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? in ath_ani_calibrate()
354 if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) { in ath_ani_calibrate()
355 if (++ah->ani_skip_count >= ATH_ANI_MAX_SKIP_COUNT) { in ath_ani_calibrate()
356 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
357 sc->ps_flags |= PS_WAIT_FOR_ANI; in ath_ani_calibrate()
358 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
362 ah->ani_skip_count = 0; in ath_ani_calibrate()
363 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
364 sc->ps_flags &= ~PS_WAIT_FOR_ANI; in ath_ani_calibrate()
365 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_ani_calibrate()
369 /* Long calibration runs independently of short calibration. */ in ath_ani_calibrate()
370 if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) { in ath_ani_calibrate()
372 common->ani.longcal_timer = timestamp; in ath_ani_calibrate()
375 /* Short calibration applies only while caldone is false */ in ath_ani_calibrate()
376 if (!common->ani.caldone) { in ath_ani_calibrate()
377 if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { in ath_ani_calibrate()
379 common->ani.shortcal_timer = timestamp; in ath_ani_calibrate()
380 common->ani.resetcal_timer = timestamp; in ath_ani_calibrate()
383 if ((timestamp - common->ani.resetcal_timer) >= in ath_ani_calibrate()
385 common->ani.caldone = ath9k_hw_reset_calvalid(ah); in ath_ani_calibrate()
386 if (common->ani.caldone) in ath_ani_calibrate()
387 common->ani.resetcal_timer = timestamp; in ath_ani_calibrate()
392 if ((timestamp - common->ani.checkani_timer) >= ah->config.ani_poll_interval) { in ath_ani_calibrate()
394 common->ani.checkani_timer = timestamp; in ath_ani_calibrate()
399 spin_lock_irqsave(&common->cc_lock, flags); in ath_ani_calibrate()
400 ath9k_hw_ani_monitor(ah, ah->curchan); in ath_ani_calibrate()
402 spin_unlock_irqrestore(&common->cc_lock, flags); in ath_ani_calibrate()
405 /* Perform calibration if necessary */ in ath_ani_calibrate()
407 int ret = ath9k_hw_calibrate(ah, ah->curchan, ah->rxchainmask, in ath_ani_calibrate()
410 common->ani.caldone = 0; in ath_ani_calibrate()
415 common->ani.caldone = ret; in ath_ani_calibrate()
419 "Calibration @%lu finished: %s %s %s, caldone: %s\n", in ath_ani_calibrate()
422 aniflag ? "ani" : "", common->ani.caldone ? "true" : "false"); in ath_ani_calibrate()
430 * short calibration and long calibration. in ath_ani_calibrate()
433 cal_interval = min(cal_interval, (u32)ah->config.ani_poll_interval); in ath_ani_calibrate()
434 if (!common->ani.caldone) in ath_ani_calibrate()
437 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); in ath_ani_calibrate()
439 if (ar9003_is_paprd_enabled(ah) && ah->caldata) { in ath_ani_calibrate()
440 if (!test_bit(PAPRD_DONE, &ah->caldata->cal_flags)) { in ath_ani_calibrate()
441 ieee80211_queue_work(sc->hw, &sc->paprd_work); in ath_ani_calibrate()
442 } else if (!ah->paprd_table_write_done) { in ath_ani_calibrate()
452 struct ath_hw *ah = sc->sc_ah; in ath_start_ani()
456 if (common->disable_ani || in ath_start_ani()
457 !test_bit(ATH_OP_ANI_RUN, &common->op_flags) || in ath_start_ani()
458 sc->cur_chan->offchannel) in ath_start_ani()
461 common->ani.longcal_timer = timestamp; in ath_start_ani()
462 common->ani.shortcal_timer = timestamp; in ath_start_ani()
463 common->ani.checkani_timer = timestamp; in ath_start_ani()
466 mod_timer(&common->ani.timer, in ath_start_ani()
467 jiffies + msecs_to_jiffies((u32)ah->config.ani_poll_interval)); in ath_start_ani()
472 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_stop_ani()
475 timer_delete_sync(&common->ani.timer); in ath_stop_ani()
480 struct ath_hw *ah = sc->sc_ah; in ath_check_ani()
481 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_check_ani()
482 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath_check_ani()
488 if (ah->opmode == NL80211_IFTYPE_ADHOC) { in ath_check_ani()
489 if (!cur_conf->enable_beacon) in ath_check_ani()
491 } else if (ah->opmode == NL80211_IFTYPE_AP) { in ath_check_ani()
492 if (!cur_conf->enable_beacon) { in ath_check_ani()
497 if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) in ath_check_ani()
500 } else if (ah->opmode == NL80211_IFTYPE_STATION) { in ath_check_ani()
501 if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) in ath_check_ani()
505 if (!test_bit(ATH_OP_ANI_RUN, &common->op_flags)) { in ath_check_ani()
506 set_bit(ATH_OP_ANI_RUN, &common->op_flags); in ath_check_ani()
513 clear_bit(ATH_OP_ANI_RUN, &common->op_flags); in ath_check_ani()
519 struct ath_hw *ah = sc->sc_ah; in ath_update_survey_nf()
520 struct ath9k_channel *chan = &ah->channels[channel]; in ath_update_survey_nf()
521 struct survey_info *survey = &sc->survey[channel]; in ath_update_survey_nf()
523 if (chan->noisefloor) { in ath_update_survey_nf()
524 survey->filled |= SURVEY_INFO_NOISE_DBM; in ath_update_survey_nf()
525 survey->noise = ath9k_hw_getchan_noise(ah, chan, in ath_update_survey_nf()
526 chan->noisefloor); in ath_update_survey_nf()
533 * result to be useful, -1 otherwise.
537 struct ath_hw *ah = sc->sc_ah; in ath_update_survey_stats()
539 int pos = ah->curchan - &ah->channels[0]; in ath_update_survey_stats()
540 struct survey_info *survey = &sc->survey[pos]; in ath_update_survey_stats()
541 struct ath_cycle_counters *cc = &common->cc_survey; in ath_update_survey_stats()
542 unsigned int div = common->clockrate * 1000; in ath_update_survey_stats()
545 if (!ah->curchan) in ath_update_survey_stats()
546 return -1; in ath_update_survey_stats()
548 if (ah->power_mode == ATH9K_PM_AWAKE) in ath_update_survey_stats()
551 if (cc->cycles > 0) { in ath_update_survey_stats()
552 survey->filled |= SURVEY_INFO_TIME | in ath_update_survey_stats()
556 survey->time += cc->cycles / div; in ath_update_survey_stats()
557 survey->time_busy += cc->rx_busy / div; in ath_update_survey_stats()
558 survey->time_rx += cc->rx_frame / div; in ath_update_survey_stats()
559 survey->time_tx += cc->tx_frame / div; in ath_update_survey_stats()
562 if (cc->cycles < div) in ath_update_survey_stats()
563 return -1; in ath_update_survey_stats()
565 if (cc->cycles > 0) in ath_update_survey_stats()
566 ret = cc->rx_busy * 100 / cc->cycles; in ath_update_survey_stats()