2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 22:35:23 +00:00

Added detection of MAX6639 to sensors-detect

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5907 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Guenter Roeck
2011-01-21 17:20:10 +00:00
parent ee31bcf37e
commit f0240f421b
2 changed files with 27 additions and 0 deletions

View File

@@ -827,6 +827,11 @@ use vars qw(@i2c_adapter_names);
driver => "max1668",
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
i2c_detect => sub { max1668_detect(@_, 2); },
}, {
name => "Maxim MAX6639",
driver => "max6639",
i2c_addrs => [0x2c, 0x2e, 0x2f],
i2c_detect => sub { max6639_detect(@_); },
}, {
name => "Maxim MAX6650/MAX6651",
driver => "max6650",
@@ -5446,6 +5451,27 @@ sub w83l784r_detect
return @res;
}
# Chip to detect: MAX6639
# Registers used:
# 0x3d: Device ID
# 0x3e: Manufacturer ID
# 0x3f: Chip revision
sub max6639_detect
{
my ($file, $addr) = @_;
my ($man_id, $dev_id, $rev);
$dev_id = i2c_smbus_read_byte_data($file, 0x3d);
$man_id = i2c_smbus_read_byte_data($file, 0x3e);
$rev = i2c_smbus_read_byte_data($file, 0x3f);
return unless $man_id == 0x4d; # Maxim
return unless $dev_id == 0x58; # MAX6639
return unless $rev == 0x00;
return 6;
}
# The max6650 has no device ID register. However, a few registers have
# spare bits, which are documented as being always zero on read. We read
# all of these registers check the spare bits. Any non-zero means this