diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-09-25 17:24:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:36 -0400 |
commit | d8c07e7a84950b5fdef424c6dabe6bed3a9ffa19 (patch) | |
tree | 8286d65e226654bf403c0ac551f3ef16fd07087b | |
parent | 2b396a120922062a0ffd2648be3ed7e72ff83620 (diff) |
iwlwifi: Chain Noise Calibration for 6000 series
Adding support of Chain Noise Calibration for 6000 series NICs.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-1000.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-6000.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-calib.c | 64 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 3 |
7 files changed, 80 insertions, 34 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 3b3e6bc74ba9..9dfd4c407efb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -165,6 +165,7 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
165 | .shadow_ram_support = false, | 165 | .shadow_ram_support = false, |
166 | .ht_greenfield_support = true, | 166 | .ht_greenfield_support = true, |
167 | .led_compensation = 51, | 167 | .led_compensation = 51, |
168 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | struct iwl_cfg iwl1000_bg_cfg = { | 171 | struct iwl_cfg iwl1000_bg_cfg = { |
@@ -185,5 +186,6 @@ struct iwl_cfg iwl1000_bg_cfg = { | |||
185 | .shadow_ram_support = false, | 186 | .shadow_ram_support = false, |
186 | .ht_greenfield_support = true, | 187 | .ht_greenfield_support = true, |
187 | .led_compensation = 51, | 188 | .led_compensation = 51, |
189 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
188 | }; | 190 | }; |
189 | 191 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index b5111702856a..4e492c154f88 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -495,14 +495,15 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) | |||
495 | static void iwl4965_gain_computation(struct iwl_priv *priv, | 495 | static void iwl4965_gain_computation(struct iwl_priv *priv, |
496 | u32 *average_noise, | 496 | u32 *average_noise, |
497 | u16 min_average_noise_antenna_i, | 497 | u16 min_average_noise_antenna_i, |
498 | u32 min_average_noise) | 498 | u32 min_average_noise, |
499 | u8 default_chain) | ||
499 | { | 500 | { |
500 | int i, ret; | 501 | int i, ret; |
501 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; | 502 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; |
502 | 503 | ||
503 | data->delta_gain_code[min_average_noise_antenna_i] = 0; | 504 | data->delta_gain_code[min_average_noise_antenna_i] = 0; |
504 | 505 | ||
505 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 506 | for (i = default_chain; i < NUM_RX_CHAINS; i++) { |
506 | s32 delta_g = 0; | 507 | s32 delta_g = 0; |
507 | 508 | ||
508 | if (!(data->disconn_array[i]) && | 509 | if (!(data->disconn_array[i]) && |
@@ -2356,6 +2357,7 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2356 | .ht_greenfield_support = false, | 2357 | .ht_greenfield_support = false, |
2357 | .broken_powersave = true, | 2358 | .broken_powersave = true, |
2358 | .led_compensation = 61, | 2359 | .led_compensation = 61, |
2360 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, | ||
2359 | }; | 2361 | }; |
2360 | 2362 | ||
2361 | /* Module firmware */ | 2363 | /* Module firmware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 68d97f50fd00..660fd51d190b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -301,14 +301,17 @@ u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv) | |||
301 | static void iwl5000_gain_computation(struct iwl_priv *priv, | 301 | static void iwl5000_gain_computation(struct iwl_priv *priv, |
302 | u32 average_noise[NUM_RX_CHAINS], | 302 | u32 average_noise[NUM_RX_CHAINS], |
303 | u16 min_average_noise_antenna_i, | 303 | u16 min_average_noise_antenna_i, |
304 | u32 min_average_noise) | 304 | u32 min_average_noise, |
305 | u8 default_chain) | ||
305 | { | 306 | { |
306 | int i; | 307 | int i; |
307 | s32 delta_g; | 308 | s32 delta_g; |
308 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; | 309 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; |
309 | 310 | ||
310 | /* Find Gain Code for the antennas B and C */ | 311 | /* |
311 | for (i = 1; i < NUM_RX_CHAINS; i++) { | 312 | * Find Gain Code for the chains based on "default chain" |
313 | */ | ||
314 | for (i = default_chain + 1; i < NUM_RX_CHAINS; i++) { | ||
312 | if ((data->disconn_array[i])) { | 315 | if ((data->disconn_array[i])) { |
313 | data->delta_gain_code[i] = 0; | 316 | data->delta_gain_code[i] = 0; |
314 | continue; | 317 | continue; |
@@ -1676,6 +1679,7 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
1676 | .need_pll_cfg = true, | 1679 | .need_pll_cfg = true, |
1677 | .ht_greenfield_support = true, | 1680 | .ht_greenfield_support = true, |
1678 | .led_compensation = 51, | 1681 | .led_compensation = 51, |
1682 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1679 | }; | 1683 | }; |
1680 | 1684 | ||
1681 | struct iwl_cfg iwl5100_bg_cfg = { | 1685 | struct iwl_cfg iwl5100_bg_cfg = { |
@@ -1694,6 +1698,7 @@ struct iwl_cfg iwl5100_bg_cfg = { | |||
1694 | .need_pll_cfg = true, | 1698 | .need_pll_cfg = true, |
1695 | .ht_greenfield_support = true, | 1699 | .ht_greenfield_support = true, |
1696 | .led_compensation = 51, | 1700 | .led_compensation = 51, |
1701 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1697 | }; | 1702 | }; |
1698 | 1703 | ||
1699 | struct iwl_cfg iwl5100_abg_cfg = { | 1704 | struct iwl_cfg iwl5100_abg_cfg = { |
@@ -1712,6 +1717,7 @@ struct iwl_cfg iwl5100_abg_cfg = { | |||
1712 | .need_pll_cfg = true, | 1717 | .need_pll_cfg = true, |
1713 | .ht_greenfield_support = true, | 1718 | .ht_greenfield_support = true, |
1714 | .led_compensation = 51, | 1719 | .led_compensation = 51, |
1720 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1715 | }; | 1721 | }; |
1716 | 1722 | ||
1717 | struct iwl_cfg iwl5100_agn_cfg = { | 1723 | struct iwl_cfg iwl5100_agn_cfg = { |
@@ -1730,6 +1736,7 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
1730 | .need_pll_cfg = true, | 1736 | .need_pll_cfg = true, |
1731 | .ht_greenfield_support = true, | 1737 | .ht_greenfield_support = true, |
1732 | .led_compensation = 51, | 1738 | .led_compensation = 51, |
1739 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1733 | }; | 1740 | }; |
1734 | 1741 | ||
1735 | struct iwl_cfg iwl5350_agn_cfg = { | 1742 | struct iwl_cfg iwl5350_agn_cfg = { |
@@ -1748,6 +1755,7 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1748 | .need_pll_cfg = true, | 1755 | .need_pll_cfg = true, |
1749 | .ht_greenfield_support = true, | 1756 | .ht_greenfield_support = true, |
1750 | .led_compensation = 51, | 1757 | .led_compensation = 51, |
1758 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1751 | }; | 1759 | }; |
1752 | 1760 | ||
1753 | struct iwl_cfg iwl5150_agn_cfg = { | 1761 | struct iwl_cfg iwl5150_agn_cfg = { |
@@ -1766,6 +1774,7 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
1766 | .need_pll_cfg = true, | 1774 | .need_pll_cfg = true, |
1767 | .ht_greenfield_support = true, | 1775 | .ht_greenfield_support = true, |
1768 | .led_compensation = 51, | 1776 | .led_compensation = 51, |
1777 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
1769 | }; | 1778 | }; |
1770 | 1779 | ||
1771 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 1780 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 01a1f81cba2a..ad5d77c96494 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -222,18 +222,11 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
222 | }, | 222 | }, |
223 | }; | 223 | }; |
224 | 224 | ||
225 | static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { | ||
226 | .get_hcmd_size = iwl5000_get_hcmd_size, | ||
227 | .build_addsta_hcmd = iwl5000_build_addsta_hcmd, | ||
228 | .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag, | ||
229 | .calc_rssi = iwl5000_calc_rssi, | ||
230 | }; | ||
231 | |||
232 | static struct iwl_ops iwl6000_ops = { | 225 | static struct iwl_ops iwl6000_ops = { |
233 | .ucode = &iwl5000_ucode, | 226 | .ucode = &iwl5000_ucode, |
234 | .lib = &iwl6000_lib, | 227 | .lib = &iwl6000_lib, |
235 | .hcmd = &iwl5000_hcmd, | 228 | .hcmd = &iwl5000_hcmd, |
236 | .utils = &iwl6000_hcmd_utils, | 229 | .utils = &iwl5000_hcmd_utils, |
237 | }; | 230 | }; |
238 | 231 | ||
239 | 232 | ||
@@ -260,6 +253,7 @@ struct iwl_cfg iwl6000h_2agn_cfg = { | |||
260 | .ht_greenfield_support = true, | 253 | .ht_greenfield_support = true, |
261 | .led_compensation = 51, | 254 | .led_compensation = 51, |
262 | .use_rts_for_ht = true, /* use rts/cts protection */ | 255 | .use_rts_for_ht = true, /* use rts/cts protection */ |
256 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
263 | }; | 257 | }; |
264 | 258 | ||
265 | struct iwl_cfg iwl6000h_2abg_cfg = { | 259 | struct iwl_cfg iwl6000h_2abg_cfg = { |
@@ -281,6 +275,7 @@ struct iwl_cfg iwl6000h_2abg_cfg = { | |||
281 | .shadow_ram_support = true, | 275 | .shadow_ram_support = true, |
282 | .ht_greenfield_support = true, | 276 | .ht_greenfield_support = true, |
283 | .led_compensation = 51, | 277 | .led_compensation = 51, |
278 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
284 | }; | 279 | }; |
285 | 280 | ||
286 | struct iwl_cfg iwl6000h_2bg_cfg = { | 281 | struct iwl_cfg iwl6000h_2bg_cfg = { |
@@ -302,6 +297,7 @@ struct iwl_cfg iwl6000h_2bg_cfg = { | |||
302 | .shadow_ram_support = true, | 297 | .shadow_ram_support = true, |
303 | .ht_greenfield_support = true, | 298 | .ht_greenfield_support = true, |
304 | .led_compensation = 51, | 299 | .led_compensation = 51, |
300 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
305 | }; | 301 | }; |
306 | 302 | ||
307 | /* | 303 | /* |
@@ -327,6 +323,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
327 | .ht_greenfield_support = true, | 323 | .ht_greenfield_support = true, |
328 | .led_compensation = 51, | 324 | .led_compensation = 51, |
329 | .use_rts_for_ht = true, /* use rts/cts protection */ | 325 | .use_rts_for_ht = true, /* use rts/cts protection */ |
326 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
330 | }; | 327 | }; |
331 | 328 | ||
332 | struct iwl_cfg iwl6000i_2abg_cfg = { | 329 | struct iwl_cfg iwl6000i_2abg_cfg = { |
@@ -348,6 +345,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = { | |||
348 | .shadow_ram_support = true, | 345 | .shadow_ram_support = true, |
349 | .ht_greenfield_support = true, | 346 | .ht_greenfield_support = true, |
350 | .led_compensation = 51, | 347 | .led_compensation = 51, |
348 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
351 | }; | 349 | }; |
352 | 350 | ||
353 | struct iwl_cfg iwl6000i_2bg_cfg = { | 351 | struct iwl_cfg iwl6000i_2bg_cfg = { |
@@ -369,6 +367,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = { | |||
369 | .shadow_ram_support = true, | 367 | .shadow_ram_support = true, |
370 | .ht_greenfield_support = true, | 368 | .ht_greenfield_support = true, |
371 | .led_compensation = 51, | 369 | .led_compensation = 51, |
370 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
372 | }; | 371 | }; |
373 | 372 | ||
374 | struct iwl_cfg iwl6050_2agn_cfg = { | 373 | struct iwl_cfg iwl6050_2agn_cfg = { |
@@ -391,6 +390,7 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
391 | .ht_greenfield_support = true, | 390 | .ht_greenfield_support = true, |
392 | .led_compensation = 51, | 391 | .led_compensation = 51, |
393 | .use_rts_for_ht = true, /* use rts/cts protection */ | 392 | .use_rts_for_ht = true, /* use rts/cts protection */ |
393 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
394 | }; | 394 | }; |
395 | 395 | ||
396 | struct iwl_cfg iwl6050_2abg_cfg = { | 396 | struct iwl_cfg iwl6050_2abg_cfg = { |
@@ -412,6 +412,7 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
412 | .shadow_ram_support = true, | 412 | .shadow_ram_support = true, |
413 | .ht_greenfield_support = true, | 413 | .ht_greenfield_support = true, |
414 | .led_compensation = 51, | 414 | .led_compensation = 51, |
415 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
415 | }; | 416 | }; |
416 | 417 | ||
417 | struct iwl_cfg iwl6000_3agn_cfg = { | 418 | struct iwl_cfg iwl6000_3agn_cfg = { |
@@ -434,6 +435,7 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
434 | .ht_greenfield_support = true, | 435 | .ht_greenfield_support = true, |
435 | .led_compensation = 51, | 436 | .led_compensation = 51, |
436 | .use_rts_for_ht = true, /* use rts/cts protection */ | 437 | .use_rts_for_ht = true, /* use rts/cts protection */ |
438 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
437 | }; | 439 | }; |
438 | 440 | ||
439 | struct iwl_cfg iwl6050_3agn_cfg = { | 441 | struct iwl_cfg iwl6050_3agn_cfg = { |
@@ -456,6 +458,7 @@ struct iwl_cfg iwl6050_3agn_cfg = { | |||
456 | .ht_greenfield_support = true, | 458 | .ht_greenfield_support = true, |
457 | .led_compensation = 51, | 459 | .led_compensation = 51, |
458 | .use_rts_for_ht = true, /* use rts/cts protection */ | 460 | .use_rts_for_ht = true, /* use rts/cts protection */ |
461 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | ||
459 | }; | 462 | }; |
460 | 463 | ||
461 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 464 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c index 6e73317c3b40..69a80d7c2e44 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-calib.c | |||
@@ -643,6 +643,15 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, | |||
643 | } | 643 | } |
644 | EXPORT_SYMBOL(iwl_sensitivity_calibration); | 644 | EXPORT_SYMBOL(iwl_sensitivity_calibration); |
645 | 645 | ||
646 | static inline u8 find_first_chain(u8 mask) | ||
647 | { | ||
648 | if (mask & ANT_A) | ||
649 | return CHAIN_A; | ||
650 | if (mask & ANT_B) | ||
651 | return CHAIN_B; | ||
652 | return CHAIN_C; | ||
653 | } | ||
654 | |||
646 | /* | 655 | /* |
647 | * Accumulate 20 beacons of signal and noise statistics for each of | 656 | * Accumulate 20 beacons of signal and noise statistics for each of |
648 | * 3 receivers/antennas/rx-chains, then figure out: | 657 | * 3 receivers/antennas/rx-chains, then figure out: |
@@ -675,14 +684,17 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
675 | u8 num_tx_chains; | 684 | u8 num_tx_chains; |
676 | unsigned long flags; | 685 | unsigned long flags; |
677 | struct statistics_rx_non_phy *rx_info = &(stat_resp->rx.general); | 686 | struct statistics_rx_non_phy *rx_info = &(stat_resp->rx.general); |
687 | u8 first_chain; | ||
678 | 688 | ||
679 | if (priv->disable_chain_noise_cal) | 689 | if (priv->disable_chain_noise_cal) |
680 | return; | 690 | return; |
681 | 691 | ||
682 | data = &(priv->chain_noise_data); | 692 | data = &(priv->chain_noise_data); |
683 | 693 | ||
684 | /* Accumulate just the first 20 beacons after the first association, | 694 | /* |
685 | * then we're done forever. */ | 695 | * Accumulate just the first "chain_noise_num_beacons" after |
696 | * the first association, then we're done forever. | ||
697 | */ | ||
686 | if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) { | 698 | if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) { |
687 | if (data->state == IWL_CHAIN_NOISE_ALIVE) | 699 | if (data->state == IWL_CHAIN_NOISE_ALIVE) |
688 | IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); | 700 | IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); |
@@ -710,7 +722,10 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
710 | return; | 722 | return; |
711 | } | 723 | } |
712 | 724 | ||
713 | /* Accumulate beacon statistics values across 20 beacons */ | 725 | /* |
726 | * Accumulate beacon statistics values across | ||
727 | * "chain_noise_num_beacons" | ||
728 | */ | ||
714 | chain_noise_a = le32_to_cpu(rx_info->beacon_silence_rssi_a) & | 729 | chain_noise_a = le32_to_cpu(rx_info->beacon_silence_rssi_a) & |
715 | IN_BAND_FILTER; | 730 | IN_BAND_FILTER; |
716 | chain_noise_b = le32_to_cpu(rx_info->beacon_silence_rssi_b) & | 731 | chain_noise_b = le32_to_cpu(rx_info->beacon_silence_rssi_b) & |
@@ -741,16 +756,19 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
741 | IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", | 756 | IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", |
742 | chain_noise_a, chain_noise_b, chain_noise_c); | 757 | chain_noise_a, chain_noise_b, chain_noise_c); |
743 | 758 | ||
744 | /* If this is the 20th beacon, determine: | 759 | /* If this is the "chain_noise_num_beacons", determine: |
745 | * 1) Disconnected antennas (using signal strengths) | 760 | * 1) Disconnected antennas (using signal strengths) |
746 | * 2) Differential gain (using silence noise) to balance receivers */ | 761 | * 2) Differential gain (using silence noise) to balance receivers */ |
747 | if (data->beacon_count != CAL_NUM_OF_BEACONS) | 762 | if (data->beacon_count != priv->cfg->chain_noise_num_beacons) |
748 | return; | 763 | return; |
749 | 764 | ||
750 | /* Analyze signal for disconnected antenna */ | 765 | /* Analyze signal for disconnected antenna */ |
751 | average_sig[0] = (data->chain_signal_a) / CAL_NUM_OF_BEACONS; | 766 | average_sig[0] = |
752 | average_sig[1] = (data->chain_signal_b) / CAL_NUM_OF_BEACONS; | 767 | (data->chain_signal_a) / priv->cfg->chain_noise_num_beacons; |
753 | average_sig[2] = (data->chain_signal_c) / CAL_NUM_OF_BEACONS; | 768 | average_sig[1] = |
769 | (data->chain_signal_b) / priv->cfg->chain_noise_num_beacons; | ||
770 | average_sig[2] = | ||
771 | (data->chain_signal_c) / priv->cfg->chain_noise_num_beacons; | ||
754 | 772 | ||
755 | if (average_sig[0] >= average_sig[1]) { | 773 | if (average_sig[0] >= average_sig[1]) { |
756 | max_average_sig = average_sig[0]; | 774 | max_average_sig = average_sig[0]; |
@@ -803,13 +821,17 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
803 | /* there is a Tx antenna connected */ | 821 | /* there is a Tx antenna connected */ |
804 | break; | 822 | break; |
805 | if (num_tx_chains == priv->hw_params.tx_chains_num && | 823 | if (num_tx_chains == priv->hw_params.tx_chains_num && |
806 | data->disconn_array[i]) { | 824 | data->disconn_array[i]) { |
807 | /* This is the last TX antenna and is also | 825 | /* |
808 | * disconnected connect it anyway */ | 826 | * If all chains are disconnected |
809 | data->disconn_array[i] = 0; | 827 | * connect the first valid tx chain |
810 | active_chains |= ant_msk; | 828 | */ |
811 | IWL_DEBUG_CALIB(priv, "All Tx chains are disconnected W/A - " | 829 | first_chain = |
812 | "declare %d as connected\n", i); | 830 | find_first_chain(priv->cfg->valid_tx_ant); |
831 | data->disconn_array[first_chain] = 0; | ||
832 | active_chains |= BIT(first_chain); | ||
833 | IWL_DEBUG_CALIB(priv, "All Tx chains are disconnected W/A - declare %d as connected\n", | ||
834 | first_chain); | ||
813 | break; | 835 | break; |
814 | } | 836 | } |
815 | } | 837 | } |
@@ -820,9 +842,12 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
820 | active_chains); | 842 | active_chains); |
821 | 843 | ||
822 | /* Analyze noise for rx balance */ | 844 | /* Analyze noise for rx balance */ |
823 | average_noise[0] = ((data->chain_noise_a)/CAL_NUM_OF_BEACONS); | 845 | average_noise[0] = |
824 | average_noise[1] = ((data->chain_noise_b)/CAL_NUM_OF_BEACONS); | 846 | ((data->chain_noise_a) / priv->cfg->chain_noise_num_beacons); |
825 | average_noise[2] = ((data->chain_noise_c)/CAL_NUM_OF_BEACONS); | 847 | average_noise[1] = |
848 | ((data->chain_noise_b) / priv->cfg->chain_noise_num_beacons); | ||
849 | average_noise[2] = | ||
850 | ((data->chain_noise_c) / priv->cfg->chain_noise_num_beacons); | ||
826 | 851 | ||
827 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 852 | for (i = 0; i < NUM_RX_CHAINS; i++) { |
828 | if (!(data->disconn_array[i]) && | 853 | if (!(data->disconn_array[i]) && |
@@ -843,7 +868,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, | |||
843 | 868 | ||
844 | if (priv->cfg->ops->utils->gain_computation) | 869 | if (priv->cfg->ops->utils->gain_computation) |
845 | priv->cfg->ops->utils->gain_computation(priv, average_noise, | 870 | priv->cfg->ops->utils->gain_computation(priv, average_noise, |
846 | min_average_noise_antenna_i, min_average_noise); | 871 | min_average_noise_antenna_i, min_average_noise, |
872 | find_first_chain(priv->cfg->valid_rx_ant)); | ||
847 | 873 | ||
848 | /* Some power changes may have been made during the calibration. | 874 | /* Some power changes may have been made during the calibration. |
849 | * Update and commit the RXON | 875 | * Update and commit the RXON |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index f094cd9de443..b66bf7b4b0a4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -98,7 +98,8 @@ struct iwl_hcmd_utils_ops { | |||
98 | void (*gain_computation)(struct iwl_priv *priv, | 98 | void (*gain_computation)(struct iwl_priv *priv, |
99 | u32 *average_noise, | 99 | u32 *average_noise, |
100 | u16 min_average_noise_antennat_i, | 100 | u16 min_average_noise_antennat_i, |
101 | u32 min_average_noise); | 101 | u32 min_average_noise, |
102 | u8 default_chain); | ||
102 | void (*chain_noise_reset)(struct iwl_priv *priv); | 103 | void (*chain_noise_reset)(struct iwl_priv *priv); |
103 | void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info, | 104 | void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info, |
104 | __le32 *tx_flags); | 105 | __le32 *tx_flags); |
@@ -218,6 +219,7 @@ struct iwl_mod_params { | |||
218 | * to the deviation to achieve the desired led frequency. | 219 | * to the deviation to achieve the desired led frequency. |
219 | * The detail algorithm is described in iwl-led.c | 220 | * The detail algorithm is described in iwl-led.c |
220 | * @use_rts_for_ht: use rts/cts protection for HT traffic | 221 | * @use_rts_for_ht: use rts/cts protection for HT traffic |
222 | * @chain_noise_num_beacons: number of beacons used to compute chain noise | ||
221 | * | 223 | * |
222 | * We enable the driver to be backward compatible wrt API version. The | 224 | * We enable the driver to be backward compatible wrt API version. The |
223 | * driver specifies which APIs it supports (with @ucode_api_max being the | 225 | * driver specifies which APIs it supports (with @ucode_api_max being the |
@@ -262,6 +264,7 @@ struct iwl_cfg { | |||
262 | u16 led_compensation; | 264 | u16 led_compensation; |
263 | const bool broken_powersave; | 265 | const bool broken_powersave; |
264 | bool use_rts_for_ht; | 266 | bool use_rts_for_ht; |
267 | int chain_noise_num_beacons; | ||
265 | }; | 268 | }; |
266 | 269 | ||
267 | /*************************** | 270 | /*************************** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 3ea97be7f6b2..ad99ce7824c6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -743,7 +743,8 @@ struct iwl_dma_ptr { | |||
743 | 743 | ||
744 | /* Sensitivity and chain noise calibration */ | 744 | /* Sensitivity and chain noise calibration */ |
745 | #define INITIALIZATION_VALUE 0xFFFF | 745 | #define INITIALIZATION_VALUE 0xFFFF |
746 | #define CAL_NUM_OF_BEACONS 20 | 746 | #define IWL4965_CAL_NUM_BEACONS 20 |
747 | #define IWL_CAL_NUM_BEACONS 16 | ||
747 | #define MAXIMUM_ALLOWED_PATHLOSS 15 | 748 | #define MAXIMUM_ALLOWED_PATHLOSS 15 |
748 | 749 | ||
749 | #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 | 750 | #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 |