Changeset 4325
- Timestamp:
- 02/15/07 11:45:49 (6 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
prog/detect/sensors-detect (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r4324 r4325 23 23 Speed up the LM75 and LM77 detection 24 24 Clean up the EEPROM detection 25 Add Dallas DS75 detection 25 26 26 27 -
lm-sensors/trunk/prog/detect/sensors-detect
r4314 r4325 820 820 driver => "lm75", 821 821 i2c_addrs => [0x48..0x4f], 822 i2c_detect => sub { lm75_detect(@_); }, 823 } , 822 i2c_detect => sub { lm75_detect(0, @_); }, 823 }, 824 { 825 name => "Dallas Semiconductor DS75", 826 driver => "lm75", 827 i2c_addrs => [0x48..0x4f], 828 i2c_detect => sub { lm75_detect(1, @_); }, 829 }, 824 830 { 825 831 name => "National Semiconductor LM77", … … 3304 3310 } 3305 3311 3306 # $_[0]: A reference to the file descriptor to access this chip. 3307 # $_[1]: Address 3312 # $_[0]: Chip to detect (0 = LM75, 1 = DS75) 3313 # $_[1]: A reference to the file descriptor to access this chip. 3314 # $_[2]: Address (unused) 3308 3315 # Returns: undef if not detected, 3 or 6 if detected; 3309 3316 # 6 means that the temperatures make sense; … … 3321 3328 # documented. 3322 3329 # Note that register 0x00 may change, so we can't use the modulo trick on it. 3330 # The DS75 is a bit different, it doesn't cycle over 8-byte boundaries, and 3331 # all register addresses from 0x04 to 0x0f behave like 0x04-0x07 do for 3332 # the LM75. 3323 3333 sub lm75_detect 3324 3334 { 3325 3335 my $i; 3326 my ($ file,$addr) = @_;3336 my ($chip, $file, $addr) = @_; 3327 3337 my $cur = i2c_smbus_read_word_data($file,0x00); 3328 3338 my $conf = i2c_smbus_read_byte_data($file,0x01); 3329 3339 3330 3340 my $hyst = i2c_smbus_read_word_data($file,0x02); 3331 return if i2c_smbus_read_word_data($file,0x04) != $hyst;3332 return if i2c_smbus_read_word_data($file,0x05) != $hyst;3333 return if i2c_smbus_read_word_data($file,0x06) != $hyst;3334 return if i2c_smbus_read_word_data($file,0x07) != $hyst;3341 my $maxreg = $chip == 1 ? 0x0f : 0x07; 3342 for $i (0x04 .. $maxreg) { 3343 return if i2c_smbus_read_word_data($file, $i) != $hyst; 3344 } 3335 3345 3336 3346 my $os = i2c_smbus_read_word_data($file,0x03); 3337 return if i2c_smbus_read_word_data($file,0x04) != $os; 3338 return if i2c_smbus_read_word_data($file,0x05) != $os; 3339 return if i2c_smbus_read_word_data($file,0x06) != $os; 3340 return if i2c_smbus_read_word_data($file,0x07) != $os; 3341 3342 for ($i = 8; $i <= 248; $i += 40) { 3343 return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf; 3344 return if i2c_smbus_read_word_data($file, $i + 0x02) != $hyst; 3345 return if i2c_smbus_read_word_data($file, $i + 0x03) != $os; 3347 for $i (0x04 .. $maxreg) { 3348 return if i2c_smbus_read_word_data($file, $i) != $os; 3349 } 3350 3351 if ($chip == 0) { 3352 for ($i = 8; $i <= 248; $i += 40) { 3353 return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf 3354 or i2c_smbus_read_word_data($file, $i + 0x02) != $hyst 3355 or i2c_smbus_read_word_data($file, $i + 0x03) != $os; 3356 } 3346 3357 } 3347 3358 … … 3354 3365 $os = swap_bytes($os); 3355 3366 # Unused bits 3356 return if ($conf & 0xe0); 3367 return if $chip == 0 and ($conf & 0xe0); 3368 return if $chip == 1 and ($conf & 0x80); 3357 3369 3358 3370 $cur = $cur >> 8;
