diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-31 06:47:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-31 06:47:15 +0000 |
commit | a2fe55730bafaa2e9f7b17e10f5cd273f3d17029 (patch) | |
tree | 6a6cb3c4778000eb60608eb52bf62b6b4215e0cf /sys | |
parent | 185ceb5f074357ae57136a276defd91ec90a4b31 (diff) |
correct the code to handle the adt7475, which stupidly is missing some
of the registers.... tested by dhartmei and others
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/i2c/adt7460.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/sys/dev/i2c/adt7460.c b/sys/dev/i2c/adt7460.c index 48136989c1f..ea648f55981 100644 --- a/sys/dev/i2c/adt7460.c +++ b/sys/dev/i2c/adt7460.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adt7460.c,v 1.15 2006/12/26 19:45:43 deraadt Exp $ */ +/* $OpenBSD: adt7460.c,v 1.16 2006/12/31 06:47:14 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -80,6 +80,25 @@ struct adt_chip { { "sch5017", { 5000, 2250, 3300, 5000, 12000 }, 5017, 0 } }; +struct { + char sensor; + u_int8_t cmd; + u_short index; +} worklist[] = { + { 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 }, + { ADT_TACH1, ADT7460_TACH1L }, + { ADT_TACH2, ADT7460_TACH2L }, + { ADT_TACH3, ADT7460_TACH3L }, + { ADT_TACH4, ADT7460_TACH4L }, +}; + struct adt_softc { struct device sc_dev; i2c_tag_t sc_tag; @@ -174,6 +193,7 @@ adt_attach(struct device *parent, struct device *self, void *aux) sc->sc_sensor[ADT_2_5V].type = SENSOR_VOLTS_DC; strlcpy(sc->sc_sensor[ADT_2_5V].desc, "+2.5Vin", sizeof(sc->sc_sensor[ADT_2_5V].desc)); + if (sc->chip->type == 5017) strlcpy(sc->sc_sensor[ADT_2_5V].desc, "+5VTR", sizeof(sc->sc_sensor[ADT_2_5V].desc)); @@ -217,6 +237,9 @@ adt_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADT_NUM_SENSORS; i++) { + if (worklist[i].index >= 32768 && + sc->chip->ratio[worklist[i].index - 32768] == 0) + continue; sc->sc_sensor[i].flags &= ~SENSOR_FINVALID; sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]); } @@ -226,25 +249,6 @@ adt_attach(struct device *parent, struct device *self, void *aux) printf("\n"); } -struct { - char sensor; - u_int8_t cmd; - u_short index; -} worklist[] = { - { 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 }, - { ADT_TACH1, ADT7460_TACH1L }, - { ADT_TACH2, ADT7460_TACH2L }, - { ADT_TACH3, ADT7460_TACH3L }, - { ADT_TACH4, ADT7460_TACH4L }, -}; - void adt_refresh(void *arg) { |