提交 abc01922 编写于 作者: G Grant Coady 提交者: Greg Kroah-Hartman

[PATCH] I2C: Setting w83627hf fan divisor 128 fails.

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: NGrant Coady <gcoady@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 b9826b3e
...@@ -264,7 +264,7 @@ static inline u8 DIV_TO_REG(long val) ...@@ -264,7 +264,7 @@ static inline u8 DIV_TO_REG(long val)
{ {
int i; int i;
val = SENSORS_LIMIT(val, 1, 128) >> 1; val = SENSORS_LIMIT(val, 1, 128) >> 1;
for (i = 0; i < 6; i++) { for (i = 0; i < 7; i++) {
if (val == 0) if (val == 0)
break; break;
val >>= 1; val >>= 1;
......
...@@ -192,7 +192,7 @@ DIV_TO_REG(long val, enum chips type) ...@@ -192,7 +192,7 @@ DIV_TO_REG(long val, enum chips type)
val = SENSORS_LIMIT(val, 1, val = SENSORS_LIMIT(val, 1,
((type == w83781d ((type == w83781d
|| type == as99127f) ? 8 : 128)) >> 1; || type == as99127f) ? 8 : 128)) >> 1;
for (i = 0; i < 6; i++) { for (i = 0; i < 7; i++) {
if (val == 0) if (val == 0)
break; break;
val >>= 1; val >>= 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册