Skip to content

Commit

Permalink
iwlagn: fix tx power initialization
Browse files Browse the repository at this point in the history
Since

commit f844a70
Author: Stanislaw Gruszka <sgruszka@redhat.com>
Date:   Fri Jan 28 16:47:44 2011 +0100

    iwlwifi: do not set tx power when channel is changing

we set device tx power during initialization to priv->tx_power_next,
which itself is initialized to minimum power. That changed
default behaviour of driver. Previously we initialized device to
transmit at maximum available power by default. Patch change again
to previous behaviour and cleanup tx power initialization.

Fortunately this is not critical fix, as mac80211 layer setup
tx power lately to 14dB, hence device does not operate at minimal
transmit power all the time.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Apr 29, 2011
1 parent 4436879 commit 75d80ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
6 changes: 0 additions & 6 deletions drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3444,12 +3444,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF;
}

/* Set the tx_power_user_lmt to the lowest power level
* this value will get overwritten by channel max power avg
* from eeprom */
priv->tx_power_user_lmt = IWLAGN_TX_POWER_TARGET_POWER_MIN;
priv->tx_power_next = IWLAGN_TX_POWER_TARGET_POWER_MIN;

ret = iwl_init_channel_map(priv);
if (ret) {
IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
Expand Down
9 changes: 7 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
struct ieee80211_channel *geo_ch;
struct ieee80211_rate *rates;
int i = 0;
s8 max_tx_power = IWLAGN_TX_POWER_TARGET_POWER_MIN;

if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
Expand Down Expand Up @@ -208,8 +209,8 @@ int iwlcore_init_geos(struct iwl_priv *priv)

geo_ch->flags |= ch->ht40_extension_channel;

if (ch->max_power_avg > priv->tx_power_device_lmt)
priv->tx_power_device_lmt = ch->max_power_avg;
if (ch->max_power_avg > max_tx_power)
max_tx_power = ch->max_power_avg;
} else {
geo_ch->flags |= IEEE80211_CHAN_DISABLED;
}
Expand All @@ -222,6 +223,10 @@ int iwlcore_init_geos(struct iwl_priv *priv)
geo_ch->flags);
}

priv->tx_power_device_lmt = max_tx_power;
priv->tx_power_user_lmt = max_tx_power;
priv->tx_power_next = max_tx_power;

if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
priv->cfg->sku & IWL_SKU_A) {
IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
Expand Down
7 changes: 0 additions & 7 deletions drivers/net/wireless/iwlwifi/iwl-eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,6 @@ int iwl_init_channel_map(struct iwl_priv *priv)
flags & EEPROM_CHANNEL_RADAR))
? "" : "not ");

/* Set the tx_power_user_lmt to the highest power
* supported by any channel */
if (eeprom_ch_info[ch].max_power_avg >
priv->tx_power_user_lmt)
priv->tx_power_user_lmt =
eeprom_ch_info[ch].max_power_avg;

ch_info++;
}
}
Expand Down

0 comments on commit 75d80ca

Please sign in to comment.