2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 22:05:11 +00:00

Add support for the PCA9540.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2367 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2004-03-19 18:22:30 +00:00
parent 12805aeb7c
commit 0fb8b6f04b

View File

@@ -780,7 +780,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
adm1026_detect w83l785ts_detect lm83_detect lm90_detect
saa1064_detect w83l784r_detect mozart_detect max6650_detect
fscher_detect adm1029_detect adm1031_detect max6900_detect
m5879_detect);
m5879_detect pca9540_detect);
# This is a list of all recognized chips.
# Each entry must have the following fields:
@@ -1252,6 +1252,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
i2c_addrs => [0x38..0x3b],
i2c_detect => sub { saa1064_detect @_ },
},
{
name => "Philips Semiconductors PCA9540",
driver => "pca9540",
i2c_addrs => [0x70],
i2c_detect => sub { pca9540_detect @_ },
},
{
name => "Maxim MAX6900",
driver => "to-be-written",
@@ -3806,6 +3812,25 @@ sub saa1064_detect
return 4;
}
# $_[0]: A reference to the file descriptor to access this chip.
# We may assume an i2c_set_slave_addr was already done.
# $_[1]: Address
# Returns: undef if not detected, 1 if detected
# Detection is rather difficult, since the PCA9540 has a single register.
# Fortunately, no other device is known to live at this address.
sub pca9540_detect
{
my ($file, $addr) = @_;
my $reg = i2c_smbus_read_byte($file);
return if ($reg & 0xf7);
return if $reg != i2c_smbus_read_byte($file);
return if $reg != i2c_smbus_read_byte($file);
return if $reg != i2c_smbus_read_byte($file);
return 1;
}
# $_[0]: A reference to the file descriptor to access this chip.
# We may assume an i2c_set_slave_addr was already done.
# $_[1]: Address