diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-11-15 20:28:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-11-15 20:28:05 +0000 |
commit | a237d262c9a2ae25043e95b5501fad9aef2793b6 (patch) | |
tree | 1e4235500d1b3cb1efe00b90f9d2cdf43268dfba /sys/dev/i2c/lm87.c | |
parent | 9b839264edc4d59c36b0e802d6ec58c6d46a77d5 (diff) |
Start monitoring operations such that values actually change.
ok deraadt@
Diffstat (limited to 'sys/dev/i2c/lm87.c')
-rw-r--r-- | sys/dev/i2c/lm87.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c index a36af99644d..da1699b6978 100644 --- a/sys/dev/i2c/lm87.c +++ b/sys/dev/i2c/lm87.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm87.c,v 1.3 2005/11/15 18:25:24 deraadt Exp $ */ +/* $OpenBSD: lm87.c,v 1.4 2005/11/15 20:28:04 kettenis Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -35,6 +35,8 @@ #define LM87_FAN1 0x28 #define LM87_FAN2 0x28 #define LM87_REVISION 0x3f +#define LM87_CONFIG1 0x40 +#define LM87_CONFIG1_START 0x01 #define LM87_FANDIV 0x47 /* Sensors */ @@ -109,6 +111,21 @@ lmenv_attach(struct device *parent, struct device *self, void *aux) sc->sc_fan1_div = 1 << ((data >> 4) & 0x03); sc->sc_fan2_div = 1 << ((data >> 6) & 0x03); + cmd = LM87_CONFIG1; + if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, + sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) { + iic_release_bus(sc->sc_tag, 0); + printf(": cannot read Configuration Register 1\n"); + return; + } + data |= LM87_CONFIG1_START; + 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); + printf(": cannot write Configuration Register 1\n"); + return; + } + cmd = LM87_REVISION; if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) { |