aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c51
1 files changed, 11 insertions, 40 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
49static int iwl4965_send_tx_power(struct iwl_priv *priv);
50
49/* module parameters */ 51/* module parameters */
50static struct iwl_mod_params iwl4965_mod_params = { 52static 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}
955int 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
961static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) 958static 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
1010static const struct iwl_channel_info *
1011iwl4965_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
1024static s32 iwl4965_get_tx_atten_grp(u16 channel) 1007static 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 */
1676int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) 1646static 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