Index: /lm-sensors/trunk/kernel/chips/w83781d.c
===================================================================
--- /lm-sensors/trunk/kernel/chips/w83781d.c	(revision 3147)
+++ /lm-sensors/trunk/kernel/chips/w83781d.c	(revision 3260)
@@ -109,9 +109,19 @@
 
 #define W83781D_REG_CONFIG 0x40
+
+/* Interrupt status (W83781D, AS99127F) */
 #define W83781D_REG_ALARM1 0x41
 #define W83781D_REG_ALARM2 0x42
-#define W83781D_REG_ALARM3 0x450	/* not on W83781D */
-
-#define W83781D_REG_IRQ 0x4C
+
+/* Real-time status (W83782D, W83783S, W83627HF) */
+#define W83782D_REG_ALARM1 0x459
+#define W83782D_REG_ALARM2 0x45A
+#define W83782D_REG_ALARM3 0x45B
+
+/* Real-time status (W83791D) */
+#define W83791D_REG_ALARM1 0xA9
+#define W83791D_REG_ALARM2 0xAA
+#define W83791D_REG_ALARM3 0xAB
+
 #define W83781D_REG_BEEP_CONFIG 0x4D
 #define W83781D_REG_BEEP_INTS1 0x56
@@ -1269,12 +1279,4 @@
 			w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG,
 					    0x00);
-		}
-		if (type != w83781d) {
-			/* enable comparator mode for temp2 and temp3 so
-		           alarm indication will work correctly */
-			i = w83781d_read_value(client, W83781D_REG_IRQ);
-			if (!(i & 0x40))
-				w83781d_write_value(client, W83781D_REG_IRQ,
-						    i | 0x40);
 		}
 	}
@@ -1387,13 +1389,34 @@
                        data->fan_div[2] |= (i >> 5) & 0x04;
                }
-               data->alarms =
-                   w83781d_read_value(client,
-                                      W83781D_REG_ALARM1) +
-                   (w83781d_read_value(client, W83781D_REG_ALARM2) << 8);
-               if ((data->type == w83782d) || (data->type == w83627hf)) {
-                       data->alarms |=
-                           w83781d_read_value(client,
-                                              W83781D_REG_ALARM3) << 16;
-               }
+
+		if ((data->type == w83782d) || (data->type == w83627hf)) {
+			data->alarms = w83781d_read_value(client,
+						W83782D_REG_ALARM1)
+				     | (w83781d_read_value(client,
+						W83782D_REG_ALARM2) << 8)
+				     | (w83781d_read_value(client,
+						W83782D_REG_ALARM3) << 16);
+		} else if (data->type == w83783s) {
+			/* Only two real-time status registers */
+			data->alarms = w83781d_read_value(client,
+						W83782D_REG_ALARM1)
+				     | (w83781d_read_value(client,
+						W83782D_REG_ALARM2) << 8);
+		} else if (data->type == w83791d) {
+			data->alarms = w83781d_read_value(client,
+						W83791D_REG_ALARM1)
+				     | (w83781d_read_value(client,
+						W83791D_REG_ALARM2) << 8)
+				     | (w83781d_read_value(client,
+						W83791D_REG_ALARM3) << 16);
+		} else {
+			/* No real-time status registers, fall back to
+			   interrupt status registers */
+			data->alarms = w83781d_read_value(client,
+						W83781D_REG_ALARM1)
+				     | (w83781d_read_value(client,
+						W83781D_REG_ALARM2) << 8);
+		}
+
                i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2);
                data->beep_enable = i >> 7;
