mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-02 07:15:39 +00:00
Rework LM82/LM83 detection according to Ben Gardner's report.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3019 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -1279,13 +1279,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
|
|||||||
i2c_detect => sub { max1619_detect 0, @_ },
|
i2c_detect => sub { max1619_detect 0, @_ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => "National Semiconductor LM82",
|
name => "National Semiconductor LM82/LM83",
|
||||||
driver => "to-be-written",
|
|
||||||
i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e],
|
|
||||||
i2c_detect => sub { lm83_detect 1, @_ },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name => "National Semiconductor LM83",
|
|
||||||
driver => "lm83",
|
driver => "lm83",
|
||||||
i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e],
|
i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e],
|
||||||
i2c_detect => sub { lm83_detect 0, @_ },
|
i2c_detect => sub { lm83_detect 0, @_ },
|
||||||
@@ -3213,11 +3207,11 @@ sub lm80_detect
|
|||||||
}
|
}
|
||||||
|
|
||||||
# $_[0]: Chip to detect
|
# $_[0]: Chip to detect
|
||||||
# (0 = LM83, 1 = LM82)
|
# (0 = LM82/LM83)
|
||||||
# $_[1]: A reference to the file descriptor to access this chip.
|
# $_[1]: A reference to the file descriptor to access this chip.
|
||||||
# We may assume an i2c_set_slave_addr was already done.
|
# We may assume an i2c_set_slave_addr was already done.
|
||||||
# $_[2]: Address
|
# $_[2]: Address
|
||||||
# Returns: undef if not detected, 5 to 8 if detected.
|
# Returns: undef if not detected, 4 to 8 if detected.
|
||||||
# Registers used:
|
# Registers used:
|
||||||
# 0x02: Status 1
|
# 0x02: Status 1
|
||||||
# 0x03: Configuration
|
# 0x03: Configuration
|
||||||
@@ -3228,13 +3222,17 @@ sub lm80_detect
|
|||||||
# We can use the LM84 Company ID register because the LM83 and the LM82 are
|
# We can use the LM84 Company ID register because the LM83 and the LM82 are
|
||||||
# compatible with the LM84.
|
# compatible with the LM84.
|
||||||
# The LM83 chip ID is missing from the datasheet and was contributed by
|
# The LM83 chip ID is missing from the datasheet and was contributed by
|
||||||
# Magnus Forsstrom.
|
# Magnus Forsstrom: 0x03.
|
||||||
|
# At least some revisions of the LM82 seem to be repackaged LM83, so they
|
||||||
|
# have the same chip ID, and temp2/temp4 will be stuck in "OPEN" state.
|
||||||
|
# For this reason, we don't even try to distinguish between both chips.
|
||||||
|
# Thanks to Ben Gardner for reporting.
|
||||||
sub lm83_detect
|
sub lm83_detect
|
||||||
{
|
{
|
||||||
my ($chip, $file) = @_;
|
my ($chip, $file) = @_;
|
||||||
return if i2c_smbus_read_byte_data($file,0xfe) != 0x01;
|
return if i2c_smbus_read_byte_data($file,0xfe) != 0x01;
|
||||||
return if $chip == 0 and i2c_smbus_read_byte_data($file,0xff) != 0x03;
|
my $chipid = i2c_smbus_read_byte_data($file,0xff);
|
||||||
return if $chip == 1 and i2c_smbus_read_byte_data($file,0xff) != 0x01;
|
return if $chipid != 0x01 && $chipid != 0x03;
|
||||||
|
|
||||||
my $confidence = 4;
|
my $confidence = 4;
|
||||||
$confidence++
|
$confidence++
|
||||||
@@ -3244,8 +3242,7 @@ sub lm83_detect
|
|||||||
$confidence++
|
$confidence++
|
||||||
if i2c_smbus_read_byte_data($file,0x04) == 0x00;
|
if i2c_smbus_read_byte_data($file,0x04) == 0x00;
|
||||||
$confidence++
|
$confidence++
|
||||||
if $chip == 0
|
if (i2c_smbus_read_byte_data($file,0x35) & 0x48) == 0x00;
|
||||||
&& (i2c_smbus_read_byte_data($file,0x35) & 0x48) == 0x00;
|
|
||||||
|
|
||||||
return $confidence;
|
return $confidence;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user