diff options
-rw-r--r-- | drivers/hwmon/w83627hf.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 996fc1ca3227..2169d8c8bbe4 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -389,6 +389,7 @@ static int __devexit w83627hf_remove(struct platform_device *pdev); | |||
389 | 389 | ||
390 | static int w83627hf_read_value(struct w83627hf_data *data, u16 reg); | 390 | static int w83627hf_read_value(struct w83627hf_data *data, u16 reg); |
391 | static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value); | 391 | static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value); |
392 | static void w83627hf_update_fan_div(struct w83627hf_data *data); | ||
392 | static struct w83627hf_data *w83627hf_update_device(struct device *dev); | 393 | static struct w83627hf_data *w83627hf_update_device(struct device *dev); |
393 | static void w83627hf_init_device(struct platform_device *pdev); | 394 | static void w83627hf_init_device(struct platform_device *pdev); |
394 | 395 | ||
@@ -1206,6 +1207,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev) | |||
1206 | data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); | 1207 | data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); |
1207 | data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); | 1208 | data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); |
1208 | data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); | 1209 | data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); |
1210 | w83627hf_update_fan_div(data); | ||
1209 | 1211 | ||
1210 | /* Register common device attributes */ | 1212 | /* Register common device attributes */ |
1211 | if ((err = sysfs_create_group(&dev->kobj, &w83627hf_group))) | 1213 | if ((err = sysfs_create_group(&dev->kobj, &w83627hf_group))) |
@@ -1540,6 +1542,24 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev) | |||
1540 | | 0x01); | 1542 | | 0x01); |
1541 | } | 1543 | } |
1542 | 1544 | ||
1545 | static void w83627hf_update_fan_div(struct w83627hf_data *data) | ||
1546 | { | ||
1547 | int reg; | ||
1548 | |||
1549 | reg = w83627hf_read_value(data, W83781D_REG_VID_FANDIV); | ||
1550 | data->fan_div[0] = (reg >> 4) & 0x03; | ||
1551 | data->fan_div[1] = (reg >> 6) & 0x03; | ||
1552 | if (data->type != w83697hf) { | ||
1553 | data->fan_div[2] = (w83627hf_read_value(data, | ||
1554 | W83781D_REG_PIN) >> 6) & 0x03; | ||
1555 | } | ||
1556 | reg = w83627hf_read_value(data, W83781D_REG_VBAT); | ||
1557 | data->fan_div[0] |= (reg >> 3) & 0x04; | ||
1558 | data->fan_div[1] |= (reg >> 4) & 0x04; | ||
1559 | if (data->type != w83697hf) | ||
1560 | data->fan_div[2] |= (reg >> 5) & 0x04; | ||
1561 | } | ||
1562 | |||
1543 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) | 1563 | static struct w83627hf_data *w83627hf_update_device(struct device *dev) |
1544 | { | 1564 | { |
1545 | struct w83627hf_data *data = dev_get_drvdata(dev); | 1565 | struct w83627hf_data *data = dev_get_drvdata(dev); |
@@ -1617,18 +1637,8 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1617 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3)); | 1637 | w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3)); |
1618 | } | 1638 | } |
1619 | 1639 | ||
1620 | i = w83627hf_read_value(data, W83781D_REG_VID_FANDIV); | 1640 | w83627hf_update_fan_div(data); |
1621 | data->fan_div[0] = (i >> 4) & 0x03; | 1641 | |
1622 | data->fan_div[1] = (i >> 6) & 0x03; | ||
1623 | if (data->type != w83697hf) { | ||
1624 | data->fan_div[2] = (w83627hf_read_value(data, | ||
1625 | W83781D_REG_PIN) >> 6) & 0x03; | ||
1626 | } | ||
1627 | i = w83627hf_read_value(data, W83781D_REG_VBAT); | ||
1628 | data->fan_div[0] |= (i >> 3) & 0x04; | ||
1629 | data->fan_div[1] |= (i >> 4) & 0x04; | ||
1630 | if (data->type != w83697hf) | ||
1631 | data->fan_div[2] |= (i >> 5) & 0x04; | ||
1632 | data->alarms = | 1642 | data->alarms = |
1633 | w83627hf_read_value(data, W83781D_REG_ALARM1) | | 1643 | w83627hf_read_value(data, W83781D_REG_ALARM1) | |
1634 | (w83627hf_read_value(data, W83781D_REG_ALARM2) << 8) | | 1644 | (w83627hf_read_value(data, W83781D_REG_ALARM2) << 8) | |