aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83781d.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-02-05 17:13:48 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-02-14 01:30:09 -0500
commitc7f5d7edd8b3fa4204389efc4c9081cc90a811d2 (patch)
tree1264bb18887b398ea2dccbba03ade05bf9fe9539 /drivers/hwmon/w83781d.c
parente3efa5a7392e07471b5d0ef7e7cd7ab862f70284 (diff)
[PATCH] w83781d: Use real-time status registers
Use the real-time status registers of the Winbond W83782D, W83783S and W83627HF chips, instead of the interrupt status registers. Interrupts cannot be trusted at least for voltage inputs, as they are two-times triggers (as opposed to comparator mode, which we want.) The w83627hf driver was fixed in a similar way some times ago. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/w83781d.c')
-rw-r--r--drivers/hwmon/w83781d.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 557114872f3c..64c1f8af5bb2 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -95,11 +95,16 @@ MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
95 (0x39))) 95 (0x39)))
96 96
97#define W83781D_REG_CONFIG 0x40 97#define W83781D_REG_CONFIG 0x40
98
99/* Interrupt status (W83781D, AS99127F) */
98#define W83781D_REG_ALARM1 0x41 100#define W83781D_REG_ALARM1 0x41
99#define W83781D_REG_ALARM2 0x42 101#define W83781D_REG_ALARM2 0x42
100#define W83781D_REG_ALARM3 0x450 /* not on W83781D */
101 102
102#define W83781D_REG_IRQ 0x4C 103/* Real-time status (W83782D, W83783S, W83627HF) */
104#define W83782D_REG_ALARM1 0x459
105#define W83782D_REG_ALARM2 0x45A
106#define W83782D_REG_ALARM3 0x45B
107
103#define W83781D_REG_BEEP_CONFIG 0x4D 108#define W83781D_REG_BEEP_CONFIG 0x4D
104#define W83781D_REG_BEEP_INTS1 0x56 109#define W83781D_REG_BEEP_INTS1 0x56
105#define W83781D_REG_BEEP_INTS2 0x57 110#define W83781D_REG_BEEP_INTS2 0x57
@@ -1513,15 +1518,6 @@ w83781d_init_client(struct i2c_client *client)
1513 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); 1518 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
1514 } 1519 }
1515 } 1520 }
1516
1517 if (type != w83781d) {
1518 /* enable comparator mode for temp2 and temp3 so
1519 alarm indication will work correctly */
1520 i = w83781d_read_value(client, W83781D_REG_IRQ);
1521 if (!(i & 0x40))
1522 w83781d_write_value(client, W83781D_REG_IRQ,
1523 i | 0x40);
1524 }
1525 } 1521 }
1526 1522
1527 /* Start monitoring */ 1523 /* Start monitoring */
@@ -1612,14 +1608,25 @@ static struct w83781d_data *w83781d_update_device(struct device *dev)
1612 data->fan_div[1] |= (i >> 4) & 0x04; 1608 data->fan_div[1] |= (i >> 4) & 0x04;
1613 data->fan_div[2] |= (i >> 5) & 0x04; 1609 data->fan_div[2] |= (i >> 5) & 0x04;
1614 } 1610 }
1615 data->alarms =
1616 w83781d_read_value(client,
1617 W83781D_REG_ALARM1) +
1618 (w83781d_read_value(client, W83781D_REG_ALARM2) << 8);
1619 if ((data->type == w83782d) || (data->type == w83627hf)) { 1611 if ((data->type == w83782d) || (data->type == w83627hf)) {
1620 data->alarms |= 1612 data->alarms = w83781d_read_value(client,
1621 w83781d_read_value(client, 1613 W83782D_REG_ALARM1)
1622 W83781D_REG_ALARM3) << 16; 1614 | (w83781d_read_value(client,
1615 W83782D_REG_ALARM2) << 8)
1616 | (w83781d_read_value(client,
1617 W83782D_REG_ALARM3) << 16);
1618 } else if (data->type == w83783s) {
1619 data->alarms = w83781d_read_value(client,
1620 W83782D_REG_ALARM1)
1621 | (w83781d_read_value(client,
1622 W83782D_REG_ALARM2) << 8);
1623 } else {
1624 /* No real-time status registers, fall back to
1625 interrupt status registers */
1626 data->alarms = w83781d_read_value(client,
1627 W83781D_REG_ALARM1)
1628 | (w83781d_read_value(client,
1629 W83781D_REG_ALARM2) << 8);
1623 } 1630 }
1624 i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2); 1631 i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2);
1625 data->beep_enable = i >> 7; 1632 data->beep_enable = i >> 7;