ath5k: Use SWI to trigger calibration

* Get rid of calibration timer, instead use a software interrupt
  to schedule the calibration tasklet.

 a) We don't need a timer for this, there is no need for accuracy
   even with round_jiffies i think this is a waste of resources.
   Also we don't need to run calibration if we are idle (no
   interrupts).

 b) When we add ANI support we 'll just extend the poll function
   and calibration tasklet and handle all periodic phy calibration
   on one place (much cleaner).

 c) Having calibration on a tasklet is better since during calibration
   we can't transmit or receive (antennas are detached to measure
   noise floor), previously calibration could run in parallel with
   tx/rx and interfere (packet loss).

 v2: kill tasklet on stop_hw, stop/wake queues
 v3: use time_is_before_eq_jiffies to compare timestamp with current
     time

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Nick Kossifidis 2009-08-10 03:31:31 +03:00 committed by John W. Linville
parent b55a5de114
commit 6e220662bf
4 changed files with 67 additions and 11 deletions

View file

@ -1104,6 +1104,29 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
PHY calibration
\*****************/
void
ath5k_hw_calibration_poll(struct ath5k_hw *ah)
{
/* Calibration interval in jiffies */
unsigned long cal_intval;
cal_intval = msecs_to_jiffies(ah->ah_cal_intval * 1000);
/* Initialize timestamp if needed */
if (!ah->ah_cal_tstamp)
ah->ah_cal_tstamp = jiffies;
/* For now we always do full calibration
* Mark software interrupt mask and fire software
* interrupt (bit gets auto-cleared) */
if (time_is_before_eq_jiffies(ah->ah_cal_tstamp + cal_intval)) {
ah->ah_cal_tstamp = jiffies;
ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION;
AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI);
}
}
/**
* ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
*