diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-01-22 18:16:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:20 -0500 |
commit | 5f8e077c0adc0dc7cfad64cdc05276e1961a1394 (patch) | |
tree | dc918d9eacab12998d8e67f259de32dbbb409e81 /drivers/net/wireless/ath9k/ath9k.h | |
parent | 24ed1da1337b92e3b0a89f2c2b7cd33b9a8fcb62 (diff) |
ath9k: simplify regulatory code
Now that cfg80211 has its own regulatory infrastructure we can
condense ath9k's regulatory code considerably. We only keep data
we need to provide our own regulatory_hint(), reg_notifier() and
information necessary for calibration.
Atheros hardware supports 12 world regulatory domains, since these
are custom we apply them through the the new wiphy_apply_custom_regulatory().
Although we have 12 we can consolidate these into 5 structures based on
frequency and apply a different set of flags that differentiate them on
a case by case basis through the reg_notifier().
If CRDA is not found our own custom world regulatory domain is applied,
this is identical to cfg80211's except we enable passive scan on most
frequencies.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/ath9k.h')
-rw-r--r-- | drivers/net/wireless/ath9k/ath9k.h | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index 0b305b832a8c..f158cba01407 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h | |||
@@ -457,22 +457,12 @@ struct ath9k_channel { | |||
457 | struct ieee80211_channel *chan; | 457 | struct ieee80211_channel *chan; |
458 | u16 channel; | 458 | u16 channel; |
459 | u32 channelFlags; | 459 | u32 channelFlags; |
460 | u8 privFlags; | ||
461 | int8_t maxRegTxPower; | ||
462 | int8_t maxTxPower; | ||
463 | int8_t minTxPower; | ||
464 | u32 chanmode; | 460 | u32 chanmode; |
465 | int32_t CalValid; | 461 | int32_t CalValid; |
466 | bool oneTimeCalsDone; | 462 | bool oneTimeCalsDone; |
467 | int8_t iCoff; | 463 | int8_t iCoff; |
468 | int8_t qCoff; | 464 | int8_t qCoff; |
469 | int16_t rawNoiseFloor; | 465 | int16_t rawNoiseFloor; |
470 | int8_t antennaMax; | ||
471 | u32 regDmnFlags; | ||
472 | u32 conformanceTestLimit[3]; /* 0:11a, 1: 11b, 2:11g */ | ||
473 | #ifdef ATH_NF_PER_CHAN | ||
474 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; | ||
475 | #endif | ||
476 | }; | 466 | }; |
477 | 467 | ||
478 | #define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \ | 468 | #define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \ |
@@ -500,7 +490,6 @@ struct ath9k_channel { | |||
500 | ((_c)->chanmode == CHANNEL_G_HT40MINUS)) | 490 | ((_c)->chanmode == CHANNEL_G_HT40MINUS)) |
501 | #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c))) | 491 | #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c))) |
502 | 492 | ||
503 | #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990) | ||
504 | #define IS_CHAN_A_5MHZ_SPACED(_c) \ | 493 | #define IS_CHAN_A_5MHZ_SPACED(_c) \ |
505 | ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ | 494 | ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ |
506 | (((_c)->channel % 20) != 0) && \ | 495 | (((_c)->channel % 20) != 0) && \ |
@@ -790,15 +779,13 @@ struct ath_hal { | |||
790 | u16 ah_currentRD; | 779 | u16 ah_currentRD; |
791 | u16 ah_currentRDExt; | 780 | u16 ah_currentRDExt; |
792 | u16 ah_currentRDInUse; | 781 | u16 ah_currentRDInUse; |
793 | u16 ah_currentRD5G; | 782 | char alpha2[2]; |
794 | u16 ah_currentRD2G; | 783 | struct reg_dmn_pair_mapping *regpair; |
795 | char ah_iso[4]; | ||
796 | enum ath9k_power_mode ah_power_mode; | 784 | enum ath9k_power_mode ah_power_mode; |
797 | enum ath9k_power_mode ah_restore_mode; | 785 | enum ath9k_power_mode ah_restore_mode; |
798 | 786 | ||
799 | struct ath9k_channel ah_channels[150]; | 787 | struct ath9k_channel ah_channels[38]; |
800 | struct ath9k_channel *ah_curchan; | 788 | struct ath9k_channel *ah_curchan; |
801 | u32 ah_nchan; | ||
802 | 789 | ||
803 | bool ah_isPciExpress; | 790 | bool ah_isPciExpress; |
804 | u16 ah_txTrigLevel; | 791 | u16 ah_txTrigLevel; |
@@ -807,10 +794,7 @@ struct ath_hal { | |||
807 | u32 ah_rfkill_polarity; | 794 | u32 ah_rfkill_polarity; |
808 | u32 ah_btactive_gpio; | 795 | u32 ah_btactive_gpio; |
809 | u32 ah_wlanactive_gpio; | 796 | u32 ah_wlanactive_gpio; |
810 | |||
811 | #ifndef ATH_NF_PER_CHAN | ||
812 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; | 797 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
813 | #endif | ||
814 | 798 | ||
815 | bool sw_mgmt_crypto; | 799 | bool sw_mgmt_crypto; |
816 | }; | 800 | }; |
@@ -825,8 +809,6 @@ struct ath_rate_table; | |||
825 | 809 | ||
826 | /* Helpers */ | 810 | /* Helpers */ |
827 | 811 | ||
828 | enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah, | ||
829 | const struct ath9k_channel *chan); | ||
830 | bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val); | 812 | bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val); |
831 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); | 813 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); |
832 | bool ath9k_get_channel_edges(struct ath_hal *ah, | 814 | bool ath9k_get_channel_edges(struct ath_hal *ah, |
@@ -836,7 +818,6 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah, | |||
836 | struct ath_rate_table *rates, | 818 | struct ath_rate_table *rates, |
837 | u32 frameLen, u16 rateix, | 819 | u32 frameLen, u16 rateix, |
838 | bool shortPreamble); | 820 | bool shortPreamble); |
839 | u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags); | ||
840 | void ath9k_hw_get_channel_centers(struct ath_hal *ah, | 821 | void ath9k_hw_get_channel_centers(struct ath_hal *ah, |
841 | struct ath9k_channel *chan, | 822 | struct ath9k_channel *chan, |
842 | struct chan_centers *centers); | 823 | struct chan_centers *centers); |
@@ -924,17 +905,18 @@ bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us); | |||
924 | void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode); | 905 | void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode); |
925 | 906 | ||
926 | /* Regulatory */ | 907 | /* Regulatory */ |
908 | u16 ath9k_regd_get_rd(struct ath_hal *ah); | ||
909 | bool ath9k_is_world_regd(struct ath_hal *ah); | ||
910 | const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hal *ah); | ||
911 | const struct ieee80211_regdomain *ath9k_default_world_regdomain(void); | ||
912 | |||
913 | void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby); | ||
914 | void ath9k_reg_apply_radar_flags(struct wiphy *wiphy); | ||
927 | 915 | ||
928 | bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah); | 916 | int ath9k_regd_init(struct ath_hal *ah); |
929 | struct ath9k_channel* ath9k_regd_check_channel(struct ath_hal *ah, | 917 | bool ath9k_regd_is_eeprom_valid(struct ath_hal *ah); |
930 | const struct ath9k_channel *c); | ||
931 | u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan); | 918 | u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan); |
932 | u32 ath9k_regd_get_antenna_allowed(struct ath_hal *ah, | 919 | int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); |
933 | struct ath9k_channel *chan); | ||
934 | bool ath9k_regd_init_channels(struct ath_hal *ah, | ||
935 | u32 maxchans, u32 *nchans, u8 *regclassids, | ||
936 | u32 maxregids, u32 *nregids, u16 cc, | ||
937 | bool enableOutdoor, bool enableExtendedChannels); | ||
938 | 920 | ||
939 | /* ANI */ | 921 | /* ANI */ |
940 | 922 | ||