aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-10-09 09:22:22 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2008-02-07 20:39:40 -0500
commitc7fa373796ea685874ca9525eeb3d0d0951e511b (patch)
treec0079be25686be32ee1d99193c41edb4e19ad37c
parent85f03bccd6e0e2ac6ccf017d4bcd5d74bb87a671 (diff)
hwmon: (lm87) Add support for the Analog Devices ADM1024
It happens that the Analog Devices ADM1024 is fully compatible with the National Semiconductor LM87, so support for the former can easily be added to the lm87 driver. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
-rw-r--r--Documentation/hwmon/lm8711
-rw-r--r--drivers/hwmon/Kconfig4
-rw-r--r--drivers/hwmon/lm87.c25
3 files changed, 29 insertions, 11 deletions
diff --git a/Documentation/hwmon/lm87 b/Documentation/hwmon/lm87
index c952c57f0e11..ec27aa1b94cb 100644
--- a/Documentation/hwmon/lm87
+++ b/Documentation/hwmon/lm87
@@ -4,8 +4,12 @@ Kernel driver lm87
4Supported chips: 4Supported chips:
5 * National Semiconductor LM87 5 * National Semiconductor LM87
6 Prefix: 'lm87' 6 Prefix: 'lm87'
7 Addresses scanned: I2C 0x2c - 0x2f 7 Addresses scanned: I2C 0x2c - 0x2e
8 Datasheet: http://www.national.com/pf/LM/LM87.html 8 Datasheet: http://www.national.com/pf/LM/LM87.html
9 * Analog Devices ADM1024
10 Prefix: 'adm1024'
11 Addresses scanned: I2C 0x2c - 0x2e
12 Datasheet: http://www.analog.com/en/prod/0,2877,ADM1024,00.html
9 13
10Authors: 14Authors:
11 Frodo Looijaard <frodol@dds.nl>, 15 Frodo Looijaard <frodol@dds.nl>,
@@ -19,11 +23,12 @@ Authors:
19Description 23Description
20----------- 24-----------
21 25
22This driver implements support for the National Semiconductor LM87. 26This driver implements support for the National Semiconductor LM87
27and the Analog Devices ADM1024.
23 28
24The LM87 implements up to three temperature sensors, up to two fan 29The LM87 implements up to three temperature sensors, up to two fan
25rotation speed sensors, up to seven voltage sensors, alarms, and some 30rotation speed sensors, up to seven voltage sensors, alarms, and some
26miscellaneous stuff. 31miscellaneous stuff. The ADM1024 is fully compatible.
27 32
28Temperatures are measured in degrees Celsius. Each input has a high 33Temperatures are measured in degrees Celsius. Each input has a high
29and low alarm settings. A high limit produces an alarm when the value 34and low alarm settings. A high limit produces an alarm when the value
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index a2187df5cc78..af43d566d770 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -433,12 +433,12 @@ config SENSORS_LM85
433 will be called lm85. 433 will be called lm85.
434 434
435config SENSORS_LM87 435config SENSORS_LM87
436 tristate "National Semiconductor LM87" 436 tristate "National Semiconductor LM87 and compatibles"
437 depends on I2C 437 depends on I2C
438 select HWMON_VID 438 select HWMON_VID
439 help 439 help
440 If you say yes here you get support for National Semiconductor LM87 440 If you say yes here you get support for National Semiconductor LM87
441 sensor chips. 441 and Analog Devices ADM1024 sensor chips.
442 442
443 This driver can also be built as a module. If so, the module 443 This driver can also be built as a module. If so, the module
444 will be called lm87. 444 will be called lm87.
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 28cdff0c556b..3ab4c3f0efdd 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -5,7 +5,7 @@
5 * Philip Edelbrock <phil@netroedge.com> 5 * Philip Edelbrock <phil@netroedge.com>
6 * Stephen Rousset <stephen.rousset@rocketlogix.com> 6 * Stephen Rousset <stephen.rousset@rocketlogix.com>
7 * Dan Eaton <dan.eaton@rocketlogix.com> 7 * Dan Eaton <dan.eaton@rocketlogix.com>
8 * Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> 8 * Copyright (C) 2004,2007 Jean Delvare <khali@linux-fr.org>
9 * 9 *
10 * Original port to Linux 2.6 by Jeff Oliver. 10 * Original port to Linux 2.6 by Jeff Oliver.
11 * 11 *
@@ -37,6 +37,11 @@
37 * instead. The LM87 is the only hardware monitoring chipset I know of 37 * instead. The LM87 is the only hardware monitoring chipset I know of
38 * which uses amplitude modulation. Be careful when using this feature. 38 * which uses amplitude modulation. Be careful when using this feature.
39 * 39 *
40 * This driver also supports the ADM1024, a sensor chip made by Analog
41 * Devices. That chip is fully compatible with the LM87. Complete
42 * datasheet can be obtained from Analog's website at:
43 * http://www.analog.com/en/prod/0,2877,ADM1024,00.html
44 *
40 * This program is free software; you can redistribute it and/or modify 45 * This program is free software; you can redistribute it and/or modify
41 * it under the terms of the GNU General Public License as published by 46 * it under the terms of the GNU General Public License as published by
42 * the Free Software Foundation; either version 2 of the License, or 47 * the Free Software Foundation; either version 2 of the License, or
@@ -74,7 +79,7 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
74 * Insmod parameters 79 * Insmod parameters
75 */ 80 */
76 81
77I2C_CLIENT_INSMOD_1(lm87); 82I2C_CLIENT_INSMOD_2(lm87, adm1024);
78 83
79/* 84/*
80 * The LM87 registers 85 * The LM87 registers
@@ -662,6 +667,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
662 struct i2c_client *new_client; 667 struct i2c_client *new_client;
663 struct lm87_data *data; 668 struct lm87_data *data;
664 int err = 0; 669 int err = 0;
670 static const char *names[] = { "lm87", "adm1024" };
665 671
666 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 672 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
667 goto exit; 673 goto exit;
@@ -686,11 +692,18 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
686 692
687 /* Now, we do the remaining detection. */ 693 /* Now, we do the remaining detection. */
688 if (kind < 0) { 694 if (kind < 0) {
695 u8 cid = lm87_read_value(new_client, LM87_REG_COMPANY_ID);
689 u8 rev = lm87_read_value(new_client, LM87_REG_REVISION); 696 u8 rev = lm87_read_value(new_client, LM87_REG_REVISION);
690 697
691 if (rev < 0x01 || rev > 0x08 698 if (cid == 0x02 /* National Semiconductor */
692 || (lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80) 699 && (rev >= 0x01 && rev <= 0x08))
693 || lm87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02) { 700 kind = lm87;
701 else if (cid == 0x41 /* Analog Devices */
702 && (rev & 0xf0) == 0x10)
703 kind = adm1024;
704
705 if (kind < 0
706 || (lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80)) {
694 dev_dbg(&adapter->dev, 707 dev_dbg(&adapter->dev,
695 "LM87 detection failed at 0x%02x.\n", 708 "LM87 detection failed at 0x%02x.\n",
696 address); 709 address);
@@ -699,7 +712,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
699 } 712 }
700 713
701 /* We can fill in the remaining client fields */ 714 /* We can fill in the remaining client fields */
702 strlcpy(new_client->name, "lm87", I2C_NAME_SIZE); 715 strlcpy(new_client->name, names[kind - 1], I2C_NAME_SIZE);
703 data->valid = 0; 716 data->valid = 0;
704 mutex_init(&data->update_lock); 717 mutex_init(&data->update_lock);
705 718