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 <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.a6077801d7d5.I7d8d5c895bc467efbf81ea055dde366ea01cced1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
Miri Korenblit 2021-08-05 14:21:57 +03:00 committed by Luca Coelho
parent 78a19d5285
commit eb09ae93da
3 changed files with 26 additions and 2 deletions

View File

@ -1381,6 +1381,25 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
reg_query_regdb_wmm(regd->alpha2, center_freq, rule);
}
/*
* Certain firmware versions might report no valid channels
* if booted in RF-kill, i.e. not all calibrations etc. are
* running. We'll get out of this situation later when the
* rfkill is removed and we update the regdomain again, but
* since cfg80211 doesn't accept an empty regdomain, add a
* dummy (unusable) rule here in this case so we can init.
*/
if (!valid_rules) {
valid_rules = 1;
rule = &regd->reg_rules[valid_rules - 1];
rule->freq_range.start_freq_khz = MHZ_TO_KHZ(2412);
rule->freq_range.end_freq_khz = MHZ_TO_KHZ(2413);
rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(1);
rule->power_rule.max_antenna_gain = DBI_TO_MBI(6);
rule->power_rule.max_eirp =
DBM_TO_MBM(IWL_DEFAULT_MAX_TX_POWER);
}
regd->n_reg_rules = valid_rules;
/*

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* Copyright (C) 2012-2014, 2018-2019 Intel Corporation
* Copyright (C) 2012-2014, 2018-2019, 2021 Intel Corporation
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016-2017 Intel Deutschland GmbH
*/
@ -416,7 +416,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
struct iwl_rx_packet *pkt;
struct iwl_host_cmd cmd = {
.id = MCC_UPDATE_CMD,
.flags = CMD_WANT_SKB,
.flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
.data = { &mcc_update_cmd },
};

View File

@ -692,11 +692,16 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
if (ret && ret != -ERFKILL)
iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
if (!ret && iwl_mvm_is_lar_supported(mvm)) {
mvm->hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
ret = iwl_mvm_init_mcc(mvm);
}
if (!iwlmvm_mod_params.init_dbg || !ret)
iwl_mvm_stop_device(mvm);
mutex_unlock(&mvm->mutex);
rtnl_unlock();
if (ret < 0)
IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);