From 3631d956e44fb78c5a6516180ce76a5a49904851 Mon Sep 17 00:00:00 2001 From: Paul Stewart Date: Thu, 25 Apr 2013 07:39:54 -0700 Subject: [PATCH] CHROMIUM: ath: Add ATH_DEFER_EEPROM_REGULATORY option Add option to disable the internal regulatory mask sourced from EEPROM data. This does not affect CRDA regulatory operation, but nevertheless this option should not be used by default. Signed-off-by: Paul Stewart BUG=chromium:218911 TEST=Recompile with and without flag, ensure EEPROM regulatory still works with this change disabled using world regulatory EEPROM card an "iw reg set" command. Change-Id: I20de00c7c6ea57124df1da8b052e573920579614 Reviewed-on: https://gerrit.chromium.org/gerrit/49176 Reviewed-by: Christopher Wiley Reviewed-by: mukesh agrawal Commit-Queue: Paul Stewart Tested-by: Paul Stewart --- drivers/net/wireless/ath/Kconfig | 6 ++++++ drivers/net/wireless/ath/regd.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index 0b9a868ee99a..925cc8051c19 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig @@ -22,6 +22,12 @@ config ATH_DEBUG Say Y, if you want to debug atheros wireless drivers. Right now only ath9k makes use of this. +config ATH_DEFER_EEPROM_REGULATORY + bool "Atheros defer EEPROM regulatory" + ---help--- + Say Y, if you want to disable the internal regulatory mask + sourced from EEPROM data. + source "drivers/net/wireless/ath/ath5k/Kconfig" source "drivers/net/wireless/ath/ath9k/Kconfig" source "drivers/net/wireless/ath/ath9k_btcoex/Kconfig" diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 10dea37431b3..575b80ec878d 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c @@ -129,6 +129,7 @@ bool ath_is_world_regd(struct ath_regulatory *reg) } EXPORT_SYMBOL(ath_is_world_regd); +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY static const struct ieee80211_regdomain *ath_default_world_regdomain(void) { /* this is the most restrictive */ @@ -161,6 +162,7 @@ ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg) return ath_default_world_regdomain(); } } +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ bool ath_is_49ghz_allowed(u16 regdomain) { @@ -169,11 +171,13 @@ bool ath_is_49ghz_allowed(u16 regdomain) } EXPORT_SYMBOL(ath_is_49ghz_allowed); +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY /* Frequency is one where radar detection is required */ static bool ath_is_radar_freq(u16 center_freq) { return (center_freq >= 5260 && center_freq <= 5700); } +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ /* * N.B: These exception rules do not apply radar freqs. @@ -188,6 +192,7 @@ static void ath_reg_apply_beaconing_flags(struct wiphy *wiphy, enum nl80211_reg_initiator initiator) { +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY enum ieee80211_band band; struct ieee80211_supported_band *sband; const struct ieee80211_reg_rule *reg_rule; @@ -241,6 +246,7 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy, } } } +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ } @@ -249,6 +255,7 @@ static void ath_reg_apply_active_scan_flags(struct wiphy *wiphy, enum nl80211_reg_initiator initiator) { +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; const struct ieee80211_reg_rule *reg_rule; @@ -295,11 +302,13 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy, if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; } +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ } /* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ static void ath_reg_apply_radar_flags(struct wiphy *wiphy) { +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; unsigned int i; @@ -328,6 +337,7 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy) IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN; } +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ } static void ath_reg_apply_world_flags(struct wiphy *wiphy, @@ -508,6 +518,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, int (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request)) { +#ifndef CONFIG_ATH_DEFER_EEPROM_REGULATORY const struct ieee80211_regdomain *regd; wiphy->reg_notifier = reg_notifier; @@ -531,6 +542,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, wiphy_apply_custom_regulatory(wiphy, regd); ath_reg_apply_radar_flags(wiphy); ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); +#endif /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */ return 0; } -- 2.20.1