Changeset 5261

Show
Ignore:
Timestamp:
05/23/08 12:22:30 (6 months ago)
Author:
khali
Message:

Identify the lm85-compatible chips individually. The previous method was
vendor-based, so we couldn't tell the user what exact device they had,
and the broad device ID mask could lead to false positives.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r5258 r5261  
    44SVN-HEAD 
    55  sensors-detect: Add Intel SCH (bus) support 
     6                  Add SMSC EMC6D103 support 
    67 
    783.0.2 (2008-05-18) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5260 r5261  
    670670     }, 
    671671     { 
    672        name => "National Semiconductor LM85 or LM96000", 
     672       name => "National Semiconductor LM85", 
    673673       driver => "lm85", 
    674674       i2c_addrs => [0x2c..0x2e], 
    675        i2c_detect => sub { lm85_detect(0x01, @_); }, 
    676      }, 
    677      { 
    678        name => "Analog Devices ADM1027, ADT7460 or ADT7463", 
     675       i2c_detect => sub { lm85_detect(0, @_); }, 
     676     }, 
     677     { 
     678       name => "National Semiconductor LM96000", 
    679679       driver => "lm85", 
    680680       i2c_addrs => [0x2c..0x2e], 
    681        i2c_detect => sub { lm85_detect(0x41, @_); }, 
    682      }, 
    683      { 
    684        name => "SMSC EMC6D100, EMC6D101 or EMC6D102", 
     681       i2c_detect => sub { lm85_detect(1, @_); }, 
     682     }, 
     683     { 
     684       name => "Analog Devices ADM1027", 
    685685       driver => "lm85", 
    686686       i2c_addrs => [0x2c..0x2e], 
    687        i2c_detect => sub { lm85_detect(0x5c, @_); }, 
     687       i2c_detect => sub { lm85_detect(2, @_); }, 
     688     }, 
     689     { 
     690       name => "Analog Devices ADT7460 or ADT7463", 
     691       driver => "lm85", 
     692       i2c_addrs => [0x2c..0x2e], 
     693       i2c_detect => sub { lm85_detect(3, @_); }, 
     694     }, 
     695     { 
     696       name => "SMSC EMC6D100 or EMC6D101", 
     697       driver => "lm85", 
     698       i2c_addrs => [0x2c..0x2e], 
     699       i2c_detect => sub { lm85_detect(4, @_); }, 
     700     }, 
     701     { 
     702       name => "SMSC EMC6D102", 
     703       driver => "lm85", 
     704       i2c_addrs => [0x2c..0x2e], 
     705       i2c_detect => sub { lm85_detect(5, @_); }, 
     706     }, 
     707     { 
     708       name => "SMSC EMC6D103", 
     709       driver => "lm85", 
     710       i2c_addrs => [0x2c..0x2e], 
     711       i2c_detect => sub { lm85_detect(6, @_); }, 
    688712     }, 
    689713     { 
     
    43314355} 
    43324356 
    4333 # $_[0]: Vendor to check for 
    4334 #   (0x01 = National Semi, 0x41 = Analog Dev, 0x5c = SMSC) 
     4357# $_[0]: Chip to detect 
     4358#   (0 = LM85, 1 = LM96000, 2 = ADM1027, 3 = ADT7463, 
     4359#    4 = EMC6D100/101, 5 = EMC6D102, 6 = EMC6D103) 
    43354360# $_[1]: A reference to the file descriptor to access this chip. 
    43364361# #_[2]: Base address. 
     
    43424367#                 0x41 == Analog Devices Vendor Id. 
    43434368#                 0x5c == SMSC Vendor Id. 
    4344 #                 0x60 == Version number. The lower 4 stepping 
    4345 #                         bits are masked and ignored. 
    43464369sub lm85_detect 
    43474370{ 
    4348   my ($vendor, $file, $addr) = @_; 
    4349   return if (i2c_smbus_read_byte_data($file, 0x3e)) != $vendor; 
    4350  
     4371  my ($chip, $file, $addr) = @_; 
     4372  my $vendor = i2c_smbus_read_byte_data($file, 0x3e); 
    43514373  my $verstep = i2c_smbus_read_byte_data($file, 0x3f); 
    4352   return if ($verstep & 0xf0) != 0x60; 
     4374 
     4375  if ($chip == 0) { 
     4376    return if $vendor != 0x01;  # National Semiconductor 
     4377    return if $verstep != 0x60  # LM85 C 
     4378           && $verstep != 0x62; # LM85 B 
     4379  } elsif ($chip == 1) { 
     4380    return if $vendor != 0x01;  # National Semiconductor 
     4381    return if $verstep != 0x68; # LM96000 
     4382  } elsif ($chip == 2) { 
     4383    return if $vendor != 0x41;  # Analog Devices 
     4384    return if $verstep != 0x60; # ADM1027 
     4385  } elsif ($chip == 3) { 
     4386    return if $vendor != 0x41;  # Analog Devices 
     4387    return if $verstep != 0x62; # ADT7463 
     4388  } elsif ($chip == 4) { 
     4389    return if $vendor != 0x5c;  # SMSC 
     4390    return if $verstep != 0x60  # EMC6D100/101 A0 
     4391           && $verstep != 0x61; # EMC6D100/101 A1 
     4392  } elsif ($chip == 5) { 
     4393    return if $vendor != 0x5c;  # SMSC 
     4394    return if $verstep != 0x65; # EMC6D102 
     4395  } elsif ($chip == 6) { 
     4396    return if $vendor != 0x5c;  # SMSC 
     4397    return if $verstep != 0x68; # EMC6D103 
     4398  } 
    43534399 
    43544400  if ($vendor == 0x41) # Analog Devices 
     
    43564402    return if i2c_smbus_read_byte_data($file, 0x3d) != 0x27; 
    43574403    return (8); 
    4358   } 
    4359  
    4360   if ($vendor == 0x5c) # SMSC 
    4361   { 
    4362     # Return undef if this is a SCH5027 
    4363     return if $verstep >= 0x69 and 
    4364         i2c_smbus_read_byte_data($file, 0xba) == 0x0f; 
    43654404  } 
    43664405