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

Commit 0da0e5bf authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy
Browse files

iwlagn: clean up & autodetect statistics



There's no need to keep both normal and BT statistics
versions around all the time in memory when we only
use a subset of both. So keep only the subsets that
we need in memory, depending on the debug config).

Also, in doing so, we can remove all the calls to
iwl_bt_statistics() in the driver as we'll just
access the copied statistics now.

Finally, also remove this call from the one place
where it might still be needed and automatically
detect what kind of statistics the device is sending
based on their size. This way, we don't need to keep
track of which devices do what any more, which is
good since this is subject to change based on the
ucode version (as some ucode even for non-BT devices
will in fact use BT statistics).

Warn upon encountering a statistics command from the
ucode that isn't known, so we will find such issues
earlier in the future.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Tested-by: default avatarDon Fry <donald.h.fry@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 703bc583
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -383,7 +383,6 @@ static struct iwl_ht_params iwl2000_ht_params = {
};

static struct iwl_bt_params iwl2030_bt_params = {
	.bt_statistics = true,
	/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
	.advanced_bt_coexist = true,
	.agg_time_limit = BT_AGG_THRESHOLD_DEF,
+1 −1
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ static void iwl5150_temperature(struct iwl_priv *priv)
	u32 vt = 0;
	s32 offset =  iwl_temp_calib_to_offset(priv);

	vt = le32_to_cpu(priv->_agn.statistics.general.common.temperature);
	vt = le32_to_cpu(priv->statistics.common.temperature);
	vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
	/* now vt hold the temperature in Kelvin */
	priv->temperature = KELVIN_TO_CELSIUS(vt);
+0 −1
Original line number Diff line number Diff line
@@ -489,7 +489,6 @@ static struct iwl_ht_params iwl6000_ht_params = {
};

static struct iwl_bt_params iwl6000_bt_params = {
	.bt_statistics = true,
	/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
	.advanced_bt_coexist = true,
	.agg_time_limit = BT_AGG_THRESHOLD_DEF,
+11 −32
Original line number Diff line number Diff line
@@ -605,7 +605,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
	IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
}

void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
void iwl_sensitivity_calibration(struct iwl_priv *priv)
{
	u32 rx_enable_time;
	u32 fa_cck;
@@ -631,16 +631,9 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
	}

	spin_lock_irqsave(&priv->lock, flags);
	if (iwl_bt_statistics(priv)) {
		rx_info = &(((struct iwl_bt_notif_statistics *)resp)->
			      rx.general.common);
		ofdm = &(((struct iwl_bt_notif_statistics *)resp)->rx.ofdm);
		cck = &(((struct iwl_bt_notif_statistics *)resp)->rx.cck);
	} else {
		rx_info = &(((struct iwl_notif_statistics *)resp)->rx.general);
		ofdm = &(((struct iwl_notif_statistics *)resp)->rx.ofdm);
		cck = &(((struct iwl_notif_statistics *)resp)->rx.cck);
	}
	rx_info = &priv->statistics.rx_non_phy;
	ofdm = &priv->statistics.rx_ofdm;
	cck = &priv->statistics.rx_cck;
	if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
		IWL_DEBUG_CALIB(priv, "<< invalid data.\n");
		spin_unlock_irqrestore(&priv->lock, flags);
@@ -851,7 +844,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
 * 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 *stat_resp)
void iwl_chain_noise_calibration(struct iwl_priv *priv)
{
	struct iwl_chain_noise_data *data = NULL;

@@ -896,13 +889,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
	}

	spin_lock_irqsave(&priv->lock, flags);
	if (iwl_bt_statistics(priv)) {
		rx_info = &(((struct iwl_bt_notif_statistics *)stat_resp)->
			      rx.general.common);
	} else {
		rx_info = &(((struct iwl_notif_statistics *)stat_resp)->
			      rx.general);
	}

	rx_info = &priv->statistics.rx_non_phy;

	if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
		IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
		spin_unlock_irqrestore(&priv->lock, flags);
@@ -911,19 +900,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)

	rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
	rxon_chnum = le16_to_cpu(ctx->staging.channel);
	if (iwl_bt_statistics(priv)) {
		stat_band24 = !!(((struct iwl_bt_notif_statistics *)
				 stat_resp)->flag &
				 STATISTICS_REPLY_FLG_BAND_24G_MSK);
		stat_chnum = le32_to_cpu(((struct iwl_bt_notif_statistics *)
					 stat_resp)->flag) >> 16;
	} else {
		stat_band24 = !!(((struct iwl_notif_statistics *)
				 stat_resp)->flag &
				 STATISTICS_REPLY_FLG_BAND_24G_MSK);
		stat_chnum = le32_to_cpu(((struct iwl_notif_statistics *)
					 stat_resp)->flag) >> 16;
	}
	stat_band24 =
		!!(priv->statistics.flag & STATISTICS_REPLY_FLG_BAND_24G_MSK);
	stat_chnum = le32_to_cpu(priv->statistics.flag) >> 16;

	/* Make sure we accumulate data for just the associated channel
	 *   (even if scanning). */
+2 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@
#include "iwl-core.h"
#include "iwl-commands.h"

void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp);
void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp);
void iwl_chain_noise_calibration(struct iwl_priv *priv);
void iwl_sensitivity_calibration(struct iwl_priv *priv);

void iwl_init_sensitivity(struct iwl_priv *priv);
void iwl_reset_run_time_calib(struct iwl_priv *priv);
Loading