aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2008-06-11 21:47:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:07 -0400
commit64e72c3efc2e4753ddfdd27ba8c7a31d6b11faba (patch)
tree261bdc9c2fc8433144ab2ced3d073238d83bd163 /drivers/net/wireless/iwlwifi/iwl4965-base.c
parent77c5d08e6c18e5c749f125d7df70bc7d54cb4cd8 (diff)
iwlwifi: fix resume SW RF-kill
This patch fixes SW RF-kill. If we resumed from S3 state with SW RF-kill set, the driver wouldn't be able to remove SW RF-kill. This patch fixes this. Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com> 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.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index de40e893f09e..7a9567c634c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1260,12 +1260,12 @@ static void iwl4965_set_rate(struct iwl_priv *priv)
1260 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 1260 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1261} 1261}
1262 1262
1263void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 1263int iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1264{ 1264{
1265 unsigned long flags; 1265 unsigned long flags;
1266 1266
1267 if (!!disable_radio == test_bit(STATUS_RF_KILL_SW, &priv->status)) 1267 if (!!disable_radio == test_bit(STATUS_RF_KILL_SW, &priv->status))
1268 return; 1268 return 0;
1269 1269
1270 IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO %s\n", 1270 IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO %s\n",
1271 disable_radio ? "OFF" : "ON"); 1271 disable_radio ? "OFF" : "ON");
@@ -1290,7 +1290,7 @@ void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1290 if (priv->mac80211_registered) 1290 if (priv->mac80211_registered)
1291 ieee80211_stop_queues(priv->hw); 1291 ieee80211_stop_queues(priv->hw);
1292 } 1292 }
1293 return; 1293 return 0;
1294 } 1294 }
1295 1295
1296 spin_lock_irqsave(&priv->lock, flags); 1296 spin_lock_irqsave(&priv->lock, flags);
@@ -1311,11 +1311,11 @@ void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1311 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 1311 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
1312 IWL_DEBUG_RF_KILL("Can not turn radio back on - " 1312 IWL_DEBUG_RF_KILL("Can not turn radio back on - "
1313 "disabled by HW switch\n"); 1313 "disabled by HW switch\n");
1314 return; 1314 return 0;
1315 } 1315 }
1316 1316
1317 queue_work(priv->workqueue, &priv->restart); 1317 queue_work(priv->workqueue, &priv->restart);
1318 return; 1318 return 1;
1319} 1319}
1320 1320
1321#define IWL_PACKET_RETRY_TIME HZ 1321#define IWL_PACKET_RETRY_TIME HZ
@@ -3028,13 +3028,6 @@ static int __iwl4965_up(struct iwl_priv *priv)
3028 return -EIO; 3028 return -EIO;
3029 } 3029 }
3030 3030
3031 if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
3032 IWL_WARNING("Radio disabled by SW RF kill (module "
3033 "parameter)\n");
3034 iwl_rfkill_set_hw_state(priv);
3035 return -ENODEV;
3036 }
3037
3038 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 3031 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
3039 IWL_ERROR("ucode not available for device bringup\n"); 3032 IWL_ERROR("ucode not available for device bringup\n");
3040 return -EIO; 3033 return -EIO;
@@ -3088,7 +3081,8 @@ static int __iwl4965_up(struct iwl_priv *priv)
3088 priv->ucode_data.len); 3081 priv->ucode_data.len);
3089 3082
3090 /* We return success when we resume from suspend and rf_kill is on. */ 3083 /* We return success when we resume from suspend and rf_kill is on. */
3091 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) 3084 if (test_bit(STATUS_RF_KILL_HW, &priv->status) ||
3085 test_bit(STATUS_RF_KILL_SW, &priv->status))
3092 return 0; 3086 return 0;
3093 3087
3094 for (i = 0; i < MAX_HW_RESTARTS; i++) { 3088 for (i = 0; i < MAX_HW_RESTARTS; i++) {
@@ -3115,6 +3109,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
3115 3109
3116 set_bit(STATUS_EXIT_PENDING, &priv->status); 3110 set_bit(STATUS_EXIT_PENDING, &priv->status);
3117 __iwl4965_down(priv); 3111 __iwl4965_down(priv);
3112 clear_bit(STATUS_EXIT_PENDING, &priv->status);
3118 3113
3119 /* tried to restart and config the device for as long as our 3114 /* tried to restart and config the device for as long as our
3120 * patience could withstand */ 3115 * patience could withstand */
@@ -3860,6 +3855,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
3860 3855
3861 priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); 3856 priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP);
3862 3857
3858
3859 if (priv->cfg->ops->lib->radio_kill_sw &&
3860 priv->cfg->ops->lib->radio_kill_sw(priv, !conf->radio_enabled)) {
3861 IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n");
3862 mutex_unlock(&priv->mutex);
3863 }
3864
3863 if (!iwl_is_ready(priv)) { 3865 if (!iwl_is_ready(priv)) {
3864 IWL_DEBUG_MAC80211("leave - not ready\n"); 3866 IWL_DEBUG_MAC80211("leave - not ready\n");
3865 ret = -EIO; 3867 ret = -EIO;
@@ -3912,9 +3914,6 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
3912 } 3914 }
3913#endif 3915#endif
3914 3916
3915 if (priv->cfg->ops->lib->radio_kill_sw)
3916 priv->cfg->ops->lib->radio_kill_sw(priv, !conf->radio_enabled);
3917
3918 if (!conf->radio_enabled) { 3917 if (!conf->radio_enabled) {
3919 IWL_DEBUG_MAC80211("leave - radio disabled\n"); 3918 IWL_DEBUG_MAC80211("leave - radio disabled\n");
3920 goto out; 3919 goto out;