aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2008-06-11 21:46:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:04 -0400
commit16e727e866d739d7f02790c794410f6d9f1d720b (patch)
tree88a6bbf3e8e3135bfc6b3f4a58c6421c2a81643c /drivers/net/wireless
parenta78a83255651acff8234975b5c7b6cd19d717f3f (diff)
iwlwifi: removes the RUN_TIME_CALIB ifdef
This patch removes the possibility not to compile the run time calibrations. It also renames priv->sensitivity_work to priv->run_time_calib_work, and moves bg_run_time_calib to iwl4965_base since it is common to both: 4965 and 5000. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig28
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c39
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-calib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-calib.h20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c24
12 files changed, 27 insertions, 122 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index b992428ab4db..a382c0078923 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -14,15 +14,6 @@ config IWLWIFI_LEDS
14 bool 14 bool
15 default n 15 default n
16 16
17config IWLWIFI_RUN_TIME_CALIB
18 bool
19 depends on IWLCORE
20 default n
21 ---help---
22 This option will enable run time calibration for the iwlwifi driver.
23 These calibrations are Sensitivity and Chain Noise.
24
25
26config IWLWIFI_RFKILL 17config IWLWIFI_RFKILL
27 boolean "IWLWIFI RF kill support" 18 boolean "IWLWIFI RF kill support"
28 depends on IWLCORE 19 depends on IWLCORE
@@ -68,15 +59,6 @@ config IWL4965_SPECTRUM_MEASUREMENT
68 ---help--- 59 ---help---
69 This option will enable spectrum measurement for the iwl4965 driver. 60 This option will enable spectrum measurement for the iwl4965 driver.
70 61
71config IWL4965_RUN_TIME_CALIB
72 bool "Enable run time Calibration for 4965 NIC"
73 select IWLWIFI_RUN_TIME_CALIB
74 depends on IWL4965
75 default y
76 ---help---
77 This option will enable run time calibration for the iwl4965 driver.
78 These calibrations are Sensitivity and Chain Noise. If unsure, say yes
79
80config IWLWIFI_DEBUG 62config IWLWIFI_DEBUG
81 bool "Enable full debugging output in iwl4965 driver" 63 bool "Enable full debugging output in iwl4965 driver"
82 depends on IWL4965 64 depends on IWL4965
@@ -110,16 +92,6 @@ config IWL5000
110 This option enables support for Intel Wireless WiFi Link 5000AGN Family 92 This option enables support for Intel Wireless WiFi Link 5000AGN Family
111 Dependency on 4965 is temporary 93 Dependency on 4965 is temporary
112 94
113config IWL5000_RUN_TIME_CALIB
114 bool "Enable run time Calibration for 5000 NIC"
115 select IWLWIFI_RUN_TIME_CALIB
116 depends on IWL5000
117 default y
118 ---help---
119 This option will enable run time calibration for the iwl5000 driver.
120 These calibrations are Sensitivity and Chain Noise. If unsure, say yes
121
122
123config IWLWIFI_DEBUGFS 95config IWLWIFI_DEBUGFS
124 bool "Iwlwifi debugfs support" 96 bool "Iwlwifi debugfs support"
125 depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS 97 depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index 5c73eede7193..184fdeec3606 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -1,10 +1,9 @@
1obj-$(CONFIG_IWLCORE) += iwlcore.o 1obj-$(CONFIG_IWLCORE) += iwlcore.o
2iwlcore-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o 2iwlcore-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o iwl-calib.o
3iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o 3iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o
4iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o 4iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
5iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o 5iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
6iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o 6iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
7iwlcore-$(CONFIG_IWLWIFI_RUN_TIME_CALIB) += iwl-calib.o
8 7
9obj-$(CONFIG_IWL3945) += iwl3945.o 8obj-$(CONFIG_IWL3945) += iwl3945.o
10iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o 9iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 84414da0bdeb..e2c2d9f3edb5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -652,8 +652,6 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
652 cmd.critical_temperature_R); 652 cmd.critical_temperature_R);
653} 653}
654 654
655#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
656
657/* Reset differential Rx gains in NIC to prepare for chain noise calibration. 655/* Reset differential Rx gains in NIC to prepare for chain noise calibration.
658 * Called after every association, but this runs only once! 656 * Called after every association, but this runs only once!
659 * ... once chain noise is calibrated the first time, it's good forever. */ 657 * ... once chain noise is calibrated the first time, it's good forever. */
@@ -741,30 +739,6 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
741 data->beacon_count = 0; 739 data->beacon_count = 0;
742} 740}
743 741
744static void iwl4965_bg_sensitivity_work(struct work_struct *work)
745{
746 struct iwl_priv *priv = container_of(work, struct iwl_priv,
747 sensitivity_work);
748
749 mutex_lock(&priv->mutex);
750
751 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
752 test_bit(STATUS_SCANNING, &priv->status)) {
753 mutex_unlock(&priv->mutex);
754 return;
755 }
756
757 if (priv->start_calib) {
758 iwl_chain_noise_calibration(priv, &priv->statistics);
759
760 iwl_sensitivity_calibration(priv, &priv->statistics);
761 }
762
763 mutex_unlock(&priv->mutex);
764 return;
765}
766#endif /*CONFIG_IWL4965_RUN_TIME_CALIB*/
767
768static void iwl4965_bg_txpower_work(struct work_struct *work) 742static void iwl4965_bg_txpower_work(struct work_struct *work)
769{ 743{
770 struct iwl_priv *priv = container_of(work, struct iwl_priv, 744 struct iwl_priv *priv = container_of(work, struct iwl_priv,
@@ -920,7 +894,6 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
920 return ret; 894 return ret;
921} 895}
922 896
923#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
924static struct iwl_sensitivity_ranges iwl4965_sensitivity = { 897static struct iwl_sensitivity_ranges iwl4965_sensitivity = {
925 .min_nrg_cck = 97, 898 .min_nrg_cck = 97,
926 .max_nrg_cck = 0, 899 .max_nrg_cck = 0,
@@ -943,7 +916,6 @@ static struct iwl_sensitivity_ranges iwl4965_sensitivity = {
943 .nrg_th_cck = 100, 916 .nrg_th_cck = 100,
944 .nrg_th_ofdm = 100, 917 .nrg_th_ofdm = 100,
945}; 918};
946#endif
947 919
948/** 920/**
949 * iwl4965_hw_set_hw_params 921 * iwl4965_hw_set_hw_params
@@ -983,9 +955,7 @@ int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
983 priv->hw_params.valid_rx_ant = ANT_A | ANT_B; 955 priv->hw_params.valid_rx_ant = ANT_A | ANT_B;
984 priv->hw_params.ct_kill_threshold = CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD); 956 priv->hw_params.ct_kill_threshold = CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD);
985 957
986#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
987 priv->hw_params.sens = &iwl4965_sensitivity; 958 priv->hw_params.sens = &iwl4965_sensitivity;
988#endif
989 959
990 return 0; 960 return 0;
991} 961}
@@ -2123,9 +2093,7 @@ void iwl4965_hw_rx_statistics(struct iwl_priv *priv,
2123 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && 2093 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
2124 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { 2094 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
2125 iwl4965_rx_calc_noise(priv); 2095 iwl4965_rx_calc_noise(priv);
2126#ifdef CONFIG_IWL4965_RUN_TIME_CALIB 2096 queue_work(priv->workqueue, &priv->run_time_calib_work);
2127 queue_work(priv->workqueue, &priv->sensitivity_work);
2128#endif
2129 } 2097 }
2130 2098
2131 iwl_leds_background(priv); 2099 iwl_leds_background(priv);
@@ -3504,9 +3472,6 @@ static void iwl4965_rx_handler_setup(struct iwl_priv *priv)
3504void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv) 3472void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv)
3505{ 3473{
3506 INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); 3474 INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work);
3507#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
3508 INIT_WORK(&priv->sensitivity_work, iwl4965_bg_sensitivity_work);
3509#endif
3510 init_timer(&priv->statistics_periodic); 3475 init_timer(&priv->statistics_periodic);
3511 priv->statistics_periodic.data = (unsigned long)priv; 3476 priv->statistics_periodic.data = (unsigned long)priv;
3512 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; 3477 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic;
@@ -3527,10 +3492,8 @@ static struct iwl_hcmd_ops iwl4965_hcmd = {
3527static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { 3492static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
3528 .get_hcmd_size = iwl4965_get_hcmd_size, 3493 .get_hcmd_size = iwl4965_get_hcmd_size,
3529 .build_addsta_hcmd = iwl4965_build_addsta_hcmd, 3494 .build_addsta_hcmd = iwl4965_build_addsta_hcmd,
3530#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
3531 .chain_noise_reset = iwl4965_chain_noise_reset, 3495 .chain_noise_reset = iwl4965_chain_noise_reset,
3532 .gain_computation = iwl4965_gain_computation, 3496 .gain_computation = iwl4965_gain_computation,
3533#endif
3534}; 3497};
3535 3498
3536static struct iwl_lib_ops iwl4965_lib = { 3499static struct iwl_lib_ops iwl4965_lib = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 65484779bd3d..fc8ad7326edd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -300,8 +300,6 @@ err:
300 300
301} 301}
302 302
303#ifdef CONFIG_IWL5000_RUN_TIME_CALIB
304
305static void iwl5000_gain_computation(struct iwl_priv *priv, 303static void iwl5000_gain_computation(struct iwl_priv *priv,
306 u32 average_noise[NUM_RX_CHAINS], 304 u32 average_noise[NUM_RX_CHAINS],
307 u16 min_average_noise_antenna_i, 305 u16 min_average_noise_antenna_i,
@@ -354,7 +352,6 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
354 data->beacon_count = 0; 352 data->beacon_count = 0;
355} 353}
356 354
357
358static void iwl5000_chain_noise_reset(struct iwl_priv *priv) 355static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
359{ 356{
360 struct iwl_chain_noise_data *data = &priv->chain_noise_data; 357 struct iwl_chain_noise_data *data = &priv->chain_noise_data;
@@ -393,10 +390,6 @@ static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
393 .nrg_th_ofdm = 95, 390 .nrg_th_ofdm = 95,
394}; 391};
395 392
396#endif /* CONFIG_IWL5000_RUN_TIME_CALIB */
397
398
399
400static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, 393static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
401 size_t offset) 394 size_t offset)
402{ 395{
@@ -847,9 +840,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
847 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; 840 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
848 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) | 841 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) |
849 BIT(IEEE80211_BAND_5GHZ); 842 BIT(IEEE80211_BAND_5GHZ);
850#ifdef CONFIG_IWL5000_RUN_TIME_CALIB
851 priv->hw_params.sens = &iwl5000_sensitivity; 843 priv->hw_params.sens = &iwl5000_sensitivity;
852#endif
853 844
854 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { 845 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
855 case CSR_HW_REV_TYPE_5100: 846 case CSR_HW_REV_TYPE_5100:
@@ -1309,10 +1300,8 @@ static struct iwl_hcmd_ops iwl5000_hcmd = {
1309static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { 1300static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
1310 .get_hcmd_size = iwl5000_get_hcmd_size, 1301 .get_hcmd_size = iwl5000_get_hcmd_size,
1311 .build_addsta_hcmd = iwl5000_build_addsta_hcmd, 1302 .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
1312#ifdef CONFIG_IWL5000_RUN_TIME_CALIB
1313 .gain_computation = iwl5000_gain_computation, 1303 .gain_computation = iwl5000_gain_computation,
1314 .chain_noise_reset = iwl5000_chain_noise_reset, 1304 .chain_noise_reset = iwl5000_chain_noise_reset,
1315#endif
1316}; 1305};
1317 1306
1318static struct iwl_lib_ops iwl5000_lib = { 1307static struct iwl_lib_ops iwl5000_lib = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
index a6c7f0d9a414..72242a4ede8c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
@@ -435,8 +435,6 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
435 data = &(priv->sensitivity_data); 435 data = &(priv->sensitivity_data);
436 436
437 if (ranges == NULL) 437 if (ranges == NULL)
438 /* can happen if IWLWIFI_RUN_TIME_CALIB is selected
439 * but no IWLXXXX_RUN_TIME_CALIB for specific is selected */
440 return; 438 return;
441 439
442 memset(data, 0, sizeof(struct iwl_sensitivity_data)); 440 memset(data, 0, sizeof(struct iwl_sensitivity_data));
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.h b/drivers/net/wireless/iwlwifi/iwl-calib.h
index b8e57c59eac8..45f37cb2bfe2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.h
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.h
@@ -71,7 +71,6 @@
71#include "iwl-core.h" 71#include "iwl-core.h"
72#include "iwl-dev.h" 72#include "iwl-dev.h"
73 73
74#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
75void iwl_chain_noise_calibration(struct iwl_priv *priv, 74void iwl_chain_noise_calibration(struct iwl_priv *priv,
76 struct iwl4965_notif_statistics *stat_resp); 75 struct iwl4965_notif_statistics *stat_resp);
77void iwl_sensitivity_calibration(struct iwl_priv *priv, 76void iwl_sensitivity_calibration(struct iwl_priv *priv,
@@ -86,24 +85,5 @@ static inline void iwl_chain_noise_reset(struct iwl_priv *priv)
86 priv->cfg->ops->utils->chain_noise_reset) 85 priv->cfg->ops->utils->chain_noise_reset)
87 priv->cfg->ops->utils->chain_noise_reset(priv); 86 priv->cfg->ops->utils->chain_noise_reset(priv);
88} 87}
89#else
90static inline void iwl_chain_noise_calibration(struct iwl_priv *priv,
91 struct iwl4965_notif_statistics *stat_resp)
92{
93}
94static inline void iwl_sensitivity_calibration(struct iwl_priv *priv,
95 struct iwl4965_notif_statistics *resp)
96{
97}
98static inline void iwl_init_sensitivity(struct iwl_priv *priv)
99{
100}
101static inline void iwl_chain_noise_reset(struct iwl_priv *priv)
102{
103}
104static inline void iwl_reset_run_time_calib(struct iwl_priv *priv)
105{
106}
107#endif
108 88
109#endif /* __iwl_calib_h__ */ 89#endif /* __iwl_calib_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index d9c5bd13e781..192cda24a411 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -88,13 +88,11 @@ struct iwl_hcmd_ops {
88struct iwl_hcmd_utils_ops { 88struct iwl_hcmd_utils_ops {
89 u16 (*get_hcmd_size)(u8 cmd_id, u16 len); 89 u16 (*get_hcmd_size)(u8 cmd_id, u16 len);
90 u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); 90 u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data);
91#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
92 void (*gain_computation)(struct iwl_priv *priv, 91 void (*gain_computation)(struct iwl_priv *priv,
93 u32 *average_noise, 92 u32 *average_noise,
94 u16 min_average_noise_antennat_i, 93 u16 min_average_noise_antennat_i,
95 u32 min_average_noise); 94 u32 min_average_noise);
96 void (*chain_noise_reset)(struct iwl_priv *priv); 95 void (*chain_noise_reset)(struct iwl_priv *priv);
97#endif
98}; 96};
99 97
100struct iwl_lib_ops { 98struct iwl_lib_ops {
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 11de561c7bf8..48563a07795a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -55,10 +55,8 @@ struct iwl_debugfs {
55 struct dentry *file_log_event; 55 struct dentry *file_log_event;
56 } dbgfs_data_files; 56 } dbgfs_data_files;
57 struct dir_rf_files { 57 struct dir_rf_files {
58#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
59 struct dentry *file_disable_sensitivity; 58 struct dentry *file_disable_sensitivity;
60 struct dentry *file_disable_chain_noise; 59 struct dentry *file_disable_chain_noise;
61#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
62 } dbgfs_rf_files; 60 } dbgfs_rf_files;
63 u32 sram_offset; 61 u32 sram_offset;
64 u32 sram_len; 62 u32 sram_len;
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index d5f9df176bab..da6dcb20b5e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -385,11 +385,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
385 DEBUGFS_ADD_FILE(stations, data); 385 DEBUGFS_ADD_FILE(stations, data);
386 DEBUGFS_ADD_FILE(rx_statistics, data); 386 DEBUGFS_ADD_FILE(rx_statistics, data);
387 DEBUGFS_ADD_FILE(tx_statistics, data); 387 DEBUGFS_ADD_FILE(tx_statistics, data);
388#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
389 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); 388 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
390 DEBUGFS_ADD_BOOL(disable_chain_noise, rf, 389 DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
391 &priv->disable_chain_noise_cal); 390 &priv->disable_chain_noise_cal);
392#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
393 return 0; 391 return 0;
394 392
395err: 393err:
@@ -415,10 +413,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
415 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); 413 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event);
416 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); 414 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations);
417 DEBUGFS_REMOVE(priv->dbgfs->dir_data); 415 DEBUGFS_REMOVE(priv->dbgfs->dir_data);
418#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
419 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); 416 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
420 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); 417 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);
421#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
422 DEBUGFS_REMOVE(priv->dbgfs->dir_rf); 418 DEBUGFS_REMOVE(priv->dbgfs->dir_rf);
423 DEBUGFS_REMOVE(priv->dbgfs->dir_drv); 419 DEBUGFS_REMOVE(priv->dbgfs->dir_drv);
424 kfree(priv->dbgfs); 420 kfree(priv->dbgfs);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 59a6960f41b3..631931c155a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -602,9 +602,7 @@ struct iwl_hw_params {
602 u32 max_data_size; 602 u32 max_data_size;
603 u32 max_bsm_size; 603 u32 max_bsm_size;
604 u32 ct_kill_threshold; /* value in hw-dependent units */ 604 u32 ct_kill_threshold; /* value in hw-dependent units */
605#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
606 const struct iwl_sensitivity_ranges *sens; 605 const struct iwl_sensitivity_ranges *sens;
607#endif
608}; 606};
609 607
610#define HT_SHORT_GI_20MHZ (1 << 0) 608#define HT_SHORT_GI_20MHZ (1 << 0)
@@ -882,7 +880,6 @@ enum ucode_type {
882 UCODE_RT 880 UCODE_RT
883}; 881};
884 882
885#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
886/* Sensitivity calib data */ 883/* Sensitivity calib data */
887struct iwl_sensitivity_data { 884struct iwl_sensitivity_data {
888 u32 auto_corr_ofdm; 885 u32 auto_corr_ofdm;
@@ -924,7 +921,6 @@ struct iwl_chain_noise_data {
924 u8 delta_gain_code[NUM_RX_CHAINS]; 921 u8 delta_gain_code[NUM_RX_CHAINS];
925 u8 radio_write; 922 u8 radio_write;
926}; 923};
927#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
928 924
929#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ 925#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */
930#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ 926#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
@@ -1057,11 +1053,9 @@ struct iwl_priv {
1057 u8 assoc_station_added; 1053 u8 assoc_station_added;
1058 u8 use_ant_b_for_management_frame; /* Tx antenna selection */ 1054 u8 use_ant_b_for_management_frame; /* Tx antenna selection */
1059 u8 start_calib; 1055 u8 start_calib;
1060#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
1061 struct iwl_sensitivity_data sensitivity_data; 1056 struct iwl_sensitivity_data sensitivity_data;
1062 struct iwl_chain_noise_data chain_noise_data; 1057 struct iwl_chain_noise_data chain_noise_data;
1063 __le16 sensitivity_tbl[HD_TABLE_SIZE]; 1058 __le16 sensitivity_tbl[HD_TABLE_SIZE];
1064#endif /*CONFIG_IWLWIFI_RUN_TIME_CALIB*/
1065 1059
1066 struct iwl_ht_info current_ht_config; 1060 struct iwl_ht_info current_ht_config;
1067 u8 last_phy_res[100]; 1061 u8 last_phy_res[100];
@@ -1211,13 +1205,9 @@ struct iwl_priv {
1211#endif /* CONFIG_IWLWIFI_DEBUG */ 1205#endif /* CONFIG_IWLWIFI_DEBUG */
1212 1206
1213 struct work_struct txpower_work; 1207 struct work_struct txpower_work;
1214#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
1215 u32 disable_sens_cal; 1208 u32 disable_sens_cal;
1216 u32 disable_chain_noise_cal; 1209 u32 disable_chain_noise_cal;
1217#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */ 1210 struct work_struct run_time_calib_work;
1218#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
1219 struct work_struct sensitivity_work;
1220#endif /* CONFIG_IWL4965_RUN_TIME_CALIB */
1221 struct timer_list statistics_periodic; 1211 struct timer_list statistics_periodic;
1222}; /*iwl_priv */ 1212}; /*iwl_priv */
1223 1213
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index cc61c937320f..c24844802a88 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -451,7 +451,6 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
451 struct iwl_rx_mem_buffer *rxb) 451 struct iwl_rx_mem_buffer *rxb)
452 452
453{ 453{
454#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
455 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 454 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
456 struct iwl4965_missed_beacon_notif *missed_beacon; 455 struct iwl4965_missed_beacon_notif *missed_beacon;
457 456
@@ -465,6 +464,5 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
465 if (!test_bit(STATUS_SCANNING, &priv->status)) 464 if (!test_bit(STATUS_SCANNING, &priv->status))
466 iwl_init_sensitivity(priv); 465 iwl_init_sensitivity(priv);
467 } 466 }
468#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
469} 467}
470EXPORT_SYMBOL(iwl_rx_missed_beacon_notif); 468EXPORT_SYMBOL(iwl_rx_missed_beacon_notif);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 88229e25837a..a8dfdcbb8b43 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3423,6 +3423,29 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
3423 mutex_unlock(&priv->mutex); 3423 mutex_unlock(&priv->mutex);
3424} 3424}
3425 3425
3426static void iwl_bg_run_time_calib_work(struct work_struct *work)
3427{
3428 struct iwl_priv *priv = container_of(work, struct iwl_priv,
3429 run_time_calib_work);
3430
3431 mutex_lock(&priv->mutex);
3432
3433 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
3434 test_bit(STATUS_SCANNING, &priv->status)) {
3435 mutex_unlock(&priv->mutex);
3436 return;
3437 }
3438
3439 if (priv->start_calib) {
3440 iwl_chain_noise_calibration(priv, &priv->statistics);
3441
3442 iwl_sensitivity_calibration(priv, &priv->statistics);
3443 }
3444
3445 mutex_unlock(&priv->mutex);
3446 return;
3447}
3448
3426static void iwl4965_bg_up(struct work_struct *data) 3449static void iwl4965_bg_up(struct work_struct *data)
3427{ 3450{
3428 struct iwl_priv *priv = container_of(data, struct iwl_priv, up); 3451 struct iwl_priv *priv = container_of(data, struct iwl_priv, up);
@@ -5014,6 +5037,7 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv)
5014 INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); 5037 INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill);
5015 INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); 5038 INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update);
5016 INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor); 5039 INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor);
5040 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
5017 INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate); 5041 INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate);
5018 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 5042 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start);
5019 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 5043 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start);