Changeset 5117

Show
Ignore:
Timestamp:
02/03/08 22:03:07 (5 years ago)
Author:
khali
Message:

Add SMSC SCH5027D detection. Patch from Juerg Haefliger.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r5114 r5117  
    11lm-sensors CHANGES file 
    22----------------------- 
     3 
     4SVN 
     5  sensors-detect: Add SMSC SCH5027D detection 
    36 
    473.0.1 (2008-01-28) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5108 r5117  
    14121412       driver => "dme1737", 
    14131413       i2c_addrs => [0x2c..0x2e], 
    1414        i2c_detect => sub { dme1737_detect(@_); }, 
     1414       i2c_detect => sub { dme1737_detect(1, @_); }, 
     1415     }, 
     1416     { 
     1417       name => "SMSC SCH5027D-NW", 
     1418       driver => "dme1737", 
     1419       i2c_addrs => [0x2c..0x2e], 
     1420       i2c_detect => sub { dme1737_detect(2, @_); }, 
    14151421     }, 
    14161422     { 
     
    18971903      }, 
    18981904      { 
     1905        name => "SMSC SCH5027D-NW Super IO", 
     1906        # Hardware monitoring features are accessed on the SMBus 
     1907        driver => "via-smbus-only", 
     1908        devid => 0x89, 
     1909      }, 
     1910      { 
    18991911        name => "SMSC SCH5307-NS Super IO", 
    19001912        driver => "smsc47b397", 
     
    43434355  my ($vendor,$file,$addr) = @_; 
    43444356  return if (i2c_smbus_read_byte_data($file,0x3e)) != $vendor ; 
    4345   return if (i2c_smbus_read_byte_data($file,0x3f) & 0xf0) != 0x60; 
     4357 
     4358  my $verstep = i2c_smbus_read_byte_data($file,0x3f); 
     4359  return if ($verstep & 0xf0) != 0x60; 
    43464360 
    43474361  if ($vendor == 0x41) # Analog Devices 
     
    43494363    return if i2c_smbus_read_byte_data($file, 0x3d) != 0x27; 
    43504364    return (8); 
     4365  } 
     4366 
     4367  if ($vendor == 0x5c) # SMSC 
     4368  { 
     4369    # Return undef if this is a SCH5027 
     4370    return if $verstep >= 0x69 and 
     4371        i2c_smbus_read_byte_data($file, 0xba) == 0x0f; 
    43514372  } 
    43524373 
     
    51675188} 
    51685189 
    5169 # $_[0]: A reference to the file descriptor to access this chip. 
    5170 # $_[1]: Address 
     5190# $_[0]: Chip to detect 
     5191#        (1 = DME1737, 2 = SCH5027) 
     5192# $_[1]: A reference to the file descriptor to access this chip. 
     5193# $_[2]: Address 
    51715194# Returns: undef if not detected, 5 or 6 if detected. 
    51725195# Registers used: 
     
    51755198#   0x73: Read-only test register (4 test bits) 
    51765199#   0x8A: Read-only test register (7 test bits) 
     5200#   0xBA: Read-only test register (8 test bits) 
    51775201sub dme1737_detect 
    51785202{ 
    5179   my ($file, $addr) = @_; 
    5180   return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x5c 
    5181            and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF8) == 0x88 
    5182            and (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 
    5183            and (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D; 
     5203  my ($chip, $file, $addr) = @_; 
     5204  my $vendor = i2c_smbus_read_byte_data($file, 0x3E); 
     5205  my $verstep = i2c_smbus_read_byte_data($file, 0x3F); 
     5206 
     5207  return unless $vendor == 0x5C; # SMSC 
     5208 
     5209  if ($chip == 1) { # DME1737 
     5210      return unless ($verstep & 0xF8) == 0x88 and 
     5211          (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 and 
     5212          (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D; 
     5213  } elsif ($chip == 2) { # SCH5027 
     5214      return unless $verstep >= 0x69 and $verstep <= 0x6F and 
     5215          i2c_smbus_read_byte_data($file, 0xBA) == 0x0F; 
     5216  } 
     5217 
    51845218  return ($addr == 0x2e ? 6 : 5); 
    51855219}