Skip to content

Commit eb09ae9

Browse files
Miriam-Rachellucacoelho
authored andcommitted
iwlwifi: mvm: load regdomain at INIT stage
We used to load the regdomain only in the load stage, this caused the 'iw phy phy0 reg get' command to fail if we booted a machine with wifi off. Therefor we should load it in INIT stage already. Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20210805141826.a6077801d7d5.I7d8d5c895bc467efbf81ea055dde366ea01cced1@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent 78a19d5 commit eb09ae9

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,25 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
13811381
reg_query_regdb_wmm(regd->alpha2, center_freq, rule);
13821382
}
13831383

1384+
/*
1385+
* Certain firmware versions might report no valid channels
1386+
* if booted in RF-kill, i.e. not all calibrations etc. are
1387+
* running. We'll get out of this situation later when the
1388+
* rfkill is removed and we update the regdomain again, but
1389+
* since cfg80211 doesn't accept an empty regdomain, add a
1390+
* dummy (unusable) rule here in this case so we can init.
1391+
*/
1392+
if (!valid_rules) {
1393+
valid_rules = 1;
1394+
rule = &regd->reg_rules[valid_rules - 1];
1395+
rule->freq_range.start_freq_khz = MHZ_TO_KHZ(2412);
1396+
rule->freq_range.end_freq_khz = MHZ_TO_KHZ(2413);
1397+
rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(1);
1398+
rule->power_rule.max_antenna_gain = DBI_TO_MBI(6);
1399+
rule->power_rule.max_eirp =
1400+
DBM_TO_MBM(IWL_DEFAULT_MAX_TX_POWER);
1401+
}
1402+
13841403
regd->n_reg_rules = valid_rules;
13851404

13861405
/*

drivers/net/wireless/intel/iwlwifi/mvm/nvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22
/*
3-
* Copyright (C) 2012-2014, 2018-2019 Intel Corporation
3+
* Copyright (C) 2012-2014, 2018-2019, 2021 Intel Corporation
44
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55
* Copyright (C) 2016-2017 Intel Deutschland GmbH
66
*/
@@ -416,7 +416,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
416416
struct iwl_rx_packet *pkt;
417417
struct iwl_host_cmd cmd = {
418418
.id = MCC_UPDATE_CMD,
419-
.flags = CMD_WANT_SKB,
419+
.flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
420420
.data = { &mcc_update_cmd },
421421
};
422422

drivers/net/wireless/intel/iwlwifi/mvm/ops.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,16 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
692692

693693
if (ret && ret != -ERFKILL)
694694
iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
695+
if (!ret && iwl_mvm_is_lar_supported(mvm)) {
696+
mvm->hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
697+
ret = iwl_mvm_init_mcc(mvm);
698+
}
695699

696700
if (!iwlmvm_mod_params.init_dbg || !ret)
697701
iwl_mvm_stop_device(mvm);
698702

699703
mutex_unlock(&mvm->mutex);
704+
rtnl_unlock();
700705

701706
if (ret < 0)
702707
IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);

0 commit comments

Comments
 (0)