aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83627ehf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r--drivers/hwmon/w83627ehf.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index c51ae2e1775..bca7fbcfbec 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -421,6 +421,31 @@ static void w83627ehf_write_fan_div(struct w83627ehf_data *data, int nr)
421 } 421 }
422} 422}
423 423
424static void w83627ehf_update_fan_div(struct w83627ehf_data *data)
425{
426 int i;
427
428 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1);
429 data->fan_div[0] = (i >> 4) & 0x03;
430 data->fan_div[1] = (i >> 6) & 0x03;
431 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2);
432 data->fan_div[2] = (i >> 6) & 0x03;
433 i = w83627ehf_read_value(data, W83627EHF_REG_VBAT);
434 data->fan_div[0] |= (i >> 3) & 0x04;
435 data->fan_div[1] |= (i >> 4) & 0x04;
436 data->fan_div[2] |= (i >> 5) & 0x04;
437 if (data->has_fan & ((1 << 3) | (1 << 4))) {
438 i = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
439 data->fan_div[3] = i & 0x03;
440 data->fan_div[4] = ((i >> 2) & 0x03)
441 | ((i >> 5) & 0x04);
442 }
443 if (data->has_fan & (1 << 3)) {
444 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT);
445 data->fan_div[3] |= (i >> 5) & 0x04;
446 }
447}
448
424static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) 449static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
425{ 450{
426 struct w83627ehf_data *data = dev_get_drvdata(dev); 451 struct w83627ehf_data *data = dev_get_drvdata(dev);
@@ -432,25 +457,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
432 if (time_after(jiffies, data->last_updated + HZ + HZ/2) 457 if (time_after(jiffies, data->last_updated + HZ + HZ/2)
433 || !data->valid) { 458 || !data->valid) {
434 /* Fan clock dividers */ 459 /* Fan clock dividers */
435 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); 460 w83627ehf_update_fan_div(data);
436 data->fan_div[0] = (i >> 4) & 0x03;
437 data->fan_div[1] = (i >> 6) & 0x03;
438 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2);
439 data->fan_div[2] = (i >> 6) & 0x03;
440 i = w83627ehf_read_value(data, W83627EHF_REG_VBAT);
441 data->fan_div[0] |= (i >> 3) & 0x04;
442 data->fan_div[1] |= (i >> 4) & 0x04;
443 data->fan_div[2] |= (i >> 5) & 0x04;
444 if (data->has_fan & ((1 << 3) | (1 << 4))) {
445 i = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
446 data->fan_div[3] = i & 0x03;
447 data->fan_div[4] = ((i >> 2) & 0x03)
448 | ((i >> 5) & 0x04);
449 }
450 if (data->has_fan & (1 << 3)) {
451 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT);
452 data->fan_div[3] |= (i >> 5) & 0x04;
453 }
454 461
455 /* Measured voltages and limits */ 462 /* Measured voltages and limits */
456 for (i = 0; i < data->in_num; i++) { 463 for (i = 0; i < data->in_num; i++) {
@@ -1312,6 +1319,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1312 if (!(i & (1 << 1)) && (!fan5pin)) 1319 if (!(i & (1 << 1)) && (!fan5pin))
1313 data->has_fan |= (1 << 4); 1320 data->has_fan |= (1 << 4);
1314 1321
1322 /* Read fan clock dividers immediately */
1323 w83627ehf_update_fan_div(data);
1324
1315 /* Register sysfs hooks */ 1325 /* Register sysfs hooks */
1316 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) 1326 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++)
1317 if ((err = device_create_file(dev, 1327 if ((err = device_create_file(dev,