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()
376 struct ath_regulatory *reg, in ath_reg_apply_ir_flags() argument
391 if (!ath_reg_dyn_country_user_allow(reg)) in ath_reg_apply_ir_flags()
404 struct ath_regulatory *reg) in ath_reg_apply_radar_flags() argument
417 if (!ath_is_radar_freq(ch->center_freq, reg)) in ath_reg_apply_radar_flags()
437 struct ath_regulatory *reg) in ath_reg_apply_world_flags() argument
439 switch (reg->regpair->reg_domain) { in ath_reg_apply_world_flags()
445 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
448 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
449 ath_reg_apply_ir_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
452 if (ath_reg_dyn_country_user_allow(reg)) in ath_reg_apply_world_flags()
453 ath_reg_apply_beaconing_flags(wiphy, reg, initiator); in ath_reg_apply_world_flags()
470 struct ath_regulatory *reg, in __ath_reg_dyn_country() argument
476 !ath_is_world_regd(reg)) in __ath_reg_dyn_country()
483 reg->current_rd = COUNTRY_ERD_FLAG; in __ath_reg_dyn_country()
484 reg->current_rd |= country_code; in __ath_reg_dyn_country()
486 __ath_regd_init(reg); in __ath_reg_dyn_country()
488 ath_reg_apply_world_flags(wiphy, request->initiator, reg); in __ath_reg_dyn_country()
494 struct ath_regulatory *reg, in ath_reg_dyn_country() argument
497 if (__ath_reg_dyn_country(wiphy, reg, request)) in ath_reg_dyn_country()
502 reg->current_rd, in ath_reg_dyn_country()
508 struct ath_regulatory *reg) in ath_reg_notifier_apply() argument
510 struct ath_common *common = container_of(reg, struct ath_common, in ath_reg_notifier_apply()
513 ath_reg_apply_radar_flags(wiphy, reg); in ath_reg_notifier_apply()
523 reg->region = request->dfs_region; in ath_reg_notifier_apply()
533 memcpy(reg, &common->reg_world_copy, in ath_reg_notifier_apply()
539 if (ath_reg_dyn_country_user_allow(reg)) in ath_reg_notifier_apply()
540 ath_reg_dyn_country(wiphy, reg, request); in ath_reg_notifier_apply()
543 ath_reg_dyn_country(wiphy, reg, request); in ath_reg_notifier_apply()
549 static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg) in ath_regd_is_eeprom_valid() argument
551 u16 rd = ath_regd_get_eepromRD(reg); in ath_regd_is_eeprom_valid()
633 ath_regd_init_wiphy(struct ath_regulatory *reg, in ath_regd_init_wiphy() argument
644 if (ath_is_world_regd(reg)) { in ath_regd_init_wiphy()
649 regd = ath_world_regdomain(reg); in ath_regd_init_wiphy()
661 ath_reg_apply_radar_flags(wiphy, reg); in ath_regd_init_wiphy()
662 ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); in ath_regd_init_wiphy()
673 static void ath_regd_sanitize(struct ath_regulatory *reg) in ath_regd_sanitize() argument
675 if (reg->current_rd != COUNTRY_ERD_FLAG) in ath_regd_sanitize()
678 reg->current_rd = 0x64; in ath_regd_sanitize()
681 static int __ath_regd_init(struct ath_regulatory *reg) in __ath_regd_init() argument
686 if (!reg) in __ath_regd_init()
689 ath_regd_sanitize(reg); in __ath_regd_init()
691 printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd); in __ath_regd_init()
693 if (!ath_regd_is_eeprom_valid(reg)) { in __ath_regd_init()
698 regdmn = ath_regd_get_eepromRD(reg); in __ath_regd_init()
699 reg->country_code = ath_regd_get_default_country(regdmn); in __ath_regd_init()
701 if (reg->country_code == CTRY_DEFAULT && in __ath_regd_init()
705 reg->country_code = CTRY_UNITED_STATES; in __ath_regd_init()
708 if (reg->country_code == CTRY_DEFAULT) { in __ath_regd_init()
713 country = ath_regd_find_country(reg->country_code); in __ath_regd_init()
718 reg->country_code); in __ath_regd_init()
728 reg->regpair = ath_get_regpair(regdmn); in __ath_regd_init()
730 if (!reg->regpair) { in __ath_regd_init()
740 reg->alpha2[0] = country->isoName[0]; in __ath_regd_init()
741 reg->alpha2[1] = country->isoName[1]; in __ath_regd_init()
743 reg->alpha2[0] = '0'; in __ath_regd_init()
744 reg->alpha2[1] = '0'; in __ath_regd_init()
748 reg->alpha2[0], reg->alpha2[1]); in __ath_regd_init()
750 reg->regpair->reg_domain); in __ath_regd_init()
756 ath_regd_init(struct ath_regulatory *reg, in ath_regd_init() argument
761 struct ath_common *common = container_of(reg, struct ath_common, in ath_regd_init()
765 r = __ath_regd_init(reg); in ath_regd_init()
769 if (ath_is_world_regd(reg)) in ath_regd_init()
770 memcpy(&common->reg_world_copy, reg, in ath_regd_init()
773 ath_regd_init_wiphy(reg, wiphy, reg_notifier); in ath_regd_init()
779 u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, in ath_regd_get_band_ctl() argument
782 if (!reg->regpair || in ath_regd_get_band_ctl()
783 (reg->country_code == CTRY_DEFAULT && in ath_regd_get_band_ctl()
784 is_wwr_sku(ath_regd_get_eepromRD(reg)))) { in ath_regd_get_band_ctl()
788 if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) { in ath_regd_get_band_ctl()
789 switch (reg->region) { in ath_regd_get_band_ctl()
803 return reg->regpair->reg_2ghz_ctl; in ath_regd_get_band_ctl()
805 return reg->regpair->reg_5ghz_ctl; in ath_regd_get_band_ctl()