Add Nuvoton W83795G/ADG detection. Original patch from Wei Song (Nuvoton).

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5684 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2009-03-13 08:41:19 +00:00
1 parent f0492a9095
commit f7464553bd
2 files changed
+33

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ SVN-HEAD
Display Super-I/O address even if LD is disabled
Differentiate between PC8374L and WPCD377I
Use dmidecode to find IPMI interfaces if available
Add Nuvoton W83795G/ADG detection
3.1.0 "Happy Birthday Lina" (2009-02-28)
libsensors: Add support for instantaneous power sensors
+32
View File
@@ -647,6 +647,11 @@ use vars qw(@i2c_adapter_names);
driver => "w83793",
i2c_addrs => [0x2c..0x2f],
i2c_detect => sub { w83793_detect(@_); },
}, {
name => "Nuvoton W83795G/ADG",
driver => "w83795",
i2c_addrs => [0x2c..0x2f],
i2c_detect => sub { w83795_detect(@_); },
}, {
name => "Winbond W83627HF",
driver => "use-isa-instead",
@@ -4358,6 +4363,33 @@ sub w83793_detect
return @res;
}
# Registers used:
# 0xfc: Full I2C Address
# 0x00: Vendor ID byte selection, and bank selection(Bank 0, 1, 2)
# 0xfd: Vendor ID(Bank 0, 1, 2)
# 0xfe: Device ID(Bank 0, 1, 2)
sub w83795_detect
{
my ($bank, $reg);
my ($file, $addr) = @_;
$bank = i2c_smbus_read_byte_data($file, 0x00);
$reg = i2c_smbus_read_byte_data($file, 0xfd);
return unless (($bank & 0x80) == 0x00 and $reg == 0xa3) or
(($bank & 0x80) == 0x80 and $reg == 0x5c);
$reg = i2c_smbus_read_byte_data($file, 0xfe);
return if $reg != 0x79;
# If bank 0 is selected, we can do more checks
return 6 unless ($bank & 0x07) == 0;
$reg = i2c_smbus_read_byte_data($file, 0xfc) & 0x7f;
return unless ($reg == $addr);
return 8;
}
# Registers used:
# 0x48: Full I2C Address
# 0x4e: Vendor ID byte selection