From b78bf75922ded944c3756f3e774b5bb0ae5323ef Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Jun 2006 16:53:02 +0000 Subject: [PATCH] sensors-detect: Handle the W83791D driver difference between kernels. Patch from Charles Spirakis. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4044 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 42 ++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 8a1e5afd..dd5b13ea 100644 --- a/CHANGES +++ b/CHANGES @@ -40,6 +40,7 @@ lm_sensors CHANGES file F75122R/RG, F75373S/SG, F75375S/SP, F75383S/M, F75384S/M, F75387SG/RG and F81218D detection Add Winbond W83793R/G detection + Handle the W83791D driver difference between kernels 2.10.0 (20060214) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index a71186ca..56b58b18 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1064,12 +1064,6 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect i2c_addrs => [0x2d], i2c_detect => sub { w83781d_detect 2, @_}, } , - { - name => "Winbond W83791D", - driver => "w83781d", - i2c_addrs => [0x2c..0x2f], - i2c_detect => sub { w83781d_detect 7, @_}, - }, { name => "Winbond W83792D", driver => "w83792d", @@ -1625,6 +1619,23 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect }, ); +# Special case chip information goes here and would be included in +# the chip_special_cases routine below +use vars qw($chip_kern24_w83791d $chip_kern26_w83791d); +$chip_kern24_w83791d = { + name => "Winbond W83791D", + driver => "w83781d", + i2c_addrs => [0x2c..0x2f], + i2c_detect => sub { w83781d_detect 7, @_ }, +}; + +$chip_kern26_w83791d = { + name => "Winbond W83791D", + driver => "w83791d", + i2c_addrs => [0x2c..0x2f], + i2c_detect => sub { w83781d_detect 7, @_ }, +}; + # This is a list of all recognized superio chips. # Each entry must have the following fields: # name: The full chip name @@ -2901,6 +2912,21 @@ sub scan_superio # 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 +sub chip_special_cases +{ + # Based on the kernel, add the appropriate chip structure to the + # chip_ids detection list + if (kernel_version_at_least(2, 6, 0)) { + push @chip_ids, $chip_kern26_w83791d; + } else { + push @chip_ids, $chip_kern24_w83791d; + } +} + # Each function returns a confidence value. The higher this value, the more # sure we are about this chip. A Winbond W83781D, for example, will be # detected as a LM78 too; but as the Winbond detection has a higher confidence @@ -5261,6 +5287,10 @@ sub main } } + # Before looking for chips, make sure any special case chips are + # added to the chip_ids list + chip_special_cases(); + print "\n We are now going to do the adapter probings. Some adapters may ", "hang halfway\n", " through; we can't really help that. Also, some chips will be double ",