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

Commit e1991885 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

iwlwifi: move ucode loading to op_mode



uCode loading belongs to the op_mode, as it
is dependent on various things there and the
commands sent during it are specific to it.
Move the prototypes to iwl-agn.h to indicate
this. To make this possible, also move all
the calibration handling (which is op_mode
dependent after all).

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3d4f9699
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -75,6 +75,14 @@
 * INIT calibrations framework
 *****************************************************************************/

/* Opaque calibration results */
struct iwl_calib_result {
	struct list_head list;
	size_t cmd_len;
	struct iwl_calib_hdr hdr;
	/* data follows */
};

struct statistics_general_data {
	u32 beacon_silence_rssi_a;
	u32 beacon_silence_rssi_b;
@@ -84,7 +92,7 @@ struct statistics_general_data {
	u32 beacon_energy_c;
};

int iwl_send_calib_results(struct iwl_trans *trans)
int iwl_send_calib_results(struct iwl_priv *priv)
{
	struct iwl_host_cmd hcmd = {
		.id = REPLY_PHY_CALIBRATION_CMD,
@@ -92,15 +100,15 @@ int iwl_send_calib_results(struct iwl_trans *trans)
	};
	struct iwl_calib_result *res;

	list_for_each_entry(res, &trans->calib_results, list) {
	list_for_each_entry(res, &priv->calib_results, list) {
		int ret;

		hcmd.len[0] = res->cmd_len;
		hcmd.data[0] = &res->hdr;
		hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
		ret = iwl_trans_send_cmd(trans, &hcmd);
		ret = iwl_trans_send_cmd(trans(priv), &hcmd);
		if (ret) {
			IWL_ERR(trans, "Error %d on calib cmd %d\n",
			IWL_ERR(priv, "Error %d on calib cmd %d\n",
				ret, res->hdr.op_code);
			return ret;
		}
@@ -109,7 +117,7 @@ int iwl_send_calib_results(struct iwl_trans *trans)
	return 0;
}

int iwl_calib_set(struct iwl_trans *trans,
int iwl_calib_set(struct iwl_priv *priv,
		  const struct iwl_calib_hdr *cmd, int len)
{
	struct iwl_calib_result *res, *tmp;
@@ -121,7 +129,7 @@ int iwl_calib_set(struct iwl_trans *trans,
	memcpy(&res->hdr, cmd, len);
	res->cmd_len = len;

	list_for_each_entry(tmp, &trans->calib_results, list) {
	list_for_each_entry(tmp, &priv->calib_results, list) {
		if (tmp->hdr.op_code == res->hdr.op_code) {
			list_replace(&tmp->list, &res->list);
			kfree(tmp);
@@ -130,16 +138,16 @@ int iwl_calib_set(struct iwl_trans *trans,
	}

	/* wasn't in list already */
	list_add_tail(&res->list, &trans->calib_results);
	list_add_tail(&res->list, &priv->calib_results);

	return 0;
}

void iwl_calib_free_results(struct iwl_trans *trans)
void iwl_calib_free_results(struct iwl_priv *priv)
{
	struct iwl_calib_result *res, *tmp;

	list_for_each_entry_safe(res, tmp, &trans->calib_results, list) {
	list_for_each_entry_safe(res, tmp, &priv->calib_results, list) {
		list_del(&res->list);
		kfree(res);
	}
+1 −1
Original line number Diff line number Diff line
@@ -1195,7 +1195,7 @@ int iwlagn_suspend(struct iwl_priv *priv,

	priv->wowlan = true;

	ret = iwl_load_ucode_wait_alive(trans(priv), IWL_UCODE_WOWLAN);
	ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN);
	if (ret)
		goto out;

+1 −1
Original line number Diff line number Diff line
@@ -1177,7 +1177,7 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
				pkt->hdr.cmd);
			w->triggered = true;
			if (w->fn)
				w->fn(trans(priv), pkt, w->fn_data);
				w->fn(priv, pkt, w->fn_data);
		}
		spin_unlock(&priv->shrd->notif_wait_lock);

+5 −4
Original line number Diff line number Diff line
@@ -671,14 +671,14 @@ int iwl_alive_start(struct iwl_priv *priv)
		priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS;
		priv->cur_rssi_ctx = NULL;

		iwl_send_prio_tbl(trans(priv));
		iwl_send_prio_tbl(priv);

		/* FIXME: w/a to force change uCode BT state machine */
		ret = iwl_send_bt_env(trans(priv), IWL_BT_COEX_ENV_OPEN,
		ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN,
					 BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
		if (ret)
			return ret;
		ret = iwl_send_bt_env(trans(priv), IWL_BT_COEX_ENV_CLOSE,
		ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE,
					 BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
		if (ret)
			return ret;
@@ -1040,7 +1040,7 @@ static int iwl_init_drv(struct iwl_priv *priv)

	mutex_init(&priv->shrd->mutex);

	INIT_LIST_HEAD(&trans(priv)->calib_results);
	INIT_LIST_HEAD(&priv->calib_results);

	priv->ieee_channels = NULL;
	priv->ieee_rates = NULL;
@@ -1105,6 +1105,7 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
	kfree(priv->scan_cmd);
	kfree(priv->beacon_cmd);
	kfree(rcu_dereference_raw(priv->noa_data));
	iwl_calib_free_results(priv);
#ifdef CONFIG_IWLWIFI_DEBUGFS
	kfree(priv->wowlan_sram);
#endif
+10 −0
Original line number Diff line number Diff line
@@ -113,6 +113,16 @@ int iwlagn_rx_calib_result(struct iwl_priv *priv,
			    struct iwl_rx_cmd_buffer *rxb,
			    struct iwl_device_cmd *cmd);
void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags);
int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type);
void iwl_send_prio_tbl(struct iwl_priv *priv);
int iwl_init_alive_start(struct iwl_priv *priv);
int iwl_run_init_ucode(struct iwl_priv *priv);
int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
			      enum iwl_ucode_type ucode_type);
int iwl_send_calib_results(struct iwl_priv *priv);
int iwl_calib_set(struct iwl_priv *priv,
		  const struct iwl_calib_hdr *cmd, int len);
void iwl_calib_free_results(struct iwl_priv *priv);

/* lib */
int iwlagn_send_tx_power(struct iwl_priv *priv);
Loading