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>
This commit is contained in:
Nick Hibma 2000-01-20 22:24:35 +00:00
parent fc096eaad4
commit 341777d004
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56348
5 changed files with 17 additions and 10 deletions

View file

@ -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

View file

@ -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));

View file

@ -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}
};

View file

@ -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)
{

View file

@ -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); \