diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-03-26 13:14:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:27 -0400 |
commit | 6da3a13e4fcab0ff58592087d28bd283caf23d88 (patch) | |
tree | 1b67e34373d8b17ae66a66526cc72dfd6ad067b1 /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | 4f5cab969bdbec1ab0c5b690282372b4978123ac (diff) |
iwlwifi: merge and better support of suspend/resume for iwlagn and iwl3945
With mac80211's help to call stop() and start() in mac80211
suspend/resume function, both iwlagn and iwl3945 no longer calling
stop() and start(); remove un-necessary STATUS_IN_SUSPEND bit from both
header files and functions,
Move apm_ops.stop() function into pci_suspend() to ensure
DMA is stopped before go into suspend mode.
iwl3945 has the similar suspend/resume function as iwlagn, so move both
functions to iwlcore to be shared by both drivers.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 62 |
1 files changed, 8 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index da61ecd62882..afb838b39a6c 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2996,7 +2996,7 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
2996 | ieee80211_stop_queues(priv->hw); | 2996 | ieee80211_stop_queues(priv->hw); |
2997 | 2997 | ||
2998 | /* If we have not previously called iwl3945_init() then | 2998 | /* If we have not previously called iwl3945_init() then |
2999 | * clear all bits but the RF Kill and SUSPEND bits and return */ | 2999 | * clear all bits but the RF Kill bits and return */ |
3000 | if (!iwl_is_init(priv)) { | 3000 | if (!iwl_is_init(priv)) { |
3001 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 3001 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << |
3002 | STATUS_RF_KILL_HW | | 3002 | STATUS_RF_KILL_HW | |
@@ -3004,23 +3004,19 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3004 | STATUS_RF_KILL_SW | | 3004 | STATUS_RF_KILL_SW | |
3005 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 3005 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
3006 | STATUS_GEO_CONFIGURED | | 3006 | STATUS_GEO_CONFIGURED | |
3007 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
3008 | STATUS_IN_SUSPEND | | ||
3009 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 3007 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
3010 | STATUS_EXIT_PENDING; | 3008 | STATUS_EXIT_PENDING; |
3011 | goto exit; | 3009 | goto exit; |
3012 | } | 3010 | } |
3013 | 3011 | ||
3014 | /* ...otherwise clear out all the status bits but the RF Kill and | 3012 | /* ...otherwise clear out all the status bits but the RF Kill |
3015 | * SUSPEND bits and continue taking the NIC down. */ | 3013 | * bits and continue taking the NIC down. */ |
3016 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 3014 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << |
3017 | STATUS_RF_KILL_HW | | 3015 | STATUS_RF_KILL_HW | |
3018 | test_bit(STATUS_RF_KILL_SW, &priv->status) << | 3016 | test_bit(STATUS_RF_KILL_SW, &priv->status) << |
3019 | STATUS_RF_KILL_SW | | 3017 | STATUS_RF_KILL_SW | |
3020 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 3018 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
3021 | STATUS_GEO_CONFIGURED | | 3019 | STATUS_GEO_CONFIGURED | |
3022 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
3023 | STATUS_IN_SUSPEND | | ||
3024 | test_bit(STATUS_FW_ERROR, &priv->status) << | 3020 | test_bit(STATUS_FW_ERROR, &priv->status) << |
3025 | STATUS_FW_ERROR | | 3021 | STATUS_FW_ERROR | |
3026 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 3022 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
@@ -3044,7 +3040,7 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3044 | 3040 | ||
3045 | udelay(5); | 3041 | udelay(5); |
3046 | 3042 | ||
3047 | if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status)) | 3043 | if (exit_pending) |
3048 | priv->cfg->ops->lib->apm_ops.stop(priv); | 3044 | priv->cfg->ops->lib->apm_ops.stop(priv); |
3049 | else | 3045 | else |
3050 | priv->cfg->ops->lib->apm_ops.reset(priv); | 3046 | priv->cfg->ops->lib->apm_ops.reset(priv); |
@@ -3097,10 +3093,8 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
3097 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 3093 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
3098 | else { | 3094 | else { |
3099 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 3095 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
3100 | if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) { | 3096 | IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); |
3101 | IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); | 3097 | return -ENODEV; |
3102 | return -ENODEV; | ||
3103 | } | ||
3104 | } | 3098 | } |
3105 | 3099 | ||
3106 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 3100 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
@@ -3592,9 +3586,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) | |||
3592 | 3586 | ||
3593 | IWL_DEBUG_INFO(priv, "Start UP work.\n"); | 3587 | IWL_DEBUG_INFO(priv, "Start UP work.\n"); |
3594 | 3588 | ||
3595 | if (test_bit(STATUS_IN_SUSPEND, &priv->status)) | ||
3596 | return 0; | ||
3597 | |||
3598 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from | 3589 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from |
3599 | * mac80211 will not be run successfully. */ | 3590 | * mac80211 will not be run successfully. */ |
3600 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | 3591 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, |
@@ -5233,43 +5224,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
5233 | ieee80211_free_hw(priv->hw); | 5224 | ieee80211_free_hw(priv->hw); |
5234 | } | 5225 | } |
5235 | 5226 | ||
5236 | #ifdef CONFIG_PM | ||
5237 | |||
5238 | static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) | ||
5239 | { | ||
5240 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
5241 | |||
5242 | if (priv->is_open) { | ||
5243 | set_bit(STATUS_IN_SUSPEND, &priv->status); | ||
5244 | iwl3945_mac_stop(priv->hw); | ||
5245 | priv->is_open = 1; | ||
5246 | } | ||
5247 | pci_save_state(pdev); | ||
5248 | pci_disable_device(pdev); | ||
5249 | pci_set_power_state(pdev, PCI_D3hot); | ||
5250 | |||
5251 | return 0; | ||
5252 | } | ||
5253 | |||
5254 | static int iwl3945_pci_resume(struct pci_dev *pdev) | ||
5255 | { | ||
5256 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
5257 | int ret; | ||
5258 | |||
5259 | pci_set_power_state(pdev, PCI_D0); | ||
5260 | ret = pci_enable_device(pdev); | ||
5261 | if (ret) | ||
5262 | return ret; | ||
5263 | pci_restore_state(pdev); | ||
5264 | |||
5265 | if (priv->is_open) | ||
5266 | iwl3945_mac_start(priv->hw); | ||
5267 | |||
5268 | clear_bit(STATUS_IN_SUSPEND, &priv->status); | ||
5269 | return 0; | ||
5270 | } | ||
5271 | |||
5272 | #endif /* CONFIG_PM */ | ||
5273 | 5227 | ||
5274 | /***************************************************************************** | 5228 | /***************************************************************************** |
5275 | * | 5229 | * |
@@ -5283,8 +5237,8 @@ static struct pci_driver iwl3945_driver = { | |||
5283 | .probe = iwl3945_pci_probe, | 5237 | .probe = iwl3945_pci_probe, |
5284 | .remove = __devexit_p(iwl3945_pci_remove), | 5238 | .remove = __devexit_p(iwl3945_pci_remove), |
5285 | #ifdef CONFIG_PM | 5239 | #ifdef CONFIG_PM |
5286 | .suspend = iwl3945_pci_suspend, | 5240 | .suspend = iwl_pci_suspend, |
5287 | .resume = iwl3945_pci_resume, | 5241 | .resume = iwl_pci_resume, |
5288 | #endif | 5242 | #endif |
5289 | }; | 5243 | }; |
5290 | 5244 | ||