aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2014-03-04 12:58:46 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-03-12 03:57:22 -0400
commit90d4f7db6c5d8af1f4eab7bc714ec0ee130f9f00 (patch)
tree58eff677b3afdc343166bf0fb3a4d22226237a32
parentdcaf9f5ecb6f395152609bdc40660d9b593dca63 (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>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/nvm.c37
3 files changed, 42 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index a81da4cde643..c03bde093927 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -739,6 +739,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
739 if (ret) 739 if (ret)
740 goto error; 740 goto error;
741 741
742 ret = iwl_mvm_init_mcc(mvm);
743 if (ret)
744 goto error;
745
742 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 746 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) {
743 ret = iwl_mvm_config_scan(mvm); 747 ret = iwl_mvm_config_scan(mvm);
744 if (ret) 748 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index a0aa3b1dc7a5..b31f43c7cf80 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -1397,6 +1397,7 @@ int iwl_mvm_get_temp(struct iwl_mvm *mvm);
1397/* Location Aware Regulatory */ 1397/* Location Aware Regulatory */
1398struct iwl_mcc_update_resp * 1398struct iwl_mcc_update_resp *
1399iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2); 1399iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2);
1400int iwl_mvm_init_mcc(struct iwl_mvm *mvm);
1400 1401
1401/* smart fifo */ 1402/* smart fifo */
1402int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1403int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
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
659int 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}