summaryrefslogtreecommitdiff
path: root/sys/arch/zaurus/dev/zaurus_kbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/zaurus/dev/zaurus_kbd.c')
-rw-r--r--sys/arch/zaurus/dev/zaurus_kbd.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c
index 916771d0bc7..9b83459b19f 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.22 2005/05/24 20:32:43 uwe Exp $ */
+/* $OpenBSD: zaurus_kbd.c,v 1.23 2005/05/25 07:29:17 drahn Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
*
@@ -109,6 +109,7 @@ struct zkbd_softc {
char sc_rep[MAXKEYS];
int sc_nrep;
#endif
+ void *sc_powerhook;
};
struct zkbd_softc *zkbd_dev; /* XXX */
@@ -121,6 +122,7 @@ 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);
int zkbd_modstate;
@@ -180,6 +182,12 @@ 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);
+ if (sc->sc_powerhook == NULL) {
+ printf(": unable to establish powerhook\n");
+ return;
+ }
+
if (1 /* C3000 */) {
sc->sc_sense_array = gpio_sense_pins_c3000;
sc->sc_strobe_array = gpio_strobe_pins_c3000;
@@ -573,3 +581,14 @@ void
zkbd_cnpollc(void *v, int on)
{
}
+
+void
+zkbd_power(int why, void *arg)
+{
+ struct zkbd_softc *sc = arg;
+ int a = pxa2x0_gpio_get_bit(sc->sc_swa_pin) ? 1 : 0;
+ int b = pxa2x0_gpio_get_bit(sc->sc_swb_pin) ? 2 : 0;
+
+ /* probably should check why */
+ sc->sc_hinge = a | b;
+}