Commit bfb45f54 authored by Dor Shaish's avatar Dor Shaish Committed by Wey-Yi Guy

iwlwifi: Disabling calibrations variable

Add a variable for disabling specific calibrations.
Merged old variables for calibrations disabling.
Signed-off-by: default avatarDor Shaish <dor.shaish@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 7dcf1e60
......@@ -599,7 +599,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
struct iwl_sensitivity_data *data = NULL;
const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens;
if (priv->disable_sens_cal)
if (priv->calib_disabled & IWL_SENSITIVITY_CALIB_DISABLED)
return;
IWL_DEBUG_CALIB(priv, "Start iwl_init_sensitivity\n");
......@@ -663,7 +663,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv)
struct statistics_rx_phy *ofdm, *cck;
struct statistics_general_data statis;
if (priv->disable_sens_cal)
if (priv->calib_disabled & IWL_SENSITIVITY_CALIB_DISABLED)
return;
data = &(priv->sensitivity_data);
......@@ -970,7 +970,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
if (priv->disable_chain_noise_cal)
if (priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED)
return;
data = &(priv->chain_noise_data);
......
......@@ -414,6 +414,9 @@ static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
bool defer;
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
if (priv->calib_disabled & IWL_TX_POWER_CALIB_DISABLED)
return 0;
lockdep_assert_held(&priv->mutex);
if (priv->tx_power_user_lmt == tx_power && !force)
......@@ -1319,6 +1322,9 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
struct iwl_chain_noise_data *data = &priv->chain_noise_data;
int ret;
if (!(priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED))
return;
if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
iwl_is_any_associated(priv)) {
struct iwl_calib_chain_noise_reset_cmd cmd;
......@@ -1471,8 +1477,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
iwl_power_update_mode(priv, false);
/* Enable RX differential gain and sensitivity calibrations */
if (!priv->disable_chain_noise_cal)
iwlagn_chain_noise_reset(priv);
iwlagn_chain_noise_reset(priv);
priv->start_calib = 1;
}
......
......@@ -2471,6 +2471,34 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
return count;
}
static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct iwl_priv *priv = file->private_data;
char buf[120];
int pos = 0;
const size_t bufsz = sizeof(buf);
pos += scnprintf(buf + pos, bufsz - pos,
"Sensitivity calibrations %s\n",
(priv->calib_disabled &
IWL_SENSITIVITY_CALIB_DISABLED) ?
"DISABLED" : "ENABLED");
pos += scnprintf(buf + pos, bufsz - pos,
"Chain noise calibrations %s\n",
(priv->calib_disabled &
IWL_CHAIN_NOISE_CALIB_DISABLED) ?
"DISABLED" : "ENABLED");
pos += scnprintf(buf + pos, bufsz - pos,
"Tx power calibrations %s\n",
(priv->calib_disabled &
IWL_TX_POWER_CALIB_DISABLED) ?
"DISABLED" : "ENABLED");
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}
DEBUGFS_READ_FILE_OPS(rx_statistics);
DEBUGFS_READ_FILE_OPS(tx_statistics);
DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
......@@ -2495,6 +2523,7 @@ DEBUGFS_READ_WRITE_FILE_OPS(protection_mode);
DEBUGFS_READ_FILE_OPS(reply_tx_error);
DEBUGFS_WRITE_FILE_OPS(echo_test);
DEBUGFS_READ_WRITE_FILE_OPS(log_event);
DEBUGFS_READ_FILE_OPS(calib_disabled);
/*
* Create the debugfs files and directories
......@@ -2562,10 +2591,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
if (iwl_advanced_bt_coexist(priv))
DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR);
DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf,
&priv->disable_sens_cal);
DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf,
&priv->disable_chain_noise_cal);
/* Calibrations disabled/enabled status*/
DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IRUSR);
if (iwl_trans_dbgfs_register(trans(priv), dir_debug))
goto err;
......
......@@ -741,6 +741,14 @@ struct iwl_wipan_noa_data {
u8 data[];
};
/* Calibration disabling bit mask */
#define IWL_SENSITIVITY_CALIB_DISABLED BIT(1)
#define IWL_CHAIN_NOISE_CALIB_DISABLED BIT(2)
#define IWL_TX_POWER_CALIB_DISABLED BIT(3)
#define IWL_CALIB_ENABLE_ALL 0
#define IWL_CALIB_DISABLE_ALL 0xFFFFFFFF
#define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
......@@ -1010,8 +1018,7 @@ struct iwl_priv {
enum iwl_nvm_type nvm_device_type;
struct work_struct txpower_work;
u32 disable_sens_cal;
u32 disable_chain_noise_cal;
u32 calib_disabled;
struct work_struct run_time_calib_work;
struct timer_list statistics_periodic;
struct timer_list ucode_trace;
......
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