diff options
-rw-r--r-- | sys/arch/beagle/dev/omap_com.c | 29 | ||||
-rw-r--r-- | sys/arch/beagle/dev/omdisplay.c | 38 | ||||
-rw-r--r-- | sys/arch/beagle/dev/omehci.c | 48 | ||||
-rw-r--r-- | sys/arch/beagle/dev/omohci.c | 37 |
4 files changed, 89 insertions, 63 deletions
diff --git a/sys/arch/beagle/dev/omap_com.c b/sys/arch/beagle/dev/omap_com.c index 4bc45855173..c189293f524 100644 --- a/sys/arch/beagle/dev/omap_com.c +++ b/sys/arch/beagle/dev/omap_com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap_com.c,v 1.2 2010/08/27 05:04:08 deraadt Exp $ */ +/* $OpenBSD: omap_com.c,v 1.3 2010/08/30 21:32:20 deraadt Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. * All rights reserved. @@ -57,10 +57,12 @@ int omapuart_match(struct device *, void *, void *); void omapuart_attach(struct device *, struct device *, void *); +int omapuart_activate(struct device *, int); void omapuart_power(int why, void *); struct cfattach com_ahb_ca = { - sizeof (struct com_softc), omapuart_match, omapuart_attach + sizeof (struct com_softc), omapuart_match, omapuart_attach, NULL, + omapuart_activate }; int @@ -116,23 +118,22 @@ omapuart_attach(struct device *parent, struct device *self, void *aux) sc, sc->sc_dev.dv_xname); #if 0 - (void)powerhook_establish(&omapuart_power, sc); + (void)powerhook_establish(&omapuart_powerhook, sc); #endif } -#if 0 -void -omapuart_power(int why, void *arg) +int +omapuart_activate(struct device *self, int act) { - struct com_softc *sc = arg; + struct com_softc *sc = (struct com_softc *)self; bus_space_tag_t iot = sc->sc_iot; bus_space_handle_t ioh = sc->sc_ioh; struct tty *tp = sc->sc_tty; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: break; - case PWR_RESUME: + case DVACT_RESUME: if (sc->enabled) { sc->sc_initialize = 1; comparam(tp, &tp->t_termios); @@ -145,5 +146,13 @@ omapuart_power(int why, void *arg) } break; } + return 0; +} + +#if 0 +void +omapuart_power(int why, void *arg) +{ + omapuart_activate(arg, why); } #endif diff --git a/sys/arch/beagle/dev/omdisplay.c b/sys/arch/beagle/dev/omdisplay.c index 89dc48bf8f6..85cdfdcca56 100644 --- a/sys/arch/beagle/dev/omdisplay.c +++ b/sys/arch/beagle/dev/omdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omdisplay.c,v 1.3 2010/08/27 05:04:08 deraadt Exp $ */ +/* $OpenBSD: omdisplay.c,v 1.4 2010/08/30 21:32:20 deraadt Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> * @@ -424,6 +424,7 @@ struct omdisplay_softc { int omdisplay_match(struct device *parent, void *v, void *aux); void omdisplay_attach(struct device *parent, struct device *self, void *args); +int omdisplay_activate(struct device *, int); int omdisplay_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p); void omdisplay_burner(void *v, u_int on, u_int flags); @@ -440,7 +441,7 @@ void omdisplay_set_backlight(int on); void omdisplay_blank(int blank); void omdisplay_suspend(struct omdisplay_softc *sc); void omdisplay_resume(struct omdisplay_softc *sc); -void omdisplay_power(int why, void *v); +void omdisplay_powerhook(int why, void *v); void omdisplay_initialize(struct omdisplay_softc *sc, struct omdisplay_panel_data *geom); void omdisplay_setup_rasops(struct omdisplay_softc *sc, @@ -457,7 +458,8 @@ int omdisplay_intr(void *v); void omdisplay_dumpreg(struct omdisplay_softc *sc); struct cfattach omdisplay_ca = { - sizeof (struct omdisplay_softc), omdisplay_match, omdisplay_attach + sizeof (struct omdisplay_softc), omdisplay_match, omdisplay_attach, + NULL, omdisplay_activate }; struct cfdriver omdisplay_cd = { @@ -573,7 +575,7 @@ omdisplay_attach(struct device *parent, struct device *self, void *args) /* backlight? */ /* powerhook? */ - sc->sc_ph = powerhook_establish(omdisplay_power, sc); + sc->sc_ph = powerhook_establish(omdisplay_powerhook, sc); } @@ -864,24 +866,28 @@ omdisplay_resume(struct omdisplay_softc *sc) } void -omdisplay_power(int why, void *v) +omdisplay_activate(struct device *self, int act) { - struct omdisplay_softc *sc = v; + struct omdisplay_softc *sc = (struct omdisplay_softc *)self; - switch (why) { - case PWR_SUSPEND: - omdisplay_set_brightness(0); + switch (act) { + case DVACT_SUSPEND: + omdisplay_set_brightness(0); omdisplay_suspend(sc); - break; - - case PWR_RESUME: + break; + case DVACT_RESUME: omdisplay_resume(sc); - omdisplay_set_brightness(omdisplay_get_brightness()); - break; - } + omdisplay_set_brightness(omdisplay_get_brightness()); + break; + } + return 0; } - +void +omdisplay_powerhook(int why, void *v) +{ + return omdisplay_activate(v, why); +} void omdisplay_initialize(struct omdisplay_softc *sc, diff --git a/sys/arch/beagle/dev/omehci.c b/sys/arch/beagle/dev/omehci.c index 028aa6dc710..a4c2cd58bd0 100644 --- a/sys/arch/beagle/dev/omehci.c +++ b/sys/arch/beagle/dev/omehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omehci.c,v 1.2 2010/08/27 05:04:08 deraadt Exp $ */ +/* $OpenBSD: omehci.c,v 1.3 2010/08/30 21:32:20 deraadt Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -40,7 +40,8 @@ int omehci_match(struct device *, void *, void *); void omehci_attach(struct device *, struct device *, void *); int omehci_detach(struct device *, int); -void omehci_power(int, void *); +int omehci_activate(struct device *, int); +void omehci_powerhook(int, void *); struct omehci_softc { ehci_softc_t sc; @@ -52,7 +53,7 @@ void omehci_disable(struct omehci_softc *); struct cfattach omehci_ca = { sizeof (struct omehci_softc), omehci_match, omehci_attach, - omehci_detach, ehci_activate + omehci_detach, omehci_activate }; int @@ -137,7 +138,7 @@ omehci_attach(struct device *parent, struct device *self, void *aux) } #if 0 - sc->sc.sc_powerhook = powerhook_establish(omehci_power, sc); + sc->sc.sc_powerhook = powerhook_establish(omehci_powerhook, sc); if (sc->sc.sc_powerhook == NULL) printf("%s: cannot establish powerhook\n", devname); #endif @@ -182,35 +183,38 @@ omehci_detach(struct device *self, int flags) return (0); } - -#if 0 -void -omehci_power(int why, void *arg) +int +omehci_activate(struct device *self, int act) { - struct omehci_softc *sc = (struct omehci_softc *)arg; - int s; - - s = splhardusb(); - sc->sc.sc_bus.use_polling++; - switch (why) { - case PWR_SUSPEND: - ohci_power(why, &sc->sc); + struct omehci_softc *sc = (struct omehci_softc *)self; + + switch (act) { + case DVACT_SUSPEND: + sc->sc.sc_bus.use_polling++; #if 0 + ohci_powerhook(act, &sc->sc); prcm_disableclock(PRCM_CLK_EN_USB); #endif + sc->sc.sc_bus.use_polling--; break; - - case PWR_RESUME: + case DVACT_RESUME: + sc->sc.sc_bus.use_polling++; prcm_enableclock(PRCM_CLK_EN_USB); - #if 0 omehci_enable(sc); + ohci_powerhook(act, &sc->sc); #endif - ohci_power(why, &sc->sc); + sc->sc.sc_bus.use_polling--; break; } - sc->sc.sc_bus.use_polling--; - splx(s); + return 0; +} + +#if 0 +void +omehci_powerhook(int why, void *arg) +{ + omehci_activate(arg, why); } #endif diff --git a/sys/arch/beagle/dev/omohci.c b/sys/arch/beagle/dev/omohci.c index b01f4d18f3a..843f74778e7 100644 --- a/sys/arch/beagle/dev/omohci.c +++ b/sys/arch/beagle/dev/omohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omohci.c,v 1.2 2010/08/27 05:04:08 deraadt Exp $ */ +/* $OpenBSD: omohci.c,v 1.3 2010/08/30 21:32:20 deraadt Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -95,7 +95,8 @@ int omohci_match(struct device *, void *, void *); void omohci_attach(struct device *, struct device *, void *); int omohci_detach(struct device *, int); -void omohci_power(int, void *); +int omohci_activate(struct device *, int); +void omohci_powerhook(int, void *); struct omohci_softc { ohci_softc_t sc; @@ -112,7 +113,7 @@ void omohci_disable(struct omohci_softc *); struct cfattach omohci_ca = { sizeof (struct omohci_softc), omohci_match, omohci_attach, - omohci_detach, ohci_activate + omohci_detach, omohci_detach }; int @@ -224,7 +225,7 @@ omohci_attach(struct device *parent, struct device *self, void *aux) return; } - sc->sc.sc_powerhook = powerhook_establish(omohci_power, sc); + sc->sc.sc_powerhook = powerhook_establish(omohci_powerhook, sc); if (sc->sc.sc_powerhook == NULL) printf("%s: cannot establish powerhook\n", sc->sc.sc_bus.bdev.dv_xname); @@ -279,32 +280,38 @@ omohci_detach(struct device *self, int flags) } -void -omohci_power(int why, void *arg) +int +omohci_activate(struct device *self, int act) { - struct omohci_softc *sc = (struct omohci_softc *)arg; - int s; + struct omohci_softc *sc = (struct omohci_softc *)self; - s = splhardusb(); - sc->sc.sc_bus.use_polling++; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: + sc->sc.sc_bus.use_polling++; ohci_power(why, &sc->sc); #if 0 pxa2x0_clkman_config(CKEN_USBHC, 0); #endif + sc->sc.sc_bus.use_polling--; break; - case PWR_RESUME: + case DVACT_RESUME: + sc->sc.sc_bus.use_polling++; #if 0 pxa2x0_clkman_config(CKEN_USBHC, 1); #endif omohci_enable(sc); ohci_power(why, &sc->sc); + sc->sc.sc_bus.use_polling--; break; } - sc->sc.sc_bus.use_polling--; - splx(s); + return 0; +} + +int +omohci_powerhook(int why, void *arg) +{ + omohci_activate(arg, why); } void |