From 4e66e0f377eca70ffd2e4eff11c502d1f3189334 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 27 Apr 2008 07:08:08 +0000 Subject: [PATCH] Add National Semiconductor LM64 detection. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5214 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 5e877c60..dcf99dea 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ SVN-HEAD Run chip_special_cases() earlier New device ID for the SMSC SCH5317 Add SMSC SCH5127 detection + Add National Semiconductor LM64 detection 3.0.1 (2008-01-28) documentation: Update the application writing guidelines diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index a0ff08cf..05cff160 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1249,6 +1249,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x4c], i2c_detect => sub { lm63_detect(1, @_); }, }, + { + name => "National Semiconductor LM64", + driver => "to-be-written", # lm63 + i2c_addrs => [0x18, 0x4e], + i2c_detect => sub { lm63_detect(3, @_); }, + }, { name => "Fintek F75363SG", driver => "lm63", # Not yet @@ -4050,16 +4056,15 @@ sub lm90_detect } # $_[0]: Chip to detect -# (1 = LM63, 2 = F75363SG) +# (1 = LM63, 2 = F75363SG, 3 = LM64) # $_[1]: A reference to the file descriptor to access this chip. # $_[2]: Address (unused) -# Returns: undef if not detected, 8 if detected. +# Returns: undef if not detected, 6 if detected. # Registers used: # 0xfe: Manufacturer ID # 0xff: Chip ID / die revision # 0x03: Configuration (two or three unused bits) # 0x16: Alert mask (two or three unused bits) -# 0x03-0x0e: Mirrored registers (five pairs) sub lm63_detect { my ($chip, $file, $addr) = @_; @@ -4078,18 +4083,15 @@ sub lm63_detect return if $mid != 0x23 # Fintek || $cid != 0x20; # F75363SG return if ($conf & 0x1a) != 0x00 - || ($mask & 0x84) != 0x00; + || ($mask & 0x84) != 0x00; + } elsif ($chip == 3) { + return if $mid != 0x01 # National Semiconductor + || $cid != 0x51; # LM64 + return if ($conf & 0x18) != 0x00 + || ($mask & 0xa4) != 0xa4; } - # For compatibility with the LM86, some registers are mirrored - # to alternative locations - return if $conf != i2c_smbus_read_byte_data($file, 0x09); - foreach my $i (0x04, 0x05, 0x07, 0x08) { - return if i2c_smbus_read_byte_data($file, $i) - != i2c_smbus_read_byte_data($file, $i+6); - } - - return 8; + return 6; } # $_[0]: Chip to detect