From grant_lkml@dodo.com.au Wed May 11 20:45:03 2005
From: Grant Coady <grant_lkml@dodo.com.au>
To: Mark Studebaker <mds@mds.gotdns.com>
Cc: Jarkko Lavinen <jlavi@iki.fi>, sensors@Stimpy.netroedge.com, greg@kroah.com
Subject: I2C: Setting w83627hf fan divisor 128 fails.
Date: Thu, 12 May 2005 13:41:51 +1000
Message-ID: <9lj58114ceoef48hfo6lect8u0m38hc0ai@4ax.com>

Jarkko Lavinen provided patch to fix: "couldn't set the divisor 128 
through fan1_div sysfs entry even though the chip supports it and 
setting divisors 1..64 worked. This was due to POWER_TO_REG() only 
checking 2's powers 0 till 5 but not 6."
 
This patch applies that fix to w83627hf and w83781d drivers. 

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


---
 drivers/i2c/chips/w83627hf.c |    2 +-
 drivers/i2c/chips/w83781d.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- gregkh-2.6.orig/drivers/i2c/chips/w83627hf.c	2005-05-09 09:06:57.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/w83627hf.c	2005-05-13 13:49:37.000000000 -0700
@@ -264,7 +264,7 @@
 {
 	int i;
 	val = SENSORS_LIMIT(val, 1, 128) >> 1;
-	for (i = 0; i < 6; i++) {
+	for (i = 0; i < 7; i++) {
 		if (val == 0)
 			break;
 		val >>= 1;
--- gregkh-2.6.orig/drivers/i2c/chips/w83781d.c	2005-05-13 11:37:11.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/w83781d.c	2005-05-13 13:49:37.000000000 -0700
@@ -192,7 +192,7 @@
 	val = SENSORS_LIMIT(val, 1,
 			    ((type == w83781d
 			      || type == as99127f) ? 8 : 128)) >> 1;
-	for (i = 0; i < 6; i++) {
+	for (i = 0; i < 7; i++) {
 		if (val == 0)
 			break;
 		val >>= 1;
