# HG changeset patch
# User moel.mich
# Date 1266788338 0
# Node ID d787f441286d92828088dd275bb8da28f36302f5
# Parent  142907c75be42433da8044c788b0761362633edc
Added both VCore detection modes for Winbond W82637THF (should fix issue 3).

diff -r 142907c75be4 -r d787f441286d Hardware/LPC/W836XX.cs
--- a/Hardware/LPC/W836XX.cs	Sun Feb 21 18:10:30 2010 +0000
+++ b/Hardware/LPC/W836XX.cs	Sun Feb 21 21:38:58 2010 +0000
@@ -183,8 +183,18 @@
 
       foreach (Sensor sensor in voltages) {
         if (sensor.Index < 7) {
-          int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index));
-          sensor.Value = 0.008f * voltageGains[sensor.Index] * value;
+          // two special VCore measurement modes for W83627THF
+          if (chip == Chip.W83627THF && sensor.Index == 0) {
+            byte vrmConfiguration = ReadByte(0, 0x18);
+            int value = ReadByte(0, VOLTAGE_BASE_REG);
+            if ((vrmConfiguration & 0x01) == 0)
+              sensor.Value = 0.016f * value; // VRM8 formula
+            else
+              sensor.Value = 0.00488f * value + 0.69f; // VRM9 formula
+          } else {
+            int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index));
+            sensor.Value = 0.008f * voltageGains[sensor.Index] * value;
+          }
           if (sensor.Value > 0)
             ActivateSensor(sensor);
           else