]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: Add support for LARI_CONFIG_CHANGE_CMD v11
authorAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Sun, 12 May 2024 12:25:05 +0000 (15:25 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 08:53:04 +0000 (10:53 +0200)
Add support for enable/disable 11be for china and South Korea by
reading DSM function 12 from UEFI or ACPI and sending it to the FW.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240512152312.037613d03c87.I4e5ee63c0dbdd4bd6c48daee7b0c88462b702423@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
drivers/net/wireless/intel/iwlwifi/fw/regulatory.c
drivers/net/wireless/intel/iwlwifi/fw/regulatory.h

index fa339791223b8fe5cd1616e598cd9416b7954d2a..79774c8c7ff4526b9ca1e6bf215df9931d1ba071 100644 (file)
@@ -27,6 +27,7 @@ static const size_t acpi_dsm_size[DSM_FUNC_NUM_FUNCS] = {
        [DSM_FUNC_FORCE_DISABLE_CHANNELS] =     sizeof(u32),
        [DSM_FUNC_ENERGY_DETECTION_THRESHOLD] = sizeof(u32),
        [DSM_FUNC_RFI_CONFIG] =                 sizeof(u32),
+       [DSM_FUNC_ENABLE_11BE] =                sizeof(u32),
 };
 
 static int iwl_acpi_get_handle(struct device *dev, acpi_string method,
index a08497a04733d3a3edfa7442f7f72cb5ef618e56..644c8df780bc52fbe38c524bc1596db2551072bb 100644 (file)
@@ -23,7 +23,8 @@ enum iwl_regulatory_and_nvm_subcmd_ids {
         *      &struct iwl_lari_config_change_cmd_v4,
         *      &struct iwl_lari_config_change_cmd_v5,
         *      &struct iwl_lari_config_change_cmd_v6,
-        *      &struct iwl_lari_config_change_cmd_v7 or
+        *      &struct iwl_lari_config_change_cmd_v7,
+        *      &struct iwl_lari_config_change_cmd_v10 or
         *      &struct iwl_lari_config_change_cmd
         */
        LARI_CONFIG_CHANGE = 0x1,
@@ -648,7 +649,7 @@ struct iwl_lari_config_change_cmd_v7 {
 /* LARI_CHANGE_CONF_CMD_S_VER_9 */
 
 /**
- * struct iwl_lari_config_change_cmd - change LARI configuration
+ * struct iwl_lari_config_change_cmd_v10 - 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.
@@ -674,7 +675,7 @@ struct iwl_lari_config_change_cmd_v7 {
  *     bit1: enable 320Mhz in South Korea.
  *     bit 2 - 31: reserved.
  */
-struct iwl_lari_config_change_cmd {
+struct iwl_lari_config_change_cmd_v10 {
        __le32 config_bitmap;
        __le32 oem_uhb_allow_bitmap;
        __le32 oem_11ax_allow_bitmap;
@@ -686,6 +687,51 @@ struct iwl_lari_config_change_cmd {
 } __packed;
 /* LARI_CHANGE_CONF_CMD_S_VER_10 */
 
+/**
+ * struct iwl_lari_config_change_cmd - 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.
+ *     For LARI cmd version 11 - 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
+ *     according to the BIOS definitions.
+ *     For LARI cmd version 11 - bits 0:4 are supported.
+ * @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.
+ * @oem_320mhz_allow_bitmap: 320Mhz bandwidth enablement bitmap per MCC.
+ *     bit0: enable 320Mhz in Japan.
+ *     bit1: enable 320Mhz in South Korea.
+ *     bit 2 - 31: reserved.
+ * @oem_11be_allow_bitmap: Bitmap of 11be allowed MCCs. No need to mask out the
+ *     unsupported bits
+ *     bit0: enable 11be in China(CB/CN).
+ *     bit1: enable 11be in South Korea.
+ *     bit 2 - 31: reserved.
+ */
+struct iwl_lari_config_change_cmd {
+       __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;
+       __le32 oem_320mhz_allow_bitmap;
+       __le32 oem_11be_allow_bitmap;
+} __packed;
+/* LARI_CHANGE_CONF_CMD_S_VER_11 */
+
 /* Activate UNII-1 (5.2GHz) for World Wide */
 #define ACTIVATE_5G2_IN_WW_MASK        BIT(4)
 
index b9bb3636e88f0342e534173a9be0983849b97326..5228b837a9ef68a11dd22e57234733b9151867c0 100644 (file)
@@ -497,9 +497,12 @@ static size_t iwl_get_lari_config_cmd_size(u8 cmd_ver)
        size_t cmd_size;
 
        switch (cmd_ver) {
-       case 10:
+       case 11:
                cmd_size = sizeof(struct iwl_lari_config_change_cmd);
                break;
+       case 10:
+               cmd_size = sizeof(struct iwl_lari_config_change_cmd_v10);
+               break;
        case 9:
        case 8:
        case 7:
@@ -580,6 +583,10 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
        if (!ret)
                cmd->oem_320mhz_allow_bitmap = cpu_to_le32(value);
 
+       ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_ENABLE_11BE, &value);
+       if (!ret)
+               cmd->oem_11be_allow_bitmap = cpu_to_le32(value);
+
        if (cmd->config_bitmap ||
            cmd->oem_uhb_allow_bitmap ||
            cmd->oem_11ax_allow_bitmap ||
@@ -587,7 +594,8 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
            cmd->chan_state_active_bitmap ||
            cmd->force_disable_channels_bitmap ||
            cmd->edt_bitmap ||
-           cmd->oem_320mhz_allow_bitmap) {
+           cmd->oem_320mhz_allow_bitmap ||
+           cmd->oem_11be_allow_bitmap) {
                IWL_DEBUG_RADIO(fwrt,
                                "sending LARI_CONFIG_CHANGE, config_bitmap=0x%x, oem_11ax_allow_bitmap=0x%x\n",
                                le32_to_cpu(cmd->config_bitmap),
@@ -605,6 +613,9 @@ int iwl_fill_lari_config(struct iwl_fw_runtime *fwrt,
                                "sending LARI_CONFIG_CHANGE, edt_bitmap=0x%x, oem_320mhz_allow_bitmap=0x%x\n",
                                le32_to_cpu(cmd->edt_bitmap),
                                le32_to_cpu(cmd->oem_320mhz_allow_bitmap));
+               IWL_DEBUG_RADIO(fwrt,
+                               "sending LARI_CONFIG_CHANGE, oem_11be_allow_bitmap=0x%x\n",
+                               le32_to_cpu(cmd->oem_11be_allow_bitmap));
        } else {
                return 1;
        }
index 633c9ad9af841e39fb7ceb096b28a1fd500fb608..e2c056f483c1c70980d62a70c811ccba33ba28e5 100644 (file)
@@ -115,7 +115,8 @@ enum iwl_dsm_funcs {
        DSM_FUNC_FORCE_DISABLE_CHANNELS = 9,
        DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10,
        DSM_FUNC_RFI_CONFIG = 11,
-       DSM_FUNC_NUM_FUNCS = 12,
+       DSM_FUNC_ENABLE_11BE = 12,
+       DSM_FUNC_NUM_FUNCS = 13,
 };
 
 enum iwl_dsm_values_srd {