tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
sk and bwi power hooks
Hi,
Ok to commit these ? sk(c) is similar to what msk(c) does and was tested
on an Asus P5Q-E motherboard. bwi patch was tested on Dell Inspiron 2200
that reports Broadcom BCM4318 AirForce One 54g.
Index: if_sk.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_sk.c,v
retrieving revision 1.59
diff -u -p -r1.59 if_sk.c
--- if_sk.c 18 Mar 2009 16:00:19 -0000 1.59
+++ if_sk.c 21 Apr 2009 18:35:15 -0000
@@ -210,6 +210,10 @@ void sk_setfilt(struct sk_if_softc *, vo
void sk_setmulti(struct sk_if_softc *);
void sk_tick(void *);
+static bool skc_suspend(device_t dv PMF_FN_ARGS);
+static bool skc_resume(device_t dv PMF_FN_ARGS);
+static bool sk_resume(device_t dv PMF_FN_ARGS);
+
/* #define SK_DEBUG 2 */
#ifdef SK_DEBUG
#define DPRINTF(x) if (skdebug) printf x
@@ -1458,6 +1462,11 @@ sk_attach(device_t parent, device_t self
RND_TYPE_NET, 0);
#endif
+ if (!pmf_device_register(self, NULL, sk_resume))
+ aprint_error_dev(self, "couldn't establish power handler\n");
+ else
+ pmf_class_network_register(self, ifp);
+
DPRINTFN(2, ("sk_attach: end\n"));
return;
@@ -1815,6 +1824,9 @@ skc_attach(device_t parent, device_t sel
goto fail_1;
}
+ if (!pmf_device_register(self, skc_suspend, skc_resume))
+ aprint_error_dev(self, "couldn't establish power handler\n");
+
return;
fail_1:
@@ -2939,6 +2951,43 @@ sk_stop(struct ifnet *ifp, int disable)
ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
}
+/* Power Management Framework */
+
+static bool
+skc_suspend(device_t dv PMF_FN_ARGS)
+{
+ struct sk_softc *sc = device_private(dv);
+
+ DPRINTFN(2, ("skc_suspend\n"));
+
+ /* Turn off the driver is loaded LED */
+ CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_OFF);
+
+ return true;
+}
+
+static bool
+skc_resume(device_t dv PMF_FN_ARGS)
+{
+ struct sk_softc *sc = device_private(dv);
+
+ DPRINTFN(2, ("skc_resume\n"));
+
+ sk_reset(sc);
+ CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_ON);
+
+ return true;
+}
+
+static bool
+sk_resume(device_t dv PMF_FN_ARGS)
+{
+ struct sk_if_softc *sc_if = device_private(dv);
+
+ sk_init_yukon(sc_if);
+ return true;
+}
+
CFATTACH_DECL_NEW(skc, sizeof(struct sk_softc),
skc_probe, skc_attach, NULL, NULL);
Index: ic/bwi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/bwi.c,v
retrieving revision 1.7
diff -u -r1.7 bwi.c
--- ic/bwi.c 18 Mar 2009 17:06:49 -0000 1.7
+++ ic/bwi.c 16 Apr 2009 14:05:35 -0000
@@ -9739,3 +9739,23 @@
return (bwi_rf_calc_rssi(mac, hdr));
}
+
+bool
+bwi_suspend(device_t dv PMF_FN_ARGS)
+{
+ struct bwi_softc *sc = device_private(dv);
+
+ bwi_power_off(sc, 0);
+
+ return true;
+}
+
+bool
+bwi_resume(device_t dv PMF_FN_ARGS)
+{
+ struct bwi_softc *sc = device_private(dv);
+
+ bwi_power_on(sc, 1);
+
+ return true;
+}
Index: ic/bwivar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/bwivar.h,v
retrieving revision 1.2
diff -u -r1.2 bwivar.h
--- ic/bwivar.h 9 Jan 2009 20:49:42 -0000 1.2
+++ ic/bwivar.h 16 Apr 2009 14:05:35 -0000
@@ -791,4 +791,8 @@
int bwi_attach(struct bwi_softc *);
void bwi_detach(struct bwi_softc *);
+/* Power Management Framework */
+bool bwi_suspend(device_t db PMF_FN_ARGS);
+bool bwi_resume(device_t db PMF_FN_ARGS);
+
#endif /* !_DEV_IC_BWIVAR_H */
Index: pci/if_bwi_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_bwi_pci.c,v
retrieving revision 1.3
diff -u -r1.3 if_bwi_pci.c
--- pci/if_bwi_pci.c 10 Jan 2009 12:55:45 -0000 1.3
+++ pci/if_bwi_pci.c 16 Apr 2009 14:05:35 -0000
@@ -161,6 +161,9 @@
sc->sc_pci_subvid = PCI_VENDOR(reg);
sc->sc_pci_subdid = PCI_PRODUCT(reg);
+ if (!pmf_device_register(self, bwi_suspend, bwi_resume))
+ aprint_error_dev(self, "couldn't establish power
handler\n");
+
bwi_attach(sc);
}
@@ -170,6 +173,8 @@
struct bwi_pci_softc *psc = (struct bwi_pci_softc *)self;
struct bwi_softc *sc = &psc->psc_bwi;
+ pmf_device_deregister(self);
+
bwi_detach(sc);
if (sc->sc_ih != NULL) {
--
Mihai
Home |
Main Index |
Thread Index |
Old Index