diff options
author | Igor Mitsyanko <igor.mitsyanko.os@quantenna.com> | 2019-03-20 10:03:55 +0000 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-04-04 12:57:27 +0300 |
commit | 48cefdfbcb577a44fb6fada7539bb1cdaa8cb17a (patch) | |
tree | 42fe82a8347405cf44f650c1976c3f5c31977ef2 /drivers/net/wireless/quantenna | |
parent | 2c31129f8f40ace206e9a3df9fb5581c29cd51fb (diff) | |
download | blackbird-op-linux-48cefdfbcb577a44fb6fada7539bb1cdaa8cb17a.tar.gz blackbird-op-linux-48cefdfbcb577a44fb6fada7539bb1cdaa8cb17a.zip |
qtnfmac: flexible regulatory domain registration logic
Use REGULATORY_CUSTOM_REG flag only if firmware advertised a custom
regulatory domain prior to wiphy registration. Use REGULATORY_STRICT_REG
flag only if firmware knows its regulatory domain.
Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/quantenna')
-rw-r--r-- | drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index ae08b37d81d2..3131ced8801f 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -1073,6 +1073,7 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) struct wiphy *wiphy = priv_to_wiphy(mac); struct qtnf_mac_info *macinfo = &mac->macinfo; int ret; + bool regdomain_is_known; if (!wiphy) { pr_err("invalid wiphy pointer\n"); @@ -1144,11 +1145,20 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) wiphy->wowlan = macinfo->wowlan; #endif + regdomain_is_known = isalpha(hw_info->rd->alpha2[0]) && + isalpha(hw_info->rd->alpha2[1]); + if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) { - wiphy->regulatory_flags |= REGULATORY_STRICT_REG | - REGULATORY_CUSTOM_REG; wiphy->reg_notifier = qtnf_cfg80211_reg_notifier; - wiphy_apply_custom_regulatory(wiphy, hw_info->rd); + + if (hw_info->rd->alpha2[0] == '9' && + hw_info->rd->alpha2[1] == '9') { + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | + REGULATORY_STRICT_REG; + wiphy_apply_custom_regulatory(wiphy, hw_info->rd); + } else if (regdomain_is_known) { + wiphy->regulatory_flags |= REGULATORY_STRICT_REG; + } } else { wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; } @@ -1172,8 +1182,7 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) ret = regulatory_set_wiphy_regd(wiphy, hw_info->rd); - else if (isalpha(hw_info->rd->alpha2[0]) && - isalpha(hw_info->rd->alpha2[1])) + else if (regdomain_is_known) ret = regulatory_hint(wiphy, hw_info->rd->alpha2); out: |