Add detection of SMSC EMC1403 and EMC1404.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5833 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2010-04-29 16:46:24 +00:00
1 parent 4cc4b9c69d
commit 44c1bad717
2 files changed
+36

No files matched your search

+1
View File
@@ -5,6 +5,7 @@ SVN HEAD
libsensors: Increase MAX_SENSORS_PER_TYPE to 24
sensors-detect: Give udev time to settle before accessing i2c nodes
Add support for Intel PCH (SMBus)
Add support for SMSC EMC1403 and EMC1404
3.1.2 (2010-02-02)
libsensors: Support upcoming sysfs path to i2c adapters
+35
View File
@@ -1164,6 +1164,16 @@ use vars qw(@i2c_adapter_names);
driver => "to-be-written",
i2c_addrs => [0x2f],
i2c_detect => sub { fintek_detect(@_, 7); },
}, {
name => "SMSC EMC1403",
driver => "emc1403",
i2c_addrs => [0x18, 0x2a, 0x4c, 0x4d],
i2c_detect => sub { emc1403_detect(@_, 0); },
}, {
name => "SMSC EMC1404",
driver => "to-be-written", # emc1403
i2c_addrs => [0x18, 0x2a, 0x4c, 0x4d],
i2c_detect => sub { emc1403_detect(@_, 1); },
}, {
name => "Smart Battery",
driver => "sbs", # ACPI driver, not sure if it always works
@@ -5133,6 +5143,31 @@ sub fintek_detect
return 7;
}
# Chip to detect: 0 = EMC1403, 1 = EMC1404
# Registers used:
# 0xfd: Device ID register
# 0xfe: Vendor ID register
# 0xff: Revision register
sub emc1403_detect
{
my ($file, $addr, $chip) = @_;
my $dev_id = i2c_smbus_read_byte_data($file, 0xfd);
my $man_id = i2c_smbus_read_byte_data($file, 0xfe);
my $rev = i2c_smbus_read_byte_data($file, 0xff);
return unless $man_id == 0x5d; # SMSC
if ($chip == 0) {
return unless $dev_id == 0x21;
return unless $rev == 0x01;
} elsif ($chip == 1) {
return unless $dev_id == 0x25;
return unless $rev == 0x01;
}
return 6;
}
# This checks for non-FFFF values for temperature, voltage, and current.
# The address (0x0b) is specified by the SMBus standard so it's likely
# that this really is a smart battery.