Show
Ignore:
Timestamp:
12/06/04 21:18:35 (9 years ago)
Author:
khali
Message:

Fix W83792D detection. Add W83791SD detection.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/sensors-detect

    r2779 r2787  
    853853            m5879_detect pca9540_detect smartbatt_mgr_detect 
    854854            smartbatt_chgr_detect adt7467_detect lm92_detect max1619_detect 
    855             lm93_detect lm77_detect lm63_detect pca9556_detect); 
     855            lm93_detect lm77_detect lm63_detect pca9556_detect 
     856            w83791sd_detect); 
    856857 
    857858# This is a list of all recognized chips.  
     
    859860#  name: The full chip name 
    860861#  driver: The driver name (without .o extension). Put in exactly 
    861 #      "to-be-written" if it is not yet available. 
     862#      "to-be-written" if it is not yet available. Put in exactly 
     863#      "not-a-sensor" if it is not a hardware monitoring chip and 
     864#      there is no known driver for it. 
    862865#  i2c_addrs (optional): For I2C chips, the range of valid I2C addresses to 
    863866#      probe. Recommend avoiding 0x69 because of clock chips. 
     
    10011004       i2c_addrs => [0x2c..0x2f], 
    10021005       i2c_detect => sub { w83781d_detect 8, @_}, 
     1006     }, 
     1007     { 
     1008       name => "Winbond W83791SD", 
     1009       driver => "not-a-sensor", 
     1010       i2c_addrs => [0x2c..0x2f], 
     1011       i2c_detect => sub { w83791sd_detect @_ }, 
    10031012     }, 
    10041013     { 
     
    33973406  return if $chip == 6 and  $reg1 != 0x31; 
    33983407  return if $chip == 7 and  $reg1 != 0x71; 
    3399   return if $chip == 8 and  $reg1 != 0x72; 
     3408  return if $chip == 7 and  $reg1 != 0x7a; 
    34003409  $reg1 = i2c_smbus_read_byte_data($file,0x4a); 
    34013410  @res = (8); 
     
    34053414  push @res, (($reg1 & 0x70) >> 4) + 0x48 unless ($reg1 & 0x80 or $chip == 2); 
    34063415  return @res; 
     3416} 
     3417 
     3418# $_[0]: A reference to the file descriptor to access this chip. 
     3419#        We assume an i2c_set_slave_addr was already done. 
     3420# $_[1]: Address 
     3421# Returns: undef if not detected, 3 if detected 
     3422# Registers used: 
     3423#   0x48: Full I2C Address 
     3424#   0x4e: Vendor ID byte selection 
     3425#   0x4f: Vendor ID 
     3426#   0x58: Device ID 
     3427# Note that the datasheet was useless and this detection routine 
     3428# is based on dumps we received from users. Also, the W83781SD is *NOT* 
     3429# a hardware monitoring chip as far as we know, but we still want to 
     3430# detect it so that people won't keep reporting it as an unknown chip 
     3431# we should investigate about. 
     3432sub w83791sd_detect 
     3433{ 
     3434  my ($file, $addr) = @_; 
     3435  my ($reg1, $reg2); 
     3436 
     3437  return unless (i2c_smbus_read_byte_data($file, 0x48) == $addr); 
     3438 
     3439  $reg1 = i2c_smbus_read_byte_data($file, 0x4e); 
     3440  $reg2 = i2c_smbus_read_byte_data($file, 0x4f); 
     3441  return unless (!($reg1 & 0x80) && $reg2 == 0xa3) 
     3442             || (($reg1 & 0x80) && $reg2 == 0x5c); 
     3443 
     3444  $reg1 = i2c_smbus_read_byte_data($file, 0x58); 
     3445  return unless $reg1 == 0x72; 
     3446 
     3447  return 3; 
    34073448} 
    34083449 
     
    46204661    if ($chip->{driver} eq "to-be-written") { 
    46214662      $modprobes .= "# no driver for $chip->{detected}[0]{chipname} yet\n"; 
    4622     } else { 
     4663    } elsif ($chip->{driver} ne "not-a-sensor") { 
    46234664      $modprobes .= "modprobe $chip->{driver}\n"; 
    46244665    }