Commit 87b814c9 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

hwmon/w83627ehf: Fix the fan5 clock divider write

Users have been complaining about the w83627ehf driver flooding their
logs with debug messages like:

w83627ehf 9191-0a10: Increasing fan 4 clock divider from 64 to 128

or:

w83627ehf 9191-0290: Increasing fan 4 clock divider from 4 to 8

The reason is that we failed to actually write the LSB of the encoded
clock divider value for that fan, causing the next read to report the
same old value again and again.

Additionally, the fan number was improperly reported, making the bug
harder to find.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1b3bac16
...@@ -389,7 +389,7 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr) ...@@ -389,7 +389,7 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr)
break; break;
case 4: case 4:
reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73) reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73)
| ((data->fan_div[4] & 0x03) << 3) | ((data->fan_div[4] & 0x03) << 2)
| ((data->fan_div[4] & 0x04) << 5); | ((data->fan_div[4] & 0x04) << 5);
w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg); w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg);
break; break;
...@@ -453,9 +453,9 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) ...@@ -453,9 +453,9 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
time */ time */
if (data->fan[i] == 0xff if (data->fan[i] == 0xff
&& data->fan_div[i] < 0x07) { && data->fan_div[i] < 0x07) {
dev_dbg(&client->dev, "Increasing fan %d " dev_dbg(&client->dev, "Increasing fan%d "
"clock divider from %u to %u\n", "clock divider from %u to %u\n",
i, div_from_reg(data->fan_div[i]), i + 1, div_from_reg(data->fan_div[i]),
div_from_reg(data->fan_div[i] + 1)); div_from_reg(data->fan_div[i] + 1));
data->fan_div[i]++; data->fan_div[i]++;
w83627ehf_write_fan_div(client, i); w83627ehf_write_fan_div(client, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment