Commit d4fe5ac9 authored by Ben Cahill's avatar Ben Cahill Committed by John W. Linville

iwlwifi: Add chain noise scaling factor

6x50 device requires a different scaling factor for Rx gain values sent to
device via PHY_CALIBRATION_CMD (CHAIN_NOISE_GAIN_CMD).  Rather than create
a new iwlXXXX_gain_computation() function, add new chain_noise_scale member
to struct iwl_cfg, and keep using iwl5000_gain_computation().
Signed-off-by: default avatarBen Cahill <ben.m.cahill@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 19885c4f
......@@ -247,6 +247,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl1000_bg_cfg = {
......@@ -274,6 +275,7 @@ struct iwl_cfg iwl1000_bg_cfg = {
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
......@@ -179,14 +179,24 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
data->delta_gain_code[i] = 0;
continue;
}
delta_g = (1000 * ((s32)average_noise[default_chain] -
delta_g = (priv->cfg->chain_noise_scale *
((s32)average_noise[default_chain] -
(s32)average_noise[i])) / 1500;
/* bound gain by 2 bits value max, 3rd bit is sign */
data->delta_gain_code[i] =
min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
if (delta_g < 0)
/* set negative sign */
/*
* set negative sign ...
* note to Intel developers: This is uCode API format,
* not the format of any internal device registers.
* Do not change this format for e.g. 6050 or similar
* devices. Change format only if more resolution
* (i.e. more than 2 bits magnitude) is needed.
*/
data->delta_gain_code[i] |= (1 << 2);
}
......@@ -1587,6 +1597,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
.use_rts_for_ht = true, /* use rts/cts protection */
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5100_bgn_cfg = {
......@@ -1612,6 +1623,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
.use_rts_for_ht = true, /* use rts/cts protection */
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5100_abg_cfg = {
......@@ -1635,6 +1647,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
.led_compensation = 51,
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5100_agn_cfg = {
......@@ -1660,6 +1673,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
.use_rts_for_ht = true, /* use rts/cts protection */
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5350_agn_cfg = {
......@@ -1685,6 +1699,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
.use_rts_for_ht = true, /* use rts/cts protection */
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5150_agn_cfg = {
......@@ -1710,6 +1725,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
.use_rts_for_ht = true, /* use rts/cts protection */
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl5150_abg_cfg = {
......@@ -1733,6 +1749,7 @@ struct iwl_cfg iwl5150_abg_cfg = {
.led_compensation = 51,
.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
......
......@@ -324,6 +324,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl6000i_2abg_cfg = {
......@@ -354,6 +355,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl6000i_2bg_cfg = {
......@@ -384,6 +386,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
struct iwl_cfg iwl6050_2agn_cfg = {
......@@ -415,6 +418,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1500,
};
struct iwl_cfg iwl6050_2abg_cfg = {
......@@ -445,6 +449,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1500,
};
struct iwl_cfg iwl6000_3agn_cfg = {
......@@ -476,6 +481,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
.adv_thermal_throttle = true,
.support_ct_kill_exit = true,
.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
.chain_noise_scale = 1000,
};
MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
......
......@@ -293,6 +293,7 @@ struct iwl_cfg {
bool support_ct_kill_exit;
const bool support_wimax_coexist;
u8 plcp_delta_threshold;
s32 chain_noise_scale;
};
/***************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment