wifi: iwlwifi: Add support for LARI_CONFIG_CHANGE_CMD cmd v9
authorAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Wed, 20 Mar 2024 21:26:34 +0000 (23:26 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Mar 2024 14:39:55 +0000 (15:39 +0100)
There is a requirement from OEMs to support new bits in DSM function 7,
which will indicate enablement of 5.9 GHz in Canada.
Add support for this by reading those bits from BIOS and sending it to the
FW. mask unii4 allow bitmap based on LARI_CONFIG_CHANGE_CMD version

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240320232419.5c31ccd73119.I0363992efc3607368648d34a7918b2534150a3ca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
drivers/net/wireless/intel/iwlwifi/fw/regulatory.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index 58034dfa7e706e677ad8e55cc0a035f18acb3b5c..988b5421a62994eca0a39a351d766de6704b4127 100644 (file)
@@ -609,7 +609,7 @@ struct iwl_lari_config_change_cmd_v6 {
 
 /**
  * struct iwl_lari_config_change_cmd_v7 - change LARI configuration
- * This structure is used also for lari cmd version 8.
+ * This structure is used also for lari cmd version 8 and 9.
  * @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.
@@ -619,6 +619,8 @@ struct iwl_lari_config_change_cmd_v6 {
  * @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.
+ *     For LARI cmd version 4 to 8 - bits 0:3 are supported.
+ *     For LARI cmd version 9 - bits 0:5 are supported.
  * @chan_state_active_bitmap: Bitmap to enable different bands per country
  *     or region.
  *     Each bit represents a country or region, and a band to activate
@@ -642,6 +644,7 @@ struct iwl_lari_config_change_cmd_v7 {
 } __packed;
 /* LARI_CHANGE_CONF_CMD_S_VER_7 */
 /* LARI_CHANGE_CONF_CMD_S_VER_8 */
+/* LARI_CHANGE_CONF_CMD_S_VER_9 */
 
 /* Activate UNII-1 (5.2GHz) for World Wide */
 #define ACTIVATE_5G2_IN_WW_MASK        BIT(4)
index 28e774766847e7ac75301d1e9146c6b042a78839..a0cb8881e629f1c427e5053d048fd8a122e7961e 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2023 Intel Corporation
+ * Copyright (C) 2023-2024 Intel Corporation
  */
 
 #ifndef __fw_regulatory_h__
@@ -132,6 +132,23 @@ enum iwl_dsm_values_indonesia {
        DSM_VALUE_INDONESIA_MAX
 };
 
+enum iwl_dsm_unii4_bitmap {
+       DSM_VALUE_UNII4_US_OVERRIDE_MSK         = BIT(0),
+       DSM_VALUE_UNII4_US_EN_MSK               = BIT(1),
+       DSM_VALUE_UNII4_ETSI_OVERRIDE_MSK       = BIT(2),
+       DSM_VALUE_UNII4_ETSI_EN_MSK             = BIT(3),
+       DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK     = BIT(4),
+       DSM_VALUE_UNII4_CANADA_EN_MSK           = BIT(5),
+};
+
+#define DSM_UNII4_ALLOW_BITMAP_CMD_V8 (DSM_VALUE_UNII4_US_OVERRIDE_MSK | \
+                                      DSM_VALUE_UNII4_US_EN_MSK | \
+                                      DSM_VALUE_UNII4_ETSI_OVERRIDE_MSK | \
+                                      DSM_VALUE_UNII4_ETSI_EN_MSK)
+#define DSM_UNII4_ALLOW_BITMAP (DSM_UNII4_ALLOW_BITMAP_CMD_V8 | \
+                               DSM_VALUE_UNII4_CANADA_OVERRIDE_MSK | \
+                               DSM_VALUE_UNII4_CANADA_EN_MSK)
+
 enum iwl_dsm_values_rfi {
        DSM_VALUE_RFI_DLVR_DISABLE      = BIT(0),
        DSM_VALUE_RFI_DDR_DISABLE       = BIT(1),
index df3b29b998cf9321758f71a29fbffcf90cafee99..1f8d4723512f3f637802ca66706503fe13b72074 100644 (file)
@@ -1239,8 +1239,14 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
                cmd.oem_11ax_allow_bitmap = cpu_to_le32(value);
 
        ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ENABLE_UNII4_CHAN, &value);
-       if (!ret)
+       if (!ret) {
+               if (cmd_ver < 9)
+                       value &= DSM_UNII4_ALLOW_BITMAP_CMD_V8;
+               else
+                       value &= DSM_UNII4_ALLOW_BITMAP;
+
                cmd.oem_unii4_allow_bitmap = cpu_to_le32(value);
+       }
 
        ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ACTIVATE_CHANNEL, &value);
        if (!ret) {
@@ -1273,6 +1279,7 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
                size_t cmd_size;
 
                switch (cmd_ver) {
+               case 9:
                case 8:
                case 7:
                        cmd_size = sizeof(struct iwl_lari_config_change_cmd_v7);