aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/quantenna/qtnfmac
diff options
context:
space:
mode:
authorIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>2019-03-20 06:03:55 -0400
committerKalle Valo <kvalo@codeaurora.org>2019-04-04 05:57:27 -0400
commit48cefdfbcb577a44fb6fada7539bb1cdaa8cb17a (patch)
tree42fe82a8347405cf44f650c1976c3f5c31977ef2 /drivers/net/wireless/quantenna/qtnfmac
parent2c31129f8f40ace206e9a3df9fb5581c29cd51fb (diff)
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/qtnfmac')
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/cfg80211.c19
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)
1073 struct wiphy *wiphy = priv_to_wiphy(mac); 1073 struct wiphy *wiphy = priv_to_wiphy(mac);
1074 struct qtnf_mac_info *macinfo = &mac->macinfo; 1074 struct qtnf_mac_info *macinfo = &mac->macinfo;
1075 int ret; 1075 int ret;
1076 bool regdomain_is_known;
1076 1077
1077 if (!wiphy) { 1078 if (!wiphy) {
1078 pr_err("invalid wiphy pointer\n"); 1079 pr_err("invalid wiphy pointer\n");
@@ -1144,11 +1145,20 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
1144 wiphy->wowlan = macinfo->wowlan; 1145 wiphy->wowlan = macinfo->wowlan;
1145#endif 1146#endif
1146 1147
1148 regdomain_is_known = isalpha(hw_info->rd->alpha2[0]) &&
1149 isalpha(hw_info->rd->alpha2[1]);
1150
1147 if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) { 1151 if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) {
1148 wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
1149 REGULATORY_CUSTOM_REG;
1150 wiphy->reg_notifier = qtnf_cfg80211_reg_notifier; 1152 wiphy->reg_notifier = qtnf_cfg80211_reg_notifier;
1151 wiphy_apply_custom_regulatory(wiphy, hw_info->rd); 1153
1154 if (hw_info->rd->alpha2[0] == '9' &&
1155 hw_info->rd->alpha2[1] == '9') {
1156 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
1157 REGULATORY_STRICT_REG;
1158 wiphy_apply_custom_regulatory(wiphy, hw_info->rd);
1159 } else if (regdomain_is_known) {
1160 wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
1161 }
1152 } else { 1162 } else {
1153 wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; 1163 wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
1154 } 1164 }
@@ -1172,8 +1182,7 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
1172 1182
1173 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1183 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1174 ret = regulatory_set_wiphy_regd(wiphy, hw_info->rd); 1184 ret = regulatory_set_wiphy_regd(wiphy, hw_info->rd);
1175 else if (isalpha(hw_info->rd->alpha2[0]) && 1185 else if (regdomain_is_known)
1176 isalpha(hw_info->rd->alpha2[1]))
1177 ret = regulatory_hint(wiphy, hw_info->rd->alpha2); 1186 ret = regulatory_hint(wiphy, hw_info->rd->alpha2);
1178 1187
1179out: 1188out: