diff options
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 30a76404f0af..f4d850c71585 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -716,10 +716,15 @@ store_fan_min(struct device *dev, struct device_attribute *attr, | |||
716 | /* Write both the fan clock divider (if it changed) and the new | 716 | /* Write both the fan clock divider (if it changed) and the new |
717 | fan min (unconditionally) */ | 717 | fan min (unconditionally) */ |
718 | if (new_div != data->fan_div[nr]) { | 718 | if (new_div != data->fan_div[nr]) { |
719 | if (new_div > data->fan_div[nr]) | 719 | /* Preserve the fan speed reading */ |
720 | data->fan[nr] >>= (data->fan_div[nr] - new_div); | 720 | if (data->fan[nr] != 0xff) { |
721 | else | 721 | if (new_div > data->fan_div[nr]) |
722 | data->fan[nr] <<= (new_div - data->fan_div[nr]); | 722 | data->fan[nr] >>= new_div - data->fan_div[nr]; |
723 | else if (data->fan[nr] & 0x80) | ||
724 | data->fan[nr] = 0xff; | ||
725 | else | ||
726 | data->fan[nr] <<= data->fan_div[nr] - new_div; | ||
727 | } | ||
723 | 728 | ||
724 | dev_dbg(dev, "fan%u clock divider changed from %u to %u\n", | 729 | dev_dbg(dev, "fan%u clock divider changed from %u to %u\n", |
725 | nr + 1, div_from_reg(data->fan_div[nr]), | 730 | nr + 1, div_from_reg(data->fan_div[nr]), |