NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/42758: W83627HF hw monitor not initialized completely (wrong temperature values)



>Number:         42758
>Category:       kern
>Synopsis:       W83627HF hw monitor not initialized completely (wrong 
>temperature values)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 07 00:40:00 +0000 2010
>Originator:     Michael Stapelberg
>Release:        5.0.1
>Organization:
>Environment:
NetBSD  5.0.1 NetBSD 5.0.1 (FLOBIMVRO) #19: Sun Feb  7 01:20:34 CET 2010  
root@:/usr/src/sys/arch/i386/compile/FLOBIMVRO i386

>Description:
My Tyan Tiger MPX S2466 mainboard has a W83627HF chip connected via i2c. After 
enabling the driver using the following line in my kernel configuration:

amdpm* at pci? dev ? function ?
iic0 at amdpm?
lm* at iic0 addr 0x2c

(A patch is necessary to make amdpm actually attach the i2c-bus. This will 
follow in a different bugreport).

envstat now showed values like the following:
  Temp0:     76.000                                degC
  Temp1:     76.500                                degC
  Temp2:     77.000                                degC
While in the BIOS hardware monitor temperatures about 40 degC were shown.

This difference was due to incomplete initialization of the W83627HF. According 
to Tyan, the temperature sensors are of type 3904. The datasheet lists two 
registers which are relevant for the configuration:
VBAT Monitor Control Register (page 62 of the pdf) and the reserved register 
(page 59 of the pdf).

In the VBATMCR bit 1-3 have to be set to 1 (they are initialized as 0) to 
switch to a bipolar sensor. In the reserved register the bits 4-6 have to be 
set to 0 to select 2N3904 bipolar mode (they are initialized as 1).
>How-To-Repeat:
Run envstat after enabling the driver in your kernel.
>Fix:
Patch follows:
Index: ic/nslm7x.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/nslm7x.c,v
retrieving revision 1.49
diff -u -r1.49 nslm7x.c
--- ic/nslm7x.c 13 Oct 2008 12:44:46 -0000      1.49
+++ ic/nslm7x.c 7 Feb 2010 00:35:29 -0000
@@ -1790,6 +1790,16 @@
        case WB_CHIPID_W83627HF:
                model = "W83627HF";
                lm_setup_sensors(sc, w83627hf_sensors);
+
+               lm_generic_banksel(sc, WB_BANKSEL_B0);
+               /* Switch to 2N3904 mode for the temperature sensors */
+               (*sc->lm_writereg)(sc, 0x59, 0x0);
+               int val = (*sc->lm_readreg)(sc, 0x5d);
+               val |= 0xF;
+               (*sc->lm_writereg)(sc, 0x5d, val);
+
+               lm_generic_banksel(sc, banksel);
+
                break;
        case WB_CHIPID_W83627THF:
                model = "W83627THF";


However, I am not sure if this fix is appropriate for all boards using the 
W83627HF. Maybe this should be added as an option to the driver.



Home | Main Index | Thread Index | Old Index