diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-30 21:35:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-30 21:35:58 +0000 |
commit | b0fc800de7e8d3eaae874bc61f1b5cb7abcdf6c6 (patch) | |
tree | adeaa6f7b9f7a832bcfe1e4d7b13bdf7cca95974 /sys | |
parent | 6bb6daa43666dc1ad3b2689ee1024066e424018d (diff) |
Convert all powerhooks to activate functions, and provide powerhook stubs.
Of note: lcd stubs get pulled up to the parent; zts has to keep track of
whether it is in use or not
testing by myself and jakemsr; proof reading by oga
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm/mainbus/mainbus.c | 5 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa27x_udc.c | 26 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa27x_udc.h | 1 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0.c | 5 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_com.c | 29 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_lcd.c | 18 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_audio.c | 29 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_kbd.c | 28 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_scoop.c | 29 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_ssp.c | 27 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_udc.c | 10 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zts.c | 42 | ||||
-rw-r--r-- | sys/arch/zaurus/zaurus/zaurus_lcd.c | 36 |
13 files changed, 182 insertions, 103 deletions
diff --git a/sys/arch/arm/mainbus/mainbus.c b/sys/arch/arm/mainbus/mainbus.c index 86fbaae9720..8f2a1e9f1b1 100644 --- a/sys/arch/arm/mainbus/mainbus.c +++ b/sys/arch/arm/mainbus/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.4 2010/04/27 16:43:23 drahn Exp $ */ +/* $OpenBSD: mainbus.c,v 1.5 2010/08/30 21:35:57 deraadt Exp $ */ /* $NetBSD: mainbus.c,v 1.3 2001/06/13 17:52:43 nathanw Exp $ */ /* @@ -70,7 +70,8 @@ int mainbussearch (struct device *, void *, void *); /* attach and device structures for the device */ struct cfattach mainbus_ca = { - sizeof(struct device), mainbusmatch, mainbusattach + sizeof(struct device), mainbusmatch, mainbusattach, NULL, + config_activate_children }; struct cfdriver mainbus_cd = { diff --git a/sys/arch/arm/xscale/pxa27x_udc.c b/sys/arch/arm/xscale/pxa27x_udc.c index ab417857403..9f2d4a014eb 100644 --- a/sys/arch/arm/xscale/pxa27x_udc.c +++ b/sys/arch/arm/xscale/pxa27x_udc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa27x_udc.c,v 1.25 2010/08/27 05:04:06 deraadt Exp $ */ +/* $OpenBSD: pxa27x_udc.c,v 1.26 2010/08/30 21:35:55 deraadt Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -52,7 +52,7 @@ struct pxaudc_pipe { // LIST_ENTRY(pxaudc_pipe) list; }; -void pxaudc_power(int, void *); +void pxaudc_powerhook(int, void *); void pxaudc_enable(struct pxaudc_softc *); void pxaudc_disable(struct pxaudc_softc *); @@ -200,7 +200,7 @@ pxaudc_attach(struct pxaudc_softc *sc, void *aux) return; } - sc->sc_powerhook = powerhook_establish(pxaudc_power, sc); + sc->sc_powerhook = powerhook_establish(pxaudc_powerhook, sc); /* Set up the bus struct. */ sc->sc_bus.methods = &pxaudc_bus_methods; @@ -245,20 +245,26 @@ pxaudc_detach(struct pxaudc_softc *sc, int flags) return (0); } -void -pxaudc_power(int why, void *arg) +int +pxaudc_activate(struct pxaudc_softc *self, int act) { - struct pxaudc_softc *sc = (struct pxaudc_softc *)arg; + struct pxaudc_softc *sc = (struct pxaudc_softc *)self; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: pxaudc_disable(sc); break; - - case PWR_RESUME: + case DVACT_RESUME: pxaudc_enable(sc); break; } + return 0; +} + +void +pxaudc_powerhook(int why, void *arg) +{ + pxaudc_activate(arg, why); } /* diff --git a/sys/arch/arm/xscale/pxa27x_udc.h b/sys/arch/arm/xscale/pxa27x_udc.h index db34ebd3783..4dbe728af6f 100644 --- a/sys/arch/arm/xscale/pxa27x_udc.h +++ b/sys/arch/arm/xscale/pxa27x_udc.h @@ -65,3 +65,4 @@ struct pxaudc_softc { int pxaudc_match(void); void pxaudc_attach(struct pxaudc_softc *, void *); int pxaudc_detach(struct pxaudc_softc *, int); +int pxaudc_activate(struct pxaudc_softc *, int); diff --git a/sys/arch/arm/xscale/pxa2x0.c b/sys/arch/arm/xscale/pxa2x0.c index 6c2ccec9e01..ce543461ba2 100644 --- a/sys/arch/arm/xscale/pxa2x0.c +++ b/sys/arch/arm/xscale/pxa2x0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0.c,v 1.15 2008/11/22 17:08:03 drahn Exp $ */ +/* $OpenBSD: pxa2x0.c,v 1.16 2010/08/30 21:35:55 deraadt Exp $ */ /* $NetBSD: pxa2x0.c,v 1.5 2003/12/12 16:42:44 thorpej Exp $ */ /* @@ -129,7 +129,8 @@ CFATTACH_DECL(pxaip, sizeof(struct pxaip_softc), pxaip_match, pxaip_attach, NULL, NULL); #else struct cfattach pxaip_ca = { - sizeof(struct pxaip_softc), pxaip_match, pxaip_attach + sizeof(struct pxaip_softc), pxaip_match, pxaip_attach, NULL, + config_activate_children }; struct cfdriver pxaip_cd = { diff --git a/sys/arch/arm/xscale/pxa2x0_com.c b/sys/arch/arm/xscale/pxa2x0_com.c index ac3adc38da3..c14344ce10b 100644 --- a/sys/arch/arm/xscale/pxa2x0_com.c +++ b/sys/arch/arm/xscale/pxa2x0_com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_com.c,v 1.10 2010/08/27 05:04:06 deraadt Exp $ */ +/* $OpenBSD: pxa2x0_com.c,v 1.11 2010/08/30 21:35:55 deraadt Exp $ */ /* $NetBSD: pxa2x0_com.c,v 1.4 2003/07/15 00:24:55 lukem Exp $ */ /* @@ -63,10 +63,12 @@ int pxauart_match(struct device *, void *, void *); void pxauart_attach(struct device *, struct device *, void *); -void pxauart_power(int why, void *); +int pxauart_activate(struct device *, int); +void pxauart_powerhook(int why, void *); struct cfattach com_pxaip_ca = { - sizeof (struct com_softc), pxauart_match, pxauart_attach + sizeof (struct com_softc), pxauart_match, pxauart_attach, NULL, + pxauart_activate }; int @@ -144,25 +146,25 @@ pxauart_attach(struct device *parent, struct device *self, void *aux) (void)pxa2x0_intr_establish(pxa->pxa_intr, IPL_TTY, comintr, sc, sc->sc_dev.dv_xname); - (void)powerhook_establish(&pxauart_power, sc); + (void)powerhook_establish(pxauart_powerhook, sc); } -void -pxauart_power(int why, void *arg) +int +pxauart_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: #ifdef __zaurus__ if (sc->enabled && ISSET(sc->sc_hwflags, COM_HW_SIR)) scoop_set_irled(0); #endif break; - case PWR_RESUME: + case DVACT_RESUME: if (sc->enabled) { sc->sc_initialize = 1; comparam(tp, &tp->t_termios); @@ -178,4 +180,11 @@ pxauart_power(int why, void *arg) } break; } + return 0; +} + +void +pxauart_powerhook(int why, void *arg) +{ + pxauart_activate(arg, why); } diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c index 835425f37bc..d465256341c 100644 --- a/sys/arch/arm/xscale/pxa2x0_lcd.c +++ b/sys/arch/arm/xscale/pxa2x0_lcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_lcd.c,v 1.23 2010/08/27 05:04:06 deraadt Exp $ */ +/* $OpenBSD: pxa2x0_lcd.c,v 1.24 2010/08/30 21:35:55 deraadt Exp $ */ /* $NetBSD: pxa2x0_lcd.c,v 1.8 2003/10/03 07:24:05 bsh Exp $ */ /* @@ -843,19 +843,3 @@ pxa2x0_lcd_resume(struct pxa2x0_lcd_softc *sc) pxa2x0_lcd_start_dma(sc->iot, sc->ioh, sc->active); } } - -void -pxa2x0_lcd_power(int why, void *v) -{ - struct pxa2x0_lcd_softc *sc = v; - - switch (why) { - case PWR_SUSPEND: - pxa2x0_lcd_suspend(sc); - break; - - case PWR_RESUME: - pxa2x0_lcd_resume(sc); - break; - } -} diff --git a/sys/arch/zaurus/dev/zaurus_audio.c b/sys/arch/zaurus/dev/zaurus_audio.c index 22799cfb682..2bd220e2c94 100644 --- a/sys/arch/zaurus/dev/zaurus_audio.c +++ b/sys/arch/zaurus/dev/zaurus_audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_audio.c,v 1.12 2010/08/27 05:04:11 deraadt Exp $ */ +/* $OpenBSD: zaurus_audio.c,v 1.13 2010/08/30 21:35:57 deraadt Exp $ */ /* * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org> @@ -56,7 +56,8 @@ int zaudio_match(struct device *, void *, void *); void zaudio_attach(struct device *, struct device *, void *); int zaudio_detach(struct device *, int); -void zaudio_power(int, void *); +int zaudio_activate(struct device *, int); +void zaudio_powerhook(int, void *); #define ZAUDIO_OP_SPKR 0 #define ZAUDIO_OP_HP 1 @@ -97,7 +98,7 @@ struct zaudio_softc { struct cfattach zaudio_ca = { sizeof(struct zaudio_softc), zaudio_match, zaudio_attach, - zaudio_detach + zaudio_detach, zaudio_activate }; struct cfdriver zaudio_cd = { @@ -199,7 +200,7 @@ zaudio_attach(struct device *parent, struct device *self, void *aux) struct pxaip_attach_args *pxa = aux; int err; - sc->sc_powerhook = powerhook_establish(zaudio_power, sc); + sc->sc_powerhook = powerhook_establish(zaudio_powerhook, sc); if (sc->sc_powerhook == NULL) { printf(": unable to establish powerhook\n"); return; @@ -276,23 +277,29 @@ zaudio_detach(struct device *self, int flags) return (0); } -void -zaudio_power(int why, void *arg) +int +zaudio_activate(struct device *self, int act) { - struct zaudio_softc *sc = arg; + struct zaudio_softc *sc = (struct zaudio_softc *)self; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: timeout_del(&sc->sc_to); zaudio_standby(sc); break; - - case PWR_RESUME: + case DVACT_RESUME: pxa2x0_i2s_init(&sc->sc_i2s); pxa2x0_i2c_init(&sc->sc_i2c); zaudio_init(sc); break; } + return 0; +} + +void +zaudio_powerhook(int why, void *arg) +{ + zaudio_activate(arg, why); } void diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c index 689e764da0c..5aa281938d6 100644 --- a/sys/arch/zaurus/dev/zaurus_kbd.c +++ b/sys/arch/zaurus/dev/zaurus_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_kbd.c,v 1.29 2007/09/17 01:33:33 krw Exp $ */ +/* $OpenBSD: zaurus_kbd.c,v 1.30 2010/08/30 21:35:57 deraadt Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -116,18 +116,20 @@ struct zkbd_softc *zkbd_dev; /* XXX */ int zkbd_match(struct device *, void *, void *); void zkbd_attach(struct device *, struct device *, void *); +int zkbd_activate(struct device *, int); int zkbd_irq(void *v); void zkbd_poll(void *v); int zkbd_on(void *v); int zkbd_sync(void *v); int zkbd_hinge(void *v); -void zkbd_power(int why, void *arg); +void zkbd_powerhook(int why, void *arg); int zkbd_modstate; struct cfattach zkbd_ca = { - sizeof(struct zkbd_softc), zkbd_match, zkbd_attach + sizeof(struct zkbd_softc), zkbd_match, zkbd_attach, NULL, + zkbd_activate }; struct cfdriver zkbd_cd = { @@ -182,7 +184,7 @@ zkbd_attach(struct device *parent, struct device *self, void *aux) #endif /* Determine which system we are - XXX */ - sc->sc_powerhook = powerhook_establish(zkbd_power, sc); + sc->sc_powerhook = powerhook_establish(zkbd_powerhook, sc); if (sc->sc_powerhook == NULL) { printf(": unable to establish powerhook\n"); return; @@ -572,8 +574,22 @@ zkbd_cnpollc(void *v, int on) { } +int +zkbd_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_SUSPEND: + zkbd_hinge(self); + break; + case DVACT_RESUME: + zkbd_hinge(self); + break; + } + return 0; +} + void -zkbd_power(int why, void *arg) +zkbd_powerhook(int why, void *arg) { - zkbd_hinge(arg); + zkbd_activate(arg, why); } diff --git a/sys/arch/zaurus/dev/zaurus_scoop.c b/sys/arch/zaurus/dev/zaurus_scoop.c index 6629bfa9b0d..8f0a3f7cdaf 100644 --- a/sys/arch/zaurus/dev/zaurus_scoop.c +++ b/sys/arch/zaurus/dev/zaurus_scoop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_scoop.c,v 1.19 2010/08/27 05:04:11 deraadt Exp $ */ +/* $OpenBSD: zaurus_scoop.c,v 1.20 2010/08/30 21:35:57 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> @@ -46,9 +46,11 @@ struct scoop_softc { int scoopmatch(struct device *, void *, void *); void scoopattach(struct device *, struct device *, void *); +int scoop_activate(struct device *, int); struct cfattach scoop_ca = { - sizeof (struct scoop_softc), scoopmatch, scoopattach + sizeof (struct scoop_softc), scoopmatch, scoopattach, NULL, + scoop_activate }; struct cfdriver scoop_cd = { @@ -67,7 +69,7 @@ void scoop0_set_card_power(enum card, int); struct timeout scoop_checkdisk; void scoop_timeout(void *); -void scoop_power(int, void *); +void scoop_powerhook(int, void *); int scoopmatch(struct device *parent, void *match, void *aux) @@ -120,7 +122,7 @@ scoopattach(struct device *parent, struct device *self, void *aux) printf(": PCMCIA/GPIO controller\n"); - sc->sc_powerhook = powerhook_establish(scoop_power, sc); + sc->sc_powerhook = powerhook_establish(scoop_powerhook, sc); if (sc->sc_powerhook == NULL) panic("Unable to establish %s powerhook", sc->sc_dev.dv_xname); @@ -448,13 +450,13 @@ scoop_timeout(void *v) timeout_add(&scoop_checkdisk, hz/25); } -void -scoop_power(int why, void *arg) +int +scoop_activate(struct device *self, int act) { - struct scoop_softc *sc = arg; + struct scoop_softc *sc = (struct scoop_softc *)self; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: /* * Nothing should use the scoop from this point on. * No timeouts, no interrupts (even though interrupts @@ -466,11 +468,18 @@ scoop_power(int why, void *arg) scoop_suspend(); } break; - case PWR_RESUME: + case DVACT_RESUME: if (sc->sc_dev.dv_unit == 0) { scoop_resume(); sc->sc_suspended = 0; } break; } + return 0; +} + +void +scoop_powerhook(int why, void *arg) +{ + scoop_activate(arg, why); } diff --git a/sys/arch/zaurus/dev/zaurus_ssp.c b/sys/arch/zaurus/dev/zaurus_ssp.c index 1bbaf13a9f7..b66b75a7824 100644 --- a/sys/arch/zaurus/dev/zaurus_ssp.c +++ b/sys/arch/zaurus/dev/zaurus_ssp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_ssp.c,v 1.6 2005/04/08 21:58:49 uwe Exp $ */ +/* $OpenBSD: zaurus_ssp.c,v 1.7 2010/08/30 21:35:57 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> @@ -45,6 +45,7 @@ struct zssp_softc { int zssp_match(struct device *, void *, void *); void zssp_attach(struct device *, struct device *, void *); void zssp_init(void); +int zssp_activate(struct device *, int); void zssp_powerhook(int, void *); int zssp_read_max1111(u_int32_t); @@ -52,7 +53,8 @@ u_int32_t zssp_read_ads7846(u_int32_t); void zssp_write_lz9jg18(u_int32_t); struct cfattach zssp_ca = { - sizeof (struct zssp_softc), zssp_match, zssp_attach + sizeof (struct zssp_softc), zssp_match, zssp_attach, NULL, + zssp_activate }; struct cfdriver zssp_cd = { @@ -108,16 +110,23 @@ zssp_init(void) pxa2x0_gpio_set_function(GPIO_TG_CS_C3000, GPIO_OUT|GPIO_SET); } -void -zssp_powerhook(int why, void *arg) +int +zssp_activate(struct device *self, int act) { - int s; - - if (why == PWR_RESUME) { - s = splhigh(); + switch (act) { + case DVACT_SUSPEND: + break; + case DVACT_RESUME: zssp_init(); - splx(s); + break; } + return 0; +} + +void +zssp_powerhook(int why, void *arg) +{ + zssp_activate(arg, why); } /* diff --git a/sys/arch/zaurus/dev/zaurus_udc.c b/sys/arch/zaurus/dev/zaurus_udc.c index 11f0ed234a3..1b4ab46881b 100644 --- a/sys/arch/zaurus/dev/zaurus_udc.c +++ b/sys/arch/zaurus/dev/zaurus_udc.c @@ -37,6 +37,7 @@ int zaurus_udc_match(struct device *, void *, void *); void zaurus_udc_attach(struct device *, struct device *, void *); int zaurus_udc_detach(struct device *, int); +int zaurus_udc_activate(struct device *, int); int zaurus_udc_is_host(void); struct cfattach pxaudc_zaurus_ca = { @@ -44,6 +45,7 @@ struct cfattach pxaudc_zaurus_ca = { zaurus_udc_match, zaurus_udc_attach, zaurus_udc_detach, + zaurus_udc_activate }; int @@ -95,3 +97,11 @@ zaurus_udc_detach(struct device *self, int flags) return pxaudc_detach(sc, flags); } + +int +zaurus_udc_activate(struct device *self, int act) +{ + struct pxaudc_softc *sc = (struct pxaudc_softc *)self; + + return pxaudc_activate(sc, act); +} diff --git a/sys/arch/zaurus/dev/zts.c b/sys/arch/zaurus/dev/zts.c index 54bf415cbb0..9e8969f8acf 100644 --- a/sys/arch/zaurus/dev/zts.c +++ b/sys/arch/zaurus/dev/zts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zts.c,v 1.12 2010/08/27 05:04:11 deraadt Exp $ */ +/* $OpenBSD: zts.c,v 1.13 2010/08/30 21:35:57 deraadt Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -71,9 +71,10 @@ struct tsscale { int zts_match(struct device *, void *, void *); void zts_attach(struct device *, struct device *, void *); +int zts_activate(struct device *, int); int zts_enable(void *); void zts_disable(void *); -void zts_power(int, void *); +void zts_powerhook(int, void *); void zts_poll(void *); int zts_irq(void *); int zts_ioctl(void *, u_long, caddr_t, int, struct proc *); @@ -84,6 +85,7 @@ struct zts_softc { void *sc_gh; void *sc_powerhook; int sc_enabled; + int sc_running; int sc_buttons; /* button emulation ? */ struct device *sc_wsmousedev; int sc_oldx; @@ -94,7 +96,8 @@ struct zts_softc { }; struct cfattach zts_ca = { - sizeof(struct zts_softc), zts_match, zts_attach + sizeof(struct zts_softc), zts_match, zts_attach, NULL, + zts_activate }; struct cfdriver zts_cd = { @@ -155,7 +158,7 @@ zts_enable(void *v) timeout_del(&sc->sc_ts_poll); - sc->sc_powerhook = powerhook_establish(zts_power, sc); + sc->sc_powerhook = powerhook_establish(zts_powerhook, sc); if (sc->sc_powerhook == NULL) { printf("%s: enable failed\n", sc->sc_dev.dv_xname); return ENOMEM; @@ -173,6 +176,7 @@ zts_enable(void *v) /* enable interrupts */ sc->sc_enabled = 1; + sc->sc_running = 1; sc->sc_buttons = 0; return 0; @@ -199,16 +203,19 @@ zts_disable(void *v) /* disable interrupts */ sc->sc_enabled = 0; + sc->sc_running = 0; } -void -zts_power(int why, void *v) +int +zts_activate(struct device *self, int act) { - struct zts_softc *sc = v; + struct zts_softc *sc = (struct zts_softc *)self; - switch (why) { - case PWR_SUSPEND: - sc->sc_enabled = 0; + switch (act) { + case DVACT_SUSPEND: + if (sc->sc_enabled == 0) + break; + sc->sc_running = 0; #if 0 pxa2x0_gpio_intr_disestablish(sc->sc_gh); #endif @@ -224,7 +231,9 @@ zts_power(int why, void *v) GPIO_OUT | GPIO_SET); break; - case PWR_RESUME: + case DVACT_RESUME: + if (sc->sc_enabled == 0) + break; pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); pxa2x0_gpio_intr_mask(sc->sc_gh); @@ -239,9 +248,16 @@ zts_power(int why, void *v) #else pxa2x0_gpio_intr_unmask(sc->sc_gh); #endif - sc->sc_enabled = 1; + sc->sc_running = 1; break; } + return 0; +} + +void +zts_powerhook(int why, void *v) +{ + zts_activate(v, why); } struct zts_pos { @@ -492,7 +508,7 @@ zts_irq(void *v) int down; extern int zkbd_modstate; - if (!sc->sc_enabled) + if (!sc->sc_running) return 0; s = splhigh(); diff --git a/sys/arch/zaurus/zaurus/zaurus_lcd.c b/sys/arch/zaurus/zaurus/zaurus_lcd.c index d239787f3a9..eabf4ca34e2 100644 --- a/sys/arch/zaurus/zaurus/zaurus_lcd.c +++ b/sys/arch/zaurus/zaurus/zaurus_lcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_lcd.c,v 1.22 2010/08/27 05:04:11 deraadt Exp $ */ +/* $OpenBSD: zaurus_lcd.c,v 1.23 2010/08/30 21:35:57 deraadt Exp $ */ /* $NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp $ */ /* @@ -62,8 +62,9 @@ #include <dev/rasops/rasops.h> -void lcd_attach(struct device *, struct device *, void *); int lcd_match(struct device *, void *, void *); +void lcd_attach(struct device *, struct device *, void *); +int lcd_activate(struct device *, int); int lcd_cnattach(void (*)(u_int, int)); /* @@ -107,7 +108,8 @@ const struct wsdisplay_accessops lcd_accessops = { }; struct cfattach lcd_pxaip_ca = { - sizeof (struct pxa2x0_lcd_softc), lcd_match, lcd_attach + sizeof (struct pxa2x0_lcd_softc), lcd_match, lcd_attach, NULL, + lcd_activate }; struct cfdriver lcd_cd = { @@ -161,7 +163,7 @@ void lcd_set_brightness_internal(int); int lcd_get_backlight(void); void lcd_set_backlight(int); void lcd_blank(int); -void lcd_power(int, void *); +void lcd_powerhook(int, void *); int lcd_match(struct device *parent, void *cf, void *aux) @@ -192,7 +194,7 @@ lcd_attach(struct device *parent, struct device *self, void *aux) /* Start with approximately 40% of full brightness. */ lcd_set_brightness(3); - (void)powerhook_establish(lcd_power, sc); + (void)powerhook_establish(lcd_powerhook, sc); } int @@ -396,19 +398,27 @@ lcd_blank(int blank) } } -void -lcd_power(int why, void *v) +int +lcd_activate(struct device *self, int act) { + struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self; - switch (why) { - case PWR_SUSPEND: + switch (act) { + case DVACT_SUSPEND: lcd_set_brightness(0); - pxa2x0_lcd_power(why, v); + pxa2x0_lcd_suspend(sc); break; - - case PWR_RESUME: - pxa2x0_lcd_power(why, v); + case DVACT_RESUME: + pxa2x0_lcd_resume(sc); lcd_set_brightness(lcd_get_brightness()); break; } + return 0; } + +void +lcd_powerhook(int why, void *v) +{ + lcd_activate(v, why); +} + |