Lines Matching +full:nc +full:- +full:si
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2019-2020 Realtek Corporation
64 COUNTRY_REGD("SI", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
215 COUNTRY_REGD("NC", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
286 "SI",
319 return regd - rtw89_regd_map; in rtw89_regd_get_index()
335 ##_argv, __r->alpha2[0], __r->alpha2[1], \
336 __r->txpwr_regd[RTW89_BAND_2G], \
337 __r->txpwr_regd[RTW89_BAND_5G], \
338 __r->txpwr_regd[RTW89_BAND_6G]); \
344 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_unii4()
345 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_setup_unii4()
354 sband = wiphy->bands[NL80211_BAND_5GHZ]; in rtw89_regd_setup_unii4()
358 if (!chip->support_unii4) { in rtw89_regd_setup_unii4()
359 sband->n_channels -= RTW89_5GHZ_UNII4_CHANNEL_NUM; in rtw89_regd_setup_unii4()
363 bitmap_fill(regulatory->block_unii4, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_unii4()
379 "acpi: eval if allow unii-4: 0x%x\n", val); in rtw89_regd_setup_unii4()
385 switch (regd->txpwr_regd[RTW89_BAND_5G]) { in rtw89_regd_setup_unii4()
388 clear_bit(i, regulatory->block_unii4); in rtw89_regd_setup_unii4()
392 clear_bit(i, regulatory->block_unii4); in rtw89_regd_setup_unii4()
403 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_regd_setup_policy_6ghz()
414 set_bit(index, regulatory->block_6ghz); in __rtw89_regd_setup_policy_6ghz()
416 clear_bit(index, regulatory->block_6ghz); in __rtw89_regd_setup_policy_6ghz()
421 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_policy_6ghz()
438 switch (ptr->policy_mode) { in rtw89_regd_setup_policy_6ghz()
445 bitmap_fill(regulatory->block_6ghz, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_policy_6ghz()
450 ptr->policy_mode); in rtw89_regd_setup_policy_6ghz()
454 for (i = 0; i < ptr->country_count; i++) { in rtw89_regd_setup_policy_6ghz()
455 country = &ptr->country_list[i]; in rtw89_regd_setup_policy_6ghz()
456 if (memcmp("EU", country->alpha2, 2) != 0) { in rtw89_regd_setup_policy_6ghz()
458 country->alpha2); in rtw89_regd_setup_policy_6ghz()
473 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_policy_6ghz_sp()
483 "acpi: cannot eval policy 6ghz-sp: %d\n", ret); in rtw89_regd_setup_policy_6ghz_sp()
489 switch (ptr->override) { in rtw89_regd_setup_policy_6ghz_sp()
493 ptr->override); in rtw89_regd_setup_policy_6ghz_sp()
501 bitmap_fill(regulatory->block_6ghz_sp, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_policy_6ghz_sp()
503 enable_by_us = u8_get_bits(ptr->conf, RTW89_ACPI_CONF_6GHZ_SP_US); in rtw89_regd_setup_policy_6ghz_sp()
508 if (enable_by_us && memcmp(tmp->alpha2, "US", 2) == 0) in rtw89_regd_setup_policy_6ghz_sp()
509 clear_bit(i, regulatory->block_6ghz_sp); in rtw89_regd_setup_policy_6ghz_sp()
518 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_setup_6ghz()
519 bool chip_support_6ghz = chip->support_bands & BIT(NL80211_BAND_6GHZ); in rtw89_regd_setup_6ghz()
562 sband = wiphy->bands[NL80211_BAND_6GHZ]; in rtw89_regd_setup_6ghz()
566 wiphy->bands[NL80211_BAND_6GHZ] = NULL; in rtw89_regd_setup_6ghz()
567 kfree((__force void *)sband->iftype_data); in rtw89_regd_setup_6ghz()
573 struct wiphy *wiphy = rtwdev->hw->wiphy; in rtw89_regd_setup()
576 return -EINVAL; in rtw89_regd_setup()
581 wiphy->reg_notifier = rtw89_regd_notifier; in rtw89_regd_setup()
589 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_init()
591 struct wiphy *wiphy = rtwdev->hw->wiphy; in rtw89_regd_init()
594 regulatory->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_regd_init()
597 return -EINVAL; in rtw89_regd_init()
599 chip_regd = rtw89_regd_find_reg_by_name(rtwdev->efuse.country_code); in rtw89_regd_init()
601 rtwdev->regulatory.regd = chip_regd; in rtw89_regd_init()
603 wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_init()
604 wiphy->regulatory_flags |= REGULATORY_STRICT_REG; in rtw89_regd_init()
606 ret = regulatory_hint(rtwdev->hw->wiphy, in rtw89_regd_init()
607 rtwdev->regulatory.regd->alpha2); in rtw89_regd_init()
615 rtw89_debug_regd(rtwdev, rtwdev->regulatory.regd, in rtw89_regd_init()
623 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_apply_policy_unii4()
624 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_apply_policy_unii4()
625 const struct rtw89_regd *regd = regulatory->regd; in rtw89_regd_apply_policy_unii4()
630 sband = wiphy->bands[NL80211_BAND_5GHZ]; in rtw89_regd_apply_policy_unii4()
634 if (!chip->support_unii4) in rtw89_regd_apply_policy_unii4()
639 !test_bit(index, regulatory->block_unii4)) in rtw89_regd_apply_policy_unii4()
642 rtw89_debug(rtwdev, RTW89_DBG_REGD, "%c%c unii-4 is blocked by policy\n", in rtw89_regd_apply_policy_unii4()
643 regd->alpha2[0], regd->alpha2[1]); in rtw89_regd_apply_policy_unii4()
645 for (i = RTW89_5GHZ_UNII4_START_INDEX; i < sband->n_channels; i++) in rtw89_regd_apply_policy_unii4()
646 sband->channels[i].flags |= IEEE80211_CHAN_DISABLED; in rtw89_regd_apply_policy_unii4()
651 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in regd_is_6ghz_blocked()
652 const struct rtw89_regd *regd = regulatory->regd; in regd_is_6ghz_blocked()
657 !test_bit(index, regulatory->block_6ghz)) in regd_is_6ghz_blocked()
661 regd->alpha2[0], regd->alpha2[1]); in regd_is_6ghz_blocked()
667 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in regd_is_6ghz_not_applicable()
668 const struct rtw89_regd *regd = regulatory->regd; in regd_is_6ghz_not_applicable()
670 if (regd->txpwr_regd[RTW89_BAND_6G] != RTW89_NA) in regd_is_6ghz_not_applicable()
674 regd->alpha2[0], regd->alpha2[1]); in regd_is_6ghz_not_applicable()
688 sband = wiphy->bands[NL80211_BAND_6GHZ]; in rtw89_regd_apply_policy_6ghz()
692 for (i = 0; i < sband->n_channels; i++) in rtw89_regd_apply_policy_6ghz()
693 sband->channels[i].flags |= IEEE80211_CHAN_DISABLED; in rtw89_regd_apply_policy_6ghz()
700 rtwdev->regulatory.regd = rtw89_regd_find_reg_by_name(request->alpha2); in rtw89_regd_notifier_apply()
705 if (request->initiator == NL80211_REGDOM_SET_BY_USER && in rtw89_regd_notifier_apply()
706 !rtw89_regd_is_ww(rtwdev->regulatory.regd)) in rtw89_regd_notifier_apply()
707 wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_notifier_apply()
709 wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_notifier_apply()
718 struct rtw89_dev *rtwdev = hw->priv; in rtw89_regd_notifier()
720 mutex_lock(&rtwdev->mutex); in rtw89_regd_notifier()
723 if (wiphy->regd) { in rtw89_regd_notifier()
729 rtw89_debug_regd(rtwdev, rtwdev->regulatory.regd, in rtw89_regd_notifier()
731 request->initiator); in rtw89_regd_notifier()
736 mutex_unlock(&rtwdev->mutex); in rtw89_regd_notifier()
740 * Both units are 0.5 dB-based. Return a constraint in dB.
749 return (raw - offset) / 2; in tpe_get_constraint()
754 if (tpe->valid) { in tpe_intersect_constraint()
755 tpe->constraint = min(tpe->constraint, cstr); in tpe_intersect_constraint()
759 tpe->constraint = cstr; in tpe_intersect_constraint()
760 tpe->valid = true; in tpe_intersect_constraint()
769 if (!eirp->valid) in tpe_deal_with_eirp()
772 for (i = 0; i < eirp->count; i++) { in tpe_deal_with_eirp()
773 cstr = tpe_get_constraint(eirp->power[i]); in tpe_deal_with_eirp()
792 if (!psd->valid) in tpe_deal_with_psd()
795 for (i = 0; i < psd->count; i++) { in tpe_deal_with_psd()
796 cstr_psd = tpe_get_constraint(psd->power[i]); in tpe_deal_with_psd()
808 tpe_deal_with_eirp(result_tpe, &parsed_tpe->max_local[category]); in rtw89_calculate_tpe()
809 tpe_deal_with_eirp(result_tpe, &parsed_tpe->max_reg_client[category]); in rtw89_calculate_tpe()
810 tpe_deal_with_psd(result_tpe, &parsed_tpe->psd_local[category]); in rtw89_calculate_tpe()
811 tpe_deal_with_psd(result_tpe, &parsed_tpe->psd_reg_client[category]); in rtw89_calculate_tpe()
816 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_reg_6ghz_tpe_recalc()
828 chan = rtw89_chan_get(rtwdev, rtwvif_link->chanctx_idx); in __rtw89_reg_6ghz_tpe_recalc()
829 if (chan->band_type != RTW89_BAND_6G) in __rtw89_reg_6ghz_tpe_recalc()
832 tmp = &rtwvif_link->reg_6ghz_tpe; in __rtw89_reg_6ghz_tpe_recalc()
833 if (!tmp->valid) in __rtw89_reg_6ghz_tpe_recalc()
836 tpe_intersect_constraint(&new, tmp->constraint); in __rtw89_reg_6ghz_tpe_recalc()
840 if (memcmp(®ulatory->reg_6ghz_tpe, &new, in __rtw89_reg_6ghz_tpe_recalc()
841 sizeof(regulatory->reg_6ghz_tpe)) != 0) in __rtw89_reg_6ghz_tpe_recalc()
853 regulatory->reg_6ghz_tpe = new; in __rtw89_reg_6ghz_tpe_recalc()
863 struct rtw89_reg_6ghz_tpe *tpe = &rtwvif_link->reg_6ghz_tpe; in rtw89_reg_6ghz_tpe_recalc()
868 if (!active || rtwvif_link->reg_6ghz_power != RTW89_REG_6GHZ_POWER_STD) in rtw89_reg_6ghz_tpe_recalc()
874 rtw89_calculate_tpe(rtwdev, tpe, &bss_conf->tpe); in rtw89_reg_6ghz_tpe_recalc()
878 if (!tpe->valid) in rtw89_reg_6ghz_tpe_recalc()
881 if (tpe->constraint < RTW89_MIN_VALID_POWER_CONSTRAINT) { in rtw89_reg_6ghz_tpe_recalc()
884 __func__, tpe->constraint); in rtw89_reg_6ghz_tpe_recalc()
886 tpe->valid = false; in rtw89_reg_6ghz_tpe_recalc()
887 return -EINVAL; in rtw89_reg_6ghz_tpe_recalc()
897 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_reg_6ghz_power_recalc()
898 const struct rtw89_regd *regd = regulatory->regd; in __rtw89_reg_6ghz_power_recalc()
909 chan = rtw89_chan_get(rtwdev, rtwvif_link->chanctx_idx); in __rtw89_reg_6ghz_power_recalc()
910 if (chan->band_type != RTW89_BAND_6G) in __rtw89_reg_6ghz_power_recalc()
913 if (count != 0 && rtwvif_link->reg_6ghz_power == sel) in __rtw89_reg_6ghz_power_recalc()
916 sel = rtwvif_link->reg_6ghz_power; in __rtw89_reg_6ghz_power_recalc()
927 test_bit(index, regulatory->block_6ghz_sp)) { in __rtw89_reg_6ghz_power_recalc()
930 regd->alpha2[0], regd->alpha2[1]); in __rtw89_reg_6ghz_power_recalc()
935 if (regulatory->reg_6ghz_power == sel) in __rtw89_reg_6ghz_power_recalc()
941 regulatory->reg_6ghz_power = sel; in __rtw89_reg_6ghz_power_recalc()
956 switch (bss_conf->power_type) { in rtw89_reg_6ghz_power_recalc()
958 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_VLP; in rtw89_reg_6ghz_power_recalc()
961 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_LPI; in rtw89_reg_6ghz_power_recalc()
964 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_STD; in rtw89_reg_6ghz_power_recalc()
967 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_reg_6ghz_power_recalc()
971 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_reg_6ghz_power_recalc()
986 lockdep_assert_held(&rtwdev->mutex); in rtw89_reg_6ghz_recalc()