2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-02 07:15:39 +00:00

Merge several alias detection functions.

Drop unused parameter of vt1211_alias_detect.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5275 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2008-06-07 21:14:07 +00:00
parent 79fa83d534
commit 83c47f9a5e
2 changed files with 24 additions and 59 deletions

View File

@@ -10,6 +10,7 @@ SVN-HEAD
Add Maxim MAX6654/MAX6690 support Add Maxim MAX6654/MAX6690 support
Add National Semiconductor LM95231 support Add National Semiconductor LM95231 support
Add Analog Devices ADT7481 support Add Analog Devices ADT7481 support
Refactor alias detection functions
3.0.2 (2008-05-18) 3.0.2 (2008-05-18)
documentation: Delete the FAQ, now maintained on the wiki documentation: Delete the FAQ, now maintained on the wiki

View File

@@ -625,7 +625,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_detect => sub { lm78_detect(0, @_); }, i2c_detect => sub { lm78_detect(0, @_); },
isa_addrs => [0x290], isa_addrs => [0x290],
isa_detect => sub { lm78_isa_detect(0, @_); }, isa_detect => sub { lm78_isa_detect(0, @_); },
alias_detect => sub { lm78_alias_detect(0, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "National Semiconductor LM78-J", name => "National Semiconductor LM78-J",
@@ -634,7 +634,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_detect => sub { lm78_detect(1, @_); }, i2c_detect => sub { lm78_detect(1, @_); },
isa_addrs => [0x290], isa_addrs => [0x290],
isa_detect => sub { lm78_isa_detect(1, @_); }, isa_detect => sub { lm78_isa_detect(1, @_); },
alias_detect => sub { lm78_alias_detect(1, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "National Semiconductor LM79", name => "National Semiconductor LM79",
@@ -643,7 +643,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_detect => sub { lm78_detect(2, @_); }, i2c_detect => sub { lm78_detect(2, @_); },
isa_addrs => [0x290], isa_addrs => [0x290],
isa_detect => sub { lm78_isa_detect(2, @_); }, isa_detect => sub { lm78_isa_detect(2, @_); },
alias_detect => sub { lm78_alias_detect(2, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "National Semiconductor LM75", name => "National Semiconductor LM75",
@@ -798,7 +798,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_addrs => [0x28..0x2f], i2c_addrs => [0x28..0x2f],
isa_addrs => [0x290], isa_addrs => [0x290],
isa_detect => sub { w83781d_isa_detect(0, @_); }, isa_detect => sub { w83781d_isa_detect(0, @_); },
alias_detect => sub { w83781d_alias_detect(0, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "Winbond W83782D", name => "Winbond W83782D",
@@ -807,7 +807,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
i2c_detect => sub { w83781d_detect(1, @_); }, i2c_detect => sub { w83781d_detect(1, @_); },
isa_addrs => [0x290], isa_addrs => [0x290],
isa_detect => sub { w83781d_isa_detect(1, @_); }, isa_detect => sub { w83781d_isa_detect(1, @_); },
alias_detect => sub { w83781d_alias_detect(1, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "Winbond W83783S", name => "Winbond W83783S",
@@ -1887,14 +1887,14 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids
driver => "vt1211", driver => "vt1211",
devid => 0x3c, devid => 0x3c,
logdev => 0x0b, logdev => 0x0b,
alias_detect => sub { vt1211_alias_detect(0, @_); }, alias_detect => sub { vt1211_alias_detect(@_); },
}, },
{ {
name => "Winbond W83627HF/F/HG/G Super IO Sensors", name => "Winbond W83627HF/F/HG/G Super IO Sensors",
driver => "w83627hf", driver => "w83627hf",
devid => 0x52, devid => 0x52,
logdev => 0x0b, logdev => 0x0b,
alias_detect => sub { w83781d_alias_detect(3, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3d, @_); },
}, },
{ {
name => "Winbond W83627THF/THG Super IO Sensors", name => "Winbond W83627THF/THG Super IO Sensors",
@@ -1934,7 +1934,7 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids
devid => 0x8840, devid => 0x8840,
devid_mask => 0xFFC0, devid_mask => 0xFFC0,
logdev => 0x0b, logdev => 0x0b,
alias_detect => sub { w83781d_alias_detect(9, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3e, @_); },
}, },
{ {
name => "Winbond W83627DHG Super IO Sensors", name => "Winbond W83627DHG Super IO Sensors",
@@ -1942,7 +1942,7 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids
devid => 0xA020, devid => 0xA020,
devid_mask => 0xFFF0, devid_mask => 0xFFF0,
logdev => 0x0b, logdev => 0x0b,
alias_detect => sub { w83781d_alias_detect(10, @_); }, alias_detect => sub { winbond_alias_detect(0x2b, 0x3e, @_); },
}, },
{ {
name => "Winbond W83L517D Super IO", name => "Winbond W83L517D Super IO",
@@ -2030,7 +2030,7 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids
driver => "it87", driver => "it87",
devid => 0x8712, devid => 0x8712,
logdev => 0x04, logdev => 0x04,
alias_detect => sub { ite_alias_detect(0, @_); }, alias_detect => sub { winbond_alias_detect(0x30, 0x45, @_); },
}, },
{ {
name => "ITE IT8716F Super IO Sensors", name => "ITE IT8716F Super IO Sensors",
@@ -3601,23 +3601,6 @@ sub lm78_isa_detect
return 6; return 6;
} }
# $_[0]: Chip to detect (0 = LM78, 1 = LM78-J, 2 = LM79)
# $_[1]: ISA address
# $_[2]: I2C file handle
# $_[3]: I2C address
sub lm78_alias_detect
{
my ($chip, $isa_addr, $file, $i2c_addr) = @_;
my $i;
return 0 unless isa_read_i5d6($isa_addr, 0x48) == $i2c_addr;
for ($i = 0x2b; $i <= 0x3d; $i ++) {
return 0 unless isa_read_i5d6($isa_addr, $i) == i2c_smbus_read_byte_data($file, $i);
}
return 1;
}
# $_[0]: Chip to detect (0 = LM75, 1 = DS75) # $_[0]: Chip to detect (0 = LM75, 1 = DS75)
# $_[1]: A reference to the file descriptor to access this chip. # $_[1]: A reference to the file descriptor to access this chip.
# $_[2]: Address (unused) # $_[2]: Address (unused)
@@ -4668,19 +4651,18 @@ sub mozart_detect
return 5; return 5;
} }
# $_[0]: Chip to detect (0 = W83781D, 1 = W83782D, 3 = W83627HF, # $_[0]: First limit register to compare
# 9 = W83627EHF 10, = W83627DHG) # $_[1]: Last limit register to compare
# $_[1]: ISA address # $_[2]: ISA address
# $_[2]: I2C file handle # $_[3]: I2C file handle
# $_[3]: I2C address # $_[4]: I2C address
sub w83781d_alias_detect sub winbond_alias_detect
{ {
my ($chip, $isa_addr, $file, $i2c_addr) = @_; my ($first, $last, $isa_addr, $file, $i2c_addr) = @_;
my $i; my $i;
my $max = ($chip == 9 || $chip == 10) ? 0x3e : 0x3d;
return 0 unless isa_read_i5d6($isa_addr, 0x48) == $i2c_addr; return 0 unless isa_read_i5d6($isa_addr, 0x48) == $i2c_addr;
for ($i = 0x2b; $i <= $max; $i ++) { for ($i = $first; $i <= $last; $i++) {
return 0 unless isa_read_i5d6($isa_addr, $i) == i2c_smbus_read_byte_data($file, $i); return 0 unless isa_read_i5d6($isa_addr, $i) == i2c_smbus_read_byte_data($file, $i);
} }
return 1; return 1;
@@ -5056,23 +5038,6 @@ sub ite_detect
return (7 + ($addr == 0x2d)); return (7 + ($addr == 0x2d));
} }
# $_[0]: Chip to detect (0 = IT8712F)
# $_[1]: ISA address
# $_[2]: I2C file handle
# $_[3]: I2C address
sub ite_alias_detect
{
my ($chip, $isa_addr, $file, $i2c_addr) = @_;
my $i;
return 0 unless isa_read_i5d6($isa_addr, 0x48) == $i2c_addr;
for ($i = 0x30; $i <= 0x45; $i++) {
return 0 unless isa_read_i5d6($isa_addr, $i) == i2c_smbus_read_byte_data($file, $i);
}
return 1;
}
# $_[0]: A reference to the file descriptor to access this chip # $_[0]: A reference to the file descriptor to access this chip
# $_[1]: Address # $_[1]: Address
# Returns: 8 for a memory eeprom # Returns: 8 for a memory eeprom
@@ -5537,16 +5502,15 @@ sub vt1211_i2c_detect
return 2; return 2;
} }
# $_[0]: Chip to detect (0 = VT1211) # $_[0]: ISA address
# $_[1]: ISA address # $_[1]: I2C file handle
# $_[2]: I2C file handle # $_[2]: I2C address
# $_[3]: I2C address
sub vt1211_alias_detect sub vt1211_alias_detect
{ {
my ($chip, $isa_addr, $file, $i2c_addr) = @_; my ($isa_addr, $file, $i2c_addr) = @_;
my $i; my $i;
return 0 unless (inb($isa_addr + 0x48) & 0x7f) == $i2c_addr; return 0 unless (inb($isa_addr + 0x48) & 0x7f) == $i2c_addr;
for ($i = 0x2b; $i <= 0x3d; $i ++) { for ($i = 0x2b; $i <= 0x3d; $i++) {
return 0 unless inb($isa_addr + $i) == i2c_smbus_read_byte_data($file, $i); return 0 unless inb($isa_addr + $i) == i2c_smbus_read_byte_data($file, $i);
} }
return 1; return 1;