diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-06-11 21:47:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:08 -0400 |
commit | 630fe9b6f774dd55b71fe94392101eb00df58762 (patch) | |
tree | a4835d1d28195321f52f877f89d5bf1dbe8bf436 /drivers | |
parent | 25a6572cc13ba2a3fefc02a63a077ff3664a1ca9 (diff) |
iwlwifi: refactor setting tx power
This patch
1. Refactors settings of tx power
2. enables iwconfig txpower <value>
3. adds 5000 HW tx power
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 51 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 17 |
8 files changed, 96 insertions, 62 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 3f24e979731b..1b8dc2dbdb8f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #include "iwl-calib.h" | 46 | #include "iwl-calib.h" |
47 | #include "iwl-sta.h" | 47 | #include "iwl-sta.h" |
48 | 48 | ||
49 | static int iwl4965_send_tx_power(struct iwl_priv *priv); | ||
50 | |||
49 | /* module parameters */ | 51 | /* module parameters */ |
50 | static struct iwl_mod_params iwl4965_mod_params = { | 52 | static struct iwl_mod_params iwl4965_mod_params = { |
51 | .num_of_queues = IWL49_NUM_QUEUES, | 53 | .num_of_queues = IWL49_NUM_QUEUES, |
@@ -737,7 +739,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work) | |||
737 | /* Regardless of if we are assocaited, we must reconfigure the | 739 | /* Regardless of if we are assocaited, we must reconfigure the |
738 | * TX power since frames can be sent on non-radar channels while | 740 | * TX power since frames can be sent on non-radar channels while |
739 | * not associated */ | 741 | * not associated */ |
740 | iwl4965_hw_reg_send_txpower(priv); | 742 | iwl4965_send_tx_power(priv); |
741 | 743 | ||
742 | /* Update last_temperature to keep is_calib_needed from running | 744 | /* Update last_temperature to keep is_calib_needed from running |
743 | * when it isn't needed... */ | 745 | * when it isn't needed... */ |
@@ -952,11 +954,6 @@ static int iwl4965_set_power(struct iwl_priv *priv, | |||
952 | cmd, NULL); | 954 | cmd, NULL); |
953 | return ret; | 955 | return ret; |
954 | } | 956 | } |
955 | int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) | ||
956 | { | ||
957 | IWL_ERROR("TODO: Implement iwl4965_hw_reg_set_txpower!\n"); | ||
958 | return -EINVAL; | ||
959 | } | ||
960 | 957 | ||
961 | static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) | 958 | static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) |
962 | { | 959 | { |
@@ -1007,20 +1004,6 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, | |||
1007 | return comp; | 1004 | return comp; |
1008 | } | 1005 | } |
1009 | 1006 | ||
1010 | static const struct iwl_channel_info * | ||
1011 | iwl4965_get_channel_txpower_info(struct iwl_priv *priv, | ||
1012 | enum ieee80211_band band, u16 channel) | ||
1013 | { | ||
1014 | const struct iwl_channel_info *ch_info; | ||
1015 | |||
1016 | ch_info = iwl_get_channel_info(priv, band, channel); | ||
1017 | |||
1018 | if (!is_channel_valid(ch_info)) | ||
1019 | return NULL; | ||
1020 | |||
1021 | return ch_info; | ||
1022 | } | ||
1023 | |||
1024 | static s32 iwl4965_get_tx_atten_grp(u16 channel) | 1007 | static s32 iwl4965_get_tx_atten_grp(u16 channel) |
1025 | { | 1008 | { |
1026 | if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && | 1009 | if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && |
@@ -1444,30 +1427,17 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
1444 | s32 factory_actual_pwr[2]; | 1427 | s32 factory_actual_pwr[2]; |
1445 | s32 power_index; | 1428 | s32 power_index; |
1446 | 1429 | ||
1447 | /* Sanity check requested level (dBm) */ | ||
1448 | if (priv->user_txpower_limit < IWL_TX_POWER_TARGET_POWER_MIN) { | ||
1449 | IWL_WARNING("Requested user TXPOWER %d below limit.\n", | ||
1450 | priv->user_txpower_limit); | ||
1451 | return -EINVAL; | ||
1452 | } | ||
1453 | if (priv->user_txpower_limit > IWL_TX_POWER_TARGET_POWER_MAX) { | ||
1454 | IWL_WARNING("Requested user TXPOWER %d above limit.\n", | ||
1455 | priv->user_txpower_limit); | ||
1456 | return -EINVAL; | ||
1457 | } | ||
1458 | |||
1459 | /* user_txpower_limit is in dBm, convert to half-dBm (half-dB units | 1430 | /* user_txpower_limit is in dBm, convert to half-dBm (half-dB units |
1460 | * are used for indexing into txpower table) */ | 1431 | * are used for indexing into txpower table) */ |
1461 | user_target_power = 2 * priv->user_txpower_limit; | 1432 | user_target_power = 2 * priv->tx_power_user_lmt; |
1462 | 1433 | ||
1463 | /* Get current (RXON) channel, band, width */ | 1434 | /* Get current (RXON) channel, band, width */ |
1464 | ch_info = | ||
1465 | iwl4965_get_channel_txpower_info(priv, priv->band, channel); | ||
1466 | |||
1467 | IWL_DEBUG_TXPOWER("chan %d band %d is_fat %d\n", channel, band, | 1435 | IWL_DEBUG_TXPOWER("chan %d band %d is_fat %d\n", channel, band, |
1468 | is_fat); | 1436 | is_fat); |
1469 | 1437 | ||
1470 | if (!ch_info) | 1438 | ch_info = iwl_get_channel_info(priv, priv->band, channel); |
1439 | |||
1440 | if (!is_channel_valid(ch_info)) | ||
1471 | return -EINVAL; | 1441 | return -EINVAL; |
1472 | 1442 | ||
1473 | /* get txatten group, used to select 1) thermal txpower adjustment | 1443 | /* get txatten group, used to select 1) thermal txpower adjustment |
@@ -1668,12 +1638,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
1668 | } | 1638 | } |
1669 | 1639 | ||
1670 | /** | 1640 | /** |
1671 | * iwl4965_hw_reg_send_txpower - Configure the TXPOWER level user limit | 1641 | * iwl4965_send_tx_power - Configure the TXPOWER level user limit |
1672 | * | 1642 | * |
1673 | * Uses the active RXON for channel, band, and characteristics (fat, high) | 1643 | * Uses the active RXON for channel, band, and characteristics (fat, high) |
1674 | * The power limit is taken from priv->user_txpower_limit. | 1644 | * The power limit is taken from priv->tx_power_user_lmt. |
1675 | */ | 1645 | */ |
1676 | int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) | 1646 | static int iwl4965_send_tx_power(struct iwl_priv *priv) |
1677 | { | 1647 | { |
1678 | struct iwl4965_txpowertable_cmd cmd = { 0 }; | 1648 | struct iwl4965_txpowertable_cmd cmd = { 0 }; |
1679 | int ret; | 1649 | int ret; |
@@ -3507,6 +3477,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
3507 | }, | 3477 | }, |
3508 | .radio_kill_sw = iwl4965_radio_kill_sw, | 3478 | .radio_kill_sw = iwl4965_radio_kill_sw, |
3509 | .set_power = iwl4965_set_power, | 3479 | .set_power = iwl4965_set_power, |
3480 | .send_tx_power = iwl4965_send_tx_power, | ||
3510 | .update_chain_flags = iwl4965_update_chain_flags, | 3481 | .update_chain_flags = iwl4965_update_chain_flags, |
3511 | }; | 3482 | }; |
3512 | 3483 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 2a30306b7ed0..da8750b97eec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -1424,6 +1424,19 @@ static int iwl5000_send_rxon_assoc(struct iwl_priv *priv) | |||
1424 | 1424 | ||
1425 | return ret; | 1425 | return ret; |
1426 | } | 1426 | } |
1427 | static int iwl5000_send_tx_power(struct iwl_priv *priv) | ||
1428 | { | ||
1429 | struct iwl5000_tx_power_dbm_cmd tx_power_cmd; | ||
1430 | |||
1431 | /* half dBm need to multiply */ | ||
1432 | tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); | ||
1433 | tx_power_cmd.flags = 0; | ||
1434 | tx_power_cmd.srv_chan_lmt = IWL50_TX_POWER_AUTO; | ||
1435 | return iwl_send_cmd_pdu_async(priv, REPLY_TX_POWER_DBM_CMD, | ||
1436 | sizeof(tx_power_cmd), &tx_power_cmd, | ||
1437 | NULL); | ||
1438 | } | ||
1439 | |||
1427 | 1440 | ||
1428 | static struct iwl_hcmd_ops iwl5000_hcmd = { | 1441 | static struct iwl_hcmd_ops iwl5000_hcmd = { |
1429 | .rxon_assoc = iwl5000_send_rxon_assoc, | 1442 | .rxon_assoc = iwl5000_send_rxon_assoc, |
@@ -1452,6 +1465,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
1452 | .load_ucode = iwl5000_load_ucode, | 1465 | .load_ucode = iwl5000_load_ucode, |
1453 | .init_alive_start = iwl5000_init_alive_start, | 1466 | .init_alive_start = iwl5000_init_alive_start, |
1454 | .alive_notify = iwl5000_alive_notify, | 1467 | .alive_notify = iwl5000_alive_notify, |
1468 | .send_tx_power = iwl5000_send_tx_power, | ||
1455 | .apm_ops = { | 1469 | .apm_ops = { |
1456 | .init = iwl5000_apm_init, | 1470 | .init = iwl5000_apm_init, |
1457 | .reset = iwl5000_apm_reset, | 1471 | .reset = iwl5000_apm_reset, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 9b64a390564c..a093f5b83cb6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -126,6 +126,7 @@ enum { | |||
126 | /* Miscellaneous commands */ | 126 | /* Miscellaneous commands */ |
127 | QUIET_NOTIFICATION = 0x96, /* not used */ | 127 | QUIET_NOTIFICATION = 0x96, /* not used */ |
128 | REPLY_TX_PWR_TABLE_CMD = 0x97, | 128 | REPLY_TX_PWR_TABLE_CMD = 0x97, |
129 | REPLY_TX_POWER_DBM_CMD = 0x98, | ||
129 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ | 130 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
130 | 131 | ||
131 | /* Bluetooth device coexistance config command */ | 132 | /* Bluetooth device coexistance config command */ |
@@ -339,6 +340,17 @@ struct iwl4965_tx_power_db { | |||
339 | struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; | 340 | struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; |
340 | } __attribute__ ((packed)); | 341 | } __attribute__ ((packed)); |
341 | 342 | ||
343 | /** | ||
344 | * Commad REPLY_TX_POWER_DBM_CMD = 0x98 | ||
345 | * struct iwl5000_tx_power_dbm_cmd | ||
346 | */ | ||
347 | #define IWL50_TX_POWER_AUTO 0x7f | ||
348 | struct iwl5000_tx_power_dbm_cmd { | ||
349 | s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ | ||
350 | u8 flags; | ||
351 | s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ | ||
352 | u8 reserved; | ||
353 | } __attribute__ ((packed)); | ||
342 | 354 | ||
343 | /****************************************************************************** | 355 | /****************************************************************************** |
344 | * (0a) | 356 | * (0a) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 21995ff0cc0f..164697a6413d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -480,9 +480,8 @@ static int iwlcore_init_geos(struct iwl_priv *priv) | |||
480 | 480 | ||
481 | geo_ch->flags |= ch->fat_extension_channel; | 481 | geo_ch->flags |= ch->fat_extension_channel; |
482 | 482 | ||
483 | if (ch->max_power_avg > priv->max_channel_txpower_limit) | 483 | if (ch->max_power_avg > priv->tx_power_channel_lmt) |
484 | priv->max_channel_txpower_limit = | 484 | priv->tx_power_channel_lmt = ch->max_power_avg; |
485 | ch->max_power_avg; | ||
486 | } else { | 485 | } else { |
487 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 486 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
488 | } | 487 | } |
@@ -832,7 +831,7 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
832 | priv->rates_mask = IWL_RATES_MASK; | 831 | priv->rates_mask = IWL_RATES_MASK; |
833 | /* If power management is turned on, default to AC mode */ | 832 | /* If power management is turned on, default to AC mode */ |
834 | priv->power_mode = IWL_POWER_AC; | 833 | priv->power_mode = IWL_POWER_AC; |
835 | priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; | 834 | priv->tx_power_user_lmt = IWL_TX_POWER_TARGET_POWER_MAX; |
836 | 835 | ||
837 | ret = iwl_init_channel_map(priv); | 836 | ret = iwl_init_channel_map(priv); |
838 | if (ret) { | 837 | if (ret) { |
@@ -871,6 +870,34 @@ void iwl_free_calib_results(struct iwl_priv *priv) | |||
871 | } | 870 | } |
872 | EXPORT_SYMBOL(iwl_free_calib_results); | 871 | EXPORT_SYMBOL(iwl_free_calib_results); |
873 | 872 | ||
873 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | ||
874 | { | ||
875 | int ret = 0; | ||
876 | if (tx_power < IWL_TX_POWER_TARGET_POWER_MIN) { | ||
877 | IWL_WARNING("Requested user TXPOWER %d below limit.\n", | ||
878 | priv->tx_power_user_lmt); | ||
879 | return -EINVAL; | ||
880 | } | ||
881 | |||
882 | if (tx_power > IWL_TX_POWER_TARGET_POWER_MAX) { | ||
883 | IWL_WARNING("Requested user TXPOWER %d above limit.\n", | ||
884 | priv->tx_power_user_lmt); | ||
885 | return -EINVAL; | ||
886 | } | ||
887 | |||
888 | if (priv->tx_power_user_lmt != tx_power) | ||
889 | force = true; | ||
890 | |||
891 | priv->tx_power_user_lmt = tx_power; | ||
892 | |||
893 | if (force && priv->cfg->ops->lib->send_tx_power) | ||
894 | ret = priv->cfg->ops->lib->send_tx_power(priv); | ||
895 | |||
896 | return ret; | ||
897 | } | ||
898 | EXPORT_SYMBOL(iwl_set_tx_power); | ||
899 | |||
900 | |||
874 | void iwl_uninit_drv(struct iwl_priv *priv) | 901 | void iwl_uninit_drv(struct iwl_priv *priv) |
875 | { | 902 | { |
876 | iwl_free_calib_results(priv); | 903 | iwl_free_calib_results(priv); |
@@ -880,6 +907,8 @@ void iwl_uninit_drv(struct iwl_priv *priv) | |||
880 | } | 907 | } |
881 | EXPORT_SYMBOL(iwl_uninit_drv); | 908 | EXPORT_SYMBOL(iwl_uninit_drv); |
882 | 909 | ||
910 | |||
911 | |||
883 | /* Low level driver call this function to update iwlcore with | 912 | /* Low level driver call this function to update iwlcore with |
884 | * driver status. | 913 | * driver status. |
885 | */ | 914 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 44d0fcf79e60..5bae691cc492 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -140,6 +140,7 @@ struct iwl_lib_ops { | |||
140 | } apm_ops; | 140 | } apm_ops; |
141 | /* power */ | 141 | /* power */ |
142 | int (*set_power)(struct iwl_priv *priv, void *cmd); | 142 | int (*set_power)(struct iwl_priv *priv, void *cmd); |
143 | int (*send_tx_power) (struct iwl_priv *priv); | ||
143 | void (*update_chain_flags)(struct iwl_priv *priv); | 144 | void (*update_chain_flags)(struct iwl_priv *priv); |
144 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 145 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
145 | struct iwl_eeprom_ops eeprom_ops; | 146 | struct iwl_eeprom_ops eeprom_ops; |
@@ -238,6 +239,11 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid); | |||
238 | int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id); | 239 | int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id); |
239 | 240 | ||
240 | /***************************************************** | 241 | /***************************************************** |
242 | * TX power | ||
243 | ****************************************************/ | ||
244 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); | ||
245 | |||
246 | /***************************************************** | ||
241 | * S e n d i n g H o s t C o m m a n d s * | 247 | * S e n d i n g H o s t C o m m a n d s * |
242 | *****************************************************/ | 248 | *****************************************************/ |
243 | 249 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 54e6ac84980b..b420f64dcb7d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -683,8 +683,6 @@ extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
683 | struct ieee80211_tx_info *info, | 683 | struct ieee80211_tx_info *info, |
684 | struct ieee80211_hdr *hdr, | 684 | struct ieee80211_hdr *hdr, |
685 | int sta_id, int tx_id); | 685 | int sta_id, int tx_id); |
686 | extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv); | ||
687 | extern int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); | ||
688 | extern void iwl4965_hw_rx_statistics(struct iwl_priv *priv, | 686 | extern void iwl4965_hw_rx_statistics(struct iwl_priv *priv, |
689 | struct iwl_rx_mem_buffer *rxb); | 687 | struct iwl_rx_mem_buffer *rxb); |
690 | extern void iwl4965_disable_events(struct iwl_priv *priv); | 688 | extern void iwl4965_disable_events(struct iwl_priv *priv); |
@@ -1167,10 +1165,9 @@ struct iwl_priv { | |||
1167 | struct delayed_work alive_start; | 1165 | struct delayed_work alive_start; |
1168 | struct delayed_work scan_check; | 1166 | struct delayed_work scan_check; |
1169 | struct delayed_work post_associate; | 1167 | struct delayed_work post_associate; |
1170 | 1168 | /* TX Power */ | |
1171 | #define IWL_DEFAULT_TX_POWER 0x0F | 1169 | s8 tx_power_user_lmt; |
1172 | s8 user_txpower_limit; | 1170 | s8 tx_power_channel_lmt; |
1173 | s8 max_channel_txpower_limit; | ||
1174 | 1171 | ||
1175 | #ifdef CONFIG_PM | 1172 | #ifdef CONFIG_PM |
1176 | u32 pm_state[16]; | 1173 | u32 pm_state[16]; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index cbb812f9f620..4a08a1b50979 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -382,8 +382,8 @@ static int iwl_set_fat_chan_info(struct iwl_priv *priv, | |||
382 | if (!is_channel_valid(ch_info)) | 382 | if (!is_channel_valid(ch_info)) |
383 | return -1; | 383 | return -1; |
384 | 384 | ||
385 | IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x" | 385 | IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" |
386 | " %ddBm): Ad-Hoc %ssupported\n", | 386 | " Ad-Hoc %ssupported\n", |
387 | ch_info->channel, | 387 | ch_info->channel, |
388 | is_channel_a_band(ch_info) ? | 388 | is_channel_a_band(ch_info) ? |
389 | "5.2" : "2.4", | 389 | "5.2" : "2.4", |
@@ -493,8 +493,8 @@ int iwl_init_channel_map(struct iwl_priv *priv) | |||
493 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | 493 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; |
494 | ch_info->min_power = 0; | 494 | ch_info->min_power = 0; |
495 | 495 | ||
496 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" | 496 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm):" |
497 | " %ddBm): Ad-Hoc %ssupported\n", | 497 | " Ad-Hoc %ssupported\n", |
498 | ch_info->channel, | 498 | ch_info->channel, |
499 | is_channel_a_band(ch_info) ? | 499 | is_channel_a_band(ch_info) ? |
500 | "5.2" : "2.4", | 500 | "5.2" : "2.4", |
@@ -515,8 +515,8 @@ int iwl_init_channel_map(struct iwl_priv *priv) | |||
515 | /* Set the user_txpower_limit to the highest power | 515 | /* Set the user_txpower_limit to the highest power |
516 | * supported by any channel */ | 516 | * supported by any channel */ |
517 | if (eeprom_ch_info[ch].max_power_avg > | 517 | if (eeprom_ch_info[ch].max_power_avg > |
518 | priv->user_txpower_limit) | 518 | priv->tx_power_user_lmt) |
519 | priv->user_txpower_limit = | 519 | priv->tx_power_user_lmt = |
520 | eeprom_ch_info[ch].max_power_avg; | 520 | eeprom_ch_info[ch].max_power_avg; |
521 | 521 | ||
522 | ch_info++; | 522 | ch_info++; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 510e40348a30..af448197cc05 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -367,9 +367,9 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
367 | 367 | ||
368 | /* If we issue a new RXON command which required a tune then we must | 368 | /* If we issue a new RXON command which required a tune then we must |
369 | * send a new TXPOWER command or we won't be able to Tx any frames */ | 369 | * send a new TXPOWER command or we won't be able to Tx any frames */ |
370 | rc = iwl4965_hw_reg_send_txpower(priv); | 370 | rc = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true); |
371 | if (rc) { | 371 | if (rc) { |
372 | IWL_ERROR("Error setting Tx power (%d).\n", rc); | 372 | IWL_ERROR("Error sending TX power (%d).\n", rc); |
373 | return rc; | 373 | return rc; |
374 | } | 374 | } |
375 | 375 | ||
@@ -3637,7 +3637,7 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) | |||
3637 | struct iwl_priv *priv = | 3637 | struct iwl_priv *priv = |
3638 | container_of(work, struct iwl_priv, scan_completed); | 3638 | container_of(work, struct iwl_priv, scan_completed); |
3639 | 3639 | ||
3640 | IWL_DEBUG(IWL_DL_SCAN, "SCAN complete scan\n"); | 3640 | IWL_DEBUG_SCAN("SCAN complete scan\n"); |
3641 | 3641 | ||
3642 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3642 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3643 | return; | 3643 | return; |
@@ -3650,7 +3650,7 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) | |||
3650 | /* Since setting the TXPOWER may have been deferred while | 3650 | /* Since setting the TXPOWER may have been deferred while |
3651 | * performing the scan, fire one off */ | 3651 | * performing the scan, fire one off */ |
3652 | mutex_lock(&priv->mutex); | 3652 | mutex_lock(&priv->mutex); |
3653 | iwl4965_hw_reg_send_txpower(priv); | 3653 | iwl_set_tx_power(priv, priv->tx_power_user_lmt, true); |
3654 | mutex_unlock(&priv->mutex); | 3654 | mutex_unlock(&priv->mutex); |
3655 | } | 3655 | } |
3656 | 3656 | ||
@@ -3930,6 +3930,11 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
3930 | goto out; | 3930 | goto out; |
3931 | } | 3931 | } |
3932 | 3932 | ||
3933 | IWL_DEBUG_MAC80211("TX Power old=%d new=%d\n", | ||
3934 | priv->tx_power_user_lmt, conf->power_level); | ||
3935 | |||
3936 | iwl_set_tx_power(priv, conf->power_level, false); | ||
3937 | |||
3933 | iwl4965_set_rate(priv); | 3938 | iwl4965_set_rate(priv); |
3934 | 3939 | ||
3935 | if (memcmp(&priv->active_rxon, | 3940 | if (memcmp(&priv->active_rxon, |
@@ -4713,7 +4718,7 @@ static ssize_t show_tx_power(struct device *d, | |||
4713 | struct device_attribute *attr, char *buf) | 4718 | struct device_attribute *attr, char *buf) |
4714 | { | 4719 | { |
4715 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; | 4720 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
4716 | return sprintf(buf, "%d\n", priv->user_txpower_limit); | 4721 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); |
4717 | } | 4722 | } |
4718 | 4723 | ||
4719 | static ssize_t store_tx_power(struct device *d, | 4724 | static ssize_t store_tx_power(struct device *d, |
@@ -4729,7 +4734,7 @@ static ssize_t store_tx_power(struct device *d, | |||
4729 | printk(KERN_INFO DRV_NAME | 4734 | printk(KERN_INFO DRV_NAME |
4730 | ": %s is not in decimal form.\n", buf); | 4735 | ": %s is not in decimal form.\n", buf); |
4731 | else | 4736 | else |
4732 | iwl4965_hw_reg_set_txpower(priv, val); | 4737 | iwl_set_tx_power(priv, val, false); |
4733 | 4738 | ||
4734 | return count; | 4739 | return count; |
4735 | } | 4740 | } |