summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2006-12-26 19:45:43 +0000
committerderaadt <deraadt@openbsd.org>2006-12-26 19:45:43 +0000
commit9bcfda6e70a7aa9892dcf5c268fef47d1e03e6e1 (patch)
tree6147acc23201f06b144bc71ae11fb65c64cb67b8
parentThere is a single 'p', not a double, in 'triple'. (diff)
downloadwireguard-openbsd-9bcfda6e70a7aa9892dcf5c268fef47d1e03e6e1.tar.xz
wireguard-openbsd-9bcfda6e70a7aa9892dcf5c268fef47d1e03e6e1.zip
support adt7475; tested by dhartmei
-rw-r--r--share/man/man4/adt.48
-rw-r--r--sys/dev/i2c/adt7460.c23
2 files changed, 17 insertions, 14 deletions
diff --git a/share/man/man4/adt.4 b/share/man/man4/adt.4
index 3adf04ee5a9..800dcabac7f 100644
--- a/share/man/man4/adt.4
+++ b/share/man/man4/adt.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: adt.4,v 1.9 2006/09/07 10:42:25 jmc Exp $
+.\" $OpenBSD: adt.4,v 1.10 2006/12/26 19:45:44 deraadt Exp $
.\"
.\" Copyright (c) 2005 Theo de Raadt <deraadt@openbsd.org>
.\"
@@ -26,9 +26,9 @@
The
.Nm
driver provides support for the Analog Devices ADT7460,
-Analog Devices ADT7467, Analog Devices ADT7476,
-Analog Devices ADM1027, National Semiconductor LM85,
-National Semiconductor LM96000,
+Analog Devices ADT7465, Analog Devices ADT7476,
+Analog Devices ADT7477, Analog Devices ADM1027,
+National Semiconductor LM85, National Semiconductor LM96000,
SMSC EMC6D10x, and SMSC SCH5017 temperature sensors.
The sensor possesses a collection of sensor values which are
made available through the
diff --git a/sys/dev/i2c/adt7460.c b/sys/dev/i2c/adt7460.c
index 3c4fb6e036d..48136989c1f 100644
--- a/sys/dev/i2c/adt7460.c
+++ b/sys/dev/i2c/adt7460.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adt7460.c,v 1.14 2006/12/23 17:46:39 deraadt Exp $ */
+/* $OpenBSD: adt7460.c,v 1.15 2006/12/26 19:45:43 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -70,6 +70,7 @@ struct adt_chip {
{ "adt7460", { 2500, 0, 3300, 0, 0 }, 7460, 5000 },
{ "adt7467", { 2500, 2250, 3300, 5000, 12000 }, 7467, 5000 },
+ { "adt7475", { 0, 2250, 3300, 0, 0 }, 7475, 0 },
{ "adt7476", { 2500, 2250, 3300, 5000, 12000 }, 7476, 0 },
{ "adm1027", { 2500, 2250, 3300, 5000, 12000 }, 1027, 5000 },
{ "lm85", { 2500, 2250, 3300, 5000, 12000 }, 7467, 0 },
@@ -228,13 +229,13 @@ adt_attach(struct device *parent, struct device *self, void *aux)
struct {
char sensor;
u_int8_t cmd;
- u_char index;
+ u_short index;
} worklist[] = {
- { ADT_2_5V, ADT7460_2_5V, 0 },
- { ADT_VCCP, ADT7460_VCCP, 1 },
- { ADT_VCC, ADT7460_VCC, 2 },
- { ADT_V5, ADT7460_V5, 3 },
- { ADT_V12, ADT7460_V12, 4 },
+ { ADT_2_5V, ADT7460_2_5V, 32768 + 0 },
+ { ADT_VCCP, ADT7460_VCCP, 32768 + 1 },
+ { ADT_VCC, ADT7460_VCC, 32768 + 2 },
+ { ADT_V5, ADT7460_V5, 32768 + 3 },
+ { ADT_V12, ADT7460_V12, 32768 + 4 },
{ ADT_REM1_TEMP, ADT7460_REM1_TEMP },
{ ADT_LOCAL_TEMP, ADT7460_LOCAL_TEMP },
{ ADT_REM2_TEMP, ADT7460_REM2_TEMP },
@@ -256,8 +257,11 @@ adt_refresh(void *arg)
for (i = 0; i < sizeof worklist / sizeof(worklist[0]); i++) {
- if (sc->chip->ratio[worklist[i].index] == 0)
- continue;
+ if (worklist[i].index >= 32768) {
+ ratio = sc->chip->ratio[worklist[i].index - 32768];
+ if (ratio == 0) /* do not read a dead register */
+ continue;
+ }
cmd = worklist[i].cmd;
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
@@ -266,7 +270,6 @@ adt_refresh(void *arg)
}
sc->sc_sensor[i].flags &= ~SENSOR_FINVALID;
- ratio = sc->chip->ratio[worklist[i].index];
switch (worklist[i].sensor) {
case ADT_VCC:
if (sc->chip->vcc && (sc->sc_conf & ADT7460_CONFIG_Vcc))