summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 20:05:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 20:05:04 +0000
commit05ec984ea4287835eff7302b967da1b54a895382 (patch)
tree143cc7ad5cb4d726190ddb165465f6d7d35413e9 /sys/dev
parent754c60a2dc644236085c8a0ebdd20f764b3c26ea (diff)
if the device is busy trying to deliver an interrupt, it will stall on
scanning. at startup, that is dumb. clear the interrupt bit. now i get 40 sensors on the alpha... crazy
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2c/lm87.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c
index 66626a93904..500ab9c4598 100644
--- a/sys/dev/i2c/lm87.c
+++ b/sys/dev/i2c/lm87.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm87.c,v 1.11 2005/12/27 19:45:28 deraadt Exp $ */
+/* $OpenBSD: lm87.c,v 1.12 2005/12/27 20:05:03 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -37,6 +37,7 @@
#define LM87_REVISION 0x3f
#define LM87_CONFIG1 0x40
#define LM87_CONFIG1_START 0x01
+#define LM87_CONFIG1_INTCLR 0x08
#define LM87_CHANNEL 0x16
#define LM87_CHANNEL_AIN1 0x01
#define LM87_CHANNEL_AIN2 0x02
@@ -97,7 +98,7 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
{
struct lmenv_softc *sc = (struct lmenv_softc *)self;
struct i2c_attach_args *ia = aux;
- u_int8_t cmd, data, channel;
+ u_int8_t cmd, data, data2, channel;
int i;
sc->sc_tag = ia->ia_tag;
@@ -149,10 +150,17 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
return;
}
- if ((data & LM87_CONFIG1_START) == 0) {
- data |= LM87_CONFIG1_START;
+ /*
+ * if chip is not running, try to start it.
+ * if it is stalled doing an interrupt, unstall it
+ */
+ data2 = (data | LM87_CONFIG1_START);
+ if (sc->sc_family == 81)
+ data2 = data2 & ~LM87_CONFIG1_INTCLR;
+
+ if (data != data2) {
if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
- sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
+ sc->sc_addr, &cmd, sizeof cmd, &data2, sizeof data2, 0)) {
iic_release_bus(sc->sc_tag, 0);
printf(", cannot write Configuration Register 1\n");
return;