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),
289 "SI",
322 return regd - rtw89_regd_map; in rtw89_regd_get_index()
338 ##_argv, __r->alpha2[0], __r->alpha2[1], \
339 __r->txpwr_regd[RTW89_BAND_2G], \
340 __r->txpwr_regd[RTW89_BAND_5G], \
341 __r->txpwr_regd[RTW89_BAND_6G]); \
347 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_unii4()
348 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_setup_unii4()
357 sband = wiphy->bands[NL80211_BAND_5GHZ]; in rtw89_regd_setup_unii4()
361 if (!chip->support_unii4) { in rtw89_regd_setup_unii4()
362 sband->n_channels -= RTW89_5GHZ_UNII4_CHANNEL_NUM; in rtw89_regd_setup_unii4()
366 bitmap_fill(regulatory->block_unii4, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_unii4()
382 "acpi: eval if allow unii-4: 0x%x\n", val); in rtw89_regd_setup_unii4()
388 switch (regd->txpwr_regd[RTW89_BAND_5G]) { in rtw89_regd_setup_unii4()
391 clear_bit(i, regulatory->block_unii4); in rtw89_regd_setup_unii4()
395 clear_bit(i, regulatory->block_unii4); in rtw89_regd_setup_unii4()
406 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_regd_setup_policy_6ghz()
417 set_bit(index, regulatory->block_6ghz); in __rtw89_regd_setup_policy_6ghz()
419 clear_bit(index, regulatory->block_6ghz); in __rtw89_regd_setup_policy_6ghz()
424 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_policy_6ghz()
441 switch (ptr->policy_mode) { in rtw89_regd_setup_policy_6ghz()
448 bitmap_fill(regulatory->block_6ghz, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_policy_6ghz()
453 ptr->policy_mode); in rtw89_regd_setup_policy_6ghz()
457 for (i = 0; i < ptr->country_count; i++) { in rtw89_regd_setup_policy_6ghz()
458 country = &ptr->country_list[i]; in rtw89_regd_setup_policy_6ghz()
459 if (memcmp("EU", country->alpha2, 2) != 0) { in rtw89_regd_setup_policy_6ghz()
461 country->alpha2); in rtw89_regd_setup_policy_6ghz()
476 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_setup_policy_6ghz_sp()
486 "acpi: cannot eval policy 6ghz-sp: %d\n", ret); in rtw89_regd_setup_policy_6ghz_sp()
492 switch (ptr->override) { in rtw89_regd_setup_policy_6ghz_sp()
496 ptr->override); in rtw89_regd_setup_policy_6ghz_sp()
504 bitmap_fill(regulatory->block_6ghz_sp, RTW89_REGD_MAX_COUNTRY_NUM); in rtw89_regd_setup_policy_6ghz_sp()
506 enable_by_us = u8_get_bits(ptr->conf, RTW89_ACPI_CONF_6GHZ_SP_US); in rtw89_regd_setup_policy_6ghz_sp()
511 if (enable_by_us && memcmp(tmp->alpha2, "US", 2) == 0) in rtw89_regd_setup_policy_6ghz_sp()
512 clear_bit(i, regulatory->block_6ghz_sp); in rtw89_regd_setup_policy_6ghz_sp()
521 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_setup_6ghz()
522 bool chip_support_6ghz = chip->support_bands & BIT(NL80211_BAND_6GHZ); in rtw89_regd_setup_6ghz()
565 sband = wiphy->bands[NL80211_BAND_6GHZ]; in rtw89_regd_setup_6ghz()
569 wiphy->bands[NL80211_BAND_6GHZ] = NULL; in rtw89_regd_setup_6ghz()
570 kfree((__force void *)sband->iftype_data); in rtw89_regd_setup_6ghz()
576 struct wiphy *wiphy = rtwdev->hw->wiphy; in rtw89_regd_setup()
579 return -EINVAL; in rtw89_regd_setup()
584 wiphy->reg_notifier = rtw89_regd_notifier; in rtw89_regd_setup()
592 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_init()
594 struct wiphy *wiphy = rtwdev->hw->wiphy; in rtw89_regd_init()
597 regulatory->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_regd_init()
600 return -EINVAL; in rtw89_regd_init()
602 chip_regd = rtw89_regd_find_reg_by_name(rtwdev->efuse.country_code); in rtw89_regd_init()
604 rtwdev->regulatory.regd = chip_regd; in rtw89_regd_init()
606 wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_init()
607 wiphy->regulatory_flags |= REGULATORY_STRICT_REG; in rtw89_regd_init()
609 ret = regulatory_hint(rtwdev->hw->wiphy, in rtw89_regd_init()
610 rtwdev->regulatory.regd->alpha2); in rtw89_regd_init()
618 rtw89_debug_regd(rtwdev, rtwdev->regulatory.regd, in rtw89_regd_init()
626 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in rtw89_regd_apply_policy_unii4()
627 const struct rtw89_chip_info *chip = rtwdev->chip; in rtw89_regd_apply_policy_unii4()
628 const struct rtw89_regd *regd = regulatory->regd; in rtw89_regd_apply_policy_unii4()
633 sband = wiphy->bands[NL80211_BAND_5GHZ]; in rtw89_regd_apply_policy_unii4()
637 if (!chip->support_unii4) in rtw89_regd_apply_policy_unii4()
642 !test_bit(index, regulatory->block_unii4)) in rtw89_regd_apply_policy_unii4()
645 rtw89_debug(rtwdev, RTW89_DBG_REGD, "%c%c unii-4 is blocked by policy\n", in rtw89_regd_apply_policy_unii4()
646 regd->alpha2[0], regd->alpha2[1]); in rtw89_regd_apply_policy_unii4()
648 for (i = RTW89_5GHZ_UNII4_START_INDEX; i < sband->n_channels; i++) in rtw89_regd_apply_policy_unii4()
649 sband->channels[i].flags |= IEEE80211_CHAN_DISABLED; in rtw89_regd_apply_policy_unii4()
654 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in regd_is_6ghz_blocked()
655 const struct rtw89_regd *regd = regulatory->regd; in regd_is_6ghz_blocked()
660 !test_bit(index, regulatory->block_6ghz)) in regd_is_6ghz_blocked()
664 regd->alpha2[0], regd->alpha2[1]); in regd_is_6ghz_blocked()
670 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in regd_is_6ghz_not_applicable()
671 const struct rtw89_regd *regd = regulatory->regd; in regd_is_6ghz_not_applicable()
673 if (regd->txpwr_regd[RTW89_BAND_6G] != RTW89_NA) in regd_is_6ghz_not_applicable()
677 regd->alpha2[0], regd->alpha2[1]); in regd_is_6ghz_not_applicable()
691 sband = wiphy->bands[NL80211_BAND_6GHZ]; in rtw89_regd_apply_policy_6ghz()
695 for (i = 0; i < sband->n_channels; i++) in rtw89_regd_apply_policy_6ghz()
696 sband->channels[i].flags |= IEEE80211_CHAN_DISABLED; in rtw89_regd_apply_policy_6ghz()
703 rtwdev->regulatory.regd = rtw89_regd_find_reg_by_name(request->alpha2); in rtw89_regd_notifier_apply()
708 if (request->initiator == NL80211_REGDOM_SET_BY_USER && in rtw89_regd_notifier_apply()
709 !rtw89_regd_is_ww(rtwdev->regulatory.regd)) in rtw89_regd_notifier_apply()
710 wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_notifier_apply()
712 wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; in rtw89_regd_notifier_apply()
721 struct rtw89_dev *rtwdev = hw->priv; in rtw89_regd_notifier()
723 mutex_lock(&rtwdev->mutex); in rtw89_regd_notifier()
726 if (wiphy->regd) { in rtw89_regd_notifier()
732 rtw89_debug_regd(rtwdev, rtwdev->regulatory.regd, in rtw89_regd_notifier()
734 request->initiator); in rtw89_regd_notifier()
739 mutex_unlock(&rtwdev->mutex); in rtw89_regd_notifier()
743 * Both units are 0.5 dB-based. Return a constraint in dB.
752 return (raw - offset) / 2; in tpe_get_constraint()
757 if (tpe->valid) { in tpe_intersect_constraint()
758 tpe->constraint = min(tpe->constraint, cstr); in tpe_intersect_constraint()
762 tpe->constraint = cstr; in tpe_intersect_constraint()
763 tpe->valid = true; in tpe_intersect_constraint()
772 if (!eirp->valid) in tpe_deal_with_eirp()
775 for (i = 0; i < eirp->count; i++) { in tpe_deal_with_eirp()
776 cstr = tpe_get_constraint(eirp->power[i]); in tpe_deal_with_eirp()
795 if (!psd->valid) in tpe_deal_with_psd()
798 for (i = 0; i < psd->count; i++) { in tpe_deal_with_psd()
799 cstr_psd = tpe_get_constraint(psd->power[i]); in tpe_deal_with_psd()
811 tpe_deal_with_eirp(result_tpe, &parsed_tpe->max_local[category]); in rtw89_calculate_tpe()
812 tpe_deal_with_eirp(result_tpe, &parsed_tpe->max_reg_client[category]); in rtw89_calculate_tpe()
813 tpe_deal_with_psd(result_tpe, &parsed_tpe->psd_local[category]); in rtw89_calculate_tpe()
814 tpe_deal_with_psd(result_tpe, &parsed_tpe->psd_reg_client[category]); in rtw89_calculate_tpe()
819 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_reg_6ghz_tpe_recalc()
831 chan = rtw89_chan_get(rtwdev, rtwvif_link->chanctx_idx); in __rtw89_reg_6ghz_tpe_recalc()
832 if (chan->band_type != RTW89_BAND_6G) in __rtw89_reg_6ghz_tpe_recalc()
835 tmp = &rtwvif_link->reg_6ghz_tpe; in __rtw89_reg_6ghz_tpe_recalc()
836 if (!tmp->valid) in __rtw89_reg_6ghz_tpe_recalc()
839 tpe_intersect_constraint(&new, tmp->constraint); in __rtw89_reg_6ghz_tpe_recalc()
843 if (memcmp(®ulatory->reg_6ghz_tpe, &new, in __rtw89_reg_6ghz_tpe_recalc()
844 sizeof(regulatory->reg_6ghz_tpe)) != 0) in __rtw89_reg_6ghz_tpe_recalc()
856 regulatory->reg_6ghz_tpe = new; in __rtw89_reg_6ghz_tpe_recalc()
866 struct rtw89_reg_6ghz_tpe *tpe = &rtwvif_link->reg_6ghz_tpe; in rtw89_reg_6ghz_tpe_recalc()
871 if (!active || rtwvif_link->reg_6ghz_power != RTW89_REG_6GHZ_POWER_STD) in rtw89_reg_6ghz_tpe_recalc()
877 rtw89_calculate_tpe(rtwdev, tpe, &bss_conf->tpe); in rtw89_reg_6ghz_tpe_recalc()
881 if (!tpe->valid) in rtw89_reg_6ghz_tpe_recalc()
884 if (tpe->constraint < RTW89_MIN_VALID_POWER_CONSTRAINT) { in rtw89_reg_6ghz_tpe_recalc()
887 __func__, tpe->constraint); in rtw89_reg_6ghz_tpe_recalc()
889 tpe->valid = false; in rtw89_reg_6ghz_tpe_recalc()
890 return -EINVAL; in rtw89_reg_6ghz_tpe_recalc()
900 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory; in __rtw89_reg_6ghz_power_recalc()
901 const struct rtw89_regd *regd = regulatory->regd; in __rtw89_reg_6ghz_power_recalc()
912 chan = rtw89_chan_get(rtwdev, rtwvif_link->chanctx_idx); in __rtw89_reg_6ghz_power_recalc()
913 if (chan->band_type != RTW89_BAND_6G) in __rtw89_reg_6ghz_power_recalc()
916 if (count != 0 && rtwvif_link->reg_6ghz_power == sel) in __rtw89_reg_6ghz_power_recalc()
919 sel = rtwvif_link->reg_6ghz_power; in __rtw89_reg_6ghz_power_recalc()
930 test_bit(index, regulatory->block_6ghz_sp)) { in __rtw89_reg_6ghz_power_recalc()
933 regd->alpha2[0], regd->alpha2[1]); in __rtw89_reg_6ghz_power_recalc()
938 if (regulatory->reg_6ghz_power == sel) in __rtw89_reg_6ghz_power_recalc()
944 regulatory->reg_6ghz_power = sel; in __rtw89_reg_6ghz_power_recalc()
959 switch (bss_conf->power_type) { in rtw89_reg_6ghz_power_recalc()
961 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_VLP; in rtw89_reg_6ghz_power_recalc()
964 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_LPI; in rtw89_reg_6ghz_power_recalc()
967 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_STD; in rtw89_reg_6ghz_power_recalc()
970 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_reg_6ghz_power_recalc()
974 rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT; in rtw89_reg_6ghz_power_recalc()
989 lockdep_assert_held(&rtwdev->mutex); in rtw89_reg_6ghz_recalc()