Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e295116 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

iwlwifi: move hw_params into priv



The hw_params are mostly values that are
derived from the actual hardware config.
As such, while it is possible that MVM
will require similar ones, it makes more
sense -- at least for now -- to put them
into the DVM struct.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7c5ba4a8
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -77,8 +77,8 @@
static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
{
	/* want Celsius */
	hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
	hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
	priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
	priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
}

/* NIC configuration for 1000 series */
@@ -122,20 +122,20 @@ static const struct iwl_sensitivity_ranges iwl1000_sensitivity = {

static void iwl1000_hw_set_hw_params(struct iwl_priv *priv)
{
	hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ);
	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ);

	hw_params(priv).tx_chains_num =
		num_of_ant(hw_params(priv).valid_tx_ant);
	priv->hw_params.tx_chains_num =
		num_of_ant(priv->hw_params.valid_tx_ant);
	if (cfg(priv)->rx_with_siso_diversity)
		hw_params(priv).rx_chains_num = 1;
		priv->hw_params.rx_chains_num = 1;
	else
		hw_params(priv).rx_chains_num =
			num_of_ant(hw_params(priv).valid_rx_ant);
		priv->hw_params.rx_chains_num =
			num_of_ant(priv->hw_params.valid_rx_ant);

	iwl1000_set_ct_threshold(priv);

	/* Set initial sensitivity parameters */
	hw_params(priv).sens = &iwl1000_sensitivity;
	priv->hw_params.sens = &iwl1000_sensitivity;
}

static struct iwl_lib_ops iwl1000_lib = {
+9 −9
Original line number Diff line number Diff line
@@ -77,8 +77,8 @@
static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
{
	/* want Celsius */
	hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
	hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
	priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
	priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
}

/* NIC configuration for 2000 series */
@@ -116,20 +116,20 @@ static const struct iwl_sensitivity_ranges iwl2000_sensitivity = {

static void iwl2000_hw_set_hw_params(struct iwl_priv *priv)
{
	hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ);
	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ);

	hw_params(priv).tx_chains_num =
		num_of_ant(hw_params(priv).valid_tx_ant);
	priv->hw_params.tx_chains_num =
		num_of_ant(priv->hw_params.valid_tx_ant);
	if (cfg(priv)->rx_with_siso_diversity)
		hw_params(priv).rx_chains_num = 1;
		priv->hw_params.rx_chains_num = 1;
	else
		hw_params(priv).rx_chains_num =
			num_of_ant(hw_params(priv).valid_rx_ant);
		priv->hw_params.rx_chains_num =
			num_of_ant(priv->hw_params.valid_rx_ant);

	iwl2000_set_ct_threshold(priv);

	/* Set initial sensitivity parameters */
	hw_params(priv).sens = &iwl2000_sensitivity;
	priv->hw_params.sens = &iwl2000_sensitivity;
}

static struct iwl_lib_ops iwl2000_lib = {
+14 −14
Original line number Diff line number Diff line
@@ -145,45 +145,45 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
	s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
			iwl_temp_calib_to_offset(priv->shrd);

	hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
	priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef;
}

static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
{
	/* want Celsius */
	hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
	priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
}

static void iwl5000_hw_set_hw_params(struct iwl_priv *priv)
{
	hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
					BIT(IEEE80211_BAND_5GHZ);

	hw_params(priv).tx_chains_num =
		num_of_ant(hw_params(priv).valid_tx_ant);
	hw_params(priv).rx_chains_num =
		num_of_ant(hw_params(priv).valid_rx_ant);
	priv->hw_params.tx_chains_num =
		num_of_ant(priv->hw_params.valid_tx_ant);
	priv->hw_params.rx_chains_num =
		num_of_ant(priv->hw_params.valid_rx_ant);

	iwl5000_set_ct_threshold(priv);

	/* Set initial sensitivity parameters */
	hw_params(priv).sens = &iwl5000_sensitivity;
	priv->hw_params.sens = &iwl5000_sensitivity;
}

static void iwl5150_hw_set_hw_params(struct iwl_priv *priv)
{
	hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
					BIT(IEEE80211_BAND_5GHZ);

	hw_params(priv).tx_chains_num =
		num_of_ant(hw_params(priv).valid_tx_ant);
	hw_params(priv).rx_chains_num =
		num_of_ant(hw_params(priv).valid_rx_ant);
	priv->hw_params.tx_chains_num =
		num_of_ant(priv->hw_params.valid_tx_ant);
	priv->hw_params.rx_chains_num =
		num_of_ant(priv->hw_params.valid_rx_ant);

	iwl5150_set_ct_threshold(priv);

	/* Set initial sensitivity parameters */
	hw_params(priv).sens = &iwl5150_sensitivity;
	priv->hw_params.sens = &iwl5150_sensitivity;
}

static void iwl5150_temperature(struct iwl_priv *priv)
+9 −9
Original line number Diff line number Diff line
@@ -74,8 +74,8 @@
static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
{
	/* want Celsius */
	hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
	hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
	priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
	priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
}

static void iwl6050_additional_nic_config(struct iwl_priv *priv)
@@ -139,21 +139,21 @@ static const struct iwl_sensitivity_ranges iwl6000_sensitivity = {

static void iwl6000_hw_set_hw_params(struct iwl_priv *priv)
{
	hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
					BIT(IEEE80211_BAND_5GHZ);

	hw_params(priv).tx_chains_num =
		num_of_ant(hw_params(priv).valid_tx_ant);
	priv->hw_params.tx_chains_num =
		num_of_ant(priv->hw_params.valid_tx_ant);
	if (cfg(priv)->rx_with_siso_diversity)
		hw_params(priv).rx_chains_num = 1;
		priv->hw_params.rx_chains_num = 1;
	else
		hw_params(priv).rx_chains_num =
			num_of_ant(hw_params(priv).valid_rx_ant);
		priv->hw_params.rx_chains_num =
			num_of_ant(priv->hw_params.valid_rx_ant);

	iwl6000_set_ct_threshold(priv);

	/* Set initial sensitivity parameters */
	hw_params(priv).sens = &iwl6000_sensitivity;
	priv->hw_params.sens = &iwl6000_sensitivity;

}

+11 −11
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
	u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
	u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
	struct iwl_sensitivity_data *data = NULL;
	const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
	const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens;

	data = &(priv->sensitivity_data);

@@ -373,7 +373,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
	u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
	u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
	struct iwl_sensitivity_data *data = NULL;
	const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
	const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens;

	data = &(priv->sensitivity_data);

@@ -597,7 +597,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
	int ret = 0;
	int i;
	struct iwl_sensitivity_data *data = NULL;
	const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
	const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens;

	if (priv->disable_sens_cal)
		return;
@@ -833,28 +833,28 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
	 * To be safe, simply mask out any chains that we know
	 * are not on the device.
	 */
	active_chains &= hw_params(priv).valid_rx_ant;
	active_chains &= priv->hw_params.valid_rx_ant;

	num_tx_chains = 0;
	for (i = 0; i < NUM_RX_CHAINS; i++) {
		/* loops on all the bits of
		 * priv->hw_setting.valid_tx_ant */
		u8 ant_msk = (1 << i);
		if (!(hw_params(priv).valid_tx_ant & ant_msk))
		if (!(priv->hw_params.valid_tx_ant & ant_msk))
			continue;

		num_tx_chains++;
		if (data->disconn_array[i] == 0)
			/* there is a Tx antenna connected */
			break;
		if (num_tx_chains == hw_params(priv).tx_chains_num &&
		if (num_tx_chains == priv->hw_params.tx_chains_num &&
		    data->disconn_array[i]) {
			/*
			 * If all chains are disconnected
			 * connect the first valid tx chain
			 */
			first_chain =
				find_first_chain(hw_params(priv).valid_tx_ant);
				find_first_chain(priv->hw_params.valid_tx_ant);
			data->disconn_array[first_chain] = 0;
			active_chains |= BIT(first_chain);
			IWL_DEBUG_CALIB(priv,
@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
		}
	}

	if (active_chains != hw_params(priv).valid_rx_ant &&
	if (active_chains != priv->hw_params.valid_rx_ant &&
	    active_chains != priv->chain_noise_data.active_chains)
		IWL_DEBUG_CALIB(priv,
				"Detected that not all antennas are connected! "
				"Connected: %#x, valid: %#x.\n",
				active_chains,
				hw_params(priv).valid_rx_ant);
				priv->hw_params.valid_rx_ant);

	/* Save for use within RXON, TX, SCAN commands, etc. */
	data->active_chains = active_chains;
@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
	    cfg(priv)->bt_params->advanced_bt_coexist) {
		/* Disable disconnected antenna algorithm for advanced
		   bt coex, assuming valid antennas are connected */
		data->active_chains = hw_params(priv).valid_rx_ant;
		data->active_chains = priv->hw_params.valid_rx_ant;
		for (i = 0; i < NUM_RX_CHAINS; i++)
			if (!(data->active_chains & (1<<i)))
				data->disconn_array[i] = 1;
@@ -1085,7 +1085,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
			min_average_noise, min_average_noise_antenna_i);

	iwlagn_gain_computation(priv, average_noise,
				find_first_chain(hw_params(priv).valid_rx_ant));
				find_first_chain(priv->hw_params.valid_rx_ant));

	/* Some power changes may have been made during the calibration.
	 * Update and commit the RXON
Loading