summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/ihidev.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/i2c/ihidev.c')
-rw-r--r--sys/dev/i2c/ihidev.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index 4e65a4bf350..de0c29ba2fb 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.32 2024/08/19 09:26:58 kettenis Exp $ */
+/* $OpenBSD: ihidev.c,v 1.33 2024/10/18 12:53:49 tobhe Exp $ */
/*
* HID-over-i2c driver
*
@@ -67,6 +67,7 @@ int ihidev_activate(struct device *, int);
int ihidev_hid_command(struct ihidev_softc *, int, void *);
int ihidev_intr(void *);
+int ihidev_poweron(struct ihidev_softc *);
int ihidev_reset(struct ihidev_softc *);
int ihidev_hid_desc_parse(struct ihidev_softc *);
@@ -248,7 +249,7 @@ ihidev_activate(struct device *self, int act)
sc->sc_dev.dv_xname);
break;
case DVACT_WAKEUP:
- ihidev_reset(sc);
+ ihidev_poweron(sc);
sc->sc_dying = 0;
if (sc->sc_poll && timeout_initialized(&sc->sc_timer))
timeout_add(&sc->sc_timer, 2000);
@@ -525,7 +526,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
}
int
-ihidev_reset(struct ihidev_softc *sc)
+ihidev_poweron(struct ihidev_softc *sc)
{
DPRINTF(("%s: resetting\n", sc->sc_dev.dv_xname));
@@ -536,6 +537,16 @@ ihidev_reset(struct ihidev_softc *sc)
ihidev_sleep(sc, 100);
+ return 0;
+}
+
+
+int
+ihidev_reset(struct ihidev_softc *sc)
+{
+ if (ihidev_poweron(sc))
+ return (1);
+
if (ihidev_hid_command(sc, I2C_HID_CMD_RESET, 0)) {
printf("%s: failed to reset hardware\n", sc->sc_dev.dv_xname);
@@ -784,7 +795,7 @@ ihidev_open(struct ihidev *scd)
return (0);
/* power on */
- ihidev_reset(sc);
+ ihidev_poweron(sc);
if (sc->sc_poll) {
if (!timeout_initialized(&sc->sc_timer))