add special driver name "use-isa-instead",

add vt1211 alias detection


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2904 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2005-02-13 16:56:42 +00:00
1 parent 07357293e0
commit 05018a9613
1 file changed
+44 -1
+44 -1
View File
@@ -885,7 +885,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
m5879_detect pca9540_detect smartbatt_mgr_detect
smartbatt_chgr_detect adt7467_detect lm92_detect max1619_detect
lm93_detect lm77_detect lm63_detect pca9556_detect
w83791sd_detect);
w83791sd_detect vt1211_i2c_detect vt1211_alias_detect);
# This is a list of all recognized chips.
# Each entry must have the following fields:
@@ -894,6 +894,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
# "to-be-written" if it is not yet available. Put in exactly
# "not-a-sensor" if it is not a hardware monitoring chip and
# there is no known driver for it.
# Put in exactly "use-isa-instead" if no i2c driver will be written.
# i2c_addrs (optional): For I2C chips, the range of valid I2C addresses to
# probe. Recommend avoiding 0x69 because of clock chips.
# i2c_driver_addrs (optional): For I2C chips, the range of valid I2C
@@ -1384,6 +1385,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
isa_addrs => [ 0 ],
isa_detect => sub { via8231_isa_detect @_ },
},
{
name => "VIA VT1211 (I2C)",
driver => "use-isa-instead",
i2c_addrs => [0x2d],
i2c_detect => sub { vt1211_i2c_detect 0, @_ },
},
{
name => "ITE IT8712F",
driver => "it87",
@@ -1732,6 +1739,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
driver => "vt1211",
devid => 0x3c,
logdev => 0x0b,
alias_detect => sub { vt1211_alias_detect 0, @_ },
},
{
name => "Winbond W83627HF Super IO Sensors",
@@ -4638,6 +4646,39 @@ sub max6650_detect
return 4;
}
# $_[0]: Chip to detect (0 = VT1211)
# $_[1]: A reference to the file descriptor to access this chip.
# We may assume an i2c_set_slave_addr was already done.
# $_[2]: Address
#
# This isn't very good detection.
# Verify the i2c address, and the stepping ID (which is 0xb0 on
# my chip but could be different for others...
#
sub vt1211_i2c_detect
{
my ($chip,$file,$addr) = @_;
return 0 unless (i2c_smbus_read_byte_data($file,0x48) & 0x7f) == $addr;
return 0 unless i2c_smbus_read_byte_data($file,0x3f) == 0xb0;
return 2;
}
# $_[0]: Chip to detect (0 = VT1211)
# $_[1]: ISA address
# $_[2]: I2C file handle
# $_[3]: I2C address
sub vt1211_alias_detect
{
my ($chip,$isa_addr,$file,$i2c_addr) = @_;
my $i;
return 0 unless (inb($isa_addr + 0x48) & 0x7f) == $i2c_addr;
return 0 unless (i2c_smbus_read_byte_data($file,0x48) & 0x7f) == $i2c_addr;
for ($i = 0x2b; $i <= 0x3d; $i ++) {
return 0 unless inb($isa_addr + $i) == i2c_smbus_read_byte_data($file,$i);
}
return 1;
}
################
# MAIN PROGRAM #
@@ -4766,6 +4807,8 @@ sub generate_modprobes
next if not @{$chip->{detected}};
if ($chip->{driver} eq "to-be-written") {
$modprobes .= "# no driver for $chip->{detected}[0]{chipname} yet\n";
} elsif ($chip->{driver} eq "use-isa-instead") {
$modprobes .= "# no I2C driver for $chip->{detected}[0]{chipname} use ISA driver instead\n";
} elsif ($chip->{driver} ne "not-a-sensor") {
$modprobes .= "modprobe $chip->{driver}\n";
}