diff options
author | Tobias Heider <tobhe@cvs.openbsd.org> | 2024-10-18 12:53:50 +0000 |
---|---|---|
committer | Tobias Heider <tobhe@cvs.openbsd.org> | 2024-10-18 12:53:50 +0000 |
commit | 8c27b6a57fb813320ec7b9983599c3780468fa9a (patch) | |
tree | f25e5e4a673833a39b5346c5accbb7836b9d5547 /sys/dev/i2c | |
parent | 705ec3bd2205b06026d6f9aaab5db37744e137a3 (diff) |
Instead of always following up "power on" with a "reset", only
send a single reset during attach. We have discovered that some
devices such as the built-in keyboard on the Thinkpad T14s Gen 6
don't like getting more than one reset sent or they become
unresponsive.
This has been in snaps for a while and hasn't caused any major
regressions so we are confident the extra reset is not needed on
most hardware.
feedback from kettenis@
ok deraadt@ mlarkin@
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r-- | sys/dev/i2c/ihidev.c | 19 |
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)) |