diff options
author | 2016-04-10 16:43:17 +0000 | |
---|---|---|
committer | 2016-04-10 16:43:17 +0000 | |
commit | 985c1510ff2c50b7ee8345ee96c91434fbcc4990 (patch) | |
tree | 0605c03deb4463b4c44f0c9ef0a6c0946f2839d2 /sys/dev/i2c/ihidev.c | |
parent | Simple regression tests for rev(1), including UTF-8. (diff) | |
download | wireguard-openbsd-985c1510ff2c50b7ee8345ee96c91434fbcc4990.tar.xz wireguard-openbsd-985c1510ff2c50b7ee8345ee96c91434fbcc4990.zip |
Fix layer violation in the ihidev(4) code by implementing a generic mechanism
that allows the i2c controller implementation to establish interrupts on
behalf of i2c slave device drivers. Use this mechanism in dwiic(4) to let
it configure the right acpi interrupt (global or gpio). Change the level to
IPL_TTY as this is the appropriate level to use for keyboards and other
input devices.
ok jsg@
Diffstat (limited to 'sys/dev/i2c/ihidev.c')
-rw-r--r-- | sys/dev/i2c/ihidev.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index 804771930a1..57724b4003d 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.10 2016/04/02 00:56:39 jsg Exp $ */ +/* $OpenBSD: ihidev.c,v 1.11 2016/04/10 16:43:17 kettenis Exp $ */ /* * HID-over-i2c driver * @@ -30,12 +30,6 @@ #include <dev/hid/hid.h> -#if defined(__i386__) || defined(__amd64__) -#include "acpi.h" -#include <dev/acpi/acpivar.h> -#include <dev/acpi/amltypes.h> -#endif - /* #define IHIDEV_DEBUG */ #ifdef IHIDEV_DEBUG @@ -114,7 +108,9 @@ ihidev_attach(struct device *parent, struct device *self, void *aux) sc->sc_addr = ia->ia_addr; sc->sc_hid_desc_addr = ia->ia_size; - printf(": int %d", ia->ia_int); + /* XXX print proper interrupt string */ + if (ia->ia_intr) + printf(": interrupt"); if (ihidev_hid_command(sc, I2C_HID_CMD_DESCR, NULL) || ihidev_hid_desc_parse(sc)) { @@ -159,18 +155,11 @@ 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) { - sc->sc_ih = acpi_intr_establish(ia->ia_int, ia->ia_int_flags, - IPL_BIO, ihidev_intr, sc, sc->sc_dev.dv_xname); + if (ia->ia_intr) { + sc->sc_ih = iic_intr_establish(sc->sc_tag, ia->ia_intr, + IPL_TTY, ihidev_intr, sc, sc->sc_dev.dv_xname); if (sc->sc_ih == NULL) { - printf(", failed establishing intr\n"); + printf(", can't establish interrupt\n"); return; } } |