diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-02-09 02:57:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:01 -0500 |
commit | d6bad496c6fbe3adb3323915a8b0430fa2955199 (patch) | |
tree | 02078701fd5cdf419684eb57e2ffb497b084c916 /drivers/net/wireless/ath9k | |
parent | d535a42a21eb62bb0e7f35b8ae39da07b679dda4 (diff) |
ath9k: Move regulatory information to a separate structure
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k')
-rw-r--r-- | drivers/net/wireless/ath9k/eeprom.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/hw.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/regd.c | 48 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/regd.h | 12 |
6 files changed, 66 insertions, 61 deletions
diff --git a/drivers/net/wireless/ath9k/eeprom.c b/drivers/net/wireless/ath9k/eeprom.c index 420a060e32ae..d58d8a330b64 100644 --- a/drivers/net/wireless/ath9k/eeprom.c +++ b/drivers/net/wireless/ath9k/eeprom.c | |||
@@ -1232,9 +1232,9 @@ static bool ath9k_hw_set_def_power_per_rate_table(struct ath_hal *ah, | |||
1232 | 1232 | ||
1233 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; | 1233 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; |
1234 | 1234 | ||
1235 | if (ah->ah_tpScale != ATH9K_TP_SCALE_MAX) { | 1235 | if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) { |
1236 | maxRegAllowedPower -= | 1236 | maxRegAllowedPower -= |
1237 | (tpScaleReductionTable[(ah->ah_tpScale)] * 2); | 1237 | (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2); |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | scaledPower = min(powerLimit, maxRegAllowedPower); | 1240 | scaledPower = min(powerLimit, maxRegAllowedPower); |
@@ -1510,9 +1510,9 @@ static bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hal *ah, | |||
1510 | 1510 | ||
1511 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; | 1511 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; |
1512 | 1512 | ||
1513 | if (ah->ah_tpScale != ATH9K_TP_SCALE_MAX) { | 1513 | if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) { |
1514 | maxRegAllowedPower -= | 1514 | maxRegAllowedPower -= |
1515 | (tpScaleReductionTable[(ah->ah_tpScale)] * 2); | 1515 | (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | scaledPower = min(powerLimit, maxRegAllowedPower); | 1518 | scaledPower = min(powerLimit, maxRegAllowedPower); |
@@ -1823,10 +1823,10 @@ static int ath9k_hw_def_set_txpower(struct ath_hal *ah, | |||
1823 | i = rateHt20_0; | 1823 | i = rateHt20_0; |
1824 | 1824 | ||
1825 | if (AR_SREV_9280_10_OR_LATER(ah)) | 1825 | if (AR_SREV_9280_10_OR_LATER(ah)) |
1826 | ah->ah_maxPowerLevel = | 1826 | ah->regulatory.max_power_level = |
1827 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; | 1827 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; |
1828 | else | 1828 | else |
1829 | ah->ah_maxPowerLevel = ratesArray[i]; | 1829 | ah->regulatory.max_power_level = ratesArray[i]; |
1830 | 1830 | ||
1831 | return 0; | 1831 | return 0; |
1832 | } | 1832 | } |
@@ -1951,10 +1951,10 @@ static int ath9k_hw_4k_set_txpower(struct ath_hal *ah, | |||
1951 | i = rateHt20_0; | 1951 | i = rateHt20_0; |
1952 | 1952 | ||
1953 | if (AR_SREV_9280_10_OR_LATER(ah)) | 1953 | if (AR_SREV_9280_10_OR_LATER(ah)) |
1954 | ah->ah_maxPowerLevel = | 1954 | ah->regulatory.max_power_level = |
1955 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; | 1955 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; |
1956 | else | 1956 | else |
1957 | ah->ah_maxPowerLevel = ratesArray[i]; | 1957 | ah->regulatory.max_power_level = ratesArray[i]; |
1958 | 1958 | ||
1959 | return 0; | 1959 | return 0; |
1960 | } | 1960 | } |
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 164a543248d3..9eafada743d4 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -409,7 +409,7 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid, | |||
409 | ah->ah_sc = sc; | 409 | ah->ah_sc = sc; |
410 | ah->ah_sh = mem; | 410 | ah->ah_sh = mem; |
411 | ah->hw_version.magic = AR5416_MAGIC; | 411 | ah->hw_version.magic = AR5416_MAGIC; |
412 | ah->ah_countryCode = CTRY_DEFAULT; | 412 | ah->regulatory.country_code = CTRY_DEFAULT; |
413 | ah->hw_version.devid = devid; | 413 | ah->hw_version.devid = devid; |
414 | ah->hw_version.subvendorid = 0; | 414 | ah->hw_version.subvendorid = 0; |
415 | 415 | ||
@@ -419,8 +419,8 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid, | |||
419 | if (!AR_SREV_9100(ah)) | 419 | if (!AR_SREV_9100(ah)) |
420 | ah->ah_flags = AH_USE_EEPROM; | 420 | ah->ah_flags = AH_USE_EEPROM; |
421 | 421 | ||
422 | ah->ah_powerLimit = MAX_RATE_POWER; | 422 | ah->regulatory.power_limit = MAX_RATE_POWER; |
423 | ah->ah_tpScale = ATH9K_TP_SCALE_MAX; | 423 | ah->regulatory.tp_scale = ATH9K_TP_SCALE_MAX; |
424 | ahp->ah_atimWindow = 0; | 424 | ahp->ah_atimWindow = 0; |
425 | ahp->ah_diversityControl = ah->ah_config.diversity_control; | 425 | ahp->ah_diversityControl = ah->ah_config.diversity_control; |
426 | ahp->ah_antennaSwitchSwap = | 426 | ahp->ah_antennaSwitchSwap = |
@@ -1337,7 +1337,7 @@ static int ath9k_hw_process_ini(struct ath_hal *ah, | |||
1337 | channel->max_antenna_gain * 2, | 1337 | channel->max_antenna_gain * 2, |
1338 | channel->max_power * 2, | 1338 | channel->max_power * 2, |
1339 | min((u32) MAX_RATE_POWER, | 1339 | min((u32) MAX_RATE_POWER, |
1340 | (u32) ah->ah_powerLimit)); | 1340 | (u32) ah->regulatory.power_limit)); |
1341 | if (status != 0) { | 1341 | if (status != 0) { |
1342 | DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT, | 1342 | DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT, |
1343 | "error init'ing transmit power\n"); | 1343 | "error init'ing transmit power\n"); |
@@ -1668,7 +1668,7 @@ static bool ath9k_hw_channel_change(struct ath_hal *ah, | |||
1668 | channel->max_antenna_gain * 2, | 1668 | channel->max_antenna_gain * 2, |
1669 | channel->max_power * 2, | 1669 | channel->max_power * 2, |
1670 | min((u32) MAX_RATE_POWER, | 1670 | min((u32) MAX_RATE_POWER, |
1671 | (u32) ah->ah_powerLimit)) != 0) { | 1671 | (u32) ah->regulatory.power_limit)) != 0) { |
1672 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, | 1672 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, |
1673 | "error init'ing transmit power\n"); | 1673 | "error init'ing transmit power\n"); |
1674 | return false; | 1674 | return false; |
@@ -3136,21 +3136,22 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah) | |||
3136 | 3136 | ||
3137 | eeval = ath9k_hw_get_eeprom(ah, EEP_REG_0); | 3137 | eeval = ath9k_hw_get_eeprom(ah, EEP_REG_0); |
3138 | 3138 | ||
3139 | ah->ah_currentRD = eeval; | 3139 | ah->regulatory.current_rd = eeval; |
3140 | 3140 | ||
3141 | eeval = ath9k_hw_get_eeprom(ah, EEP_REG_1); | 3141 | eeval = ath9k_hw_get_eeprom(ah, EEP_REG_1); |
3142 | ah->ah_currentRDExt = eeval; | 3142 | ah->regulatory.current_rd_ext = eeval; |
3143 | 3143 | ||
3144 | capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP); | 3144 | capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP); |
3145 | 3145 | ||
3146 | if (ah->ah_opmode != NL80211_IFTYPE_AP && | 3146 | if (ah->ah_opmode != NL80211_IFTYPE_AP && |
3147 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { | 3147 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { |
3148 | if (ah->ah_currentRD == 0x64 || ah->ah_currentRD == 0x65) | 3148 | if (ah->regulatory.current_rd == 0x64 || |
3149 | ah->ah_currentRD += 5; | 3149 | ah->regulatory.current_rd == 0x65) |
3150 | else if (ah->ah_currentRD == 0x41) | 3150 | ah->regulatory.current_rd += 5; |
3151 | ah->ah_currentRD = 0x43; | 3151 | else if (ah->regulatory.current_rd == 0x41) |
3152 | ah->regulatory.current_rd = 0x43; | ||
3152 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, | 3153 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, |
3153 | "regdomain mapped to 0x%x\n", ah->ah_currentRD); | 3154 | "regdomain mapped to 0x%x\n", ah->regulatory.current_rd); |
3154 | } | 3155 | } |
3155 | 3156 | ||
3156 | eeval = ath9k_hw_get_eeprom(ah, EEP_OP_MODE); | 3157 | eeval = ath9k_hw_get_eeprom(ah, EEP_OP_MODE); |
@@ -3292,7 +3293,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah) | |||
3292 | else | 3293 | else |
3293 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; | 3294 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; |
3294 | 3295 | ||
3295 | if (ah->ah_currentRDExt & (1 << REG_EXT_JAPAN_MIDBAND)) { | 3296 | if (ah->regulatory.current_rd_ext & (1 << REG_EXT_JAPAN_MIDBAND)) { |
3296 | pCap->reg_cap = | 3297 | pCap->reg_cap = |
3297 | AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | | 3298 | AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | |
3298 | AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | | 3299 | AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | |
@@ -3392,13 +3393,13 @@ bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type, | |||
3392 | case 0: | 3393 | case 0: |
3393 | return 0; | 3394 | return 0; |
3394 | case 1: | 3395 | case 1: |
3395 | *result = ah->ah_powerLimit; | 3396 | *result = ah->regulatory.power_limit; |
3396 | return 0; | 3397 | return 0; |
3397 | case 2: | 3398 | case 2: |
3398 | *result = ah->ah_maxPowerLevel; | 3399 | *result = ah->regulatory.max_power_level; |
3399 | return 0; | 3400 | return 0; |
3400 | case 3: | 3401 | case 3: |
3401 | *result = ah->ah_tpScale; | 3402 | *result = ah->regulatory.tp_scale; |
3402 | return 0; | 3403 | return 0; |
3403 | } | 3404 | } |
3404 | return false; | 3405 | return false; |
@@ -3655,14 +3656,14 @@ bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit) | |||
3655 | struct ath9k_channel *chan = ah->ah_curchan; | 3656 | struct ath9k_channel *chan = ah->ah_curchan; |
3656 | struct ieee80211_channel *channel = chan->chan; | 3657 | struct ieee80211_channel *channel = chan->chan; |
3657 | 3658 | ||
3658 | ah->ah_powerLimit = min(limit, (u32) MAX_RATE_POWER); | 3659 | ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER); |
3659 | 3660 | ||
3660 | if (ath9k_hw_set_txpower(ah, chan, | 3661 | if (ath9k_hw_set_txpower(ah, chan, |
3661 | ath9k_regd_get_ctl(ah, chan), | 3662 | ath9k_regd_get_ctl(ah, chan), |
3662 | channel->max_antenna_gain * 2, | 3663 | channel->max_antenna_gain * 2, |
3663 | channel->max_power * 2, | 3664 | channel->max_power * 2, |
3664 | min((u32) MAX_RATE_POWER, | 3665 | min((u32) MAX_RATE_POWER, |
3665 | (u32) ah->ah_powerLimit)) != 0) | 3666 | (u32) ah->regulatory.power_limit)) != 0) |
3666 | return false; | 3667 | return false; |
3667 | 3668 | ||
3668 | return true; | 3669 | return true; |
diff --git a/drivers/net/wireless/ath9k/hw.h b/drivers/net/wireless/ath9k/hw.h index afa64bde301d..3fdf9626a766 100644 --- a/drivers/net/wireless/ath9k/hw.h +++ b/drivers/net/wireless/ath9k/hw.h | |||
@@ -425,17 +425,9 @@ struct ath_hal { | |||
425 | enum nl80211_iftype ah_opmode; | 425 | enum nl80211_iftype ah_opmode; |
426 | struct ath9k_ops_config ah_config; | 426 | struct ath9k_ops_config ah_config; |
427 | struct ath9k_hw_capabilities ah_caps; | 427 | struct ath9k_hw_capabilities ah_caps; |
428 | 428 | struct ath9k_regulatory regulatory; | |
429 | u16 ah_countryCode; | ||
430 | u32 ah_flags; | 429 | u32 ah_flags; |
431 | int16_t ah_powerLimit; | 430 | |
432 | u16 ah_maxPowerLevel; | ||
433 | u32 ah_tpScale; | ||
434 | u16 ah_currentRD; | ||
435 | u16 ah_currentRDExt; | ||
436 | u16 ah_currentRDInUse; | ||
437 | char alpha2[2]; | ||
438 | struct reg_dmn_pair_mapping *regpair; | ||
439 | enum ath9k_power_mode ah_power_mode; | 431 | enum ath9k_power_mode ah_power_mode; |
440 | enum ath9k_power_mode ah_restore_mode; | 432 | enum ath9k_power_mode ah_restore_mode; |
441 | 433 | ||
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index dacf97afe763..a1c76ec09b3a 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1659,7 +1659,7 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1659 | error = ieee80211_register_hw(hw); | 1659 | error = ieee80211_register_hw(hw); |
1660 | 1660 | ||
1661 | if (!ath9k_is_world_regd(sc->sc_ah)) | 1661 | if (!ath9k_is_world_regd(sc->sc_ah)) |
1662 | regulatory_hint(hw->wiphy, sc->sc_ah->alpha2); | 1662 | regulatory_hint(hw->wiphy, sc->sc_ah->regulatory.alpha2); |
1663 | 1663 | ||
1664 | /* Initialize LED control */ | 1664 | /* Initialize LED control */ |
1665 | ath_init_leds(sc); | 1665 | ath_init_leds(sc); |
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c index 819feb963821..32dd0cb34490 100644 --- a/drivers/net/wireless/ath9k/regd.c +++ b/drivers/net/wireless/ath9k/regd.c | |||
@@ -108,7 +108,7 @@ static const struct ieee80211_regdomain ath9k_world_regdom_67_68_6A = { | |||
108 | 108 | ||
109 | static u16 ath9k_regd_get_eepromRD(struct ath_hal *ah) | 109 | static u16 ath9k_regd_get_eepromRD(struct ath_hal *ah) |
110 | { | 110 | { |
111 | return ah->ah_currentRD & ~WORLDWIDE_ROAMING_FLAG; | 111 | return ah->regulatory.current_rd & ~WORLDWIDE_ROAMING_FLAG; |
112 | } | 112 | } |
113 | 113 | ||
114 | u16 ath9k_regd_get_rd(struct ath_hal *ah) | 114 | u16 ath9k_regd_get_rd(struct ath_hal *ah) |
@@ -129,7 +129,7 @@ const struct ieee80211_regdomain *ath9k_default_world_regdomain(void) | |||
129 | 129 | ||
130 | const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hal *ah) | 130 | const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hal *ah) |
131 | { | 131 | { |
132 | switch (ah->regpair->regDmnEnum) { | 132 | switch (ah->regulatory.regpair->regDmnEnum) { |
133 | case 0x60: | 133 | case 0x60: |
134 | case 0x61: | 134 | case 0x61: |
135 | case 0x62: | 135 | case 0x62: |
@@ -284,7 +284,7 @@ void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby) | |||
284 | struct ath_softc *sc = hw->priv; | 284 | struct ath_softc *sc = hw->priv; |
285 | struct ath_hal *ah = sc->sc_ah; | 285 | struct ath_hal *ah = sc->sc_ah; |
286 | 286 | ||
287 | switch (ah->regpair->regDmnEnum) { | 287 | switch (ah->regulatory.regpair->regDmnEnum) { |
288 | case 0x60: | 288 | case 0x60: |
289 | case 0x63: | 289 | case 0x63: |
290 | case 0x66: | 290 | case 0x66: |
@@ -413,30 +413,30 @@ int ath9k_regd_init(struct ath_hal *ah) | |||
413 | return -EINVAL; | 413 | return -EINVAL; |
414 | } | 414 | } |
415 | 415 | ||
416 | ah->ah_countryCode = ath9k_regd_get_default_country(ah); | 416 | ah->regulatory.country_code = ath9k_regd_get_default_country(ah); |
417 | 417 | ||
418 | if (ah->ah_countryCode == CTRY_DEFAULT && | 418 | if (ah->regulatory.country_code == CTRY_DEFAULT && |
419 | ath9k_regd_get_eepromRD(ah) == CTRY_DEFAULT) | 419 | ath9k_regd_get_eepromRD(ah) == CTRY_DEFAULT) |
420 | ah->ah_countryCode = CTRY_UNITED_STATES; | 420 | ah->regulatory.country_code = CTRY_UNITED_STATES; |
421 | 421 | ||
422 | if (ah->ah_countryCode == CTRY_DEFAULT) { | 422 | if (ah->regulatory.country_code == CTRY_DEFAULT) { |
423 | regdmn = ath9k_regd_get_eepromRD(ah); | 423 | regdmn = ath9k_regd_get_eepromRD(ah); |
424 | country = NULL; | 424 | country = NULL; |
425 | } else { | 425 | } else { |
426 | country = ath9k_regd_find_country(ah->ah_countryCode); | 426 | country = ath9k_regd_find_country(ah->regulatory.country_code); |
427 | if (country == NULL) { | 427 | if (country == NULL) { |
428 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, | 428 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, |
429 | "Country is NULL!!!!, cc= %d\n", | 429 | "Country is NULL!!!!, cc= %d\n", |
430 | ah->ah_countryCode); | 430 | ah->regulatory.country_code); |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | } else | 432 | } else |
433 | regdmn = country->regDmnEnum; | 433 | regdmn = country->regDmnEnum; |
434 | } | 434 | } |
435 | 435 | ||
436 | ah->ah_currentRDInUse = regdmn; | 436 | ah->regulatory.current_rd_inuse = regdmn; |
437 | ah->regpair = ath9k_get_regpair(regdmn); | 437 | ah->regulatory.regpair = ath9k_get_regpair(regdmn); |
438 | 438 | ||
439 | if (!ah->regpair) { | 439 | if (!ah->regulatory.regpair) { |
440 | DPRINTF(ah->ah_sc, ATH_DBG_FATAL, | 440 | DPRINTF(ah->ah_sc, ATH_DBG_FATAL, |
441 | "No regulatory domain pair found, cannot continue\n"); | 441 | "No regulatory domain pair found, cannot continue\n"); |
442 | return -EINVAL; | 442 | return -EINVAL; |
@@ -446,18 +446,18 @@ int ath9k_regd_init(struct ath_hal *ah) | |||
446 | country = ath9k_regd_find_country_by_rd(regdmn); | 446 | country = ath9k_regd_find_country_by_rd(regdmn); |
447 | 447 | ||
448 | if (country) { | 448 | if (country) { |
449 | ah->alpha2[0] = country->isoName[0]; | 449 | ah->regulatory.alpha2[0] = country->isoName[0]; |
450 | ah->alpha2[1] = country->isoName[1]; | 450 | ah->regulatory.alpha2[1] = country->isoName[1]; |
451 | } else { | 451 | } else { |
452 | ah->alpha2[0] = '0'; | 452 | ah->regulatory.alpha2[0] = '0'; |
453 | ah->alpha2[1] = '0'; | 453 | ah->regulatory.alpha2[1] = '0'; |
454 | } | 454 | } |
455 | 455 | ||
456 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, | 456 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, |
457 | "Country alpha2 being used: %c%c\n" | 457 | "Country alpha2 being used: %c%c\n" |
458 | "Regpair detected: 0x%0x\n", | 458 | "Regulatory.Regpair detected: 0x%0x\n", |
459 | ah->alpha2[0], ah->alpha2[1], | 459 | ah->regulatory.alpha2[0], ah->regulatory.alpha2[1], |
460 | ah->regpair->regDmnEnum); | 460 | ah->regulatory.regpair->regDmnEnum); |
461 | 461 | ||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
@@ -466,8 +466,8 @@ u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan) | |||
466 | { | 466 | { |
467 | u32 ctl = NO_CTL; | 467 | u32 ctl = NO_CTL; |
468 | 468 | ||
469 | if (!ah->regpair || | 469 | if (!ah->regulatory.regpair || |
470 | (ah->ah_countryCode == CTRY_DEFAULT && isWwrSKU(ah))) { | 470 | (ah->regulatory.country_code == CTRY_DEFAULT && isWwrSKU(ah))) { |
471 | if (IS_CHAN_B(chan)) | 471 | if (IS_CHAN_B(chan)) |
472 | ctl = SD_NO_CTL | CTL_11B; | 472 | ctl = SD_NO_CTL | CTL_11B; |
473 | else if (IS_CHAN_G(chan)) | 473 | else if (IS_CHAN_G(chan)) |
@@ -478,11 +478,11 @@ u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | if (IS_CHAN_B(chan)) | 480 | if (IS_CHAN_B(chan)) |
481 | ctl = ah->regpair->reg_2ghz_ctl | CTL_11B; | 481 | ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11B; |
482 | else if (IS_CHAN_G(chan)) | 482 | else if (IS_CHAN_G(chan)) |
483 | ctl = ah->regpair->reg_5ghz_ctl | CTL_11G; | 483 | ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11G; |
484 | else | 484 | else |
485 | ctl = ah->regpair->reg_5ghz_ctl | CTL_11A; | 485 | ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11A; |
486 | 486 | ||
487 | return ctl; | 487 | return ctl; |
488 | } | 488 | } |
diff --git a/drivers/net/wireless/ath9k/regd.h b/drivers/net/wireless/ath9k/regd.h index d1c4457de436..65abdf46115d 100644 --- a/drivers/net/wireless/ath9k/regd.h +++ b/drivers/net/wireless/ath9k/regd.h | |||
@@ -45,6 +45,18 @@ struct country_code_to_enum_rd { | |||
45 | const char *isoName; | 45 | const char *isoName; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | struct ath9k_regulatory { | ||
49 | char alpha2[2]; | ||
50 | u16 country_code; | ||
51 | u16 max_power_level; | ||
52 | u32 tp_scale; | ||
53 | u16 current_rd; | ||
54 | u16 current_rd_ext; | ||
55 | u16 current_rd_inuse; | ||
56 | int16_t power_limit; | ||
57 | struct reg_dmn_pair_mapping *regpair; | ||
58 | }; | ||
59 | |||
48 | enum CountryCode { | 60 | enum CountryCode { |
49 | CTRY_ALBANIA = 8, | 61 | CTRY_ALBANIA = 8, |
50 | CTRY_ALGERIA = 12, | 62 | CTRY_ALGERIA = 12, |