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

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

iwlwifi: add wrappers for command sending



Add wrappers to send commands from the DVM
op-mode (which essentially consists of the
current driver). This will allow us to move
specific sanity checks there.

Also, this removes iwl_trans_send_cmd_pdu()
since that can now be taken care of in the
DVM-specific wrapper.

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 965974a6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@ iwlwifi-objs += iwl-1000.o
iwlwifi-objs		+= iwl-2000.o
iwlwifi-objs		+= iwl-pci.o
iwlwifi-objs		+= iwl-drv.o
iwlwifi-objs		+= iwl-trans.o
iwlwifi-objs		+= iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o

iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
+1 −1
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
		return -EFAULT;
	}

	return iwl_trans_send_cmd(trans(priv), &hcmd);
	return iwl_dvm_send_cmd(priv, &hcmd);
}

static struct iwl_lib_ops iwl5000_lib = {
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
		return -EFAULT;
	}

	return iwl_trans_send_cmd(trans(priv), &hcmd);
	return iwl_dvm_send_cmd(priv, &hcmd);
}

static struct iwl_lib_ops iwl6000_lib = {
+4 −4
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
		hcmd.len[0] = res->cmd_len;
		hcmd.data[0] = &res->hdr;
		hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
		ret = iwl_trans_send_cmd(trans(priv), &hcmd);
		ret = iwl_dvm_send_cmd(priv, &hcmd);
		if (ret) {
			IWL_ERR(priv, "Error %d on calib cmd %d\n",
				ret, res->hdr.op_code);
@@ -500,7 +500,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
	memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
	       sizeof(u16)*HD_TABLE_SIZE);

	return iwl_trans_send_cmd(trans(priv), &cmd_out);
	return iwl_dvm_send_cmd(priv, &cmd_out);
}

/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
@@ -589,7 +589,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
	       &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
	       sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);

	return iwl_trans_send_cmd(trans(priv), &cmd_out);
	return iwl_dvm_send_cmd(priv, &cmd_out);
}

void iwl_init_sensitivity(struct iwl_priv *priv)
@@ -930,7 +930,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
			priv->phy_calib_chain_noise_gain_cmd);
		cmd.delta_gain_1 = data->delta_gain_code[1];
		cmd.delta_gain_2 = data->delta_gain_code[2];
		iwl_trans_send_cmd_pdu(trans(priv), REPLY_PHY_CALIBRATION_CMD,
		iwl_dvm_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
			CMD_ASYNC, sizeof(cmd), &cmd);

		data->radio_write = 1;
+28 −10
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
	else
		tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;

	return iwl_trans_send_cmd_pdu(trans(priv), tx_ant_cfg_cmd, CMD_SYNC,
	return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC,
			sizeof(tx_power_cmd), &tx_power_cmd);
}

@@ -241,7 +241,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
		       flush_cmd.fifo_control);
	flush_cmd.flush_control = cpu_to_le16(flush_control);

	return iwl_trans_send_cmd(trans(priv), &cmd);
	return iwl_dvm_send_cmd(priv, &cmd);
}

void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
@@ -435,12 +435,12 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
	if (cfg(priv)->bt_params->bt_session_2) {
		memcpy(&bt_cmd_2000.basic, &basic,
			sizeof(basic));
		ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
		ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
			CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
	} else {
		memcpy(&bt_cmd_6000.basic, &basic,
			sizeof(basic));
		ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
		ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG,
			CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
	}
	if (ret)
@@ -1115,7 +1115,7 @@ int iwlagn_send_patterns(struct iwl_priv *priv,
	}

	cmd.data[0] = pattern_cmd;
	err = iwl_trans_send_cmd(trans(priv), &cmd);
	err = iwl_dvm_send_cmd(priv, &cmd);
	kfree(pattern_cmd);
	return err;
}
@@ -1241,13 +1241,13 @@ int iwlagn_suspend(struct iwl_priv *priv,
				.len[0] = sizeof(key_data.rsc_tsc),
			};

			ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd);
			ret = iwl_dvm_send_cmd(priv, &rsc_tsc_cmd);
			if (ret)
				goto out;
		}

		if (key_data.use_tkip) {
			ret = iwl_trans_send_cmd_pdu(trans(priv),
			ret = iwl_dvm_send_cmd_pdu(priv,
						 REPLY_WOWLAN_TKIP_PARAMS,
						 CMD_SYNC, sizeof(tkip_cmd),
						 &tkip_cmd);
@@ -1263,7 +1263,7 @@ int iwlagn_suspend(struct iwl_priv *priv,
			kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN);
			kek_kck_cmd.replay_ctr = priv->replay_ctr;

			ret = iwl_trans_send_cmd_pdu(trans(priv),
			ret = iwl_dvm_send_cmd_pdu(priv,
						 REPLY_WOWLAN_KEK_KCK_MATERIAL,
						 CMD_SYNC, sizeof(kek_kck_cmd),
						 &kek_kck_cmd);
@@ -1272,12 +1272,12 @@ int iwlagn_suspend(struct iwl_priv *priv,
		}
	}

	ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_D3_CONFIG, CMD_SYNC,
	ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, CMD_SYNC,
				     sizeof(d3_cfg_cmd), &d3_cfg_cmd);
	if (ret)
		goto out;

	ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_WOWLAN_WAKEUP_FILTER,
	ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER,
				 CMD_SYNC, sizeof(wakeup_filter_cmd),
				 &wakeup_filter_cmd);
	if (ret)
@@ -1289,3 +1289,21 @@ int iwlagn_suspend(struct iwl_priv *priv,
	return ret;
}
#endif

int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
{
	return iwl_trans_send_cmd(trans(priv), cmd);
}

int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id,
			 u32 flags, u16 len, const void *data)
{
	struct iwl_host_cmd cmd = {
		.id = id,
		.len = { len, },
		.data = { data, },
		.flags = flags,
	};

	return iwl_dvm_send_cmd(priv, &cmd);
}
Loading