]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mvm: rename and move iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_b...
authorAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Wed, 5 Feb 2025 12:55:33 +0000 (14:55 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Feb 2025 10:59:46 +0000 (11:59 +0100)
Renamed iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_bios() to better
reflect the function's operation. Additionally, moved the function to the
regulatory.c file for better organization. optimize local variable
usage in it.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.b7ac9d05234e.Ieb623d7e8dca6bb6a5733682b31e4ff1e39373f0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/regulatory.c
drivers/net/wireless/intel/iwlwifi/fw/regulatory.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index ea435ee94312b841e4fd33b829d2ef02fe9b0f99..63320689e05d8c723698ed3802466ae868b77b09 100644 (file)
@@ -674,3 +674,34 @@ bool iwl_puncturing_is_allowed_in_bios(u32 puncturing, u16 mcc)
        }
 }
 IWL_EXPORT_SYMBOL(iwl_puncturing_is_allowed_in_bios);
+
+bool iwl_rfi_is_enabled_in_bios(struct iwl_fw_runtime *fwrt)
+{
+       /* default behaviour is disabled */
+       u32 value = 0;
+       int ret = iwl_bios_get_dsm(fwrt, DSM_FUNC_RFI_CONFIG, &value);
+
+       if (ret < 0) {
+               IWL_DEBUG_RADIO(fwrt, "Failed to get DSM RFI, ret=%d\n", ret);
+               return false;
+       }
+
+       value &= DSM_VALUE_RFI_DISABLE;
+       /* RFI BIOS CONFIG value can be 0 or 3 only.
+        * i.e 0 means DDR and DLVR enabled. 3 means DDR and DLVR disabled.
+        * 1 and 2 are invalid BIOS configurations, So, it's not possible to
+        * disable ddr/dlvr separately.
+        */
+       if (!value) {
+               IWL_DEBUG_RADIO(fwrt, "DSM RFI is evaluated to enable\n");
+               return true;
+       } else if (value == DSM_VALUE_RFI_DISABLE) {
+               IWL_DEBUG_RADIO(fwrt, "DSM RFI is evaluated to disable\n");
+       } else {
+               IWL_DEBUG_RADIO(fwrt,
+                               "DSM RFI got invalid value, value=%d\n", value);
+       }
+
+       return false;
+}
+IWL_EXPORT_SYMBOL(iwl_rfi_is_enabled_in_bios);
index b355d7bef14cd59ff4336a8c07f0dc9a210975bd..ed61bc35ef5ba83b00760b8b09d7fa9ee1aa9ba8 100644 (file)
@@ -167,6 +167,8 @@ enum iwl_dsm_values_rfi {
 #define DSM_VALUE_RFI_DISABLE  (DSM_VALUE_RFI_DLVR_DISABLE |\
                                 DSM_VALUE_RFI_DDR_DISABLE)
 
+bool iwl_rfi_is_enabled_in_bios(struct iwl_fw_runtime *fwrt);
+
 enum iwl_dsm_masks_reg {
        DSM_MASK_CHINA_22_REG = BIT(2)
 };
index df49dd2e2026dc58c766e22cdc063b478d172756..5a9ce7dba7149d77dcf84fdb921c0ff80b5cd345 100644 (file)
@@ -1213,38 +1213,6 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
                IWL_DEBUG_RADIO(mvm, "failed to send TAS_CONFIG (%d)\n", ret);
 }
 
-static bool iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
-{
-       u32 value = 0;
-       /* default behaviour is disabled */
-       bool bios_enable_rfi = false;
-       int ret = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_RFI_CONFIG, &value);
-
-
-       if (ret < 0) {
-               IWL_DEBUG_RADIO(mvm, "Failed to get DSM RFI, ret=%d\n", ret);
-               return bios_enable_rfi;
-       }
-
-       value &= DSM_VALUE_RFI_DISABLE;
-       /* RFI BIOS CONFIG value can be 0 or 3 only.
-        * i.e 0 means DDR and DLVR enabled. 3 means DDR and DLVR disabled.
-        * 1 and 2 are invalid BIOS configurations, So, it's not possible to
-        * disable ddr/dlvr separately.
-        */
-       if (!value) {
-               IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to enable\n");
-               bios_enable_rfi = true;
-       } else if (value == DSM_VALUE_RFI_DISABLE) {
-               IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to disable\n");
-       } else {
-               IWL_DEBUG_RADIO(mvm,
-                               "DSM RFI got invalid value, value=%d\n", value);
-       }
-
-       return bios_enable_rfi;
-}
-
 static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
 {
        struct iwl_lari_config_change_cmd cmd;
@@ -1631,7 +1599,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        iwl_mvm_uats_init(mvm);
 
        if (iwl_rfi_supported(mvm)) {
-               if (iwl_mvm_eval_dsm_rfi(mvm))
+               if (iwl_rfi_is_enabled_in_bios(&mvm->fwrt))
                        iwl_rfi_send_config_cmd(mvm, NULL);
        }