Skip to contentSkip to conversation

http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=813

DISCUSSION h.mulder 3 participants 3 messages May 19, 2005

lore
Share & tools
lore

h.mulder

author
#0 lore raw

Testresults,
1)init via bios
2)modprobe w83781d force_w83627hf=0,0x2c force_subclients=0,0x2c,0x4a,0x4b force_w83782d=0,0x2d init=0

3) sensors -s;sensors output
w83627hf-i2c-0-2c

Adapter: SMBus AMD7X6 adapter at 80e0
Algorithm: Non-I2C SMBus adapter
VCore:     +1.74 V  (min =  +1.71 V, max =  +1.88 V)       ALARM
in1:       +1.69 V  (min =  +1.64 V, max =  +2.04 V)       ALARM
+3.3V:     +3.31 V  (min =  +3.13 V, max =  +3.45 V)
+5V:       +4.84 V  (min =  +4.72 V, max =  +5.24 V)
+12V:      +9.35 V  (min = +10.79 V, max = +13.19 V)
-12V:     -12.44 V  (min = -13.21 V, max = -10.90 V)
-5V:       -0.08 V  (min =  -5.26 V, max =  -4.76 V)
V5SB:      +5.48 V  (min =  +4.72 V, max =  +5.24 V)
VBat:      +2.56 V  (min =  +2.40 V, max =  +3.60 V)
CPU0:     3068 RPM  (min = 1205 RPM, div = 8)
CPU1:        0 RPM  (min = 2481 RPM, div = 8)
fan3:        0 RPM  (min = 7031 RPM, div = 8)
temp1:    +50.0?C   (limit = +100?C, hysteresis = -107?C) sensor = 3904 

transistor
temp2: +51.5?C (limit = +80?C, hysteresis = +75?C) sensor = 3904
transistor
temp3: +40.5?C (limit = +80?C, hysteresis = +75?C) sensor = 3904
transistor

vid:      +1.85 V
alarms:   Chassis intrusion detection

beep_enable:
Sound alarm enabled

w83782d-i2c-0-2d

Adapter: SMBus AMD7X6 adapter at 80e0
Algorithm: Non-I2C SMBus adapter
VCore 1:   +1.72 V  (min =  +1.74 V, max =  +1.93 V)       ALARM
VCore 2:   +1.80 V  (min =  +1.74 V, max =  +1.93 V)
+3.3V:     +2.55 V  (min =  +3.11 V, max =  +3.46 V)
+5V:       +4.67 V  (min =  +4.72 V, max =  +5.24 V)
+12V:      +4.67 V  (min = +10.79 V, max = +13.19 V)
-12V:      -2.37 V  (min = -13.21 V, max = -10.90 V)
-5V:       +2.62 V  (min =  -5.26 V, max =  -4.76 V)
V5SB:      +4.18 V  (min =  +4.72 V, max =  +5.24 V)
VBat:      +2.06 V  (min =  +2.40 V, max =  +3.60 V)
fan1:        0 RPM  (min =   -1 RPM, div = 8)
fan2:        0 RPM  (min =   -1 RPM, div = 8)
fanPSU:   5152 RPM  (min = 3000 RPM, div = 2)
temp1:    +56.0?C   (limit = +40?C, hysteresis = +37?C) sensor = 3904 

transistor
temp2: +54.5?C (limit = +80?C, hysteresis = +75?C) sensor = 3904
transistor
temp3: +60.5?C (limit = +80?C, hysteresis = +75?C) sensor = 3904
transistor

vid:      +1.85 V
alarms:   Chassis intrusion detection                      ALARM

beep_enable:
Sound alarm enabled

Hope it helps.
cu Hans

#1 lore raw

http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=1326

on rounding again...
below /proc/sys/dev/sensors/(chip_id), there are values with two decimal positions only, which are already rounded down.
I'm using the w83781d driver here, but I cannot find where those values are written (a search for '.2f' didn't yield anything
useful - probably things are done lower-level).
Perhaps the general solution would be to write out full mV values (%.3f) so that sensors.c can round them itself.
Do you think that can be done easily?
If I only knew where /proc/sys/dev/sensors/as99127f/in* are written, I'd go and try myself without bothering you :-(

Cheers,
Steffen

#2 lore raw

http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=1326

In reply to h.mulder
Quoted 7 lines

on rounding again...
below /proc/sys/dev/sensors/(chip_id), there are values with two decimal positions only, which are already rounded down. I'm using the w83781d driver here, but I cannot find where those values are written (a search for '.2f' didn't yield anything useful - probably things are done lower-level).

Values are internally handled as integer values, expressed in centivolts.

Quoted 3 lines

Perhaps the general solution would be to write out full mV values (%.3f) so that sensors.c can round them itself.
Do you think that can be done easily?

Well, this could be done, but the values would be wrong again (less wrong, OK, but still not exact), because we would have a resolution of 1/1000 V in /proc values while the sensors themselves have a 1/160 V resolution. So we won't really escape rounding problems that way.

To me, the real solution would be to export the native values in /proc, and use sensors.conf for the conversion. I think I remember this was already discussed, maybe even more than once, and it was decided that all voltage values in /proc would have the same unit. I guess that this is more important than having an "infinite precision" in the readings. After all, who cares if the min value is 1.63V or 1.64V? Well... you ;) but most people don't care at all.

Anyway you were right, there is a rounding problem in the w83781d driver (and in 7 other drivers as well). I commited a fix for the w83781d, attached to this mail. Please try it and tell me if it works for you. The fix is trivial, I think you'll understand how it works at first sight.

However, please understand that it won't necessary make all min-max values symmetrical, because .5 is always rounded up (so 1.615-1.685 would show as 1.62-1.69, for example, and there's nothing wrong with that.)

Signature · 18 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
-------------- next part --------------
Index: w83781d.c
=================================RCS file: /home/cvs/lm_sensors2/kernel/chips/w83781d.c,v
retrieving revision 1.102
diff -u -r1.102 w83781d.c
--- w83781d.c	10 Jun 2003 03:01:31 -0000	1.102
+++ w83781d.c	16 Jul 2003 07:41:52 -0000
@@ -178,7 +178,7 @@
    these macros are called: arguments may be evaluated more than once.
    Fixing this is just not worth it. */
 #define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
-#define IN_FROM_REG(val) (((val) * 16) / 10)
+#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
 
 static inline u8 FAN_TO_REG(long rpm, int div)
 {