Changeset 5264

Show
Ignore:
Timestamp:
05/25/08 12:07:25 (6 years ago)
Author:
khali
Message:

Improve MAX6657, MAX6658, MAX6659 detection.
Adjust the confidence value of ADM1032, MAX6680/MAX6681 and TMP401.

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

    r5261 r5264  
    55  sensors-detect: Add Intel SCH (bus) support 
    66                  Add SMSC EMC6D103 support 
     7                  Improve MAX6657, MAX6658, MAX6659 detection 
    78 
    893.0.2 (2008-05-18) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5262 r5264  
    10951095       driver => "lm90", 
    10961096       i2c_addrs => [0x4c], 
    1097        i2c_detect => sub { lm90_detect(4, @_); }, 
     1097       i2c_detect => sub { max6657_detect(@_); }, 
    10981098     }, 
    10991099     { 
     
    11011101       driver => "lm90", 
    11021102       i2c_addrs => [0x4d..0x4e], # 0x4c is handled above 
    1103        i2c_detect => sub { lm90_detect(4, @_); }, 
     1103       i2c_detect => sub { max6657_detect(@_); }, 
    11041104     }, 
    11051105     { 
     
    39593959 
    39603960# $_[0]: Chip to detect 
    3961 #   (0 = LM90, 1=LM89/LM99, 2=LM86, 3=ADM1032, 4=MAX6657/MAX6658/MAX6659, 
     3961#   (0 = LM90, 1 = LM89/LM99, 2 = LM86, 3 = ADM1032, 
    39623962#    5 = ADT7461, 6 = MAX6648/MAX6692, 7 = MAX6680/MAX6681, 
    3963 #    8 = W83L771W/G), 9 = TI TMP401 
     3963#    8 = W83L771W/G, 9 = TI TMP401) 
    39643964# $_[1]: A reference to the file descriptor to access this chip. 
    39653965# $_[2]: Address 
    3966 # Returns: undef if not detected, 4, 6 or 8 if detected. 
    3967 #   The Maxim chips MAX6657, MAX6658 and MAX6659 have a low confidence 
    3968 #   value (4) because they don't have a die revision register. 
     3966# Returns: undef if not detected, 6 or 8 if detected. 
    39693967# Registers used: 
    39703968#   0x03: Configuration 
     
    40064004    return if $rate > 0x0a; 
    40074005    return if $mid != 0x41;     # Analog Devices 
    4008     return 8 if ($cid & 0xf0) == 0x40; # ADM1032 
    4009   } 
    4010   if ($chip == 4) { 
    4011     return if ($conf & 0x1f) != ($mid & 0x0f); # No low nibble, 
    4012                                                # returns previous low nibble 
    4013     return if $rate > 0x09; 
    4014     return if $mid != 0x4d;     # Maxim 
    4015     return if $cid != 0x4d;     # No register, returns previous value 
    4016     return 4; 
     4006    return 6 if ($cid & 0xf0) == 0x40; # ADM1032 
    40174007  } 
    40184008  if ($chip == 5) { 
     
    40344024    return if $mid != 0x4d;     # Maxim 
    40354025    return if $cid != 0x01;     # MAX6680/MAX6681 
    4036     return 6; 
     4026    return 8; 
    40374027  } 
    40384028  if ($chip == 8) { 
     
    40484038    return if $mid != 0x55;     # Texas Instruments 
    40494039    return if $cid != 0x11;     # TMP401 
    4050     return 6; 
     4040    return 8; 
    40514041  } 
    40524042  return; 
     4043} 
     4044 
     4045# $_[0]: A reference to the file descriptor to access this chip. 
     4046# $_[1]: Address 
     4047# Returns: undef if not detected, 5 if detected. 
     4048# Registers used: 
     4049#   0x03: Configuration (no low nibble) 
     4050#   0x04: Conversion rate 
     4051#   0xfe: Manufacturer ID 
     4052#   0xff: no register 
     4053sub max6657_detect 
     4054{ 
     4055  my ($file, $addr) = @_; 
     4056  my $mid = i2c_smbus_read_byte_data($file, 0xfe); 
     4057  my $cid = i2c_smbus_read_byte_data($file, 0xff); 
     4058  my $conf = i2c_smbus_read_byte_data($file, 0x03); 
     4059 
     4060  return if $mid != 0x4d;     # Maxim 
     4061  return if ($conf & 0x1f) != 0x0d; # No low nibble, 
     4062                                    # returns previous low nibble 
     4063  return if $cid != 0x4d;     # No register, returns previous value 
     4064 
     4065  my $rate = i2c_smbus_read_byte_data($file, 0x04); 
     4066  return if $rate > 0x09; 
     4067 
     4068  $cid = i2c_smbus_read_byte_data($file, 0xff); 
     4069  $conf = i2c_smbus_read_byte_data($file, 0x03); 
     4070  return if ($conf & 0x0f) != $rate; # No low nibble, 
     4071                                     # returns previous low nibble 
     4072  return if $cid != $rate;    # No register, returns previous value 
     4073 
     4074  return 5; 
    40534075} 
    40544076