2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-29 13:28:01 +00:00

Handle special case chips more efficiently. Instead of listing every

chip twice with just the driver field differing, we put the chip entry
in the main list directly and resolve the driver field at run-time.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5402 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare 2008-11-22 18:04:50 +00:00
parent 5cd00e8a72
commit a0ddf07aad
2 changed files with 21 additions and 45 deletions

View File

@ -15,6 +15,7 @@ SVN-HEAD
Fix detection of SMSC LPC47M292
Add SMSC LPC47M233 support
Drop support for Linux 2.4 (#2325)
Handle special case chips more efficiently
3.0.3 (2008-09-28)
libsensors: Avoid namespace pollution

View File

@ -1286,6 +1286,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis96x);
i2c_addrs => [0x50..0x53],
i2c_detect => sub { ddcmonitor_detect(@_); },
},
{
name => "FSC Poseidon I",
driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscpos" },
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(0, @_); },
},
{
name => "FSC Poseidon II",
driver => "to-be-written",
@ -1298,6 +1304,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis96x);
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(2, @_); },
},
{
name => "FSC Hermes",
driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscher" },
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(3, @_); },
},
{
name => "FSC Heimdal",
driver => "fschmd",
@ -1402,41 +1414,6 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis96x);
},
);
# Special case chip information goes here and would be included in
# the chip_special_cases routine below
use vars qw(@chip_oldfsc_ids @chip_fschmd_ids);
# sigh special case for old seperate FSC drivers to new merged one mapping
@chip_oldfsc_ids = (
{
name => "FSC Poseidon I",
driver => "fscpos",
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(0, @_); },
},
{
name => "FSC Hermes",
driver => "fscher",
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(3, @_); },
},
);
@chip_fschmd_ids = (
{
name => "FSC Poseidon I",
driver => "fschmd",
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(0, @_); },
},
{
name => "FSC Hermes",
driver => "fschmd",
i2c_addrs => [0x73],
i2c_detect => sub { fsc_detect(3, @_); },
},
);
# This is a list of all recognized superio chips.
# Each entry must have the following fields:
@ -3437,18 +3414,16 @@ sub scan_cpu($)
# CHIP DETECTION #
##################
# This routine allows you to select which chips are optionally added to the
# chip detection list. The most common use is to allow for different chip
# detection/drivers based on different linux kernels
# This routine follows the pattern of the SiS adapter special cases
# This routine allows you to dynamically update the chip detection list.
# The most common use is to allow for different chip to driver mappings
# based on different linux kernels
sub chip_special_cases
{
# Based on the kernel, add the appropriate chip structures to the
# chip_ids detection list
if (kernel_version_at_least(2, 6, 24)) {
push @chip_ids, @chip_fschmd_ids;
} else {
push @chip_ids, @chip_oldfsc_ids;
# Some chip to driver mappings depend on the environment
foreach my $chip (@chip_ids) {
if (ref($chip->{driver}) eq 'CODE') {
$chip->{driver} = $chip->{driver}->();
}
}
}