From patchwork Fri May 22 20:59:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michel_D=C3=A4nzer?= X-Patchwork-Id: 27537 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D8E0AB6F34 for ; Sat, 23 May 2009 07:06:21 +1000 (EST) Received: by ozlabs.org (Postfix) id 4561FDE537; Sat, 23 May 2009 07:06:03 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 42C73DE3EB for ; Sat, 23 May 2009 07:06:03 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 383 seconds by postgrey-1.31 at ozlabs; Sat, 23 May 2009 07:05:41 EST Received: from mail.gna.ch (darkcity.gna.ch [195.226.6.51]) by ozlabs.org (Postfix) with ESMTP id 11AFADE1EA for ; Sat, 23 May 2009 07:05:41 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id B1D4E1037D9; Fri, 22 May 2009 22:59:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T2yQo2f6AoAu; Fri, 22 May 2009 22:59:13 +0200 (CEST) Received: from thor.local (77-58-133-208.dclient.hispeed.ch [77.58.133.208]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id C94D63689B; Fri, 22 May 2009 22:59:11 +0200 (CEST) Received: from daenzer by thor.local with local (Exim 4.69) (envelope-from ) id 1M7bpe-0002sl-At; Fri, 22 May 2009 22:59:10 +0200 From: =?utf-8?q?Michel=20D=C3=A4nzer?= To: Colin Leroy , Benjamin Herrenschmidt Subject: [PATCH] therm_adt746x: Always clear hardware bit which inverts fan speed range. Date: Fri, 22 May 2009 22:59:10 +0200 Message-Id: <1243025950-11037-1-git-send-email-michel@daenzer.net> X-Mailer: git-send-email 1.6.3 MIME-Version: 1.0 Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org This bit would get enabled sometimes (probably after suspend/resume), so the fan would run at full speed below the temperature thresholds, but slow down and eventually stop if temperatures rose above the thresholds... not exactly what you want. Signed-off-by: Michel Dänzer --- drivers/macintosh/therm_adt746x.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 82607ad..321eaad 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 +230,8 @@ 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 */