summaryrefslogtreecommitdiffstats
path: root/sys/dev/i2c/ihidev.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2016-01-14 21:31:27 +0000
committerkettenis <kettenis@openbsd.org>2016-01-14 21:31:27 +0000
commit146fcb02cc3f60dd9d5688b89703d3c7f6ea68d4 (patch)
tree2e9eb1d115fa3076341991f7f09d175b863b7342 /sys/dev/i2c/ihidev.c
parentUse I2C_F_POLL flag when acquiring and releasing the i2c bus in the (diff)
downloadwireguard-openbsd-146fcb02cc3f60dd9d5688b89703d3c7f6ea68d4.tar.xz
wireguard-openbsd-146fcb02cc3f60dd9d5688b89703d3c7f6ea68d4.zip
Several fixes for dwiic(4).
* Properly map bus space; using BUS_SPACE_MAP_PREFATCHABLE is not agood idea as it may lead to reordering or merging of register writes in the store buffer. * Properly implement the iic(4) operations in dwiic_i2c_exec(). * Keep timings set up by the firmware if the SSCN and FMCN methods aren't available. ok jcs@
Diffstat (limited to 'sys/dev/i2c/ihidev.c')
-rw-r--r--sys/dev/i2c/ihidev.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index 11b310a3c6a..23637e93be1 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.6 2016/01/14 21:25:57 kettenis Exp $ */
+/* $OpenBSD: ihidev.c,v 1.7 2016/01/14 21:31:27 kettenis Exp $ */
/*
* HID-over-i2c driver
*
@@ -248,8 +248,8 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
sc->sc_dev.dv_xname, htole16(sc->sc_hid_desc_addr)));
/* 20 00 */
- res = iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmdbuf,
- sizeof(cmdbuf), &sc->hid_desc_buf,
+ res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
+ &cmdbuf, sizeof(cmdbuf), &sc->hid_desc_buf,
sizeof(struct i2c_hid_desc), 0);
DPRINTF(("%s: HID descriptor:", sc->sc_dev.dv_xname));
@@ -273,8 +273,8 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
cmd->c.opcode = I2C_HID_CMD_RESET;
/* 22 00 00 01 */
- res = iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmdbuf,
- sizeof(cmdbuf), NULL, 0, 0);
+ res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
+ &cmdbuf, sizeof(cmdbuf), NULL, 0, 0);
break;
}
@@ -294,8 +294,8 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
cmd->c.reportTypeId = power;
/* 22 00 00 08 */
- res = iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmdbuf,
- sizeof(cmdbuf), NULL, 0, 0);
+ res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
+ &cmdbuf, sizeof(cmdbuf), NULL, 0, 0);
break;
}
@@ -309,8 +309,8 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
sc->sc_reportlen));
/* 20 00 */
- res = iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmdbuf,
- sizeof(cmdbuf), sc->sc_report, sc->sc_reportlen, 0);
+ res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
+ &cmdbuf, sizeof(cmdbuf), sc->sc_report, sc->sc_reportlen, 0);
DPRINTF(("%s: HID report descriptor:", sc->sc_dev.dv_xname));
for (i = 0; i < sc->sc_reportlen; i++)
@@ -431,7 +431,7 @@ ihidev_intr(void *arg)
iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
- res = iic_exec(sc->sc_tag, I2C_OP_READ, sc->sc_addr, NULL, 0,
+ res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0,
sc->sc_ibuf, sc->sc_isize, I2C_F_POLL);
iic_release_bus(sc->sc_tag, I2C_F_POLL);