2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

Add National Semiconductor LM95241 detection.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5708 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2009-04-06 17:05:54 +00:00
parent f7464553bd
commit 7fd91785d4
2 changed files with 21 additions and 7 deletions

View File

@@ -911,7 +911,12 @@ use vars qw(@i2c_adapter_names);
name => "National Semiconductor LM95231",
driver => "to-be-written",
i2c_addrs => [0x2b, 0x19, 0x2a],
i2c_detect => sub { lm95231_detect(@_); },
i2c_detect => sub { lm95231_detect(@_, 0); },
}, {
name => "National Semiconductor LM95241",
driver => "lm95241",
i2c_addrs => [0x2b, 0x19, 0x2a],
i2c_detect => sub { lm95231_detect(@_, 1); },
}, {
name => "National Semiconductor LM63",
driver => "lm63",
@@ -3907,20 +3912,28 @@ sub max6657_detect
return 5;
}
# Chip to detect: 0 = LM95231, 1 = LM95241
# Registers used:
# 0x03: Configuration
# 0x02: Status (3 unused bits)
# 0x03: Configuration (3 unused bits)
# 0x06: Remote diode filter control (6 unused bits)
# 0x30: Remote diode model type select (6 unused bits)
# 0xfe: Manufacturer ID
# 0xff: Revision ID
sub lm95231_detect
{
my ($file, $addr) = @_;
my ($file, $addr, $chip) = @_;
my $mid = i2c_smbus_read_byte_data($file, 0xfe);
my $cid = i2c_smbus_read_byte_data($file, 0xff);
my $conf = i2c_smbus_read_byte_data($file, 0x03);
return if ($conf & 0x89) != 0;
return if $mid != 0x01; # National Semiconductor
return if $cid != 0xa1; # LM95231
return if $mid != 0x01; # National Semiconductor
return if $chip == 0 && $cid != 0xa1; # LM95231
return if $chip == 1 && $cid != 0xa4; # LM95231
return if i2c_smbus_read_byte_data($file, 0x02) & 0x70;
return if i2c_smbus_read_byte_data($file, 0x03) & 0x89;
return if i2c_smbus_read_byte_data($file, 0x06) & 0xfa;
return if i2c_smbus_read_byte_data($file, 0x30) & 0xfa;
return 6;
}