summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2010-07-02 06:08:39 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2010-07-02 06:08:39 +0000
commit673d2556ff72247015b2897f5fc1eb0b10b62468 (patch)
tree3113388a7e378428e5f45e45893e80ee434112bd /sys/dev/pci
parent471d0db055b7514429553c2fe60eac3c46b393aa (diff)
Add an ath_pci_activate callback for ACPI suspend/resume with ath(4).
The card now should come back after resume and doesn't need a manual ifconfig down/up. ok deraadt@ mlarkin@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_ath_pci.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/dev/pci/if_ath_pci.c b/sys/dev/pci/if_ath_pci.c
index f267bb4304a..74334a7eb6e 100644
--- a/sys/dev/pci/if_ath_pci.c
+++ b/sys/dev/pci/if_ath_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ath_pci.c,v 1.20 2009/08/10 20:29:52 deraadt Exp $ */
+/* $OpenBSD: if_ath_pci.c,v 1.21 2010/07/02 06:08:38 reyk Exp $ */
/* $NetBSD: if_ath_pci.c,v 1.7 2004/06/30 05:58:17 mycroft Exp $ */
/*-
@@ -91,12 +91,14 @@ struct ath_pci_softc {
int ath_pci_match(struct device *, void *, void *);
void ath_pci_attach(struct device *, struct device *, void *);
int ath_pci_detach(struct device *, int);
+int ath_pci_activate(struct device *, int);
struct cfattach ath_pci_ca = {
sizeof(struct ath_pci_softc),
ath_pci_match,
ath_pci_attach,
- ath_pci_detach
+ ath_pci_detach,
+ ath_pci_activate
};
int
@@ -205,3 +207,21 @@ ath_pci_detach(struct device *self, int flags)
return (0);
}
+
+int
+ath_pci_activate(struct device *self, int act)
+{
+ struct ath_pci_softc *psc = (struct ath_pci_softc *)self;
+ struct ath_softc *sc = &psc->sc_sc;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ /* It is safe to call ath's power hooks */
+ ath_power(PWR_SUSPEND, sc);
+ break;
+ case DVACT_RESUME:
+ ath_power(PWR_RESUME, sc);
+ break;
+ }
+ return (0);
+}