Commit dc2b94a1 authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg

wifi: iwlwifi: rfi: use a single DSM function for all RFI configurations

RFI configuration moved from internal guid to the wifi guid, DSM
function 11. Update reading RFI configuration from BIOS.
Signed-off-by: default avatarAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.f4e62435310d.I4f9b6860dd8e3c7ae1f816be5ff8b5967eee266f@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 20935f3e
...@@ -14,11 +14,6 @@ const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6, ...@@ -14,11 +14,6 @@ const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6,
0x8E, 0x28, 0x5A, 0xDE); 0x8E, 0x28, 0x5A, 0xDE);
IWL_EXPORT_SYMBOL(iwl_guid); IWL_EXPORT_SYMBOL(iwl_guid);
const guid_t iwl_rfi_guid = GUID_INIT(0x7266172C, 0x220B, 0x4B29,
0x81, 0x4F, 0x75, 0xE4,
0xDD, 0x26, 0xB5, 0xFD);
IWL_EXPORT_SYMBOL(iwl_rfi_guid);
static int iwl_acpi_get_handle(struct device *dev, acpi_string method, static int iwl_acpi_get_handle(struct device *dev, acpi_string method,
acpi_handle *ret_handle) acpi_handle *ret_handle)
{ {
......
...@@ -103,6 +103,7 @@ enum iwl_dsm_funcs_rev_0 { ...@@ -103,6 +103,7 @@ enum iwl_dsm_funcs_rev_0 {
DSM_FUNC_ACTIVATE_CHANNEL = 8, DSM_FUNC_ACTIVATE_CHANNEL = 8,
DSM_FUNC_FORCE_DISABLE_CHANNELS = 9, DSM_FUNC_FORCE_DISABLE_CHANNELS = 9,
DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10, DSM_FUNC_ENERGY_DETECTION_THRESHOLD = 10,
DSM_FUNC_RFI_CONFIG = 11
}; };
enum iwl_dsm_values_srd { enum iwl_dsm_values_srd {
...@@ -119,16 +120,14 @@ enum iwl_dsm_values_indonesia { ...@@ -119,16 +120,14 @@ enum iwl_dsm_values_indonesia {
DSM_VALUE_INDONESIA_MAX DSM_VALUE_INDONESIA_MAX
}; };
/* DSM RFI uses a different GUID, so need separate definitions */
#define DSM_RFI_FUNC_ENABLE 3
enum iwl_dsm_values_rfi { enum iwl_dsm_values_rfi {
DSM_VALUE_RFI_ENABLE, DSM_VALUE_RFI_DLVR_DISABLE = BIT(0),
DSM_VALUE_RFI_DISABLE, DSM_VALUE_RFI_DDR_DISABLE = BIT(1),
DSM_VALUE_RFI_MAX
}; };
#define DSM_VALUE_RFI_DISABLE (DSM_VALUE_RFI_DLVR_DISABLE |\
DSM_VALUE_RFI_DDR_DISABLE)
enum iwl_dsm_masks_reg { enum iwl_dsm_masks_reg {
DSM_MASK_CHINA_22_REG = BIT(2) DSM_MASK_CHINA_22_REG = BIT(2)
}; };
...@@ -138,7 +137,6 @@ enum iwl_dsm_masks_reg { ...@@ -138,7 +137,6 @@ enum iwl_dsm_masks_reg {
struct iwl_fw_runtime; struct iwl_fw_runtime;
extern const guid_t iwl_guid; extern const guid_t iwl_guid;
extern const guid_t iwl_rfi_guid;
int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func, int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func,
const guid_t *guid, u8 *value); const guid_t *guid, u8 *value);
......
...@@ -1203,28 +1203,37 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm) ...@@ -1203,28 +1203,37 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm) static bool iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
{ {
u8 value; u8 value = 0;
int ret = iwl_acpi_get_dsm_u8(mvm->fwrt.dev, 0, DSM_RFI_FUNC_ENABLE, /* default behaviour is disabled */
&iwl_rfi_guid, &value); bool bios_enable_rfi = false;
int ret = iwl_acpi_get_dsm_u8(mvm->fwrt.dev, 0,
DSM_FUNC_RFI_CONFIG, &iwl_guid,
&value);
if (ret < 0) { if (ret < 0) {
IWL_DEBUG_RADIO(mvm, "Failed to get DSM RFI, ret=%d\n", ret); IWL_DEBUG_RADIO(mvm, "Failed to get DSM RFI, ret=%d\n", ret);
return bios_enable_rfi;
}
} else if (value >= DSM_VALUE_RFI_MAX) { value &= DSM_VALUE_RFI_DISABLE;
IWL_DEBUG_RADIO(mvm, "DSM RFI got invalid value, ret=%d\n", /* RFI BIOS CONFIG value can be 0 or 3 only.
value); * 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
} else if (value == DSM_VALUE_RFI_ENABLE) { * disable ddr/dlvr separately.
*/
if (!value) {
IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to enable\n"); IWL_DEBUG_RADIO(mvm, "DSM RFI is evaluated to enable\n");
return DSM_VALUE_RFI_ENABLE; 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);
} }
IWL_DEBUG_RADIO(mvm, "DSM RFI is disabled\n"); return bios_enable_rfi;
/* default behaviour is disabled */
return DSM_VALUE_RFI_DISABLE;
} }
static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
...@@ -1347,9 +1356,9 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm) ...@@ -1347,9 +1356,9 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
{ {
} }
static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm) static bool iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
{ {
return DSM_VALUE_RFI_DISABLE; return false;
} }
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
...@@ -1727,7 +1736,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm) ...@@ -1727,7 +1736,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
iwl_mvm_uats_init(mvm); iwl_mvm_uats_init(mvm);
if (iwl_rfi_supported(mvm)) { if (iwl_rfi_supported(mvm)) {
if (iwl_mvm_eval_dsm_rfi(mvm) == DSM_VALUE_RFI_ENABLE) if (iwl_mvm_eval_dsm_rfi(mvm))
iwl_rfi_send_config_cmd(mvm, NULL); iwl_rfi_send_config_cmd(mvm, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment