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

Commit 0d8877a1 authored by Johannes Berg's avatar Johannes Berg
Browse files

iwlwifi: move some configuration parameters into DVM



There are a number of parameters that aren't really hardware
specific but rather define how the DVM firmware is used.
Move these into the DVM configuration.

Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent ee4d5471
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -78,10 +78,13 @@
/* device operations */
extern struct iwl_dvm_cfg iwl_dvm_1000_cfg;
extern struct iwl_dvm_cfg iwl_dvm_2000_cfg;
extern struct iwl_dvm_cfg iwl_dvm_105_cfg;
extern struct iwl_dvm_cfg iwl_dvm_2030_cfg;
extern struct iwl_dvm_cfg iwl_dvm_5000_cfg;
extern struct iwl_dvm_cfg iwl_dvm_5150_cfg;
extern struct iwl_dvm_cfg iwl_dvm_6000_cfg;
extern struct iwl_dvm_cfg iwl_dvm_6005_cfg;
extern struct iwl_dvm_cfg iwl_dvm_6050_cfg;
extern struct iwl_dvm_cfg iwl_dvm_6030_cfg;


@@ -291,8 +294,8 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena);

static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
{
	return priv->cfg->bt_params &&
	       priv->cfg->bt_params->advanced_bt_coexist;
	return priv->lib->bt_params &&
	       priv->lib->bt_params->advanced_bt_coexist;
}

#ifdef CONFIG_IWLWIFI_DEBUG
+4 −4
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)

	iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]);

	if (priv->cfg->base_params->hd_v2) {
	if (priv->lib->hd_v2) {
		cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] =
			HD_INA_NON_SQUARE_DET_OFDM_DATA_V2;
		cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] =
@@ -895,7 +895,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
			continue;
		}

		delta_g = (priv->cfg->base_params->chain_noise_scale *
		delta_g = (priv->lib->chain_noise_scale *
			((s32)average_noise[default_chain] -
			(s32)average_noise[i])) / 1500;

@@ -1051,8 +1051,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
		return;

	/* Analyze signal for disconnected antenna */
	if (priv->cfg->bt_params &&
	    priv->cfg->bt_params->advanced_bt_coexist) {
	if (priv->lib->bt_params &&
	    priv->lib->bt_params->advanced_bt_coexist) {
		/* Disable disconnected antenna algorithm for advanced
		   bt coex, assuming valid antennas are connected */
		data->active_chains = priv->nvm_data->valid_rx_ant;
+49 −4
Original line number Diff line number Diff line
@@ -568,16 +568,61 @@ struct iwl_hw_params {
	const struct iwl_sensitivity_ranges *sens;
};

/**
 * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters
 * @advanced_bt_coexist: support advanced bt coexist
 * @bt_init_traffic_load: specify initial bt traffic load
 * @bt_prio_boost: default bt priority boost value
 * @agg_time_limit: maximum number of uSec in aggregation
 * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
 */
struct iwl_dvm_bt_params {
	bool advanced_bt_coexist;
	u8 bt_init_traffic_load;
	u32 bt_prio_boost;
	u16 agg_time_limit;
	bool bt_sco_disable;
	bool bt_session_2;
};

/**
 * struct iwl_dvm_cfg - DVM firmware specific device configuration
 * @set_hw_params: set hardware parameters
 * @set_channel_switch: send channel switch command
 * @nic_config: apply device specific configuration
 * @temperature: read temperature
 * @adv_thermal_throttle: support advance thermal throttle
 * @support_ct_kill_exit: support ct kill exit condition
 * @plcp_delta_threshold: plcp error rate threshold used to trigger
 *	radio tuning when there is a high receiving plcp error rate
 * @chain_noise_scale: default chain noise scale used for gain computation
 * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
 * @no_idle_support: do not support idle mode
 * @bt_params: pointer to BT parameters
 * @need_temp_offset_calib: need to perform temperature offset calibration
 * @no_xtal_calib: some devices do not need crystal calibration data,
 *	don't send it to those
 * @temp_offset_v2: support v2 of temperature offset calibration
 * @adv_pm: advanced power management
 */
struct iwl_dvm_cfg {
	/* set hw dependent parameters */
	void (*set_hw_params)(struct iwl_priv *priv);
	int (*set_channel_switch)(struct iwl_priv *priv,
				  struct ieee80211_channel_switch *ch_switch);
	/* device specific configuration */
	void (*nic_config)(struct iwl_priv *priv);

	/* temperature */
	void (*temperature)(struct iwl_priv *priv);

	const struct iwl_dvm_bt_params *bt_params;
	s32 chain_noise_scale;
	u8 plcp_delta_threshold;
	bool adv_thermal_throttle;
	bool support_ct_kill_exit;
	bool hd_v2;
	bool no_idle_support;
	bool need_temp_offset_calib;
	bool no_xtal_calib;
	bool temp_offset_v2;
	bool adv_pm;
};

struct iwl_wipan_noa_data {
+93 −0
Original line number Diff line number Diff line
@@ -178,6 +178,9 @@ struct iwl_dvm_cfg iwl_dvm_1000_cfg = {
	.set_hw_params = iwl1000_hw_set_hw_params,
	.nic_config = iwl1000_nic_config,
	.temperature = iwlagn_temperature,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
};


@@ -236,12 +239,52 @@ struct iwl_dvm_cfg iwl_dvm_2000_cfg = {
	.set_hw_params = iwl2000_hw_set_hw_params,
	.nic_config = iwl2000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.hd_v2 = true,
	.need_temp_offset_calib = true,
	.temp_offset_v2 = true,
};

struct iwl_dvm_cfg iwl_dvm_105_cfg = {
	.set_hw_params = iwl2000_hw_set_hw_params,
	.nic_config = iwl2000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.hd_v2 = true,
	.need_temp_offset_calib = true,
	.temp_offset_v2 = true,
	.adv_pm = true,
};

static const struct iwl_dvm_bt_params iwl2030_bt_params = {
	/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
	.advanced_bt_coexist = true,
	.agg_time_limit = BT_AGG_THRESHOLD_DEF,
	.bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
	.bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT32,
	.bt_sco_disable = true,
	.bt_session_2 = true,
};

struct iwl_dvm_cfg iwl_dvm_2030_cfg = {
	.set_hw_params = iwl2000_hw_set_hw_params,
	.nic_config = iwl2000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.hd_v2 = true,
	.bt_params = &iwl2030_bt_params,
	.need_temp_offset_calib = true,
	.temp_offset_v2 = true,
	.adv_pm = true,
};

/*
@@ -424,12 +467,19 @@ struct iwl_dvm_cfg iwl_dvm_5000_cfg = {
	.set_hw_params = iwl5000_hw_set_hw_params,
	.set_channel_switch = iwl5000_hw_channel_switch,
	.temperature = iwlagn_temperature,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.no_idle_support = true,
};

struct iwl_dvm_cfg iwl_dvm_5150_cfg = {
	.set_hw_params = iwl5150_hw_set_hw_params,
	.set_channel_switch = iwl5000_hw_channel_switch,
	.temperature = iwl5150_temperature,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.no_idle_support = true,
	.no_xtal_calib = true,
};


@@ -589,6 +639,42 @@ struct iwl_dvm_cfg iwl_dvm_6000_cfg = {
	.set_channel_switch = iwl6000_hw_channel_switch,
	.nic_config = iwl6000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
};

const struct iwl_dvm_cfg iwl_dvm_6005_cfg = {
	.set_hw_params = iwl6000_hw_set_hw_params,
	.set_channel_switch = iwl6000_hw_channel_switch,
	.nic_config = iwl6000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.need_temp_offset_calib = true,
};

struct iwl_dvm_cfg iwl_dvm_6050_cfg = {
	.set_hw_params = iwl6000_hw_set_hw_params,
	.set_channel_switch = iwl6000_hw_channel_switch,
	.nic_config = iwl6000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1500,
};

static const struct iwl_dvm_bt_params iwl6000_bt_params = {
	/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
	.advanced_bt_coexist = true,
	.agg_time_limit = BT_AGG_THRESHOLD_DEF,
	.bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
	.bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
	.bt_sco_disable = true,
};

struct iwl_dvm_cfg iwl_dvm_6030_cfg = {
@@ -596,4 +682,11 @@ struct iwl_dvm_cfg iwl_dvm_6030_cfg = {
	.set_channel_switch = iwl6000_hw_channel_switch,
	.nic_config = iwl6000_nic_config,
	.temperature = iwlagn_temperature,
	.adv_thermal_throttle = true,
	.support_ct_kill_exit = true,
	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
	.chain_noise_scale = 1000,
	.bt_params = &iwl6000_bt_params,
	.need_temp_offset_calib = true,
	.adv_pm = true,
};
+10 −10
Original line number Diff line number Diff line
@@ -254,23 +254,23 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
	BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) !=
			sizeof(basic.bt3_lookup_table));

	if (priv->cfg->bt_params) {
	if (priv->lib->bt_params) {
		/*
		 * newer generation of devices (2000 series and newer)
		 * use the version 2 of the bt command
		 * we need to make sure sending the host command
		 * with correct data structure to avoid uCode assert
		 */
		if (priv->cfg->bt_params->bt_session_2) {
		if (priv->lib->bt_params->bt_session_2) {
			bt_cmd_v2.prio_boost = cpu_to_le32(
				priv->cfg->bt_params->bt_prio_boost);
				priv->lib->bt_params->bt_prio_boost);
			bt_cmd_v2.tx_prio_boost = 0;
			bt_cmd_v2.rx_prio_boost = 0;
		} else {
			/* older version only has 8 bits */
			WARN_ON(priv->cfg->bt_params->bt_prio_boost & ~0xFF);
			WARN_ON(priv->lib->bt_params->bt_prio_boost & ~0xFF);
			bt_cmd_v1.prio_boost =
				priv->cfg->bt_params->bt_prio_boost;
				priv->lib->bt_params->bt_prio_boost;
			bt_cmd_v1.tx_prio_boost = 0;
			bt_cmd_v1.rx_prio_boost = 0;
		}
@@ -330,7 +330,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
		       priv->bt_full_concurrent ?
		       "full concurrency" : "3-wire");

	if (priv->cfg->bt_params->bt_session_2) {
	if (priv->lib->bt_params->bt_session_2) {
		memcpy(&bt_cmd_v2.basic, &basic,
			sizeof(basic));
		ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
@@ -758,8 +758,8 @@ static bool is_single_rx_stream(struct iwl_priv *priv)
 */
static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
{
	if (priv->cfg->bt_params &&
	    priv->cfg->bt_params->advanced_bt_coexist &&
	if (priv->lib->bt_params &&
	    priv->lib->bt_params->advanced_bt_coexist &&
	    (priv->bt_full_concurrent ||
	     priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
		/*
@@ -830,8 +830,8 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
	else
		active_chains = priv->nvm_data->valid_rx_ant;

	if (priv->cfg->bt_params &&
	    priv->cfg->bt_params->advanced_bt_coexist &&
	if (priv->lib->bt_params &&
	    priv->lib->bt_params->advanced_bt_coexist &&
	    (priv->bt_full_concurrent ||
	     priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
		/*
Loading