From 046c76d4a014e7ed6ea53d98c8e4d8f7a61b8145 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 11 Mar 2009 21:44:32 +0000 Subject: [PATCH] Differentiate between PC8374L and WPCD377I. Both chips have the same device ID so we use the revision register to differentiate between them, using custom detection functions. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5680 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8231fa09..669723db 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN-HEAD sensors-detect: Add nNidia nForce MCP78S SMBus detection Display Super-I/O address even if LD is disabled + Differentiate between PC8374L and WPCD377I 3.1.0 "Happy Birthday Lina" (2009-02-28) libsensors: Add support for instantaneous power sensors diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 2a32587d..a7b8294d 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1163,6 +1163,9 @@ use vars qw(@i2c_adapter_names); # devid: The device ID we have to match (base device) # devid_mask (optional): Bitmask to apply before checking the device ID # logdev: The logical device containing the sensors +# check (optional): A function to refine the detection. Will be passed +# the index and data ports as parameters. Must return 1 for a matching +# device, 0 otherwise. # features (optional): Features supported by this device, amongst: # * FEAT_IN # * FEAT_FAN @@ -1177,11 +1180,25 @@ use constant FEAT_SMBUS => (1 << 7); @superio_ids_natsemi = ( { - name => "Nat. Semi. PC8374L Super IO Sensors", + name => "Nat. Semi. PC8374L Super IO Sensors", # Also Nuvoton WPCD374L driver => "to-be-written", devid => 0xf1, + check => sub { + outb($_[0], 0x27); + # Guess work; seen so far: 0x11 + return (inb($_[1]) < 0x80); + }, logdev => 0x08, features => FEAT_IN | FEAT_FAN | FEAT_TEMP, + }, { + name => "Nuvoton WPCD377I Super IO", # Also WPCD376I + driver => "not-a-sensor", + devid => 0xf1, + check => sub { + outb($_[0], 0x27); + # Guess work; seen so far: 0x91 (twice) + return (inb($_[1]) >= 0x80); + }, }, { name => "Nat. Semi. PC87351 Super IO Fan Sensors", driver => "to-be-written", @@ -3205,6 +3222,10 @@ sub probe_superio my ($addrreg, $datareg, $chip) = @_; my ($val, $addr); + if (exists $chip->{check}) { + return 0 unless $chip->{check}($addrreg, $datareg); + } + printf "\%-60s", "Found `$chip->{name}'"; # Does it have hardware monitoring capabilities?