diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-23 22:56:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-23 22:56:45 +0000 |
commit | 70bde609bcea88b58b0ac61015b094c84a1e1919 (patch) | |
tree | f1c60271842a77ecab37ff1aec400e51a7881bfc /sys/dev/i2c/adm1025.c | |
parent | d405bab9aa26b30713bbcdd5a97cb18d6fefc50e (diff) |
build a cacheing-read api internally, so that we can be even more stingy
with i2c cycles. as well, this will let us basically now write if/else
code for basically free. much easier; tested by kettenis and pval
Diffstat (limited to 'sys/dev/i2c/adm1025.c')
-rw-r--r-- | sys/dev/i2c/adm1025.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/i2c/adm1025.c b/sys/dev/i2c/adm1025.c index 5e0418979af..14dc9f77dac 100644 --- a/sys/dev/i2c/adm1025.c +++ b/sys/dev/i2c/adm1025.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1025.c,v 1.9 2005/12/23 21:13:18 deraadt Exp $ */ +/* $OpenBSD: adm1025.c,v 1.10 2005/12/23 22:56:44 deraadt Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -109,7 +109,7 @@ admtm_attach(struct device *parent, struct device *self, void *aux) printf(": cannot get control register\n"); return; } - data |= 0x01; + data &= ~0x01; if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) { iic_release_bus(sc->sc_tag, 0); @@ -170,19 +170,19 @@ void admtm_refresh(void *arg) { struct admtm_softc *sc = arg; - u_int8_t cmd, data; + u_int8_t cmd, data, sdata; iic_acquire_bus(sc->sc_tag, 0); cmd = ADM1025_INT_TEMP; if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, - sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0) == 0) - sc->sc_sensor[ADMTM_INT].value = 273150000 + 1000000 * data; + sc->sc_addr, &cmd, sizeof cmd, &sdata, sizeof sdata, 0) == 0) + sc->sc_sensor[ADMTM_INT].value = 273150000 + 1000000 * sdata; cmd = ADM1025_EXT_TEMP; if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, - sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0) == 0) - sc->sc_sensor[ADMTM_EXT].value = 273150000 + 1000000 * data; + sc->sc_addr, &cmd, sizeof cmd, &sdata, sizeof sdata, 0) == 0) + sc->sc_sensor[ADMTM_EXT].value = 273150000 + 1000000 * sdata; cmd = ADM1025_STATUS2; if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, |