diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/ath5k.h')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 308b79e1ff08..2718136e4886 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/average.h> | ||
28 | #include <net/mac80211.h> | 29 | #include <net/mac80211.h> |
29 | 30 | ||
30 | /* RX/TX descriptor hw structs | 31 | /* RX/TX descriptor hw structs |
@@ -1102,7 +1103,7 @@ struct ath5k_hw { | |||
1102 | struct ath5k_nfcal_hist ah_nfcal_hist; | 1103 | struct ath5k_nfcal_hist ah_nfcal_hist; |
1103 | 1104 | ||
1104 | /* average beacon RSSI in our BSS (used by ANI) */ | 1105 | /* average beacon RSSI in our BSS (used by ANI) */ |
1105 | struct ath5k_avg_val ah_beacon_rssi_avg; | 1106 | struct ewma ah_beacon_rssi_avg; |
1106 | 1107 | ||
1107 | /* noise floor from last periodic calibration */ | 1108 | /* noise floor from last periodic calibration */ |
1108 | s32 ah_noise_floor; | 1109 | s32 ah_noise_floor; |
@@ -1315,27 +1316,4 @@ static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) | |||
1315 | return retval; | 1316 | return retval; |
1316 | } | 1317 | } |
1317 | 1318 | ||
1318 | #define AVG_SAMPLES 8 | ||
1319 | #define AVG_FACTOR 1000 | ||
1320 | |||
1321 | /** | ||
1322 | * ath5k_moving_average - Exponentially weighted moving average | ||
1323 | * @avg: average structure | ||
1324 | * @val: current value | ||
1325 | * | ||
1326 | * This implementation make use of a struct ath5k_avg_val to prevent rounding | ||
1327 | * errors. | ||
1328 | */ | ||
1329 | static inline struct ath5k_avg_val | ||
1330 | ath5k_moving_average(const struct ath5k_avg_val avg, const int val) | ||
1331 | { | ||
1332 | struct ath5k_avg_val new; | ||
1333 | new.avg_weight = avg.avg_weight ? | ||
1334 | (((avg.avg_weight * ((AVG_SAMPLES) - 1)) + | ||
1335 | (val * (AVG_FACTOR))) / (AVG_SAMPLES)) : | ||
1336 | (val * (AVG_FACTOR)); | ||
1337 | new.avg = new.avg_weight / (AVG_FACTOR); | ||
1338 | return new; | ||
1339 | } | ||
1340 | |||
1341 | #endif | 1319 | #endif |