2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-05 00:35:35 +00:00

Add detection for National Semiconductor LM73.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5779 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2009-10-03 10:38:14 +00:00
parent 183947c528
commit b6becb237e
2 changed files with 37 additions and 0 deletions

View File

@@ -947,6 +947,11 @@ use vars qw(@i2c_adapter_names);
driver => "lm63", # Not yet
i2c_addrs => [0x4c],
i2c_detect => sub { lm63_detect(@_, 2); },
}, {
name => "National Semiconductor LM73",
driver => "lm73",
i2c_addrs => [0x48..0x4a, 0x4c..0x4e],
i2c_detect => sub { lm73_detect(@_); },
}, {
name => "National Semiconductor LM92",
driver => "lm92",
@@ -3585,6 +3590,37 @@ sub lm75_detect
return 3;
}
# Registers used:
# 0x00: Temperature
# 0x01: Configuration
# 0x02: High Limit
# 0x03: Low Limit
# 0x04: Status
# 0x07: Manufacturer ID and Product ID
sub lm73_detect
{
my ($file, $addr) = @_;
my $conf = i2c_smbus_read_byte_data($file, 0x01);
my $status = i2c_smbus_read_byte_data($file, 0x04);
# Bits that always return 0
return if ($conf & 0x0c) or ($status & 0x10);
return if i2c_smbus_read_word_data($file, 0x07) != 0x9001;
# Make sure the chip supports SMBus read word transactions
my $cur = i2c_smbus_read_word_data($file, 0x00);
return if $cur < 0;
my $high = i2c_smbus_read_word_data($file, 0x02);
return if $high < 0;
my $low = i2c_smbus_read_word_data($file, 0x03);
return if $low < 0;
return if ($cur & 0x0300) or (($high | $low) & 0x1f00);
return 3;
}
# Registers used:
# 0x00: Temperature
# 0x01: Configuration