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

Commit b7998c8b authored by Eytan Lifshitz's avatar Eytan Lifshitz Committed by Johannes Berg
Browse files

iwlwifi: Change define and struct names in iwl-eeprom-parse.h



Since we will have several forms of NVM (EEPROM, OTP, etc.)
and they will have different layouts, make the parsed data
more generic. This allows functional code to be independent
of a specific layout.

Also change some variables and function names from having
"eeprom" to "nvm" in their name.

Signed-off-by: default avatarEytan Lifshitz <eytan.lifshitz@intel.com>
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 59f547ac
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -833,14 +833,14 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
	 * To be safe, simply mask out any chains that we know
	 * are not on the device.
	 */
	active_chains &= priv->eeprom_data->valid_rx_ant;
	active_chains &= priv->nvm_data->valid_rx_ant;

	num_tx_chains = 0;
	for (i = 0; i < NUM_RX_CHAINS; i++) {
		/* loops on all the bits of
		 * priv->hw_setting.valid_tx_ant */
		u8 ant_msk = (1 << i);
		if (!(priv->eeprom_data->valid_tx_ant & ant_msk))
		if (!(priv->nvm_data->valid_tx_ant & ant_msk))
			continue;

		num_tx_chains++;
@@ -854,7 +854,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
			 * connect the first valid tx chain
			 */
			first_chain =
				find_first_chain(priv->eeprom_data->valid_tx_ant);
				find_first_chain(priv->nvm_data->valid_tx_ant);
			data->disconn_array[first_chain] = 0;
			active_chains |= BIT(first_chain);
			IWL_DEBUG_CALIB(priv,
@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
		}
	}

	if (active_chains != priv->eeprom_data->valid_rx_ant &&
	if (active_chains != priv->nvm_data->valid_rx_ant &&
	    active_chains != priv->chain_noise_data.active_chains)
		IWL_DEBUG_CALIB(priv,
				"Detected that not all antennas are connected! "
				"Connected: %#x, valid: %#x.\n",
				active_chains,
				priv->eeprom_data->valid_rx_ant);
				priv->nvm_data->valid_rx_ant);

	/* Save for use within RXON, TX, SCAN commands, etc. */
	data->active_chains = active_chains;
@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
	    priv->cfg->bt_params->advanced_bt_coexist) {
		/* Disable disconnected antenna algorithm for advanced
		   bt coex, assuming valid antennas are connected */
		data->active_chains = priv->eeprom_data->valid_rx_ant;
		data->active_chains = priv->nvm_data->valid_rx_ant;
		for (i = 0; i < NUM_RX_CHAINS; i++)
			if (!(data->active_chains & (1<<i)))
				data->disconn_array[i] = 1;
@@ -1086,7 +1086,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)

	iwlagn_gain_computation(
		priv, average_noise,
		find_first_chain(priv->eeprom_data->valid_rx_ant));
		find_first_chain(priv->nvm_data->valid_rx_ant));

	/* Some power changes may have been made during the calibration.
	 * Update and commit the RXON
+6 −6
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
	int pos = 0, ofs = 0, buf_size = 0;
	const u8 *ptr;
	char *buf;
	u16 eeprom_ver;
	u16 nvm_ver;
	size_t eeprom_len = priv->eeprom_blob_size;
	buf_size = 4 * eeprom_len + 256;

@@ -321,9 +321,9 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
	if (!buf)
		return -ENOMEM;

	eeprom_ver = priv->eeprom_data->eeprom_version;
	nvm_ver = priv->nvm_data->nvm_version;
	pos += scnprintf(buf + pos, buf_size - pos,
			 "NVM version: 0x%x\n", eeprom_ver);
			 "NVM version: 0x%x\n", nvm_ver);
	for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
		pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
		hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
@@ -1333,17 +1333,17 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
	if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
		pos += scnprintf(buf + pos, bufsz - pos,
			"tx power: (1/2 dB step)\n");
		if ((priv->eeprom_data->valid_tx_ant & ANT_A) &&
		if ((priv->nvm_data->valid_tx_ant & ANT_A) &&
		    tx->tx_power.ant_a)
			pos += scnprintf(buf + pos, bufsz - pos,
					fmt_hex, "antenna A:",
					tx->tx_power.ant_a);
		if ((priv->eeprom_data->valid_tx_ant & ANT_B) &&
		if ((priv->nvm_data->valid_tx_ant & ANT_B) &&
		    tx->tx_power.ant_b)
			pos += scnprintf(buf + pos, bufsz - pos,
					fmt_hex, "antenna B:",
					tx->tx_power.ant_b);
		if ((priv->eeprom_data->valid_tx_ant & ANT_C) &&
		if ((priv->nvm_data->valid_tx_ant & ANT_C) &&
		    tx->tx_power.ant_c)
			pos += scnprintf(buf + pos, bufsz - pos,
					fmt_hex, "antenna C:",
+1 −1
Original line number Diff line number Diff line
@@ -844,7 +844,7 @@ struct iwl_priv {
	void *wowlan_sram;
#endif /* CONFIG_IWLWIFI_DEBUGFS */

	struct iwl_eeprom_data *eeprom_data;
	struct iwl_nvm_data *nvm_data;
	/* eeprom blob for debugfs/testmode */
	u8 *eeprom_blob;
	size_t eeprom_blob_size;
+4 −4
Original line number Diff line number Diff line
@@ -305,8 +305,8 @@ static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
{
	u16 temperature, voltage;

	temperature = le16_to_cpu(priv->eeprom_data->kelvin_temperature);
	voltage = le16_to_cpu(priv->eeprom_data->kelvin_voltage);
	temperature = le16_to_cpu(priv->nvm_data->kelvin_temperature);
	voltage = le16_to_cpu(priv->nvm_data->kelvin_voltage);

	/* offset = temp - volt / coeff */
	return (s32)(temperature -
@@ -460,13 +460,13 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
		break;
	case IWL_DEVICE_FAMILY_6050:
		/* Indicate calibration version to uCode. */
		if (priv->eeprom_data->calib_version >= 6)
		if (priv->nvm_data->calib_version >= 6)
			iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
					CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
		break;
	case IWL_DEVICE_FAMILY_6150:
		/* Indicate calibration version to uCode. */
		if (priv->eeprom_data->calib_version >= 6)
		if (priv->nvm_data->calib_version >= 6)
			iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
					CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
		iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
+4 −4
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
	/* half dBm need to multiply */
	tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);

	if (tx_power_cmd.global_lmt > priv->eeprom_data->max_tx_pwr_half_dbm) {
	if (tx_power_cmd.global_lmt > priv->nvm_data->max_tx_pwr_half_dbm) {
		/*
		 * For the newer devices which using enhanced/extend tx power
		 * table in EEPROM, the format is in half dBm. driver need to
@@ -72,7 +72,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
		 * half-dBm format), lower the tx power based on EEPROM
		 */
		tx_power_cmd.global_lmt =
			priv->eeprom_data->max_tx_pwr_half_dbm;
			priv->nvm_data->max_tx_pwr_half_dbm;
	}
	tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED;
	tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO;
@@ -159,7 +159,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv)
					   IWL_PAN_SCD_MGMT_MSK |
					   IWL_PAN_SCD_MULTICAST_MSK;

	if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
	if (priv->nvm_data->sku_cap_11n_enable)
		flush_cmd.queue_control |= IWL_AGG_TX_QUEUE_MSK;

	IWL_DEBUG_INFO(priv, "queue control: 0x%x\n",
@@ -825,7 +825,7 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
	if (priv->chain_noise_data.active_chains)
		active_chains = priv->chain_noise_data.active_chains;
	else
		active_chains = priv->eeprom_data->valid_rx_ant;
		active_chains = priv->nvm_data->valid_rx_ant;

	if (priv->cfg->bt_params &&
	    priv->cfg->bt_params->advanced_bt_coexist &&
Loading