diff options
author | Rudolf Marek <r.marek@assembler.cz> | 2006-10-08 16:02:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-18 16:03:08 -0400 |
commit | 14992c7eff937bb12c8ebf2d91dbaa8c2f0cfc87 (patch) | |
tree | a040439505b90072067540f4d2ae336b437540c4 /drivers/hwmon/w83627ehf.c | |
parent | 4660cb354a1dacbbc9c96f94eceedc38fe542fe2 (diff) |
w83627ehf: Fix the detection of fan5
Fix the detection of fan5 and preserve the bit between the
register writes, because the bit is write only.
Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 833faa275ffa..2257806d0102 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -354,6 +354,8 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr) | |||
354 | case 0: | 354 | case 0: |
355 | reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0xcf) | 355 | reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0xcf) |
356 | | ((data->fan_div[0] & 0x03) << 4); | 356 | | ((data->fan_div[0] & 0x03) << 4); |
357 | /* fan5 input control bit is write only, compute the value */ | ||
358 | reg |= (data->has_fan & (1 << 4)) ? 1 : 0; | ||
357 | w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); | 359 | w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); |
358 | reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xdf) | 360 | reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xdf) |
359 | | ((data->fan_div[0] & 0x04) << 3); | 361 | | ((data->fan_div[0] & 0x04) << 3); |
@@ -362,6 +364,8 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr) | |||
362 | case 1: | 364 | case 1: |
363 | reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0x3f) | 365 | reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0x3f) |
364 | | ((data->fan_div[1] & 0x03) << 6); | 366 | | ((data->fan_div[1] & 0x03) << 6); |
367 | /* fan5 input control bit is write only, compute the value */ | ||
368 | reg |= (data->has_fan & (1 << 4)) ? 1 : 0; | ||
365 | w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); | 369 | w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg); |
366 | reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xbf) | 370 | reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xbf) |
367 | | ((data->fan_div[1] & 0x04) << 4); | 371 | | ((data->fan_div[1] & 0x04) << 4); |
@@ -1216,13 +1220,16 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) | |||
1216 | superio_exit(); | 1220 | superio_exit(); |
1217 | 1221 | ||
1218 | /* It looks like fan4 and fan5 pins can be alternatively used | 1222 | /* It looks like fan4 and fan5 pins can be alternatively used |
1219 | as fan on/off switches */ | 1223 | as fan on/off switches, but fan5 control is write only :/ |
1224 | We assume that if the serial interface is disabled, designers | ||
1225 | connected fan5 as input unless they are emitting log 1, which | ||
1226 | is not the default. */ | ||
1220 | 1227 | ||
1221 | data->has_fan = 0x07; /* fan1, fan2 and fan3 */ | 1228 | data->has_fan = 0x07; /* fan1, fan2 and fan3 */ |
1222 | i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1); | 1229 | i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1); |
1223 | if ((i & (1 << 2)) && (!fan4pin)) | 1230 | if ((i & (1 << 2)) && (!fan4pin)) |
1224 | data->has_fan |= (1 << 3); | 1231 | data->has_fan |= (1 << 3); |
1225 | if ((i & (1 << 0)) && (!fan5pin)) | 1232 | if (!(i & (1 << 1)) && (!fan5pin)) |
1226 | data->has_fan |= (1 << 4); | 1233 | data->has_fan |= (1 << 4); |
1227 | 1234 | ||
1228 | /* Register sysfs hooks */ | 1235 | /* Register sysfs hooks */ |