diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-04-02 00:56:40 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-04-02 00:56:40 +0000 |
commit | 1205b031a9ad9ffbd73b76f455e3bcf03051352d (patch) | |
tree | 50a48389d84c32e30aa2524c5a5848a62088d3c5 /sys/dev/i2c | |
parent | b54c4ee0cba313b9404baa78fdc8883273e79883 (diff) |
Add support for I2C HID devices with GPIO signalled interrupts.
Required for the keyboard and touchpad on the ideapad 100s.
ok kettenis@
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r-- | sys/dev/i2c/i2cvar.h | 3 | ||||
-rw-r--r-- | sys/dev/i2c/ihidev.c | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h index 5a8e71d67bd..40b487c379c 100644 --- a/sys/dev/i2c/i2cvar.h +++ b/sys/dev/i2c/i2cvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i2cvar.h,v 1.13 2016/01/12 17:30:23 deraadt Exp $ */ +/* $OpenBSD: i2cvar.h,v 1.14 2016/04/02 00:56:39 jsg Exp $ */ /* $NetBSD: i2cvar.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* @@ -110,6 +110,7 @@ struct i2c_attach_args { int ia_int_flags; /* IRQ flags */ char *ia_name; /* chip name */ void *ia_cookie; /* pass extra info from bus to dev */ + void *acpi_gpio; }; /* diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index 8d5c3e9118b..804771930a1 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.9 2016/01/29 17:11:58 jcs Exp $ */ +/* $OpenBSD: ihidev.c,v 1.10 2016/04/02 00:56:39 jsg Exp $ */ /* * HID-over-i2c driver * @@ -30,8 +30,11 @@ #include <dev/hid/hid.h> -/* XXX */ +#if defined(__i386__) || defined(__amd64__) +#include "acpi.h" #include <dev/acpi/acpivar.h> +#include <dev/acpi/amltypes.h> +#endif /* #define IHIDEV_DEBUG */ @@ -156,8 +159,14 @@ ihidev_attach(struct device *parent, struct device *self, void *aux) sc->sc_ibuf = malloc(sc->sc_isize, M_DEVBUF, M_NOWAIT | M_ZERO); /* register interrupt with system */ +#if NACPI > 0 + if (ia->ia_int > 0 && ia->acpi_gpio != NULL) { + struct acpi_gpio *gpio = ia->acpi_gpio; + gpio->intr_establish(gpio->cookie, ia->ia_int, + ia->ia_int_flags, ihidev_intr, sc); + } else +#endif if (ia->ia_int > 0) { - /* XXX: don't assume this uses acpi_intr_establish */ sc->sc_ih = acpi_intr_establish(ia->ia_int, ia->ia_int_flags, IPL_BIO, ihidev_intr, sc, sc->sc_dev.dv_xname); if (sc->sc_ih == NULL) { |