diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-05-21 05:55:54 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-06-06 07:24:19 -0400 |
commit | 26a7ca9a71a3f7e1826de96b1a1e907123e11b07 (patch) | |
tree | 7ab52c58fdd876bacf112c1bfceeac865f196704 /drivers/net/wireless/iwlwifi/dvm/calib.c | |
parent | 08838cdeca65e754af5c755a05f6cdb1c632eda8 (diff) |
iwlwifi: refactor EEPROM reading/parsing
The EEPROM reading/parsing code is all mixed in
the driver today, and the EEPROM is parsed only
when we access data from it. This is problematic
because the NVM needs to be parsed and that is
independent of reading it. Also, the NVM format
for new devices will be different and probably
require a new parser.
Therefore refactor the reading and parsing and
create two independent components. Reading the
EEPROM requires direct hardware accesses and
therefore access to the transport, but parsing
is independent and can be done on an NVM blob.
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm/calib.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/calib.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.c b/drivers/net/wireless/iwlwifi/dvm/calib.c index 7eb3fa3df7c4..f2dd671d7dc8 100644 --- a/drivers/net/wireless/iwlwifi/dvm/calib.c +++ b/drivers/net/wireless/iwlwifi/dvm/calib.c | |||
@@ -833,14 +833,14 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, | |||
833 | * To be safe, simply mask out any chains that we know | 833 | * To be safe, simply mask out any chains that we know |
834 | * are not on the device. | 834 | * are not on the device. |
835 | */ | 835 | */ |
836 | active_chains &= priv->hw_params.valid_rx_ant; | 836 | active_chains &= priv->eeprom_data->valid_rx_ant; |
837 | 837 | ||
838 | num_tx_chains = 0; | 838 | num_tx_chains = 0; |
839 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 839 | for (i = 0; i < NUM_RX_CHAINS; i++) { |
840 | /* loops on all the bits of | 840 | /* loops on all the bits of |
841 | * priv->hw_setting.valid_tx_ant */ | 841 | * priv->hw_setting.valid_tx_ant */ |
842 | u8 ant_msk = (1 << i); | 842 | u8 ant_msk = (1 << i); |
843 | if (!(priv->hw_params.valid_tx_ant & ant_msk)) | 843 | if (!(priv->eeprom_data->valid_tx_ant & ant_msk)) |
844 | continue; | 844 | continue; |
845 | 845 | ||
846 | num_tx_chains++; | 846 | num_tx_chains++; |
@@ -854,7 +854,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, | |||
854 | * connect the first valid tx chain | 854 | * connect the first valid tx chain |
855 | */ | 855 | */ |
856 | first_chain = | 856 | first_chain = |
857 | find_first_chain(priv->hw_params.valid_tx_ant); | 857 | find_first_chain(priv->eeprom_data->valid_tx_ant); |
858 | data->disconn_array[first_chain] = 0; | 858 | data->disconn_array[first_chain] = 0; |
859 | active_chains |= BIT(first_chain); | 859 | active_chains |= BIT(first_chain); |
860 | IWL_DEBUG_CALIB(priv, | 860 | IWL_DEBUG_CALIB(priv, |
@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, | |||
864 | } | 864 | } |
865 | } | 865 | } |
866 | 866 | ||
867 | if (active_chains != priv->hw_params.valid_rx_ant && | 867 | if (active_chains != priv->eeprom_data->valid_rx_ant && |
868 | active_chains != priv->chain_noise_data.active_chains) | 868 | active_chains != priv->chain_noise_data.active_chains) |
869 | IWL_DEBUG_CALIB(priv, | 869 | IWL_DEBUG_CALIB(priv, |
870 | "Detected that not all antennas are connected! " | 870 | "Detected that not all antennas are connected! " |
871 | "Connected: %#x, valid: %#x.\n", | 871 | "Connected: %#x, valid: %#x.\n", |
872 | active_chains, | 872 | active_chains, |
873 | priv->hw_params.valid_rx_ant); | 873 | priv->eeprom_data->valid_rx_ant); |
874 | 874 | ||
875 | /* Save for use within RXON, TX, SCAN commands, etc. */ | 875 | /* Save for use within RXON, TX, SCAN commands, etc. */ |
876 | data->active_chains = active_chains; | 876 | data->active_chains = active_chains; |
@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) | |||
1055 | priv->cfg->bt_params->advanced_bt_coexist) { | 1055 | priv->cfg->bt_params->advanced_bt_coexist) { |
1056 | /* Disable disconnected antenna algorithm for advanced | 1056 | /* Disable disconnected antenna algorithm for advanced |
1057 | bt coex, assuming valid antennas are connected */ | 1057 | bt coex, assuming valid antennas are connected */ |
1058 | data->active_chains = priv->hw_params.valid_rx_ant; | 1058 | data->active_chains = priv->eeprom_data->valid_rx_ant; |
1059 | for (i = 0; i < NUM_RX_CHAINS; i++) | 1059 | for (i = 0; i < NUM_RX_CHAINS; i++) |
1060 | if (!(data->active_chains & (1<<i))) | 1060 | if (!(data->active_chains & (1<<i))) |
1061 | data->disconn_array[i] = 1; | 1061 | data->disconn_array[i] = 1; |
@@ -1084,8 +1084,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) | |||
1084 | IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", | 1084 | IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", |
1085 | min_average_noise, min_average_noise_antenna_i); | 1085 | min_average_noise, min_average_noise_antenna_i); |
1086 | 1086 | ||
1087 | iwlagn_gain_computation(priv, average_noise, | 1087 | iwlagn_gain_computation( |
1088 | find_first_chain(priv->hw_params.valid_rx_ant)); | 1088 | priv, average_noise, |
1089 | find_first_chain(priv->eeprom_data->valid_rx_ant)); | ||
1089 | 1090 | ||
1090 | /* Some power changes may have been made during the calibration. | 1091 | /* Some power changes may have been made during the calibration. |
1091 | * Update and commit the RXON | 1092 | * Update and commit the RXON |