Lines Matching refs:rg
39 static void _convert_ch2g(struct rtw_regulation *rg, u32 *ch_cnt, in _convert_ch2g() argument
69 struct rtw_regulation *rg, const struct freq_plan *f) in _chnlplan_update_2g() argument
91 rg->ch_idx2g = f->ch_idx; in _chnlplan_update_2g()
92 rg->regulation_2g = f->regulation; in _chnlplan_update_2g()
94 plan = &rg->chplan[FREQ_GROUP_2GHZ]; in _chnlplan_update_2g()
98 _convert_ch2g(rg, &plan->cnt, plan->ch, ch, passive); in _chnlplan_update_2g()
167 static void _convert_ch5g(u8 band_5g, struct rtw_regulation *rg, in _convert_ch5g() argument
205 struct rtw_regulation *rg, const struct freq_plan *f) in _chnlplan_update_5g() argument
230 rg->ch_idx5g = f->ch_idx; in _chnlplan_update_5g()
231 rg->regulation_5g = f->regulation; in _chnlplan_update_5g()
235 plan = &rg->chplan[group]; in _chnlplan_update_5g()
239 _convert_ch5g((u8)(i + 1), rg, &plan->cnt, plan->ch, in _chnlplan_update_5g()
250 struct rtw_regulation *rg, u8 did, enum regulation_rsn reason) in _regulatory_domain_update() argument
259 rg->domain.code = rdmap[did].domain_code; in _regulatory_domain_update()
260 rg->domain.reason = reason; in _regulatory_domain_update()
262 status = _chnlplan_update_2g(rg, plan_2g); in _regulatory_domain_update()
265 status = _chnlplan_update_5g(rg, plan_5g); in _regulatory_domain_update()
272 static void _get_group_chplan(struct rtw_regulation *rg, in _get_group_chplan() argument
283 (!dfs || ((rg->capability & CAPABILITY_DFS) && dfs))) { in _get_group_chplan()
308 static enum rtw_regulation_status _get_chnlplan(struct rtw_regulation *rg, in _get_chnlplan() argument
314 if (rg->domain.code == INVALID_DOMAIN_CODE) in _get_chnlplan()
320 if (rg->capability & CAPABILITY_2GHZ) { in _get_chnlplan()
324 group = &rg->chplan[FREQ_GROUP_2GHZ]; in _get_chnlplan()
325 _get_group_chplan(rg, group, plan); in _get_chnlplan()
330 if (rg->capability & CAPABILITY_5GHZ) { in _get_chnlplan()
336 group = &rg->chplan[FREQ_GROUP_5GHZ_BAND1]; in _get_chnlplan()
337 _get_group_chplan(rg, group, plan); in _get_chnlplan()
344 group = &rg->chplan[FREQ_GROUP_5GHZ_BAND2]; in _get_chnlplan()
345 _get_group_chplan(rg, group, plan); in _get_chnlplan()
352 group = &rg->chplan[FREQ_GROUP_5GHZ_BAND3]; in _get_chnlplan()
353 _get_group_chplan(rg, group, plan); in _get_chnlplan()
360 group = &rg->chplan[FREQ_GROUP_5GHZ_BAND4]; in _get_chnlplan()
361 _get_group_chplan(rg, group, plan); in _get_chnlplan()
366 regu_get_chnlplan_6g(rg, type, plan); in _get_chnlplan()
425 struct rtw_regulation *rg = NULL; in _regulation_valid() local
432 rg = &phl_info->regulation; in _regulation_valid()
433 if (!rg->init) in _regulation_valid()
437 _os_spinlock(d, &rg->lock, _bh, NULL); in _regulation_valid()
438 valid = rg->valid; in _regulation_valid()
439 _os_spinunlock(d, &rg->lock, _bh, NULL); in _regulation_valid()
444 static bool _query_channel(struct rtw_regulation *rg, in _query_channel() argument
451 if ((BAND_2GHZ(band) && !(rg->capability & CAPABILITY_2GHZ)) || in _query_channel()
452 (BAND_5GHZ(band) && !(rg->capability & CAPABILITY_5GHZ)) || in _query_channel()
453 (BAND_6GHZ(band) && !(rg->capability & CAPABILITY_6GHZ))) in _query_channel()
457 plan = &rg->chplan[i]; in _query_channel()
501 static void _history_log(struct rtw_regulation *rg, u8 domain, u8 reason) in _history_log() argument
503 rg->history[rg->history_cnt].code = domain; in _history_log()
504 rg->history[rg->history_cnt].reason = reason; in _history_log()
505 rg->history_cnt++; in _history_log()
506 if (rg->history_cnt >= MAX_HISTORY_NUM) in _history_log()
507 rg->history_cnt = 0; in _history_log()
557 static void _reset_for_non_specific_country(struct rtw_regulation *rg) in _reset_for_non_specific_country() argument
560 rg->country[0] = 0; in _reset_for_non_specific_country()
561 rg->country[1] = 0; in _reset_for_non_specific_country()
564 rg->tpo = TPO_NA; in _reset_for_non_specific_country()
567 rg->support_mode |= (SUPPORT_11B | SUPPORT_11G | SUPPORT_11N | in _reset_for_non_specific_country()
586 struct rtw_regulation *rg = NULL; in rtw_phl_set_user_def_chplan() local
597 rg = &phl_info->regulation; in rtw_phl_set_user_def_chplan()
598 if (!rg->init) in rtw_phl_set_user_def_chplan()
601 if (rg->domain.code != RSVD_DOMAIN) { in rtw_phl_set_user_def_chplan()
610 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_set_user_def_chplan()
612 rg->regulation_2g = (u8)udef->regulatory_idx; in rtw_phl_set_user_def_chplan()
613 rg->regulation_5g = (u8)udef->regulatory_idx; in rtw_phl_set_user_def_chplan()
614 rg->tpo = udef->tpo; in rtw_phl_set_user_def_chplan()
617 plan = &rg->chplan[FREQ_GROUP_2GHZ]; in rtw_phl_set_user_def_chplan()
621 _convert_ch2g(rg, &plan->cnt, plan->ch, ch, passive); in rtw_phl_set_user_def_chplan()
628 plan = &rg->chplan[group]; in rtw_phl_set_user_def_chplan()
632 _convert_ch5g((u8)(i + 1), rg, &plan->cnt, plan->ch, in rtw_phl_set_user_def_chplan()
636 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_set_user_def_chplan()
684 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_set_domain() local
694 rg = &phl_info->regulation; in rtw_phl_regulation_set_domain()
695 if (!rg->init) in rtw_phl_regulation_set_domain()
705 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_domain()
707 _history_log(rg, domain, reason); in rtw_phl_regulation_set_domain()
710 rg->domain.code = RSVD_DOMAIN; in rtw_phl_regulation_set_domain()
711 rg->domain.reason = reason; in rtw_phl_regulation_set_domain()
714 status = _regulatory_domain_update(rg, did, reason); in rtw_phl_regulation_set_domain()
717 _reset_for_non_specific_country(rg); in rtw_phl_regulation_set_domain()
718 rg->valid = true; in rtw_phl_regulation_set_domain()
720 rg->valid = false; in rtw_phl_regulation_set_domain()
721 rg->invalid_cnt++; in rtw_phl_regulation_set_domain()
723 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_domain()
756 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_set_country() local
767 rg = &phl_info->regulation; in rtw_phl_regulation_set_country()
768 if (!rg->init) in rtw_phl_regulation_set_country()
771 if (rg->domain.code == RSVD_DOMAIN) in rtw_phl_regulation_set_country()
780 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_country()
781 rg->country[0] = country[0]; in rtw_phl_regulation_set_country()
782 rg->country[1] = country[1]; in rtw_phl_regulation_set_country()
783 rg->tpo = cdmap[i].tpo; in rtw_phl_regulation_set_country()
784 rg->support_mode = 0; in rtw_phl_regulation_set_country()
786 rg->support_mode |= (SUPPORT_11B | SUPPORT_11G | SUPPORT_11N); in rtw_phl_regulation_set_country()
788 rg->support_mode |= (SUPPORT_11A); in rtw_phl_regulation_set_country()
790 rg->support_mode |= (SUPPORT_11AC); in rtw_phl_regulation_set_country()
792 rg->support_mode |= (SUPPORT_11AX); in rtw_phl_regulation_set_country()
793 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_country()
819 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_set_capability() local
827 rg = &phl_info->regulation; in rtw_phl_regulation_set_capability()
828 if (!rg->init) in rtw_phl_regulation_set_capability()
832 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_capability()
833 rg->capability = capability; in rtw_phl_regulation_set_capability()
834 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_set_capability()
837 rg->capability); in rtw_phl_regulation_set_capability()
865 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_query_chplan() local
875 rg = &phl_info->regulation; in rtw_phl_regulation_query_chplan()
878 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_query_chplan()
894 status = _get_chnlplan(rg, type, plan); in rtw_phl_regulation_query_chplan()
901 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_query_chplan()
931 struct rtw_regulation *rg = NULL; in rtw_phl_query_specific_chplan() local
966 rg = &phl_info->regulation; in rtw_phl_query_specific_chplan()
967 if (!(rg->capability & CAPABILITY_2GHZ)) in rtw_phl_query_specific_chplan()
969 if (!(rg->capability & CAPABILITY_5GHZ)) in rtw_phl_query_specific_chplan()
979 _convert_ch2g(rg, &plan->cnt, plan->ch, ch, passive); in rtw_phl_query_specific_chplan()
988 _convert_ch5g((u8)(i + 1), rg, &plan->cnt, plan->ch, in rtw_phl_query_specific_chplan()
1017 struct rtw_regulation *rg = NULL; in rtw_phl_query_regulation_info() local
1026 rg = &phl_info->regulation; in rtw_phl_query_regulation_info()
1029 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_query_regulation_info()
1031 info->domain_code = (u8)rg->domain.code; in rtw_phl_query_regulation_info()
1032 info->domain_reason = rg->domain.reason; in rtw_phl_query_regulation_info()
1033 info->country[0] = rg->country[0]; in rtw_phl_query_regulation_info()
1034 info->country[1] = rg->country[1]; in rtw_phl_query_regulation_info()
1035 info->tpo = rg->tpo; in rtw_phl_query_regulation_info()
1036 info->support_mode = rg->support_mode; in rtw_phl_query_regulation_info()
1037 info->regulation_2g = rg->regulation_2g; in rtw_phl_query_regulation_info()
1038 info->regulation_5g = rg->regulation_5g; in rtw_phl_query_regulation_info()
1041 info->capability = rg->capability; in rtw_phl_query_regulation_info()
1043 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_query_regulation_info()
1111 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_valid_channel() local
1120 rg = &phl_info->regulation; in rtw_phl_regulation_valid_channel()
1123 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_valid_channel()
1124 if (_query_channel(rg, band, channel, &ch)) { in rtw_phl_regulation_valid_channel()
1125 if (!(rg->capability & CAPABILITY_DFS)) in rtw_phl_regulation_valid_channel()
1130 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_valid_channel()
1154 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_dfs_channel() local
1162 rg = &phl_info->regulation; in rtw_phl_regulation_dfs_channel()
1165 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_dfs_channel()
1166 if (_query_channel(rg, band, channel, &ch)) { in rtw_phl_regulation_dfs_channel()
1173 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_dfs_channel()
1197 struct rtw_regulation *rg = NULL; in rtw_phl_regulation_query_ch() local
1204 rg = &phl_info->regulation; in rtw_phl_regulation_query_ch()
1207 _os_spinlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_query_ch()
1208 if (_query_channel(rg, band, channel, ch)) in rtw_phl_regulation_query_ch()
1210 _os_spinunlock(d, &rg->lock, _bh, NULL); in rtw_phl_regulation_query_ch()