|
@@ -57,17 +57,7 @@ int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
|
|
|
|
-{
|
|
|
|
- u16 size = (u16)sizeof(struct iwl_addsta_cmd);
|
|
|
|
- struct iwl_addsta_cmd *addsta = (struct iwl_addsta_cmd *)data;
|
|
|
|
- memcpy(addsta, cmd, size);
|
|
|
|
- /* resrved in 5000 */
|
|
|
|
- addsta->rate_n_flags = cpu_to_le16(0);
|
|
|
|
- return size;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void iwlagn_gain_computation(struct iwl_priv *priv,
|
|
|
|
|
|
+void iwlagn_gain_computation(struct iwl_priv *priv,
|
|
u32 average_noise[NUM_RX_CHAINS],
|
|
u32 average_noise[NUM_RX_CHAINS],
|
|
u16 min_average_noise_antenna_i,
|
|
u16 min_average_noise_antenna_i,
|
|
u32 min_average_noise,
|
|
u32 min_average_noise,
|
|
@@ -126,89 +116,6 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
|
|
|
|
-{
|
|
|
|
- struct iwl_chain_noise_data *data = &priv->chain_noise_data;
|
|
|
|
- int ret;
|
|
|
|
-
|
|
|
|
- if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
|
|
|
|
- iwl_is_any_associated(priv)) {
|
|
|
|
- struct iwl_calib_chain_noise_reset_cmd cmd;
|
|
|
|
-
|
|
|
|
- /* clear data for chain noise calibration algorithm */
|
|
|
|
- data->chain_noise_a = 0;
|
|
|
|
- data->chain_noise_b = 0;
|
|
|
|
- data->chain_noise_c = 0;
|
|
|
|
- data->chain_signal_a = 0;
|
|
|
|
- data->chain_signal_b = 0;
|
|
|
|
- data->chain_signal_c = 0;
|
|
|
|
- data->beacon_count = 0;
|
|
|
|
-
|
|
|
|
- memset(&cmd, 0, sizeof(cmd));
|
|
|
|
- iwl_set_calib_hdr(&cmd.hdr,
|
|
|
|
- priv->_agn.phy_calib_chain_noise_reset_cmd);
|
|
|
|
- ret = trans_send_cmd_pdu(priv,
|
|
|
|
- REPLY_PHY_CALIBRATION_CMD,
|
|
|
|
- CMD_SYNC, sizeof(cmd), &cmd);
|
|
|
|
- if (ret)
|
|
|
|
- IWL_ERR(priv,
|
|
|
|
- "Could not send REPLY_PHY_CALIBRATION_CMD\n");
|
|
|
|
- data->state = IWL_CHAIN_NOISE_ACCUMULATE;
|
|
|
|
- IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
|
|
|
|
- struct ieee80211_tx_info *info,
|
|
|
|
- __le16 fc, __le32 *tx_flags)
|
|
|
|
-{
|
|
|
|
- if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
|
|
|
|
- info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
|
|
|
|
- info->flags & IEEE80211_TX_CTL_AMPDU)
|
|
|
|
- *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/* Calc max signal level (dBm) among 3 possible receivers */
|
|
|
|
-static int iwlagn_calc_rssi(struct iwl_priv *priv,
|
|
|
|
- struct iwl_rx_phy_res *rx_resp)
|
|
|
|
-{
|
|
|
|
- /* data from PHY/DSP regarding signal strength, etc.,
|
|
|
|
- * contents are always there, not configurable by host
|
|
|
|
- */
|
|
|
|
- struct iwlagn_non_cfg_phy *ncphy =
|
|
|
|
- (struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
|
|
|
|
- u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
|
|
|
|
- u8 agc;
|
|
|
|
-
|
|
|
|
- val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
|
|
|
|
- agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
|
|
|
|
-
|
|
|
|
- /* Find max rssi among 3 possible receivers.
|
|
|
|
- * These values are measured by the digital signal processor (DSP).
|
|
|
|
- * They should stay fairly constant even as the signal strength varies,
|
|
|
|
- * if the radio's automatic gain control (AGC) is working right.
|
|
|
|
- * AGC value (see below) will provide the "interesting" info.
|
|
|
|
- */
|
|
|
|
- val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_AB_IDX]);
|
|
|
|
- rssi_a = (val & IWLAGN_OFDM_RSSI_INBAND_A_BITMSK) >>
|
|
|
|
- IWLAGN_OFDM_RSSI_A_BIT_POS;
|
|
|
|
- rssi_b = (val & IWLAGN_OFDM_RSSI_INBAND_B_BITMSK) >>
|
|
|
|
- IWLAGN_OFDM_RSSI_B_BIT_POS;
|
|
|
|
- val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_C_IDX]);
|
|
|
|
- rssi_c = (val & IWLAGN_OFDM_RSSI_INBAND_C_BITMSK) >>
|
|
|
|
- IWLAGN_OFDM_RSSI_C_BIT_POS;
|
|
|
|
-
|
|
|
|
- max_rssi = max_t(u32, rssi_a, rssi_b);
|
|
|
|
- max_rssi = max_t(u32, max_rssi, rssi_c);
|
|
|
|
-
|
|
|
|
- IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
|
|
|
|
- rssi_a, rssi_b, rssi_c, max_rssi, agc);
|
|
|
|
-
|
|
|
|
- /* dBm = max_rssi dB - agc dB - constant.
|
|
|
|
- * Higher AGC (higher radio gain) means lower signal. */
|
|
|
|
- return max_rssi - agc - IWLAGN_RSSI_OFFSET;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int iwlagn_set_pan_params(struct iwl_priv *priv)
|
|
int iwlagn_set_pan_params(struct iwl_priv *priv)
|
|
{
|
|
{
|
|
struct iwl_wipan_params_cmd cmd;
|
|
struct iwl_wipan_params_cmd cmd;
|
|
@@ -301,12 +208,3 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
-
|
|
|
|
-struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
|
|
|
|
- .build_addsta_hcmd = iwlagn_build_addsta_hcmd,
|
|
|
|
- .gain_computation = iwlagn_gain_computation,
|
|
|
|
- .chain_noise_reset = iwlagn_chain_noise_reset,
|
|
|
|
- .tx_cmd_protection = iwlagn_tx_cmd_protection,
|
|
|
|
- .calc_rssi = iwlagn_calc_rssi,
|
|
|
|
- .request_scan = iwlagn_request_scan,
|
|
|
|
-};
|
|
|