Re: Name of kernel driver that manages fan (PowerBook5,8)
- To: Wolfgang Pfeiffer <roto@gmx.net>
- Cc: debian-ppc <debian-powerpc@lists.debian.org>
- Subject: Re: Name of kernel driver that manages fan (PowerBook5,8)
- From: Michel Dänzer <daenzer@debian.org>
- Date: Fri, 15 May 2009 12:35:18 +0200
- Message-id: <1242383718.26883.337.camel@thor.local>
- In-reply-to: <20090515101231.GA3297@localhost>
- References: <20090515101231.GA3297@localhost>
On Fri, 2009-05-15 at 12:12 +0200, Wolfgang Pfeiffer wrote:
>
> Sometimes my fan seems to hang, at a very high speed, IINM, that is,
>
> /sys/devices/temperatures/sensor1_fan_speed
>
> in these cases gives me a value of something like
>
> 0 (3859 rpm)
>
> I'd (wild .. :) guess the second value simply means the number of
> rounds/min the fan is spinning ... No idea what the first number
> means.
>
> The only chance - so far - to stop the fan in these instances, is a
> reboot. I'd like to avoid the latter, by simply trying to
> switch off/on the driver that is responsible for the fan ...
>
> So anyone knows the name of this driver? Is there one? Or is it solely
> a firmware issue? Hints?
It's a bug in the therm_adt746x driver, it sometimes sets the hardware
bit which inverts the meaning of the fan speed register. The patch below
fixes it for me, I'm going to submit it for inclusion.
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 82607ad..d2575d5 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -37,6 +37,7 @@
#define CONFIG_REG 0x40
#define MANUAL_MASK 0xe0
#define AUTO_MASK 0x20
+#define INVERT_MASK 0x10
static u8 TEMP_REG[3] = {0x26, 0x25, 0x27}; /* local, sensor1, sensor2 */
static u8 LIMIT_REG[3] = {0x6b, 0x6a, 0x6c}; /* local, sensor1, sensor2 */
@@ -229,7 +227,9 @@ static void write_fan_speed(struct thermostat *th, int speed, int fan)
if (speed >= 0) {
manual = read_reg(th, MANUAL_MODE[fan]);
- write_reg(th, MANUAL_MODE[fan], manual|MANUAL_MASK);
+ write_reg(th, MANUAL_MODE[fan],
+ (manual|MANUAL_MASK) & (~INVERT_MASK));
write_reg(th, FAN_SPD_SET[fan], speed);
} else {
/* back to automatic */
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
Reply to: