Commit 379f0440 authored by Sujith's avatar Sujith Committed by John W. Linville

ath9k: Cleanup calibration interface

This patch cleans up the functions dealing with calibration,
using proper return values.
ath9k_hw_per_calibration(), ath9k_hw_calibrate now return bool values
instead of setting error values in the function arguments.
Signed-off-by: default avatarSujith <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 415f738e
...@@ -238,13 +238,12 @@ static void ath9k_hw_reset_calibration(struct ath_hw *ah, ...@@ -238,13 +238,12 @@ static void ath9k_hw_reset_calibration(struct ath_hw *ah,
ah->cal_samples = 0; ah->cal_samples = 0;
} }
static void ath9k_hw_per_calibration(struct ath_hw *ah, static bool ath9k_hw_per_calibration(struct ath_hw *ah,
struct ath9k_channel *ichan, struct ath9k_channel *ichan,
u8 rxchainmask, u8 rxchainmask,
struct hal_cal_list *currCal, struct hal_cal_list *currCal)
bool *isCalDone)
{ {
*isCalDone = false; bool iscaldone = false;
if (currCal->calState == CAL_RUNNING) { if (currCal->calState == CAL_RUNNING) {
if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) & if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
...@@ -263,7 +262,7 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah, ...@@ -263,7 +262,7 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah,
currCal->calData->calPostProc(ah, numChains); currCal->calData->calPostProc(ah, numChains);
ichan->CalValid |= currCal->calData->calType; ichan->CalValid |= currCal->calData->calType;
currCal->calState = CAL_DONE; currCal->calState = CAL_DONE;
*isCalDone = true; iscaldone = true;
} else { } else {
ath9k_hw_setup_calibration(ah, currCal); ath9k_hw_setup_calibration(ah, currCal);
} }
...@@ -271,6 +270,8 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah, ...@@ -271,6 +270,8 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah,
} else if (!(ichan->CalValid & currCal->calData->calType)) { } else if (!(ichan->CalValid & currCal->calData->calType)) {
ath9k_hw_reset_calibration(ah, currCal); ath9k_hw_reset_calibration(ah, currCal);
} }
return iscaldone;
} }
/* Assumes you are talking about the currently configured channel */ /* Assumes you are talking about the currently configured channel */
...@@ -841,23 +842,21 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) ...@@ -841,23 +842,21 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah)
} }
bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
u8 rxchainmask, bool longcal, u8 rxchainmask, bool longcal)
bool *isCalDone)
{ {
bool iscaldone = true;
struct hal_cal_list *currCal = ah->cal_list_curr; struct hal_cal_list *currCal = ah->cal_list_curr;
*isCalDone = true;
if (currCal && if (currCal &&
(currCal->calState == CAL_RUNNING || (currCal->calState == CAL_RUNNING ||
currCal->calState == CAL_WAITING)) { currCal->calState == CAL_WAITING)) {
ath9k_hw_per_calibration(ah, chan, rxchainmask, currCal, iscaldone = ath9k_hw_per_calibration(ah, chan,
isCalDone); rxchainmask, currCal);
if (*isCalDone) { if (iscaldone) {
ah->cal_list_curr = currCal = currCal->calNext; ah->cal_list_curr = currCal = currCal->calNext;
if (currCal->calState == CAL_WAITING) { if (currCal->calState == CAL_WAITING) {
*isCalDone = false; iscaldone = false;
ath9k_hw_reset_calibration(ah, currCal); ath9k_hw_reset_calibration(ah, currCal);
} }
} }
...@@ -877,7 +876,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, ...@@ -877,7 +876,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
chan->channelFlags &= ~CHANNEL_CW_INT; chan->channelFlags &= ~CHANNEL_CW_INT;
} }
return true; return iscaldone;
} }
static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan) static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
......
...@@ -116,8 +116,7 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah, ...@@ -116,8 +116,7 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah,
void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah); void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah);
s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
u8 rxchainmask, bool longcal, u8 rxchainmask, bool longcal);
bool *isCalDone);
bool ath9k_hw_init_cal(struct ath_hw *ah, bool ath9k_hw_init_cal(struct ath_hw *ah,
struct ath9k_channel *chan); struct ath9k_channel *chan);
......
...@@ -367,28 +367,16 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -367,28 +367,16 @@ static void ath_ani_calibrate(unsigned long data)
/* Perform calibration if necessary */ /* Perform calibration if necessary */
if (longcal || shortcal) { if (longcal || shortcal) {
bool iscaldone = false; sc->ani.caldone = ath9k_hw_calibrate(ah, ah->curchan,
sc->rx_chainmask, longcal);
if (ath9k_hw_calibrate(ah, ah->curchan,
sc->rx_chainmask, longcal,
&iscaldone)) {
if (longcal) if (longcal)
sc->ani.noise_floor = sc->ani.noise_floor = ath9k_hw_getchan_noise(ah,
ath9k_hw_getchan_noise(ah,
ah->curchan); ah->curchan);
DPRINTF(sc, ATH_DBG_ANI, DPRINTF(sc, ATH_DBG_ANI," calibrate chan %u/%x nf: %d\n",
"calibrate chan %u/%x nf: %d\n", ah->curchan->channel, ah->curchan->channelFlags,
ah->curchan->channel,
ah->curchan->channelFlags,
sc->ani.noise_floor); sc->ani.noise_floor);
} else {
DPRINTF(sc, ATH_DBG_ANY,
"calibrate chan %u/%x failed\n",
ah->curchan->channel,
ah->curchan->channelFlags);
}
sc->ani.caldone = iscaldone;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment