summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-01-20 22:24:35 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-01-20 22:24:35 +0000
commitac7818da203e78d3ce5712161676189545230d9b (patch)
tree0ac6312f6de5fa613a895428606b3f6dad59cb21 /sys/dev
parentc5a17a034f1da1b9574226a95740c0b74196639f (diff)
downloadFreeBSD-src-ac7818da203e78d3ce5712161676189545230d9b.zip
FreeBSD-src-ac7818da203e78d3ce5712161676189545230d9b.tar.gz
Add support for DEVICE_SUSPEND, DEVICE_RESUME and DEVICE_SHUTDOWN
methods for USB devices. However: with none of the devices I have here suspend seems to work properly. This is probably a bug in uhci_power which I still have to look at. Prodded and pushed by: Christopher Masto <chris@netmonger.net>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uhci.c6
-rw-r--r--sys/dev/usb/uhcivar.h3
-rw-r--r--sys/dev/usb/uhub.c10
-rw-r--r--sys/dev/usb/usb.c6
-rw-r--r--sys/dev/usb/usb_port.h2
5 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 3e907d8..8d754b8 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -150,10 +150,6 @@ struct uhci_pipe {
LIST_HEAD(, uhci_intr_info) uhci_ii_free;
static void uhci_busreset __P((uhci_softc_t *));
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-static void uhci_shutdown __P((void *v));
-static void uhci_power __P((int, void *));
-#endif
static usbd_status uhci_run __P((uhci_softc_t *, int run));
static uhci_soft_td_t *uhci_alloc_std __P((uhci_softc_t *));
static void uhci_free_std __P((uhci_softc_t *, uhci_soft_td_t *));
@@ -543,7 +539,6 @@ uhci_freex(bus, xfer)
SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
/*
* Shut down the controller when the system is going down.
*/
@@ -626,7 +621,6 @@ uhci_power(why, v)
}
splx(s);
}
-#endif
#ifdef UHCI_DEBUG
static void
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index 82e4c1e..381df9b 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -177,3 +177,6 @@ int uhci_detach __P((uhci_softc_t *, int));
int uhci_activate __P((device_ptr_t, enum devact));
#endif
+void uhci_shutdown __P((void *v));
+void uhci_power __P((int state, void *priv));
+
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index a0087de..8b1edbb 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -104,7 +104,11 @@ struct cfattach uhub_uhub_ca = {
};
#elif defined(__FreeBSD__)
USB_DECLARE_DRIVER_INIT(uhub,
- DEVMETHOD(bus_child_detached, uhub_child_detached));
+ DEVMETHOD(bus_child_detached, uhub_child_detached),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown)
+ );
/* Create the driver instance for the hub connected to usb case. */
devclass_t uhubroot_devclass;
@@ -112,8 +116,10 @@ devclass_t uhubroot_devclass;
static device_method_t uhubroot_methods[] = {
DEVMETHOD(device_probe, uhub_match),
DEVMETHOD(device_attach, uhub_attach),
-
/* detach is not allowed for a root hub */
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_suspend),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
{0,0}
};
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 891aca7..4a166db 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -174,7 +174,11 @@ extern int cold;
static const char *usbrev_str[] = USBREV_STR;
-USB_DECLARE_DRIVER(usb);
+USB_DECLARE_DRIVER_INIT(usb,
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown)
+ );
USB_MATCH(usb)
{
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 70b41c9..8ab7c31 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -296,7 +296,7 @@ __CONCAT(dname,_detach)(self, flags) \
#define PWR_SUSPEND 1
#define PWR_RESUME 0
-#define USB_DECLARE_DRIVER_INIT(dname, init) \
+#define USB_DECLARE_DRIVER_INIT(dname, init...) \
static device_probe_t __CONCAT(dname,_match); \
static device_attach_t __CONCAT(dname,_attach); \
static device_detach_t __CONCAT(dname,_detach); \
OpenPOWER on IntegriCloud