Changeset 1888

Show
Ignore:
Timestamp:
07/20/03 00:09:39 (10 years ago)
Author:
khali
Message:

Add support for LM82, LM86 and LM89.

Better detection for LM83 and LM90.

Files:
1 modified

Legend:

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

    r1886 r1888  
    10451045     }, 
    10461046     { 
     1047       name => "National Semiconductor LM82", 
     1048       driver => "to-be-written", 
     1049       i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], 
     1050       i2c_detect => sub { lm83_detect 1, @_ }, 
     1051     }, 
     1052     { 
    10471053       name => "National Semiconductor LM83", 
    10481054       driver => "lm83", 
     
    10551061       i2c_addrs => [0x4c], 
    10561062       i2c_detect => sub { lm90_detect 0, @_ }, 
     1063     }, 
     1064     { 
     1065       name => "National Semiconductor LM89", 
     1066       driver => "to-be-written", 
     1067       i2c_addrs => [0x4c], 
     1068       i2c_detect => sub { lm90_detect 1, @_ }, 
     1069     }, 
     1070     { 
     1071       name => "National Semiconductor LM86", 
     1072       driver => "to-be-written", 
     1073       i2c_addrs => [0x4c], 
     1074       i2c_detect => sub { lm90_detect 2, @_ }, 
    10571075     }, 
    10581076     { 
     
    23792397# Returns: undef if not detected, (3) if detected. 
    23802398# Registers used: 
    2381 # Registers used: 
    23822399#   0x02: Interrupt state register 
    23832400# How to detect this beast?  
     
    23972414 
    23982415# $_[0]: Chip to detect 
    2399 #   (0 = LM83) 
     2416#   (0 = LM83, 1 = LM82) 
    24002417# $_[1]: A reference to the file descriptor to access this chip. 
    24012418#        We may assume an i2c_set_slave_addr was already done. 
    24022419# $_[2]: Address 
    2403 # Returns: undef if not detected, 6 or 8 if detected. 
     2420# Returns: undef if not detected, 5 to 8 if detected. 
    24042421# Registers used: 
     2422#   0x03: Configuration 
    24052423#   0x04: Company ID of LM84 
    24062424#   0xfe: Manufacturer ID 
     2425#   0xff: Chip ID / die revision 
     2426# We can use the LM84 Company ID register because the LM83 and the LM82 are 
     2427# compatible with the LM84. 
     2428# We give a lower confidence to the LM83 because it has no known Die Revision 
     2429# so far. 
    24072430sub lm83_detect 
    24082431{ 
    2409   my ($chip, $file,$addr) = @_; 
     2432  my ($chip, $file) = @_; 
    24102433  return if $chip == 0 and i2c_smbus_read_byte_data($file,0xfe) != 0x01; 
    2411   return 8 
     2434  return if $chip == 1 and i2c_smbus_read_byte_data($file,0xfe) != 0x01 
     2435                        || i2c_smbus_read_byte_data($file,0xff) != 0x01; 
     2436  return if (i2c_smbus_read_byte_data($file,0x03) & 0x41) != 0; 
     2437  return (7 + ($chip != 0)) 
    24122438        if i2c_smbus_read_byte_data($file,0x04) == 0x00; 
    2413   return 6; 
     2439  return (5 + ($chip != 0)); 
    24142440} 
    24152441 
    24162442# $_[0]: Chip to detect 
    2417 #   (0 = LM90) 
     2443#   (0 = LM90, 1=LM89, 2=LM86) 
    24182444# $_[1]: A reference to the file descriptor to access this chip. 
    24192445#        We may assume an i2c_set_slave_addr was already done. 
    24202446# $_[2]: Address 
    2421 # Returns: undef if not detected, 6, 7 or 8 if detected. 
     2447# Returns: undef if not detected, 7 or 8 if detected. 
    24222448# Registers used: 
    24232449#   0x03: Configuration 
     
    24282454  my $reg; 
    24292455  my ($chip, $file,$addr) = @_; 
    2430   return if $chip == 0 and i2c_smbus_read_byte_data($file,0xfe) != 0x01; 
     2456  return if i2c_smbus_read_byte_data($file,0xfe) != 0x01; 
    24312457  return if (i2c_smbus_read_byte_data($file,0x03) & 0x2a) != 0; 
    2432   return 8 
    2433         if ($reg = i2c_smbus_read_byte_data($file,0xff)) == 0x21; 
    2434   return 7 
    2435     if $reg > 0x21 and $reg < 0x30; 
    2436   return 6; 
     2458  if ($chip == 0) { 
     2459    return 8 
     2460          if ($reg = i2c_smbus_read_byte_data($file,0xff)) == 0x21; 
     2461    return 7 
     2462      if $reg > 0x21 and $reg < 0x30; 
     2463  } 
     2464  if ($chip == 1) { 
     2465    return 8 
     2466          if ($reg = i2c_smbus_read_byte_data($file,0xff)) == 0x31; 
     2467    return 7 
     2468      if $reg > 0x31 and $reg < 0x40; 
     2469  } 
     2470  if ($chip == 2) { 
     2471    return 8 
     2472          if ($reg = i2c_smbus_read_byte_data($file,0xff)) == 0x11; 
     2473    return 7 
     2474      if $reg > 0x11 and $reg < 0x20; 
     2475  } 
     2476  return; 
    24372477} 
    24382478