diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-04-13 04:56:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-13 15:09:53 -0400 |
commit | 332704a51498a7e29aa92c19dc03f11f80b71bfe (patch) | |
tree | 27b15e8fda9c070784d820cc98fd5985a475e88e /drivers | |
parent | 50f6871218802be528961e24487f00c203a5c3c7 (diff) |
iwlegacy: fix tx_power initialization
priv->tx_power_next is not initialized to max supported power,
but instead default value is used, what cause errors like
[ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
if maximum tx power read from the eeprom is smaller than default.
In consequence card is unable to initialize properly. Fix the problem
and cleanup tx power initialization.
Reported-and-tested-by: Robin Dong <hao.bigrat@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-core.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-eeprom.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl3945-base.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl4965-base.c | 6 |
6 files changed, 11 insertions, 28 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h index 779d3cb86e2c..5c3a68d3af12 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h | |||
@@ -74,8 +74,6 @@ | |||
74 | /* RSSI to dBm */ | 74 | /* RSSI to dBm */ |
75 | #define IWL39_RSSI_OFFSET 95 | 75 | #define IWL39_RSSI_OFFSET 95 |
76 | 76 | ||
77 | #define IWL_DEFAULT_TX_POWER 0x0F | ||
78 | |||
79 | /* | 77 | /* |
80 | * EEPROM related constants, enums, and structures. | 78 | * EEPROM related constants, enums, and structures. |
81 | */ | 79 | */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h index 08b189c8472d..fc6fa2886d9c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h | |||
@@ -804,9 +804,6 @@ struct iwl4965_scd_bc_tbl { | |||
804 | 804 | ||
805 | #define IWL4965_DEFAULT_TX_RETRY 15 | 805 | #define IWL4965_DEFAULT_TX_RETRY 15 |
806 | 806 | ||
807 | /* Limit range of txpower output target to be between these values */ | ||
808 | #define IWL4965_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */ | ||
809 | |||
810 | /* EEPROM */ | 807 | /* EEPROM */ |
811 | #define IWL4965_FIRST_AMPDU_QUEUE 10 | 808 | #define IWL4965_FIRST_AMPDU_QUEUE 10 |
812 | 809 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index a209a0e76bf0..2b08efb3b658 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.c +++ b/drivers/net/wireless/iwlegacy/iwl-core.c | |||
@@ -160,6 +160,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
160 | struct ieee80211_channel *geo_ch; | 160 | struct ieee80211_channel *geo_ch; |
161 | struct ieee80211_rate *rates; | 161 | struct ieee80211_rate *rates; |
162 | int i = 0; | 162 | int i = 0; |
163 | s8 max_tx_power = 0; | ||
163 | 164 | ||
164 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || | 165 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || |
165 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { | 166 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { |
@@ -235,8 +236,8 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
235 | 236 | ||
236 | geo_ch->flags |= ch->ht40_extension_channel; | 237 | geo_ch->flags |= ch->ht40_extension_channel; |
237 | 238 | ||
238 | if (ch->max_power_avg > priv->tx_power_device_lmt) | 239 | if (ch->max_power_avg > max_tx_power) |
239 | priv->tx_power_device_lmt = ch->max_power_avg; | 240 | max_tx_power = ch->max_power_avg; |
240 | } else { | 241 | } else { |
241 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 242 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
242 | } | 243 | } |
@@ -249,6 +250,10 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
249 | geo_ch->flags); | 250 | geo_ch->flags); |
250 | } | 251 | } |
251 | 252 | ||
253 | priv->tx_power_device_lmt = max_tx_power; | ||
254 | priv->tx_power_user_lmt = max_tx_power; | ||
255 | priv->tx_power_next = max_tx_power; | ||
256 | |||
252 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && | 257 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && |
253 | priv->cfg->sku & IWL_SKU_A) { | 258 | priv->cfg->sku & IWL_SKU_A) { |
254 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " | 259 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " |
@@ -1124,11 +1129,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | |||
1124 | if (!priv->cfg->ops->lib->send_tx_power) | 1129 | if (!priv->cfg->ops->lib->send_tx_power) |
1125 | return -EOPNOTSUPP; | 1130 | return -EOPNOTSUPP; |
1126 | 1131 | ||
1127 | if (tx_power < IWL4965_TX_POWER_TARGET_POWER_MIN) { | 1132 | /* 0 dBm mean 1 milliwatt */ |
1133 | if (tx_power < 0) { | ||
1128 | IWL_WARN(priv, | 1134 | IWL_WARN(priv, |
1129 | "Requested user TXPOWER %d below lower limit %d.\n", | 1135 | "Requested user TXPOWER %d below 1 mW.\n", |
1130 | tx_power, | 1136 | tx_power); |
1131 | IWL4965_TX_POWER_TARGET_POWER_MIN); | ||
1132 | return -EINVAL; | 1137 | return -EINVAL; |
1133 | } | 1138 | } |
1134 | 1139 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c index 04c5648027df..cb346d1a9ffa 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c | |||
@@ -471,13 +471,6 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) | |||
471 | flags & EEPROM_CHANNEL_RADAR)) | 471 | flags & EEPROM_CHANNEL_RADAR)) |
472 | ? "" : "not "); | 472 | ? "" : "not "); |
473 | 473 | ||
474 | /* Set the tx_power_user_lmt to the highest power | ||
475 | * supported by any channel */ | ||
476 | if (eeprom_ch_info[ch].max_power_avg > | ||
477 | priv->tx_power_user_lmt) | ||
478 | priv->tx_power_user_lmt = | ||
479 | eeprom_ch_info[ch].max_power_avg; | ||
480 | |||
481 | ch_info++; | 474 | ch_info++; |
482 | } | 475 | } |
483 | } | 476 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c index 28eb3d885ba1..cc7ebcee60e5 100644 --- a/drivers/net/wireless/iwlegacy/iwl3945-base.c +++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c | |||
@@ -3825,10 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3825 | priv->force_reset[IWL_FW_RESET].reset_duration = | 3825 | priv->force_reset[IWL_FW_RESET].reset_duration = |
3826 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | 3826 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; |
3827 | 3827 | ||
3828 | |||
3829 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; | ||
3830 | priv->tx_power_next = IWL_DEFAULT_TX_POWER; | ||
3831 | |||
3832 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { | 3828 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
3833 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | 3829 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", |
3834 | eeprom->version); | 3830 | eeprom->version); |
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index 91b3d8b9d7a5..d484c3678163 100644 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c | |||
@@ -3140,12 +3140,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv) | |||
3140 | 3140 | ||
3141 | iwl_legacy_init_scan_params(priv); | 3141 | iwl_legacy_init_scan_params(priv); |
3142 | 3142 | ||
3143 | /* Set the tx_power_user_lmt to the lowest power level | ||
3144 | * this value will get overwritten by channel max power avg | ||
3145 | * from eeprom */ | ||
3146 | priv->tx_power_user_lmt = IWL4965_TX_POWER_TARGET_POWER_MIN; | ||
3147 | priv->tx_power_next = IWL4965_TX_POWER_TARGET_POWER_MIN; | ||
3148 | |||
3149 | ret = iwl_legacy_init_channel_map(priv); | 3143 | ret = iwl_legacy_init_channel_map(priv); |
3150 | if (ret) { | 3144 | if (ret) { |
3151 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); | 3145 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); |