diff options
Diffstat (limited to 'sys/arch/zaurus/dev')
-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 |
6 files changed, 116 insertions, 49 deletions
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(); |