summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgroeck <groeck@7894878c-1315-0410-8ee3-d5d059ff63e0>2011-06-01 16:20:05 +0000
committergroeck <groeck@7894878c-1315-0410-8ee3-d5d059ff63e0>2011-06-01 16:20:05 +0000
commit5b79386a3f20981551197641f62878657603f237 (patch)
tree5b9f7af24485733f5f0c9169473cbdfd871d17df
parent6dcc63d0416e8715d2597d97e0be9e4168a6efc2 (diff)
downloadlm-sensors-5b79386a3f20981551197641f62878657603f237.tar.gz
Add detection of MAX6642
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5978 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r--CHANGES1
-rwxr-xr-xprog/detect/sensors-detect39
2 files changed, 40 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 1edb744d..d1bd5c11 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ SVN HEAD
Add detection of SMSC EMC6W201
Drop unreliable detection of Maxim MAX6650
Add detection of SMSC EMC2300
+ Add detection of MAX6642
3.3.0 (2011-03-28)
Makefile: Check for bison and flex
diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
index 734e36c1..7757fb0a 100755
--- a/prog/detect/sensors-detect
+++ b/prog/detect/sensors-detect
@@ -848,6 +848,11 @@ use vars qw(@i2c_adapter_names);
i2c_addrs => [0x2c, 0x2e, 0x2f],
i2c_detect => sub { max6639_detect(@_); },
}, {
+ name => "Maxim MAX6642",
+ driver => "max6642",
+ i2c_addrs => [0x48..0x4f],
+ i2c_detect => sub { max6642_detect(@_); },
+ }, {
name => "Maxim MAX6655/MAX6656",
driver => "max6655",
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
@@ -5789,6 +5794,40 @@ sub max6639_detect
return 6;
}
+# Chip to detect: MAX6642
+# Registers used:
+# 0x02: Status register
+# 0x03: Configuration register
+# 0xfe: Manufacturer ID
+# 0x04, 0x06, 0xff: No registers
+# We use the 0x04, 0x06 and 0xff addresses (unused) to improve reliability.
+# These are not real registers and will always return the last returned value.
+# This isn't documented.
+sub max6642_detect
+{
+ my ($file, $addr) = @_;
+ my ($man_id, $conf, $status);
+
+ $man_id = i2c_smbus_read_byte_data($file, 0xfe);
+ return unless $man_id == 0x4d; # Maxim
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
+
+ $status = i2c_smbus_read_byte_data($file, 0x02);
+ # Bit 5, 3, 1 and 0 should be zero
+ return unless ($status & 0x2b) == 0x00;
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $status;
+
+ $conf = i2c_smbus_read_byte_data($file, 0x03);
+ # The 4 lower bits should be zero
+ return unless ($conf & 0x0f) == 0x00;
+
+ return 5;
+}
+
sub max6655_detect
{
my ($file, $addr) = @_;