CHROMIUM: ath: Add ATH_DEFER_EEPROM_REGULATORY option
authorPaul Stewart <pstew@chromium.org>
Thu, 25 Apr 2013 14:39:54 +0000 (07:39 -0700)
committerChromeBot <chrome-bot@google.com>
Fri, 26 Apr 2013 00:03:15 +0000 (17:03 -0700)
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 <pstew@chromium.org>
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 <wiley@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
drivers/net/wireless/ath/Kconfig
drivers/net/wireless/ath/regd.c

index 0b9a868..925cc80 100644 (file)
@@ -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.
 
          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"
 source "drivers/net/wireless/ath/ath5k/Kconfig"
 source "drivers/net/wireless/ath/ath9k/Kconfig"
 source "drivers/net/wireless/ath/ath9k_btcoex/Kconfig"
index 10dea37..575b80e 100644 (file)
@@ -129,6 +129,7 @@ bool ath_is_world_regd(struct ath_regulatory *reg)
 }
 EXPORT_SYMBOL(ath_is_world_regd);
 
 }
 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 */
 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();
        }
 }
                return ath_default_world_regdomain();
        }
 }
+#endif  /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */
 
 bool ath_is_49ghz_allowed(u16 regdomain)
 {
 
 bool ath_is_49ghz_allowed(u16 regdomain)
 {
@@ -169,11 +171,13 @@ bool ath_is_49ghz_allowed(u16 regdomain)
 }
 EXPORT_SYMBOL(ath_is_49ghz_allowed);
 
 }
 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);
 }
 /* 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.
 
 /*
  * 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)
 {
 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;
        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)
 {
 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;
        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;
        }
                        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)
 {
 }
 
 /* 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;
        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;
        }
                                     IEEE80211_CHAN_NO_IBSS |
                                     IEEE80211_CHAN_PASSIVE_SCAN;
        }
+#endif  /* CONFIG_ATH_DEFER_EEPROM_REGULATORY */
 }
 
 static void ath_reg_apply_world_flags(struct wiphy *wiphy,
 }
 
 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))
 {
                    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;
        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);
        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;
 }
 
        return 0;
 }