aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ani.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-10-08 16:13:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-11 15:04:19 -0400
commitdfdac8ac033c9ad048a5c68563bd41bda6c5e60b (patch)
treefa8b5c6b3e0cd6237f646ef5bcafd7272d7262c6 /drivers/net/wireless/ath/ath9k/ani.c
parent62c58fb4316905cd9c1dbf01967935ed5610b45d (diff)
ath9k_hw: store the clock rate in common data on channel changes
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ani.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index f2a907b4acb8..f2aa68405d2f 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -465,35 +465,13 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
465 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); 465 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1);
466} 466}
467 467
468static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah)
469{
470 struct ath9k_channel *chan = ah->curchan;
471 struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
472 u8 clockrate; /* in MHz */
473
474 if (!ah->curchan) /* should really check for CCK instead */
475 clockrate = ATH9K_CLOCK_RATE_CCK;
476 else if (conf->channel->band == IEEE80211_BAND_2GHZ)
477 clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM;
478 else if (IS_CHAN_A_FAST_CLOCK(ah, chan))
479 clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
480 else
481 clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
482
483 if (conf_is_ht40(conf))
484 return clockrate * 2;
485
486 return clockrate;
487}
488
489static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) 468static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
490{ 469{
470 struct ath_common *common = ath9k_hw_common(ah);
491 int32_t listen_time; 471 int32_t listen_time;
492 int32_t clock_rate;
493 472
494 ath9k_hw_update_cycle_counters(ah); 473 ath9k_hw_update_cycle_counters(ah);
495 clock_rate = ath9k_hw_chan_2_clockrate_mhz(ah) * 1000; 474 listen_time = ah->listen_time / (common->clockrate * 1000);
496 listen_time = ah->listen_time / clock_rate;
497 ah->listen_time = 0; 475 ah->listen_time = 0;
498 476
499 return listen_time; 477 return listen_time;