summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/mvm/nvm.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2014-03-04 19:58:46 +0200
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-03-12 09:57:22 +0200
commit90d4f7db6c5d8af1f4eab7bc714ec0ee130f9f00 (patch)
tree58eff677b3afdc343166bf0fb3a4d22226237a32 /drivers/net/wireless/iwlwifi/mvm/nvm.c
parentdcaf9f5ecb6f395152609bdc40660d9b593dca63 (diff)
downloadlwn-90d4f7db6c5d8af1f4eab7bc714ec0ee130f9f00.tar.gz
lwn-90d4f7db6c5d8af1f4eab7bc714ec0ee130f9f00.zip
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: Arik Nemtsov <arikx.nemtsov@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/nvm.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/nvm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c
index 96107b80e130..26c5d94d3717 100644
--- a/drivers/net/wireless/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c
@@ -63,6 +63,7 @@
*
*****************************************************************************/
#include <linux/firmware.h>
+#include <linux/rtnetlink.h>
#include "iwl-trans.h"
#include "iwl-csr.h"
#include "mvm.h"
@@ -654,3 +655,39 @@ exit:
return ERR_PTR(ret);
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");
+}