Re: [PATCH 4/4] ath5k: Use SWI to trigger calibration
From: Jiri Slaby <hidden>
Date: 2009-08-01 08:19:29
On 08/01/2009 07:46 AM, Nick Kossifidis wrote:
quoted hunk ↗ jump to hunk
--- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c@@ -1104,6 +1104,26 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) PHY calibration \*****************/ +void +ath5k_hw_calibration_poll(struct ath5k_hw *ah) +{ + u32 current_time = (jiffies / HZ);
jiffies are long. And they start from negative to catch such issues. You were lucky and/or tested after 5 minutes of uptime ;).
+ u32 cal_intval = ah->ah_cal_intval;
+
+ if (!ah->ah_cal_tstamp)
+ ah->ah_cal_tstamp = current_time;
+
+ /* For now we always do full calibration
+ * Mark software interrupt mask and fire software
+ * interrupt (bit gets auto-cleared) */
+ if ((current_time - ah->ah_cal_tstamp) >= cal_intval) {Aiee, this should be converted to time_after(). You don't count with a wrap here. (The same as above.)
+ ah->ah_cal_tstamp = current_time; + ah->ah_swi_mask = AR5K_SWI_FULL_CALIBRATION; + AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); + } + +}