Commit c8e01fe0 authored by Alon Giladi's avatar Alon Giladi Committed by Johannes Berg
Browse files

wifi: iwlwifi: send EDT table to FW



Read the EDT (Energy detection threshold) optimization configuration
table from BIOS using DSM Function and send it to FW.

Signed-off-by: default avatarAlon Giladi <alon.giladi@intel.com>
Signed-off-by: default avatarAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231011130030.0b78ee48219a.I8ecbd39d258e2ee0514a7e28632f6c18fb798a83@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8f9a791a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ enum iwl_dsm_funcs_rev_0 {
	DSM_FUNC_11AX_ENABLEMENT = 6,
	DSM_FUNC_ENABLE_UNII4_CHAN = 7,
	DSM_FUNC_ACTIVATE_CHANNEL = 8,
	DSM_FUNC_FORCE_DISABLE_CHANNELS = 9
	DSM_FUNC_FORCE_DISABLE_CHANNELS = 9,
	DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10,
};

enum iwl_dsm_values_srd {
+33 −2
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@ enum iwl_regulatory_and_nvm_subcmd_ids {
	 *	&struct iwl_lari_config_change_cmd_v2,
	 *	&struct iwl_lari_config_change_cmd_v3,
	 *	&struct iwl_lari_config_change_cmd_v4,
	 *	&struct iwl_lari_config_change_cmd_v5 or
	 *	&struct iwl_lari_config_change_cmd_v6
	 *	&struct iwl_lari_config_change_cmd_v5,
	 *	&struct iwl_lari_config_change_cmd_v6 or
	 *	&struct iwl_lari_config_change_cmd_v7
	 */
	LARI_CONFIG_CHANGE = 0x1,

@@ -602,6 +603,36 @@ struct iwl_lari_config_change_cmd_v6 {
	__le32 force_disable_channels_bitmap;
} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_6 */

/**
 * struct iwl_lari_config_change_cmd_v7 - change LARI configuration
 * @config_bitmap: Bitmap of the config commands. Each bit will trigger a
 *     different predefined FW config operation.
 * @oem_uhb_allow_bitmap: Bitmap of UHB enabled MCC sets.
 * @oem_11ax_allow_bitmap: Bitmap of 11ax allowed MCCs. There are two bits
 *     per country, one to indicate whether to override and the other to
 *     indicate the value to use.
 * @oem_unii4_allow_bitmap: Bitmap of unii4 allowed MCCs.There are two bits
 *     per country, one to indicate whether to override and the other to
 *     indicate allow/disallow unii4 channels.
 * @chan_state_active_bitmap: Bitmap for overriding channel state to active.
 *     Each bit represents a country or region to activate, according to the
 *     BIOS definitions.
 * @force_disable_channels_bitmap: Bitmap of disabled bands/channels.
 *     Each bit represents a set of channels in a specific band that should be
 *     disabled
 * @edt_bitmap: Bitmap of energy detection threshold table.
 *	Disable/enable the EDT optimization method for different band.
 */
struct iwl_lari_config_change_cmd_v7 {
	__le32 config_bitmap;
	__le32 oem_uhb_allow_bitmap;
	__le32 oem_11ax_allow_bitmap;
	__le32 oem_unii4_allow_bitmap;
	__le32 chan_state_active_bitmap;
	__le32 force_disable_channels_bitmap;
	__le32 edt_bitmap;
} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_7 */

/**
 * struct iwl_pnvm_init_complete_ntfy - PNVM initialization complete
 * @status: PNVM image loading status
+15 −2
Original line number Diff line number Diff line
@@ -1232,7 +1232,7 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
{
	int ret;
	u32 value;
	struct iwl_lari_config_change_cmd_v6 cmd = {};
	struct iwl_lari_config_change_cmd_v7 cmd = {};

	cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt);

@@ -1265,18 +1265,28 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
	if (!ret)
		cmd.force_disable_channels_bitmap = cpu_to_le32(value);

	ret = iwl_acpi_get_dsm_u32(mvm->fwrt.dev, 0,
				   DSM_FUNC_ENERGY_DETECTION_THRESHOLD,
				   &iwl_guid, &value);
	if (!ret)
		cmd.edt_bitmap = cpu_to_le32(value);

	if (cmd.config_bitmap ||
	    cmd.oem_uhb_allow_bitmap ||
	    cmd.oem_11ax_allow_bitmap ||
	    cmd.oem_unii4_allow_bitmap ||
	    cmd.chan_state_active_bitmap ||
	    cmd.force_disable_channels_bitmap) {
	    cmd.force_disable_channels_bitmap ||
	    cmd.edt_bitmap) {
		size_t cmd_size;
		u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
						   WIDE_ID(REGULATORY_AND_NVM_GROUP,
							   LARI_CONFIG_CHANGE),
						   1);
		switch (cmd_ver) {
		case 7:
			cmd_size = sizeof(struct iwl_lari_config_change_cmd_v7);
			break;
		case 6:
			cmd_size = sizeof(struct iwl_lari_config_change_cmd_v6);
			break;
@@ -1310,6 +1320,9 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
				"sending LARI_CONFIG_CHANGE, oem_uhb_allow_bitmap=0x%x, force_disable_channels_bitmap=0x%x\n",
				le32_to_cpu(cmd.oem_uhb_allow_bitmap),
				le32_to_cpu(cmd.force_disable_channels_bitmap));
		IWL_DEBUG_RADIO(mvm,
				"sending LARI_CONFIG_CHANGE, edt_bitmap=0x%x\n",
				le32_to_cpu(cmd.edt_bitmap));
		ret = iwl_mvm_send_cmd_pdu(mvm,
					   WIDE_ID(REGULATORY_AND_NVM_GROUP,
						   LARI_CONFIG_CHANGE),