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 /drivers/net/wireless/iwlwifi/iwl-calib.c | |
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-calib.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-calib.c | 64 |
1 files changed, 45 insertions, 19 deletions
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 |