From d282a5f3be1be56ca68e51849cde1f5fa8fb052f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 4 Jul 2004 19:12:18 +0000 Subject: [PATCH] Add LM86, MAX6657 and MAX6658 support to the lm90 driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2633 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/chips/SUMMARY | 4 ++ doc/chips/lm90 | 31 ++++++++++++-- etc/sensors.conf.eg | 2 +- kernel/chips/lm90.c | 84 +++++++++++++++++++++++--------------- lib/chips.c | 2 + lib/chips.h | 4 +- prog/detect/sensors-detect | 2 +- prog/sensors/main.c | 2 + 8 files changed, 91 insertions(+), 40 deletions(-) diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index 314dcac7..49a95d78 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -139,9 +139,13 @@ lm87 lm90 lm90 2 - - - yes no lm99 2 - - - yes no + lm86 2 - - - yes no adm1032 2 - - - yes no + max6657 2 - - - yes no (lm89 is detected as an lm99) lm89 2 - - - yes no + (max6658 is detected as a max6657) + max6658 2 - - - yes no lm92 (all are reported as an "lm92") diff --git a/doc/chips/lm90 b/doc/chips/lm90 index 2e0acb4b..e68ae824 100644 --- a/doc/chips/lm90 +++ b/doc/chips/lm90 @@ -19,11 +19,26 @@ Supported chips: Addresses scanned: I2C 0x4c and 0x4d Datasheet: Publicly available at the National Semiconductor website http://www.national.com/pf/LM/LM99.html + * National Semiconductor LM86 + Prefix: `lm86' + Addresses scanned: I2C 0x4c + Datasheet: Publicly available at the National Semiconductor website + http://www.national.com/pf/LM/LM86.html * Analog Devices ADM1032 Prefix: `adm1032' Addresses scanned: I2C 0x4c Datasheet: Publicly available at the Analog Devices website http://products.analog.com/products/info.asp?product=ADM1032 + * Maxim MAX6657 + Prefix: `max6657' + Addresses scanned: I2C 0x4c + Datasheet: Publicly available at the Maxim website + http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 + * Maxim MAX6658 + Prefix: `max6657' + Addresses scanned: I2C 0x4c + Datasheet: Publicly available at the Maxim website + http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 Author: Jean Delvare @@ -45,6 +60,12 @@ Module Parameters * force_lm99: short array (min = 1, max = 48) List of adapter,address pairs which are unquestionably assumed to contain a `lm99' chip +* force_lm86: short array (min = 1, max = 48) + List of adapter,address pairs which are unquestionably assumed to contain + a `lm86' chip +* force_max6657: short array (min = 1, max = 48) + List of adapter,address pairs which are unquestionably assumed to contain + a `max6657' chip * probe: short array (min = 1, max = 48) List of adapter,address pairs to scan additionally * probe_range: short array (min = 1, max = 48) @@ -61,8 +82,7 @@ Description The LM90 is a digital temperature sensor. It senses its own temperature as well as the temperature of up to one external diode. It is compatible with many other devices such as the LM86, the LM89, the LM99, the ADM1032, -the MAX6657 and the MAX6658. Of these, only the ADM1032, LM89 and LM99 are -supported for now, but the others can be forced (and later added). +the MAX6657 and the MAX6658, all of which are supported by this driver. The specificity of this family of chipsets over the ADM1021/LM84 family is that it features critical limits with hysteresis, and an @@ -77,7 +97,7 @@ LM90: * Filter and alert configuration register at 0xBF. * ALERT is triggered by temperatures over critical limits. -LM89: +LM86 and LM89: * Same as LM90 * Better external channel accuracy @@ -91,6 +111,9 @@ ADM1032: * Up to 64 conversions/s. * ALERT is triggered by open remote sensor. +MAX6657 and MAX6658: + * Remote sensor type selecion + All temperature values are given in degrees Celcius. Resolution is 1.0 degree for the local temperature, 0.125 degree for the remote temperature. @@ -110,7 +133,7 @@ other second; reading them more often will do no harm, but will return Chip Features ------------- -Chips 'lm90', adm1032' and 'lm99' +Chips 'lm90', adm1032', 'lm99', 'lm86' and 'max6657' LABEL LABEL CLASS COMPUTE CLASS MODE MAGN temp1 - - R- 0 diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index a51781d5..f6a18329 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1733,7 +1733,7 @@ chip "max1619-*" set temp2_hyst 40 -chip "lm90-*" "adm1032-*" +chip "lm90-*" "adm1032-*" "lm86-*" "max6657-*" label temp1 "M/B Temp" label temp2 "CPU Temp" diff --git a/kernel/chips/lm90.c b/kernel/chips/lm90.c index 39841cdb..42c4ff10 100644 --- a/kernel/chips/lm90.c +++ b/kernel/chips/lm90.c @@ -21,11 +21,26 @@ * http://www.national.com/pf/LM/LM99.html * Note that there is no way to differenciate between both chips. * + * This driver also supports the LM86, another sensor chip made by + * National Semiconductor. It is exactly similar to the LM90 except it + * has a higher accuracy. + * Complete datasheet can be obtained from National's website at: + * http://www.national.com/pf/LM/LM86.html + * * This driver also supports the ADM1032, a sensor chip made by Analog * Devices. That chip is similar to the LM90, with a few differences * that are not handled by this driver. Complete datasheet can be * obtained from Analog's website at: * http://products.analog.com/products/info.asp?product=ADM1032 + * Among others, it has a higher accuracy than the LM90, much like the + * LM86 does. + * + * This driver also supports the MAX6657 and MAX6658, sensor chips made + * by Maxim. These chips are similar to the LM86. Complete datasheet + * can be obtained at Maxim's website at: + * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 + * Note that there is no way to differenciate between both chips (but + * no need either). * * Since the LM90 was the first chipset supported by this driver, most * comments will refer to this chipset, but are actually general and @@ -60,7 +75,7 @@ /* * Addresses to scan * Address is fully defined internally and cannot be changed. - * LM89, LM90, LM99 and ADM1032 have address 0x4c. + * LM86, LM89, LM90, LM99, ADM1032, MAX6657 and MAX6658 have address 0x4c. * LM89-1, and LM99-1 have address 0x4d. */ @@ -73,7 +88,7 @@ static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; * Insmod parameters */ -SENSORS_INSMOD_3(lm90, adm1032, lm99); +SENSORS_INSMOD_5(lm90, adm1032, lm99, lm86, max6657); /* * The LM90 registers @@ -260,7 +275,6 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int err = 0; const char *type_name = ""; const char *client_name = ""; - u8 reg_config1=0, reg_convrate=0; #ifdef DEBUG if (i2c_is_isa_adapter(adapter)) @@ -309,32 +323,22 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, * are skipped. */ - if (kind < 0) /* detection */ - { - reg_config1 = i2c_smbus_read_byte_data(new_client, - LM90_REG_R_CONFIG1); - reg_convrate = i2c_smbus_read_byte_data(new_client, - LM90_REG_R_CONVRATE); + /* Default to an LM90 if forced */ + if (kind == 0) + kind = lm90; - if ((reg_config1 & 0x2A) != 0x00 - || reg_convrate > 0x0A) - { -#ifdef DEBUG - printk(KERN_DEBUG "lm90.o: Detection failed at 0x%02x.\n", - address); -#endif - goto ERROR1; - } - } - - if (kind <= 0) /* identification */ + if (kind < 0) /* detection and identification */ { - u8 man_id, chip_id; + u8 man_id, chip_id, reg_config1, reg_convrate; man_id = i2c_smbus_read_byte_data(new_client, LM90_REG_R_MAN_ID); chip_id = i2c_smbus_read_byte_data(new_client, LM90_REG_R_CHIP_ID); + reg_config1 = i2c_smbus_read_byte_data(new_client, + LM90_REG_R_CONFIG1); + reg_convrate = i2c_smbus_read_byte_data(new_client, + LM90_REG_R_CONVRATE); if (man_id == 0x01) /* National Semiconductor */ { @@ -343,30 +347,34 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, reg_config2 = i2c_smbus_read_byte_data(new_client, LM90_REG_R_CONFIG2); - if (kind == 0 /* skip detection */ - || ((reg_config2 & 0xF8) == 0x00 - && reg_convrate <= 0x09)) + if ((reg_config1 & 0x2A) == 0x00 + && (reg_config2 & 0xF8) == 0x00 + && reg_convrate <= 0x09) { if (address == 0x4C && (chip_id & 0xF0) == 0x20) /* LM90 */ - { kind = lm90; - } else if ((chip_id & 0xF0) == 0x30) /* LM89/LM99 */ - { kind = lm99; - } + else if (address == 0x4C + && (chip_id & 0xF0) == 0x10) /* LM86 */ + kind = lm99; } } else if (man_id == 0x41) /* Analog Devices */ { if (address == 0x4C && (chip_id & 0xF0) == 0x40 /* ADM1032 */ - && (kind == 0 /* skip detection */ - || (reg_config1 & 0x3F) == 0x00)) - { + && (reg_config1 & 0x3F) == 0x00 + && reg_convrate <= 0x0A) kind = adm1032; - } + } + else if (man_id == 0x4D) /* Maxim */ + { + if (address == 0x4C + && (reg_config1 & 0x1F) == 0 + && reg_convrate <= 0x09) + kind = max6657; } } @@ -391,6 +399,16 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, type_name = "lm99"; client_name = "LM99 chip"; } + else if (kind == lm86) + { + type_name = "lm86"; + client_name = "LM86 chip"; + } + else if (kind == max6657) + { + type_name = "max6657"; + client_name = "MAX6657 chip"; + } else { printk("lm90.o: Unknown kind %d.\n", kind); diff --git a/lib/chips.c b/lib/chips.c index a0e53291..e92d46b1 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -5214,6 +5214,8 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_LM90_PREFIX, lm90_features }, { SENSORS_ADM1032_PREFIX, lm90_features }, { SENSORS_LM99_PREFIX, lm90_features }, + { SENSORS_LM86_PREFIX, lm90_features }, + { SENSORS_MAX6657_PREFIX, lm90_features }, { SENSORS_MAX1619_PREFIX, max1619_features }, { SENSORS_XEONTEMP_PREFIX, xeontemp_features }, { SENSORS_MAX6650_PREFIX, max6650_features }, diff --git a/lib/chips.h b/lib/chips.h index e52bd8cc..b5532f71 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -475,11 +475,13 @@ #define SENSORS_LM85_ZONE3_RANGE 100 /* RW -- zone3_range */ #define SENSORS_LM85_ZONE3_SMOOTH 101 /* RW -- zone3_smooth */ -/* LM89/LM90/LM99/ADM1032 chips */ +/* LM86/LM89/LM90/LM99/ADM1032/MAX6657 chips */ #define SENSORS_LM90_PREFIX "lm90" #define SENSORS_ADM1032_PREFIX "adm1032" #define SENSORS_LM99_PREFIX "lm99" +#define SENSORS_LM86_PREFIX "lm86" +#define SENSORS_MAX6657_PREFIX "max6657" #define SENSORS_LM90_LOCAL_TEMP 51 /* R */ #define SENSORS_LM90_LOCAL_HIGH 52 /* RW */ diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 8aa42a80..c06fa539 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1218,7 +1218,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect }, { name => "Maxim MAX6657/MAX6658/MAX6659", - driver => "to-be-written", + driver => "lm90", i2c_addrs => [0x4c], i2c_detect => sub { lm90_detect 4, @_ }, }, diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 276d9510..e8b201c2 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -424,6 +424,8 @@ struct match matches[] = { { "lm90", print_lm90 }, { "adm1032", print_lm90 }, { "lm99", print_lm90 }, + { "lm86", print_lm90 }, + { "max6657", print_lm90 }, { "xeontemp", print_xeontemp }, { "max6650", print_max6650 }, { "asb100", print_asb100 },