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) in dynamic_country_user_possible() argument
122 switch (reg->country_code) { in dynamic_country_user_possible()
189 static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg) in ath_reg_dyn_country_user_allow() argument
193 if (!dynamic_country_user_possible(reg)) in ath_reg_dyn_country_user_allow()
205 static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) in ath_regd_get_eepromRD() argument
207 return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; in ath_regd_get_eepromRD()
210 bool ath_is_world_regd(struct ath_regulatory *reg) in ath_is_world_regd() argument
212 return is_wwr_sku(ath_regd_get_eepromRD(reg)); in ath_is_world_regd()
223 ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg) in ath_world_regdomain() argument
225 switch (reg->regpair->reg_domain) { in ath_world_regdomain()
258 struct ath_regulatory *reg) in ath_is_radar_freq() argument
261 if (reg->country_code == CTRY_INDIA) in ath_is_radar_freq()
309 struct ath_regulatory *reg, in __ath_reg_apply_beaconing_flags() argument
313 if (ath_is_radar_freq(ch->center_freq, reg) || in __ath_reg_apply_beaconing_flags()
322 if (ath_reg_dyn_country_user_allow(reg)) in __ath_reg_apply_beaconing_flags()
340 struct ath_regulatory *reg, in ath_reg_apply_beaconing_flags() argument
354 __ath_reg_apply_beaconing_flags(wiphy, reg, in ath_reg_apply_beaconing_flags()
377 struct ath_regulatory *reg, in ath_reg_apply_ir_flags() argument
392 if (!ath_reg_dyn_country_user_allow(reg)) in ath_reg_apply_ir_flags()
405 struct ath_regulatory *reg) in ath_reg_apply_radar_flags() argument
418 if (!ath_is_radar_freq(ch->center_freq, reg)) in ath_reg_apply_radar_flags()
438 struct ath_regulatory *reg) in ath_reg_apply_world_flags() argument
440 switch (reg->regpair->reg_domain) { in ath_reg_apply_world_flags()
446 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
449 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
450 ath_reg_apply_ir_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
453 if (ath_reg_dyn_country_user_allow(reg)) in ath_reg_apply_world_flags()
454 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
472 struct ath_regulatory *reg, in __ath_reg_dyn_country() argument
478 !ath_is_world_regd(reg)) in __ath_reg_dyn_country()
485 reg->current_rd = COUNTRY_ERD_FLAG; in __ath_reg_dyn_country()
486 reg->current_rd |= country_code; in __ath_reg_dyn_country()
488 __ath_regd_init(reg); in __ath_reg_dyn_country()
490 ath_reg_apply_world_flags(wiphy, request->initiator, reg); in __ath_reg_dyn_country()
496 struct ath_regulatory *reg, in ath_reg_dyn_country() argument
499 if (__ath_reg_dyn_country(wiphy, reg, request)) in ath_reg_dyn_country()
504 reg->current_rd, in ath_reg_dyn_country()
510 struct ath_regulatory *reg) in ath_reg_notifier_apply() argument
512 struct ath_common *common = container_of(reg, struct ath_common, in ath_reg_notifier_apply()
515 ath_reg_apply_radar_flags(wiphy, reg); in ath_reg_notifier_apply()
525 reg->region = request->dfs_region; in ath_reg_notifier_apply()
535 memcpy(reg, &common->reg_world_copy, in ath_reg_notifier_apply()
541 if (ath_reg_dyn_country_user_allow(reg)) in ath_reg_notifier_apply()
542 ath_reg_dyn_country(wiphy, reg, request); in ath_reg_notifier_apply()
545 ath_reg_dyn_country(wiphy, reg, request); in ath_reg_notifier_apply()
551 static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg) in ath_regd_is_eeprom_valid() argument
553 u16 rd = ath_regd_get_eepromRD(reg); in ath_regd_is_eeprom_valid()
635 ath_regd_init_wiphy(struct ath_regulatory *reg, in ath_regd_init_wiphy() argument
646 if (ath_is_world_regd(reg)) { in ath_regd_init_wiphy()
651 regd = ath_world_regdomain(reg); in ath_regd_init_wiphy()
663 ath_reg_apply_radar_flags(wiphy, reg); in ath_regd_init_wiphy()
664 ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); in ath_regd_init_wiphy()
675 static void ath_regd_sanitize(struct ath_regulatory *reg) in ath_regd_sanitize() argument
677 if (reg->current_rd != COUNTRY_ERD_FLAG) in ath_regd_sanitize()
680 reg->current_rd = 0x64; in ath_regd_sanitize()
683 static int __ath_regd_init(struct ath_regulatory *reg) in __ath_regd_init() argument
688 if (!reg) in __ath_regd_init()
691 ath_regd_sanitize(reg); in __ath_regd_init()
693 printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd); in __ath_regd_init()
695 if (!ath_regd_is_eeprom_valid(reg)) { in __ath_regd_init()
700 regdmn = ath_regd_get_eepromRD(reg); in __ath_regd_init()
701 reg->country_code = ath_regd_get_default_country(regdmn); in __ath_regd_init()
703 if (reg->country_code == CTRY_DEFAULT && in __ath_regd_init()
707 reg->country_code = CTRY_UNITED_STATES; in __ath_regd_init()
710 if (reg->country_code == CTRY_DEFAULT) { in __ath_regd_init()
715 country = ath_regd_find_country(reg->country_code); in __ath_regd_init()
720 reg->country_code); in __ath_regd_init()
730 reg->regpair = ath_get_regpair(regdmn); in __ath_regd_init()
732 if (!reg->regpair) { in __ath_regd_init()
742 reg->alpha2[0] = country->isoName[0]; in __ath_regd_init()
743 reg->alpha2[1] = country->isoName[1]; in __ath_regd_init()
745 reg->alpha2[0] = '0'; in __ath_regd_init()
746 reg->alpha2[1] = '0'; in __ath_regd_init()
750 reg->alpha2[0], reg->alpha2[1]); in __ath_regd_init()
752 reg->regpair->reg_domain); in __ath_regd_init()
758 ath_regd_init(struct ath_regulatory *reg, in ath_regd_init() argument
763 struct ath_common *common = container_of(reg, struct ath_common, in ath_regd_init()
767 r = __ath_regd_init(reg); in ath_regd_init()
771 if (ath_is_world_regd(reg)) in ath_regd_init()
772 memcpy(&common->reg_world_copy, reg, in ath_regd_init()
775 ath_regd_init_wiphy(reg, wiphy, reg_notifier); in ath_regd_init()
781 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, in ath_regd_get_band_ctl() argument
784 if (!reg->regpair || in ath_regd_get_band_ctl()
785 (reg->country_code == CTRY_DEFAULT && in ath_regd_get_band_ctl()
786 is_wwr_sku(ath_regd_get_eepromRD(reg)))) { in ath_regd_get_band_ctl()
790 if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) { in ath_regd_get_band_ctl()
791 switch (reg->region) { in ath_regd_get_band_ctl()
805 return reg->regpair->reg_2ghz_ctl; in ath_regd_get_band_ctl()
807 return reg->regpair->reg_5ghz_ctl; in ath_regd_get_band_ctl()