Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c add some more ADM1031 support:
details: https://anonhg.NetBSD.org/src/rev/44828308a769
branches: trunk
changeset: 753546:44828308a769
user: macallan <macallan%NetBSD.org@localhost>
date: Thu Apr 01 04:29:35 2010 +0000
description:
add some more ADM1031 support:
- additional temperature and fan speed sensors work now
- limits on should work on all temperature sensors
Controlling fan behaviour doesn't work yet, the ADM1031 uses the same
register for both fans which doesn't quite fit with the way the dbcool
driver works.
diffstat:
sys/dev/i2c/dbcool.c | 65 +++++++++++++++++++++++++++++++++++++++++++++--
sys/dev/i2c/dbcool_reg.h | 17 +++++++++++-
2 files changed, 76 insertions(+), 6 deletions(-)
diffs (168 lines):
diff -r e6e39077c3ea -r 44828308a769 sys/dev/i2c/dbcool.c
--- a/sys/dev/i2c/dbcool.c Thu Apr 01 04:04:11 2010 +0000
+++ b/sys/dev/i2c/dbcool.c Thu Apr 01 04:29:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool.c,v 1.21 2010/03/31 18:07:13 macallan Exp $ */
+/* $NetBSD: dbcool.c,v 1.22 2010/04/01 04:29:35 macallan Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.21 2010/03/31 18:07:13 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.22 2010/04/01 04:29:35 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -529,7 +529,7 @@
{ DBC_CTL, { DBCOOL_ADM1030_R_TMIN,
DBCOOL_NO_REG,
DBCOOL_NO_REG }, 1, 8, 0 },
- { DBC_CTL, { DBCOOL_ADM1030_L_TTHRESH,
+ { DBC_CTL, { DBCOOL_ADM1030_R_TTHRESH,
DBCOOL_NO_REG,
DBCOOL_NO_REG }, 1, 9, 0 },
{ DBC_CTL, { DBCOOL_ADM1030_R_TTHRESH,
@@ -545,6 +545,61 @@
{ { 0, 0, 0, 0 }, NULL }
};
+struct dbcool_sensor ADM1031_sensor_table[] = {
+ { DBC_TEMP, { DBCOOL_ADM1030_L_TEMP,
+ DBCOOL_ADM1030_L_HI_LIM,
+ DBCOOL_ADM1030_L_LO_LIM }, 0, 0, 0 },
+ { DBC_TEMP, { DBCOOL_ADM1030_R_TEMP,
+ DBCOOL_ADM1030_R_HI_LIM,
+ DBCOOL_ADM1030_R_LO_LIM }, 1, 0, 0 },
+ { DBC_TEMP, { DBCOOL_ADM1031_R2_TEMP,
+ DBCOOL_ADM1031_R2_HI_LIM,
+ DBCOOL_ADM1031_R2_LO_LIM }, 2, 0, 0 },
+ { DBC_FAN, { DBCOOL_ADM1030_FAN_TACH,
+ DBCOOL_NO_REG,
+ DBCOOL_ADM1030_FAN_LO_LIM }, 5, 0, 0 },
+ { DBC_FAN, { DBCOOL_ADM1031_FAN2_TACH,
+ DBCOOL_NO_REG,
+ DBCOOL_ADM1031_FAN2_LO_LIM }, 6, 0, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_L_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 0, 8, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_L_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 0, 9, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_L_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 0, 6, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_R_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 1, 8, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_R_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 1, 9, 0 },
+ { DBC_CTL, { DBCOOL_ADM1030_R_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 1, 6, 0 },
+ { DBC_CTL, { DBCOOL_ADM1031_R2_TMIN,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 2, 8, 0 },
+ { DBC_CTL, { DBCOOL_ADM1031_R2_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 2, 9, 0 },
+ { DBC_CTL, { DBCOOL_ADM1031_R2_TTHRESH,
+ DBCOOL_NO_REG,
+ DBCOOL_NO_REG }, 2, 6, 0 },
+ { DBC_EOF, {0, 0, 0 }, 0, 0, 0 }
+};
+
+struct dbcool_power_control ADM1031_power_table[] = {
+ { { DBCOOL_ADM1030_CFG1, DBCOOL_NO_REG, DBCOOL_NO_REG,
+ DBCOOL_ADM1030_FAN_SPEED_CFG },
+ "fan_control_1" },
+ { { DBCOOL_ADM1030_CFG1, DBCOOL_NO_REG, DBCOOL_NO_REG,
+ DBCOOL_ADM1030_FAN_SPEED_CFG },
+ "fan_control_2" },
+ { { 0, 0, 0, 0 }, NULL }
+};
struct chip_id chip_table[] = {
{ DBCOOL_COMPANYID, ADT7490_DEVICEID, ADT7490_REV_ID,
ADT7490_sensor_table, ADT7475_power_table,
@@ -593,7 +648,7 @@
DBCFLAG_ADM1030 | DBCFLAG_NO_READBYTE,
11250 * 60, "ADM1030" },
{ DBCOOL_COMPANYID, ADM1031_DEVICEID, 0xff,
- ADM1030_sensor_table, ADM1030_power_table,
+ ADM1031_sensor_table, ADM1030_power_table,
DBCFLAG_ADM1030 | DBCFLAG_NO_READBYTE,
11250 * 60, "ADM1031" },
{ 0, 0, 0, NULL, NULL, 0, 0, NULL }
@@ -794,6 +849,8 @@
ext = sc->sc_dc.dc_readreg(&sc->sc_dc, DBCOOL_ADM1030_TEMP_EXTRES);
if (reg == DBCOOL_ADM1030_L_TEMP)
ext >>= 6;
+ else if (reg == DBCOOL_ADM1031_R2_TEMP)
+ ext >>= 4;
else
ext >>= 1;
ext &= 0x03;
diff -r e6e39077c3ea -r 44828308a769 sys/dev/i2c/dbcool_reg.h
--- a/sys/dev/i2c/dbcool_reg.h Thu Apr 01 04:04:11 2010 +0000
+++ b/sys/dev/i2c/dbcool_reg.h Thu Apr 01 04:29:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool_reg.h,v 1.4 2010/03/31 18:07:13 macallan Exp $ */
+/* $NetBSD: dbcool_reg.h,v 1.5 2010/04/01 04:29:35 macallan Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#define DBCOOLREG_H
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool_reg.h,v 1.4 2010/03/31 18:07:13 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool_reg.h,v 1.5 2010/04/01 04:29:35 macallan Exp $");
#define DBCOOL_ADDRMASK 0x7c
#define DBCOOL_ADDR 0x2c /* Some chips have multiple addrs */
@@ -321,6 +321,10 @@
/*
* Even though it's not really a member of the dbCool family, we also
* support the ADM1030 chip. It has a different register set.
+ * the ADM1030 is in fact a cut down ADM1031 - the register set is identical
+ * except the registers used for the extra temperature and fan control sensors
+ * DBCOOL_ADM1030_* are present in both chips with identical functionality
+ * DBCOOL_ADM1031_* are ADM1031 only
*/
#define DBCOOL_ADM1030_CFG1 0x00
#define DBCOOL_ADM1030_CFG2 0x01
@@ -329,22 +333,31 @@
#define DBCOOL_ADM1030_TEMP_EXTRES 0x06
#define DBCOOL_ADM1030_TEST_REG 0x07
#define DBCOOL_ADM1030_FAN_TACH 0x08
+#define DBCOOL_ADM1031_FAN2_TACH 0x09
#define DBCOOL_ADM1030_L_TEMP 0x0A
#define DBCOOL_ADM1030_R_TEMP 0x0B
+#define DBCOOL_ADM1031_R2_TEMP 0x0C
#define DBCOOL_ADM1030_L_OFFSET 0x0D
#define DBCOOL_ADM1030_R_OFFSET 0x0E
+#define DBCOOL_ADM1031_R2_OFFSET 0x0F
#define DBCOOL_ADM1030_FAN_LO_LIM 0x10
+#define DBCOOL_ADM1031_FAN2_LO_LIM 0x11
#define DBCOOL_ADM1030_L_HI_LIM 0x14
#define DBCOOL_ADM1030_L_LO_LIM 0x15
#define DBCOOL_ADM1030_L_TTHRESH 0x16
#define DBCOOL_ADM1030_R_HI_LIM 0x18
#define DBCOOL_ADM1030_R_LO_LIM 0x19
#define DBCOOL_ADM1030_R_TTHRESH 0x1A
+#define DBCOOL_ADM1031_R2_HI_LIM 0x1C
+#define DBCOOL_ADM1031_R2_LO_LIM 0x1D
+#define DBCOOL_ADM1031_R2_TTHRESH 0x1E
#define DBCOOL_ADM1030_FAN_CHAR 0x20
+#define DBCOOL_ADM1031_FAN2_CHAR 0x21
#define DBCOOL_ADM1030_FAN_SPEED_CFG 0x22
#define DBCOOL_ADM1030_FAN_FILTER 0x23
#define DBCOOL_ADM1030_L_TMIN 0x24
#define DBCOOL_ADM1030_R_TMIN 0x25
+#define DBCOOL_ADM1031_R2_TMIN 0x26
#define DBCOOL_ADM1030_DEVICEID DBCOOL_DEVICEID_REG
#define DBCOOL_ADM1030_COMPANYID DBCOOL_COMPANYID_REG
#define DBCOOL_ADM1030_REVISION DBCOOL_REVISION_REG
Home |
Main Index |
Thread Index |
Old Index