Lines Matching refs:reg

26 static int __ath_regd_init(struct ath_regulatory *reg);
117 static bool dynamic_country_user_possible(struct ath_regulatory *reg)
122 switch (reg->country_code) {
189 static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
193 if (!dynamic_country_user_possible(reg))
205 static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg)
207 return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG;
210 bool ath_is_world_regd(struct ath_regulatory *reg)
212 return is_wwr_sku(ath_regd_get_eepromRD(reg));
223 ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg)
225 switch (reg->regpair->reg_domain) {
258 struct ath_regulatory *reg)
261 if (reg->country_code == CTRY_INDIA)
309 struct ath_regulatory *reg,
313 if (ath_is_radar_freq(ch->center_freq, reg) ||
322 if (ath_reg_dyn_country_user_allow(reg))
340 struct ath_regulatory *reg,
354 __ath_reg_apply_beaconing_flags(wiphy, reg,
376 struct ath_regulatory *reg,
391 if (!ath_reg_dyn_country_user_allow(reg))
404 struct ath_regulatory *reg)
417 if (!ath_is_radar_freq(ch->center_freq, reg))
437 struct ath_regulatory *reg)
439 switch (reg->regpair->reg_domain) {
445 ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
448 ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
449 ath_reg_apply_ir_flags(wiphy, reg, initiator);
452 if (ath_reg_dyn_country_user_allow(reg))
453 ath_reg_apply_beaconing_flags(wiphy, reg, initiator);
471 struct ath_regulatory *reg,
477 !ath_is_world_regd(reg))
484 reg->current_rd = COUNTRY_ERD_FLAG;
485 reg->current_rd |= country_code;
487 __ath_regd_init(reg);
489 ath_reg_apply_world_flags(wiphy, request->initiator, reg);
495 struct ath_regulatory *reg,
498 if (__ath_reg_dyn_country(wiphy, reg, request))
503 reg->current_rd,
509 struct ath_regulatory *reg)
511 struct ath_common *common = container_of(reg, struct ath_common,
514 ath_reg_apply_radar_flags(wiphy, reg);
524 reg->region = request->dfs_region;
534 memcpy(reg, &common->reg_world_copy,
540 if (ath_reg_dyn_country_user_allow(reg))
541 ath_reg_dyn_country(wiphy, reg, request);
544 ath_reg_dyn_country(wiphy, reg, request);
550 static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
552 u16 rd = ath_regd_get_eepromRD(reg);
634 ath_regd_init_wiphy(struct ath_regulatory *reg,
645 if (ath_is_world_regd(reg)) {
650 regd = ath_world_regdomain(reg);
662 ath_reg_apply_radar_flags(wiphy, reg);
663 ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
674 static void ath_regd_sanitize(struct ath_regulatory *reg)
676 if (reg->current_rd != COUNTRY_ERD_FLAG)
679 reg->current_rd = 0x64;
682 static int __ath_regd_init(struct ath_regulatory *reg)
687 if (!reg)
690 ath_regd_sanitize(reg);
692 printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd);
694 if (!ath_regd_is_eeprom_valid(reg)) {
699 regdmn = ath_regd_get_eepromRD(reg);
700 reg->country_code = ath_regd_get_default_country(regdmn);
702 if (reg->country_code == CTRY_DEFAULT &&
706 reg->country_code = CTRY_UNITED_STATES;
709 if (reg->country_code == CTRY_DEFAULT) {
714 country = ath_regd_find_country(reg->country_code);
719 reg->country_code);
729 reg->regpair = ath_get_regpair(regdmn);
731 if (!reg->regpair) {
741 reg->alpha2[0] = country->isoName[0];
742 reg->alpha2[1] = country->isoName[1];
744 reg->alpha2[0] = '0';
745 reg->alpha2[1] = '0';
749 reg->alpha2[0], reg->alpha2[1]);
751 reg->regpair->reg_domain);
757 ath_regd_init(struct ath_regulatory *reg,
762 struct ath_common *common = container_of(reg, struct ath_common,
766 r = __ath_regd_init(reg);
770 if (ath_is_world_regd(reg))
771 memcpy(&common->reg_world_copy, reg,
774 ath_regd_init_wiphy(reg, wiphy, reg_notifier);
780 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
783 if (!reg->regpair ||
784 (reg->country_code == CTRY_DEFAULT &&
785 is_wwr_sku(ath_regd_get_eepromRD(reg)))) {
789 if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) {
790 switch (reg->region) {
804 return reg->regpair->reg_2ghz_ctl;
806 return reg->regpair->reg_5ghz_ctl;