wifi: iwlwifi: mvm: rename and move iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_bios()

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>
This commit is contained in:
Anjaneyulu
2025-02-05 14:55:33 +02:00
committed by Johannes Berg
parent 1742b03d28
commit ca47dcc0d0
3 changed files with 34 additions and 33 deletions

View 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);

View 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)
};

View 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);
}