diff --git a/CHANGES b/CHANGES index 8dbf85d4..ddfae181 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ SVN HEAD Add detection of National Semiconductor LM96163 Add detection of GMT G781 Properly handle Super-I/O chips without logical device + Add detection of National Semiconductor LM96080 3.3.1 (2011-07-21) isadump: Add support for word (16-bit) and long (32-bit) reads diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index d2ab3753..3cfcdc80 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -540,7 +540,12 @@ use vars qw(@i2c_adapter_names); name => "National Semiconductor LM80", driver => "lm80", i2c_addrs => [0x28..0x2f], - i2c_detect => sub { lm80_detect(@_); }, + i2c_detect => sub { lm80_detect(@_, 0); }, + }, { + name => "National Semiconductor LM96080", + driver => "lm80", + i2c_addrs => [0x28..0x2f], + i2c_detect => sub { lm80_detect(@_, 1); }, }, { name => "National Semiconductor LM85", driver => "lm85", @@ -4259,11 +4264,15 @@ sub ds1621_detect return ($slope == 0x10 && $counter <= $slope) ? 3 : 2; } +# Chip to detect: 0 = LM80, 1 = LM96080 # Registers used: # 0x00: Configuration register # 0x02: Interrupt state register -# 0x2a-0x3d: Limits registers -# This one is easily misdetected since it doesn't provide identification +# 0x07: Converstion rate register (LM96080 only) +# 0x2a-0x3d: Limits registers (LM80 only) +# 0x3e: Manufacturer's ID register (LM96080 only) +# 0x3f: Steppind/die revision ID register (LM96080 only) +# The LM80 is easily misdetected since it doesn't provide identification # registers. So we have to use some tricks: # - 6-bit addressing, so limits readings modulo 0x40 should be unchanged # - positive temperature limits @@ -4276,44 +4285,51 @@ sub ds1621_detect # to loose comparisons did not change the score. sub lm80_detect { - my ($file, $addr) = @_; + my ($file, $addr, $chip) = @_; my ($i, $reg); return if (i2c_smbus_read_byte_data($file, 0x00) & 0x80) != 0; return if (i2c_smbus_read_byte_data($file, 0x02) & 0xc0) != 0; - for ($i = 0x2a; $i <= 0x3d; $i++) { - $reg = i2c_smbus_read_byte_data($file, $i); - return if i2c_smbus_read_byte_data($file, $i+0x40) != $reg; - return if i2c_smbus_read_byte_data($file, $i+0x80) != $reg; - return if i2c_smbus_read_byte_data($file, $i+0xc0) != $reg; - } + if ($chip == 0) { + for ($i = 0x2a; $i <= 0x3d; $i++) { + $reg = i2c_smbus_read_byte_data($file, $i); + return if i2c_smbus_read_byte_data($file, $i+0x40) != $reg; + return if i2c_smbus_read_byte_data($file, $i+0x80) != $reg; + return if i2c_smbus_read_byte_data($file, $i+0xc0) != $reg; + } - # Refine a bit by checking whether limits are in the correct order - # (min> 1) - 4; + # $confidence is now between -4 and 3 + + return unless $confidence > 0; + return $confidence; + } elsif ($chip == 1) { + return if (i2c_smbus_read_byte_data($file, 0x07) & 0xfe) != 0; + return if i2c_smbus_read_byte_data($file, 0x3e) != 0x01; + return if i2c_smbus_read_byte_data($file, 0x3f) != 0x08; + + return 6; } - # hot temp> 1) - 4; - # $confidence is now between -4 and 3 - - return unless $confidence > 0; - - return $confidence; } # Registers used: