diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2009-10-16 01:18:53 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:48:26 -0400 |
commit | 88e6195a911bce85adcc14e8377aa619e8054ab2 (patch) | |
tree | 84ce8e9681b9e20923027b934698429aa62ebb15 | |
parent | 7eae165e2d7dd32e88a641c0f38b2be840bcae07 (diff) |
iwmc3200wifi: Tx power setting
We can now set the Tx power from e.g. iwconfig.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/cfg80211.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/commands.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/commands.h | 6 |
3 files changed, 30 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c index 89edb6629426..af72cc746f15 100644 --- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c +++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c | |||
@@ -670,9 +670,19 @@ static int iwm_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
670 | static int iwm_cfg80211_set_txpower(struct wiphy *wiphy, | 670 | static int iwm_cfg80211_set_txpower(struct wiphy *wiphy, |
671 | enum tx_power_setting type, int dbm) | 671 | enum tx_power_setting type, int dbm) |
672 | { | 672 | { |
673 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); | ||
674 | int ret; | ||
675 | |||
673 | switch (type) { | 676 | switch (type) { |
674 | case TX_POWER_AUTOMATIC: | 677 | case TX_POWER_AUTOMATIC: |
675 | return 0; | 678 | return 0; |
679 | case TX_POWER_FIXED: | ||
680 | ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, | ||
681 | CFG_TX_PWR_LIMIT_USR, dbm * 2); | ||
682 | if (ret < 0) | ||
683 | return ret; | ||
684 | |||
685 | return iwm_tx_power_trigger(iwm); | ||
676 | default: | 686 | default: |
677 | return -EOPNOTSUPP; | 687 | return -EOPNOTSUPP; |
678 | } | 688 | } |
@@ -684,7 +694,7 @@ static int iwm_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) | |||
684 | { | 694 | { |
685 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); | 695 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); |
686 | 696 | ||
687 | *dbm = iwm->txpower; | 697 | *dbm = iwm->txpower >> 1; |
688 | 698 | ||
689 | return 0; | 699 | return 0; |
690 | } | 700 | } |
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c index aeea909992fe..d5125b7659a8 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.c +++ b/drivers/net/wireless/iwmc3200wifi/commands.c | |||
@@ -793,6 +793,19 @@ int iwm_invalidate_mlme_profile(struct iwm_priv *iwm) | |||
793 | return ret ? 0 : -EBUSY; | 793 | return ret ? 0 : -EBUSY; |
794 | } | 794 | } |
795 | 795 | ||
796 | int iwm_tx_power_trigger(struct iwm_priv *iwm) | ||
797 | { | ||
798 | struct iwm_umac_pwr_trigger pwr_trigger; | ||
799 | |||
800 | pwr_trigger.hdr.oid = UMAC_WIFI_IF_CMD_TX_PWR_TRIGGER; | ||
801 | pwr_trigger.hdr.buf_size = | ||
802 | cpu_to_le16(sizeof(struct iwm_umac_pwr_trigger) - | ||
803 | sizeof(struct iwm_umac_wifi_if)); | ||
804 | |||
805 | |||
806 | return iwm_send_wifi_if_cmd(iwm, &pwr_trigger, sizeof(pwr_trigger), 1); | ||
807 | } | ||
808 | |||
796 | int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags) | 809 | int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags) |
797 | { | 810 | { |
798 | struct iwm_udma_wifi_cmd udma_cmd = UDMA_UMAC_INIT; | 811 | struct iwm_udma_wifi_cmd udma_cmd = UDMA_UMAC_INIT; |
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.h b/drivers/net/wireless/iwmc3200wifi/commands.h index 511b6e395ac5..b36be2b23a3c 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.h +++ b/drivers/net/wireless/iwmc3200wifi/commands.h | |||
@@ -441,6 +441,11 @@ struct iwm_umac_tx_key_id { | |||
441 | u8 reserved[3]; | 441 | u8 reserved[3]; |
442 | } __attribute__ ((packed)); | 442 | } __attribute__ ((packed)); |
443 | 443 | ||
444 | struct iwm_umac_pwr_trigger { | ||
445 | struct iwm_umac_wifi_if hdr; | ||
446 | __le32 reseved; | ||
447 | } __attribute__ ((packed)); | ||
448 | |||
444 | struct iwm_umac_cmd_stats_req { | 449 | struct iwm_umac_cmd_stats_req { |
445 | __le32 flags; | 450 | __le32 flags; |
446 | } __attribute__ ((packed)); | 451 | } __attribute__ ((packed)); |
@@ -467,6 +472,7 @@ int iwm_invalidate_mlme_profile(struct iwm_priv *iwm); | |||
467 | int iwm_send_packet(struct iwm_priv *iwm, struct sk_buff *skb, int pool_id); | 472 | int iwm_send_packet(struct iwm_priv *iwm, struct sk_buff *skb, int pool_id); |
468 | int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx); | 473 | int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx); |
469 | int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key); | 474 | int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key); |
475 | int iwm_tx_power_trigger(struct iwm_priv *iwm); | ||
470 | int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags); | 476 | int iwm_send_umac_stats_req(struct iwm_priv *iwm, u32 flags); |
471 | int iwm_send_umac_channel_list(struct iwm_priv *iwm); | 477 | int iwm_send_umac_channel_list(struct iwm_priv *iwm); |
472 | int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids, | 478 | int iwm_scan_ssids(struct iwm_priv *iwm, struct cfg80211_ssid *ssids, |