2.6.10-mm2: it87 sensor driver stops CPU fan

Simone Piunno
2005-01-08T00:47:54Z

Hi,

Today I've tried 2.6.10-mm2 compiled for x86_64 and found something bad.
As soon as I modprobe it87 (one of the i2c sensors drivers) the CPU fan
completely halts and the CPU temperature skyrockets even while idle.
For context:
I have an Athlon64 3200+ on a Gigabyte K8VT800 motherboard (i2c_viapro module)
running Gentoo compiled in x86_64 mode, it87 is controlled through ISA bus,
VT8237 ISA bridge.

The same setup doesn't show the problem on vanilla 2.6.10 and neither on the
last -mm I tried, which IIRC was 2.6.9-rc4-mm1.

After some tweaking, it looks like ACPI is not the problem (tried to look at
full debug trace, nothing appears when loading it87). Instead, I've found I
can control the fan speed using /sys/devices/platform/i2c-0/0-0290/pwm1 and
initially it is set to 225, but setting it to 0 the fan runs at max speed.
Intermediate values works as well: the higher the value, the slower the fan.

I've google for this sysfs interface and found than everyone expects pwm*
values to have the reverse meaning: 255 should be max speed and 0 should halt
the fan. So apparently the problem is really in the it87 driver, using the
wrong coefficient for this scale and therefore setting it to the wrong
default value.

Comparing drivers/i2c/chips/it87.c in 2.6.10 vanilla and 2.6.10-mm2, I've
found only -mm tree includes the pwm fan controller.

I think a quick fix could be the following, but didn't try it.

--- drivers/i2c/chips/it87.c 2005-01-07 15:13:52.000000000 +0100
+++ drivers/i2c/chips/it87.c.new 2005-01-08 01:41:16.000000000 +0100
@@ -163,8 +163,8 @@

#define ALARMS_FROM_REG(val) (val)

-#define PWM_TO_REG(val) ((val) >> 1)
-#define PWM_FROM_REG(val) (((val)&0x7f) << 1)
+#define PWM_TO_REG(val) ((255-val) >> 1)
+#define PWM_FROM_REG(val) (255-(((val)&0x7f) << 1))

static int DIV_TO_REG(int val)
{

Regards,
Simone Piunno
--