wifi: iwlwifi: send EDT table to FW
authorAlon Giladi <alon.giladi@intel.com>
Wed, 11 Oct 2023 10:07:21 +0000 (13:07 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Oct 2023 10:26:27 +0000 (12:26 +0200)
Read the EDT (Energy detection threshold) optimization configuration
table from BIOS using DSM Function and send it to FW.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231011130030.0b78ee48219a.I8ecbd39d258e2ee0514a7e28632f6c18fb798a83@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/acpi.h
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index d129fc66d8bbe61092ba2613c685830fb8afff61..e9277f6f35821c9f650d917eff5b000a3b37b656 100644 (file)
@@ -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 {
index c4577219c5015651d09d4d1a59330935e12f11d7..d1fede96257395a4adbb698b2ce0682bad395bdf 100644 (file)
@@ -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
index e9710e6e2efa15fa71b30e7bfb6fbc07327f3446..233c839de502a6416bd234e186d9b08cb0334146 100644 (file)
@@ -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),