Commit 4032ec63 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: fix suspend/resume issue in brcmsmac

PCI PM suspend callback took down the interface and resume brought
it back up. In the mac80211 context this is done in subsequent calls.
Rework implementation so that suspend only stores config, and sets
PCI power state. The resume return to full power state (D0), restores
the config, and brings hardware back up. Full bringup is done by
subsequent mac80211 calls.
Reviewed-by: default avatarBrett Rudley <brudley@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d062d44a
...@@ -209,11 +209,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw) ...@@ -209,11 +209,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw)
struct wl_info *wl = hw->priv; struct wl_info *wl = hw->priv;
ASSERT(wl); ASSERT(wl);
WL_LOCK(wl); WL_LOCK(wl);
wl_down(wl);
ieee80211_stop_queues(hw); ieee80211_stop_queues(hw);
WL_UNLOCK(wl); WL_UNLOCK(wl);
return;
} }
static int static int
...@@ -246,7 +243,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -246,7 +243,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
static void static void
wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{ {
return; struct wl_info *wl;
wl = HW_TO_WL(hw);
/* put driver in down state */
WL_LOCK(wl);
wl_down(wl);
WL_UNLOCK(wl);
} }
static int static int
...@@ -779,7 +783,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs, ...@@ -779,7 +783,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,
wl_found++; wl_found++;
return wl; return wl;
fail: fail:
wl_free(wl); wl_free(wl);
fail1: fail1:
return NULL; return NULL;
...@@ -1090,7 +1094,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1090,7 +1094,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
} }
#ifdef LINUXSTA_PS
static int wl_suspend(struct pci_dev *pdev, pm_message_t state) static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct wl_info *wl; struct wl_info *wl;
...@@ -1105,11 +1108,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1105,11 +1108,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
return -ENODEV; return -ENODEV;
} }
/* only need to flag hw is down for proper resume */
WL_LOCK(wl); WL_LOCK(wl);
wl_down(wl);
wl->pub->hw_up = false; wl->pub->hw_up = false;
WL_UNLOCK(wl); WL_UNLOCK(wl);
pci_save_state(pdev, wl->pci_psstate);
pci_save_state(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
return pci_set_power_state(pdev, PCI_D3hot); return pci_set_power_state(pdev, PCI_D3hot);
} }
...@@ -1133,7 +1137,7 @@ static int wl_resume(struct pci_dev *pdev) ...@@ -1133,7 +1137,7 @@ static int wl_resume(struct pci_dev *pdev)
if (err) if (err)
return err; return err;
pci_restore_state(pdev, wl->pci_psstate); pci_restore_state(pdev);
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) if (err)
...@@ -1145,13 +1149,12 @@ static int wl_resume(struct pci_dev *pdev) ...@@ -1145,13 +1149,12 @@ static int wl_resume(struct pci_dev *pdev)
if ((val & 0x0000ff00) != 0) if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
WL_LOCK(wl); /*
err = wl_up(wl); * done. driver will be put in up state
WL_UNLOCK(wl); * in wl_ops_add_interface() call.
*/
return err; return err;
} }
#endif /* LINUXSTA_PS */
static void wl_remove(struct pci_dev *pdev) static void wl_remove(struct pci_dev *pdev)
{ {
...@@ -1184,14 +1187,12 @@ static void wl_remove(struct pci_dev *pdev) ...@@ -1184,14 +1187,12 @@ static void wl_remove(struct pci_dev *pdev)
} }
static struct pci_driver wl_pci_driver = { static struct pci_driver wl_pci_driver = {
.name = "brcm80211", .name = "brcm80211",
.probe = wl_pci_probe, .probe = wl_pci_probe,
#ifdef LINUXSTA_PS .suspend = wl_suspend,
.suspend = wl_suspend, .resume = wl_resume,
.resume = wl_resume, .remove = __devexit_p(wl_remove),
#endif /* LINUXSTA_PS */ .id_table = wl_id_table,
.remove = __devexit_p(wl_remove),
.id_table = wl_id_table,
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment