Commit 90d4f7db authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Emmanuel Grumbach

iwlwifi: mvm: init country code on init/recovery

During init queue a regulatory update to retrieve the default
regulatory settings from FW. If we're during recovery, only replay the
current country code to FW, if it exists.
Signed-off-by: default avatarArik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent dcaf9f5e
...@@ -739,6 +739,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm) ...@@ -739,6 +739,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
if (ret) if (ret)
goto error; goto error;
ret = iwl_mvm_init_mcc(mvm);
if (ret)
goto error;
if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) {
ret = iwl_mvm_config_scan(mvm); ret = iwl_mvm_config_scan(mvm);
if (ret) if (ret)
......
...@@ -1397,6 +1397,7 @@ int iwl_mvm_get_temp(struct iwl_mvm *mvm); ...@@ -1397,6 +1397,7 @@ int iwl_mvm_get_temp(struct iwl_mvm *mvm);
/* Location Aware Regulatory */ /* Location Aware Regulatory */
struct iwl_mcc_update_resp * struct iwl_mcc_update_resp *
iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2); iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2);
int iwl_mvm_init_mcc(struct iwl_mvm *mvm);
/* smart fifo */ /* smart fifo */
int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/rtnetlink.h>
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "mvm.h" #include "mvm.h"
...@@ -654,3 +655,39 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2) ...@@ -654,3 +655,39 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2)
return ERR_PTR(ret); return ERR_PTR(ret);
return resp_cp; return resp_cp;
} }
int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
{
if (!iwl_mvm_is_lar_supported(mvm))
return 0;
/*
* During HW restart, only replay the last set MCC to FW. Otherwise,
* queue an update to cfg80211 to retrieve the default alpha2 from FW.
*/
if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
/* This should only be called during vif up and hold RTNL */
const struct ieee80211_regdomain *r =
rtnl_dereference(mvm->hw->wiphy->regd);
if (r) {
struct iwl_mcc_update_resp *resp;
resp = iwl_mvm_update_mcc(mvm, r->alpha2);
if (IS_ERR_OR_NULL(resp))
return -EIO;
kfree(resp);
}
return 0;
}
/*
* Driver regulatory hint for initial update - use the special
* unknown-country "99" code. This will also clear the "custom reg"
* flag and allow regdomain changes. It will happen after init since
* RTNL is required.
*/
return regulatory_hint(mvm->hw->wiphy, "99");
}
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