// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright (C) 2005-2014 Intel Corporation */ #include <linux/slab.h> #include <net/mac80211.h> #include "iwl-trans.h" #include "dev.h" #include "calib.h" #include "agn.h" /***************************************************************************** * INIT calibrations framework *****************************************************************************/ /* Opaque calibration results */ struct iwl_calib_result { … }; struct statistics_general_data { … }; int iwl_send_calib_results(struct iwl_priv *priv) { … } int iwl_calib_set(struct iwl_priv *priv, const struct iwl_calib_cmd *cmd, size_t len) { … } void iwl_calib_free_results(struct iwl_priv *priv) { … } /***************************************************************************** * RUNTIME calibrations framework *****************************************************************************/ /* "false alarms" are signals that our DSP tries to lock onto, * but then determines that they are either noise, or transmissions * from a distant wireless network (also "noise", really) that get * "stepped on" by stronger transmissions within our own network. * This algorithm attempts to set a sensitivity level that is high * enough to receive all of our own network traffic, but not so * high that our DSP gets too busy trying to lock onto non-network * activity/noise. */ static int iwl_sens_energy_cck(struct iwl_priv *priv, u32 norm_fa, u32 rx_enable_time, struct statistics_general_data *rx_info) { … } static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv, u32 norm_fa, u32 rx_enable_time) { … } static void iwl_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv, struct iwl_sensitivity_data *data, __le16 *tbl) { … } /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ static int iwl_sensitivity_write(struct iwl_priv *priv) { … } /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv) { … } void iwl_init_sensitivity(struct iwl_priv *priv) { … } void iwl_sensitivity_calibration(struct iwl_priv *priv) { … } static inline u8 find_first_chain(u8 mask) { … } /* * Run disconnected antenna algorithm to find out which antennas are * disconnected. */ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, struct iwl_chain_noise_data *data) { … } static void iwlagn_gain_computation(struct iwl_priv *priv, u32 average_noise[NUM_RX_CHAINS], u8 default_chain) { … } /* * Accumulate 16 beacons of signal and noise statistics for each of * 3 receivers/antennas/rx-chains, then figure out: * 1) Which antennas are connected. * 2) Differential rx gain settings to balance the 3 receivers. */ void iwl_chain_noise_calibration(struct iwl_priv *priv) { … } void iwl_reset_run_time_calib(struct iwl_priv *priv) { … }