Changeset 4260

Show
Ignore:
Timestamp:
12/10/06 14:50:54 (6 years ago)
Author:
khali
Message:

sensors-detect: Improve ADM1029 detection.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r4256 r4260  
    3434                          Add Intel ICH9 detection 
    3535                          Add Maxim MAX6648/MAX6692 detection 
     36                          Improve ADM1029 detection 
    3637 
    3738 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4258 r4260  
    37103710#   (0 = ADM1029) 
    37113711# $_[1]: A reference to the file descriptor to access this chip. 
    3712 #        We may assume an i2c_set_slave_addr was already done. 
    3713 # $_[2]: Address 
    3714 # Returns: undef if not detected, 3 to 9 if detected. 
     3712# $_[2]: Address (unused) 
     3713# Returns: undef if not detected, 6 if detected. 
    37153714# Registers used: 
    37163715#   0x02, 0x03: Fan support 
    3717 #   0x05: GPIO config 
    37183716#   0x07, 0x08, 0x09: Fan config 
    37193717#   0x0d: Manufacturer ID 
     
    37243722  my $mid = i2c_smbus_read_byte_data($file, 0x0d); 
    37253723  my $cid = i2c_smbus_read_byte_data($file, 0x0e); 
    3726   my $fansc = i2c_smbus_read_byte_data($file, 0x02); 
    3727   my $fanss = i2c_smbus_read_byte_data($file, 0x03); 
    3728   my $gpio = i2c_smbus_read_byte_data($file, 0x05); 
    3729   my $fanas = i2c_smbus_read_byte_data($file, 0x07); 
    3730   my $fanhps = i2c_smbus_read_byte_data($file, 0x08); 
    3731   my $fanfs = i2c_smbus_read_byte_data($file, 0x09); 
    3732   my $confidence = 3; 
    37333724 
    37343725  if ($chip == 0) { 
    3735     return if $mid != 0x41;     # Analog Devices 
    3736     $confidence++ if ($cid & 0xF0) == 0x00; # ADM1029 
    3737     $confidence+=2 if ($fansc & 0xFC) == 0x00 
    3738                    && ($fanss & 0xFC) == 0x00; 
    3739     $confidence+=2 if ($fanas & 0xFC) == 0x00 
    3740                    && ($fanhps & 0xFC) == 0x00 
    3741                    && ($fanfs & 0xFC) == 0x00; 
    3742     $confidence++ if ($gpio & 0x80) == 0x00; 
    3743     return $confidence; 
     3726    return unless $mid == 0x41;             # Analog Devices 
     3727    return unless ($cid & 0xF0) == 0x00;    # ADM1029 
     3728 
     3729    # Extra check on unused bits 
     3730    foreach my $reg (0x02, 0x03, 0x07, 0x08, 0x09) { 
     3731      my $fancfg = i2c_smbus_read_byte_data($file, $reg); 
     3732      return unless ($fancfg & 0xFC) == 0x00; 
     3733    } 
     3734 
     3735    return 7; 
    37443736  } 
    37453737  return;