Introduce iic_intr_disestablish() and use it in ihidev(4).
authorkettenis <kettenis@openbsd.org>
Wed, 31 Aug 2022 15:14:01 +0000 (15:14 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 31 Aug 2022 15:14:01 +0000 (15:14 +0000)
ok jcs@

sys/dev/acpi/dwiic_acpi.c
sys/dev/i2c/i2cvar.h
sys/dev/i2c/ihidev.c
sys/dev/ic/dwiicvar.h

index 23b427b..ad8b977 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwiic_acpi.c,v 1.19 2022/04/06 18:59:27 naddy Exp $ */
+/* $OpenBSD: dwiic_acpi.c,v 1.20 2022/08/31 15:14:01 kettenis Exp $ */
 /*
  * Synopsys DesignWare I2C controller
  *
@@ -173,6 +173,7 @@ dwiic_acpi_attach(struct device *parent, struct device *self, void *aux)
        sc->sc_i2c_tag.ic_release_bus = dwiic_i2c_release_bus;
        sc->sc_i2c_tag.ic_exec = dwiic_i2c_exec;
        sc->sc_i2c_tag.ic_intr_establish = dwiic_i2c_intr_establish;
+       sc->sc_i2c_tag.ic_intr_disestablish = dwiic_i2c_intr_disestablish;
        sc->sc_i2c_tag.ic_intr_string = dwiic_i2c_intr_string;
 
        bzero(&sc->sc_iba, sizeof(sc->sc_iba));
@@ -312,6 +313,13 @@ dwiic_i2c_intr_establish(void *cookie, void *ih, int level,
            level, func, arg, name);
 }
 
+void
+dwiic_i2c_intr_disestablish(void *cookie, void *ih)
+{
+       /* XXX GPIO interrupts */
+       acpi_intr_disestablish(ih);
+}
+
 const char *
 dwiic_i2c_intr_string(void *cookie, void *ih)
 {
index 7246922..346337a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: i2cvar.h,v 1.18 2022/02/09 07:58:24 visa Exp $        */
+/*     $OpenBSD: i2cvar.h,v 1.19 2022/08/31 15:14:01 kettenis Exp $    */
 /*     $NetBSD: i2cvar.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $       */
 
 /*
@@ -93,6 +93,7 @@ typedef struct i2c_controller {
 
        void    *(*ic_intr_establish)(void *, void *, int, int (*)(void *),
                    void *, const char *);
+       void    (*ic_intr_disestablish)(void *, void *);
        const char *(*ic_intr_string)(void *, void *);
 } *i2c_tag_t;
 
@@ -161,6 +162,8 @@ int iic_smbus_receive_byte(i2c_tag_t, i2c_addr_t, uint8_t *, int);
 #define iic_intr_establish(ic, ih, level, func, arg, name)             \
        (*(ic)->ic_intr_establish)((ic)->ic_cookie, (ih), (level),      \
            (func), (arg), (name))
+#define iic_intr_disestablish(ic, ih)                                  \
+       (*(ic)->ic_intr_disestablish)((ic)->ic_cookie, (ih))
 #define iic_intr_string(ic, ih)                                                \
        (*(ic)->ic_intr_string)((ic)->ic_cookie, (ih))
 
index 2d1d7e4..2337394 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.27 2022/05/20 05:03:45 anton Exp $ */
+/* $OpenBSD: ihidev.c,v 1.28 2022/08/31 15:14:01 kettenis Exp $ */
 /*
  * HID-over-i2c driver
  *
@@ -211,7 +211,7 @@ ihidev_detach(struct device *self, int flags)
        struct ihidev_softc *sc = (struct ihidev_softc *)self;
 
        if (sc->sc_ih != NULL) {
-               intr_disestablish(sc->sc_ih);
+               iic_intr_disestablish(sc->sc_tag, sc->sc_ih);
                sc->sc_ih = NULL;
        }
 
index 275e652..ea71891 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwiicvar.h,v 1.4 2020/02/18 12:13:39 mpi Exp $ */
+/* $OpenBSD: dwiicvar.h,v 1.5 2022/08/31 15:14:01 kettenis Exp $ */
 /*
  * Synopsys DesignWare I2C controller
  *
@@ -90,6 +90,7 @@ int           dwiic_intr(void *);
 
 void *         dwiic_i2c_intr_establish(void *, void *, int,
                    int (*)(void *), void *, const char *);
+void           dwiic_i2c_intr_disestablish(void *, void *);
 const char *   dwiic_i2c_intr_string(void *, void *);
 int            dwiic_i2c_print(void *, const char *);