diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-06-13 03:44:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:11 -0400 |
commit | 14a08a7fcf72a8d69cdee225cc76c50b229faa20 (patch) | |
tree | fed4f75ab3551b205184a7cbecf6b7f532dd3c08 /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 14b3d3387c95cc78f3d740ea53577d9ff41415e3 (diff) |
iwlwifi: unify SW rf-kill flow
This patch unifies SW rf-kill flow between 4965 and 5000. It enables SW
RF-kill for 5000. This patch also solves a bug in iwl4965_mac_config:
bad mutex locking balance.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
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/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 90 |
1 files changed, 5 insertions, 85 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index a9da17ce0e1d..f5911687671b 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -379,28 +379,6 @@ static int iwl4965_send_bt_config(struct iwl_priv *priv) | |||
379 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); | 379 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); |
380 | } | 380 | } |
381 | 381 | ||
382 | /* | ||
383 | * CARD_STATE_CMD | ||
384 | * | ||
385 | * Use: Sets the device's internal card state to enable, disable, or halt | ||
386 | * | ||
387 | * When in the 'enable' state the card operates as normal. | ||
388 | * When in the 'disable' state, the card enters into a low power mode. | ||
389 | * When in the 'halt' state, the card is shut down and must be fully | ||
390 | * restarted to come back on. | ||
391 | */ | ||
392 | static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) | ||
393 | { | ||
394 | struct iwl_host_cmd cmd = { | ||
395 | .id = REPLY_CARD_STATE_CMD, | ||
396 | .len = sizeof(u32), | ||
397 | .data = &flags, | ||
398 | .meta.flags = meta_flag, | ||
399 | }; | ||
400 | |||
401 | return iwl_send_cmd(priv, &cmd); | ||
402 | } | ||
403 | |||
404 | static void iwl_clear_free_frames(struct iwl_priv *priv) | 382 | static void iwl_clear_free_frames(struct iwl_priv *priv) |
405 | { | 383 | { |
406 | struct list_head *element; | 384 | struct list_head *element; |
@@ -916,65 +894,6 @@ static void iwl4965_set_rate(struct iwl_priv *priv) | |||
916 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 894 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
917 | } | 895 | } |
918 | 896 | ||
919 | int iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio) | ||
920 | { | ||
921 | unsigned long flags; | ||
922 | |||
923 | if (!!disable_radio == test_bit(STATUS_RF_KILL_SW, &priv->status)) | ||
924 | return 0; | ||
925 | |||
926 | IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO %s\n", | ||
927 | disable_radio ? "OFF" : "ON"); | ||
928 | |||
929 | if (disable_radio) { | ||
930 | iwl_scan_cancel(priv); | ||
931 | /* FIXME: This is a workaround for AP */ | ||
932 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | ||
933 | spin_lock_irqsave(&priv->lock, flags); | ||
934 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, | ||
935 | CSR_UCODE_SW_BIT_RFKILL); | ||
936 | spin_unlock_irqrestore(&priv->lock, flags); | ||
937 | /* call the host command only if no hw rf-kill set */ | ||
938 | if (!test_bit(STATUS_RF_KILL_HW, &priv->status) && | ||
939 | iwl_is_ready(priv)) | ||
940 | iwl4965_send_card_state(priv, | ||
941 | CARD_STATE_CMD_DISABLE, | ||
942 | 0); | ||
943 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
944 | |||
945 | /* make sure mac80211 stop sending Tx frame */ | ||
946 | if (priv->mac80211_registered) | ||
947 | ieee80211_stop_queues(priv->hw); | ||
948 | } | ||
949 | return 0; | ||
950 | } | ||
951 | |||
952 | spin_lock_irqsave(&priv->lock, flags); | ||
953 | iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | ||
954 | |||
955 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | ||
956 | spin_unlock_irqrestore(&priv->lock, flags); | ||
957 | |||
958 | /* wake up ucode */ | ||
959 | msleep(10); | ||
960 | |||
961 | spin_lock_irqsave(&priv->lock, flags); | ||
962 | iwl_read32(priv, CSR_UCODE_DRV_GP1); | ||
963 | if (!iwl_grab_nic_access(priv)) | ||
964 | iwl_release_nic_access(priv); | ||
965 | spin_unlock_irqrestore(&priv->lock, flags); | ||
966 | |||
967 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | ||
968 | IWL_DEBUG_RF_KILL("Can not turn radio back on - " | ||
969 | "disabled by HW switch\n"); | ||
970 | return 0; | ||
971 | } | ||
972 | |||
973 | if (priv->is_open) | ||
974 | queue_work(priv->workqueue, &priv->restart); | ||
975 | return 1; | ||
976 | } | ||
977 | |||
978 | #define IWL_PACKET_RETRY_TIME HZ | 897 | #define IWL_PACKET_RETRY_TIME HZ |
979 | 898 | ||
980 | int iwl4965_is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) | 899 | int iwl4965_is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) |
@@ -2982,13 +2901,14 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
2982 | 2901 | ||
2983 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); | 2902 | priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); |
2984 | 2903 | ||
2985 | 2904 | if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) { | |
2986 | if (priv->cfg->ops->lib->radio_kill_sw && | ||
2987 | priv->cfg->ops->lib->radio_kill_sw(priv, !conf->radio_enabled)) { | ||
2988 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); | 2905 | IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n"); |
2989 | mutex_unlock(&priv->mutex); | 2906 | goto out; |
2990 | } | 2907 | } |
2991 | 2908 | ||
2909 | if (!conf->radio_enabled) | ||
2910 | iwl_radio_kill_sw_disable_radio(priv); | ||
2911 | |||
2992 | if (!iwl_is_ready(priv)) { | 2912 | if (!iwl_is_ready(priv)) { |
2993 | IWL_DEBUG_MAC80211("leave - not ready\n"); | 2913 | IWL_DEBUG_MAC80211("leave - not ready\n"); |
2994 | ret = -EIO; | 2914 | ret = -EIO; |