mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
Prevent LM75 misdetection as a DS1621.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2133 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -2546,19 +2546,30 @@ sub lm75_detect
|
||||
# We may assume an i2c_set_slave_addr was already done.
|
||||
# $_[1]: Address
|
||||
# Returns: undef if not detected, (3) if detected,
|
||||
# (6) or (9) if even more bits match.
|
||||
# (5) or (7) if even more bits match.
|
||||
# Registers used:
|
||||
# 0xAA: Temperature
|
||||
# 0xA1: High limit
|
||||
# 0xA2: Low limit
|
||||
# 0xAC: Configuration
|
||||
# Detection is weak. We check if Bit 3 is set and Bit 2 is clear.
|
||||
# The DS1621 will aways have a config like 0x????10??. A even better
|
||||
# match would be 0x0??01000.
|
||||
# Temperature checkings will hopefully prevent LM75 chips from being
|
||||
# detected as a DS1621.
|
||||
sub ds1621_detect
|
||||
{
|
||||
my $i;
|
||||
my ($file,$addr) = @_;
|
||||
my $temp = i2c_smbus_read_word_data($file,0xAA);
|
||||
return if ($temp & 0x007F);
|
||||
$temp = i2c_smbus_read_word_data($file,0xA1);
|
||||
return if ($temp & 0x007F);
|
||||
$temp = i2c_smbus_read_word_data($file,0xA2);
|
||||
return if ($temp & 0x007F);
|
||||
my $conf = i2c_smbus_read_byte_data($file,0xAC);
|
||||
return (9) if ($conf & 0x9F) == 0x98;
|
||||
return (6) if ($conf & 0x0F) == 0x08;
|
||||
return (7) if ($conf & 0x9F) == 0x98;
|
||||
return (5) if ($conf & 0x0F) == 0x08;
|
||||
return (3) if ($conf & 0x0C) == 0x08;
|
||||
return ;
|
||||
}
|
||||
|
Reference in New Issue
Block a user