aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-03-26 13:14:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:27 -0400
commit6da3a13e4fcab0ff58592087d28bd283caf23d88 (patch)
tree1b67e34373d8b17ae66a66526cc72dfd6ad067b1 /drivers/net/wireless/iwlwifi/iwl-agn.c
parent4f5cab969bdbec1ab0c5b690282372b4978123ac (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/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c54
1 files changed, 4 insertions, 50 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 3889158b359c..2cb073efb95d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1654,7 +1654,7 @@ static void __iwl_down(struct iwl_priv *priv)
1654 ieee80211_stop_queues(priv->hw); 1654 ieee80211_stop_queues(priv->hw);
1655 1655
1656 /* If we have not previously called iwl_init() then 1656 /* If we have not previously called iwl_init() then
1657 * clear all bits but the RF Kill and SUSPEND bits and return */ 1657 * clear all bits but the RF Kill bits and return */
1658 if (!iwl_is_init(priv)) { 1658 if (!iwl_is_init(priv)) {
1659 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 1659 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1660 STATUS_RF_KILL_HW | 1660 STATUS_RF_KILL_HW |
@@ -1662,23 +1662,19 @@ static void __iwl_down(struct iwl_priv *priv)
1662 STATUS_RF_KILL_SW | 1662 STATUS_RF_KILL_SW |
1663 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1663 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1664 STATUS_GEO_CONFIGURED | 1664 STATUS_GEO_CONFIGURED |
1665 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
1666 STATUS_IN_SUSPEND |
1667 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1665 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
1668 STATUS_EXIT_PENDING; 1666 STATUS_EXIT_PENDING;
1669 goto exit; 1667 goto exit;
1670 } 1668 }
1671 1669
1672 /* ...otherwise clear out all the status bits but the RF Kill and 1670 /* ...otherwise clear out all the status bits but the RF Kill
1673 * SUSPEND bits and continue taking the NIC down. */ 1671 * bits and continue taking the NIC down. */
1674 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << 1672 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1675 STATUS_RF_KILL_HW | 1673 STATUS_RF_KILL_HW |
1676 test_bit(STATUS_RF_KILL_SW, &priv->status) << 1674 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
1677 STATUS_RF_KILL_SW | 1675 STATUS_RF_KILL_SW |
1678 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1676 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1679 STATUS_GEO_CONFIGURED | 1677 STATUS_GEO_CONFIGURED |
1680 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
1681 STATUS_IN_SUSPEND |
1682 test_bit(STATUS_FW_ERROR, &priv->status) << 1678 test_bit(STATUS_FW_ERROR, &priv->status) <<
1683 STATUS_FW_ERROR | 1679 STATUS_FW_ERROR |
1684 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1680 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
@@ -1703,7 +1699,7 @@ static void __iwl_down(struct iwl_priv *priv)
1703 udelay(5); 1699 udelay(5);
1704 1700
1705 /* FIXME: apm_ops.suspend(priv) */ 1701 /* FIXME: apm_ops.suspend(priv) */
1706 if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status)) 1702 if (exit_pending)
1707 priv->cfg->ops->lib->apm_ops.stop(priv); 1703 priv->cfg->ops->lib->apm_ops.stop(priv);
1708 else 1704 else
1709 priv->cfg->ops->lib->apm_ops.reset(priv); 1705 priv->cfg->ops->lib->apm_ops.reset(priv);
@@ -2064,9 +2060,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2064 2060
2065 IWL_DEBUG_INFO(priv, "Start UP work done.\n"); 2061 IWL_DEBUG_INFO(priv, "Start UP work done.\n");
2066 2062
2067 if (test_bit(STATUS_IN_SUSPEND, &priv->status))
2068 return 0;
2069
2070 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from 2063 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from
2071 * mac80211 will not be run successfully. */ 2064 * mac80211 will not be run successfully. */
2072 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 2065 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
@@ -3566,45 +3559,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
3566 ieee80211_free_hw(priv->hw); 3559 ieee80211_free_hw(priv->hw);
3567} 3560}
3568 3561
3569#ifdef CONFIG_PM
3570
3571static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
3572{
3573 struct iwl_priv *priv = pci_get_drvdata(pdev);
3574
3575 if (priv->is_open) {
3576 set_bit(STATUS_IN_SUSPEND, &priv->status);
3577 iwl_mac_stop(priv->hw);
3578 priv->is_open = 1;
3579 }
3580
3581 pci_save_state(pdev);
3582 pci_disable_device(pdev);
3583 pci_set_power_state(pdev, PCI_D3hot);
3584
3585 return 0;
3586}
3587
3588static int iwl_pci_resume(struct pci_dev *pdev)
3589{
3590 struct iwl_priv *priv = pci_get_drvdata(pdev);
3591 int ret;
3592
3593 pci_set_power_state(pdev, PCI_D0);
3594 ret = pci_enable_device(pdev);
3595 if (ret)
3596 return ret;
3597 pci_restore_state(pdev);
3598 iwl_enable_interrupts(priv);
3599
3600 if (priv->is_open)
3601 iwl_mac_start(priv->hw);
3602
3603 clear_bit(STATUS_IN_SUSPEND, &priv->status);
3604 return 0;
3605}
3606
3607#endif /* CONFIG_PM */
3608 3562
3609/***************************************************************************** 3563/*****************************************************************************
3610 * 3564 *