Skip to contentSkip to conversation

hwmon/w83627ehf: Preserve speed reading when

PATCH In review Jean Delvare 2 participants 2 messages Jun 17, 2007 – Jun 24, 2007 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon/w83627ehf: Preserve speed reading when

The w83627ehf driver changes the fan clock divider automatically when a new min fan speed is set. It is supposed to preserve the fan speed reading while doing so, bug doesn't really. Fix it.

---
 drivers/hwmon/w83627ehf.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hwmon/w83627ehf.c +9 -4
@@ -716,10 +716,15 @@ store_fan_min(struct device *dev, struct
 	/* Write both the fan clock divider (if it changed) and the new
 	   fan min (unconditionally) */
 	if (new_div != data->fan_div[nr]) {
-		if (new_div > data->fan_div[nr])
-			data->fan[nr] >>= (data->fan_div[nr] - new_div);
-		else
-			data->fan[nr] <<= (new_div - data->fan_div[nr]);
+		/* Preserve the fan speed reading */
+		if (data->fan[nr] != 0xff) {
+			if (new_div > data->fan_div[nr])
+				data->fan[nr] >>= new_div - data->fan_div[nr];
+			else if (data->fan[nr] & 0x80)
+				data->fan[nr] = 0xff;
+			else
+				data->fan[nr] <<= data->fan_div[nr] - new_div;
+		}
 
 		dev_dbg(dev, "fan%u clock divider changed from %u to %u\n",
 			nr + 1, div_from_reg(data->fan_div[nr]),
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Re: [lm-sensors] [PATCH] hwmon/w83627ehf: Preserve speed reading

Hi Jean:

Quoted 22 lines · Jean Delvare

The w83627ehf driver changes the fan clock divider automatically when a new min fan speed is set. It is supposed to preserve the fan speed reading while doing so, bug doesn't really. Fix it.

---
 drivers/hwmon/w83627ehf.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hwmon/w83627ehf.c +2 -4
@@ -716,10 +716,15 @@ store_fan_min(struct device *dev, struct
 	/* Write both the fan clock divider (if it changed) and the new
 	   fan min (unconditionally) */
 	if (new_div != data->fan_div[nr]) {
-		if (new_div > data->fan_div[nr])
-			data->fan[nr] >>= (data->fan_div[nr] - new_div);
-		else
-			data->fan[nr] <<= (new_div - data->fan_div[nr]);
+		/* Preserve the fan speed reading */
+		if (data->fan[nr] != 0xff) {

drivers/hwmon/w83627ehf.c store_fan_min(struct device *dev, struct · line 730

Quoted 10 lines
drivers/hwmon/w83627ehf.c +7 -0
+			if (new_div > data->fan_div[nr])
+				data->fan[nr] >>= new_div - data->fan_div[nr];
+			else if (data->fan[nr] & 0x80)
+				data->fan[nr] = 0xff;
+			else
+				data->fan[nr] <<= data->fan_div[nr] - new_div;
+		}
 
 		dev_dbg(dev, "fan%u clock divider changed from %u to %u\n",
 			nr + 1, div_from_reg(data->fan_div[nr]),

Applied to testing, thanks.

Regards,

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors