Changeset 1888
- Timestamp:
- 07/20/03 00:09:39 (10 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/prog/detect/sensors-detect (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/detect/sensors-detect
r1886 r1888 1045 1045 }, 1046 1046 { 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 { 1047 1053 name => "National Semiconductor LM83", 1048 1054 driver => "lm83", … … 1055 1061 i2c_addrs => [0x4c], 1056 1062 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, @_ }, 1057 1075 }, 1058 1076 { … … 2379 2397 # Returns: undef if not detected, (3) if detected. 2380 2398 # Registers used: 2381 # Registers used:2382 2399 # 0x02: Interrupt state register 2383 2400 # How to detect this beast? … … 2397 2414 2398 2415 # $_[0]: Chip to detect 2399 # (0 = LM83 )2416 # (0 = LM83, 1 = LM82) 2400 2417 # $_[1]: A reference to the file descriptor to access this chip. 2401 2418 # We may assume an i2c_set_slave_addr was already done. 2402 2419 # $_[2]: Address 2403 # Returns: undef if not detected, 6 or8 if detected.2420 # Returns: undef if not detected, 5 to 8 if detected. 2404 2421 # Registers used: 2422 # 0x03: Configuration 2405 2423 # 0x04: Company ID of LM84 2406 2424 # 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. 2407 2430 sub lm83_detect 2408 2431 { 2409 my ($chip, $file ,$addr) = @_;2432 my ($chip, $file) = @_; 2410 2433 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)) 2412 2438 if i2c_smbus_read_byte_data($file,0x04) == 0x00; 2413 return 6;2439 return (5 + ($chip != 0)); 2414 2440 } 2415 2441 2416 2442 # $_[0]: Chip to detect 2417 # (0 = LM90 )2443 # (0 = LM90, 1=LM89, 2=LM86) 2418 2444 # $_[1]: A reference to the file descriptor to access this chip. 2419 2445 # We may assume an i2c_set_slave_addr was already done. 2420 2446 # $_[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. 2422 2448 # Registers used: 2423 2449 # 0x03: Configuration … … 2428 2454 my $reg; 2429 2455 my ($chip, $file,$addr) = @_; 2430 return if $chip == 0 andi2c_smbus_read_byte_data($file,0xfe) != 0x01;2456 return if i2c_smbus_read_byte_data($file,0xfe) != 0x01; 2431 2457 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; 2437 2477 } 2438 2478
