diff options
author | Arik Nemtsov <arik@wizery.com> | 2014-03-04 12:58:46 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-03-12 03:57:22 -0400 |
commit | 90d4f7db6c5d8af1f4eab7bc714ec0ee130f9f00 (patch) | |
tree | 58eff677b3afdc343166bf0fb3a4d22226237a32 /drivers/net/wireless/iwlwifi/mvm/nvm.c | |
parent | dcaf9f5ecb6f395152609bdc40660d9b593dca63 (diff) |
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.c | 37 |
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 @@ | |||
63 | * | 63 | * |
64 | *****************************************************************************/ | 64 | *****************************************************************************/ |
65 | #include <linux/firmware.h> | 65 | #include <linux/firmware.h> |
66 | #include <linux/rtnetlink.h> | ||
66 | #include "iwl-trans.h" | 67 | #include "iwl-trans.h" |
67 | #include "iwl-csr.h" | 68 | #include "iwl-csr.h" |
68 | #include "mvm.h" | 69 | #include "mvm.h" |
@@ -654,3 +655,39 @@ exit: | |||
654 | return ERR_PTR(ret); | 655 | return ERR_PTR(ret); |
655 | return resp_cp; | 656 | return resp_cp; |
656 | } | 657 | } |
658 | |||
659 | int iwl_mvm_init_mcc(struct iwl_mvm *mvm) | ||
660 | { | ||
661 | if (!iwl_mvm_is_lar_supported(mvm)) | ||
662 | return 0; | ||
663 | |||
664 | /* | ||
665 | * During HW restart, only replay the last set MCC to FW. Otherwise, | ||
666 | * queue an update to cfg80211 to retrieve the default alpha2 from FW. | ||
667 | */ | ||
668 | if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { | ||
669 | /* This should only be called during vif up and hold RTNL */ | ||
670 | const struct ieee80211_regdomain *r = | ||
671 | rtnl_dereference(mvm->hw->wiphy->regd); | ||
672 | |||
673 | if (r) { | ||
674 | struct iwl_mcc_update_resp *resp; | ||
675 | |||
676 | resp = iwl_mvm_update_mcc(mvm, r->alpha2); | ||
677 | if (IS_ERR_OR_NULL(resp)) | ||
678 | return -EIO; | ||
679 | |||
680 | kfree(resp); | ||
681 | } | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | /* | ||
687 | * Driver regulatory hint for initial update - use the special | ||
688 | * unknown-country "99" code. This will also clear the "custom reg" | ||
689 | * flag and allow regdomain changes. It will happen after init since | ||
690 | * RTNL is required. | ||
691 | */ | ||
692 | return regulatory_hint(mvm->hw->wiphy, "99"); | ||
693 | } | ||