aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83793.c
diff options
context:
space:
mode:
authorGong Jun <jgong@winbond.com>2007-01-18 16:14:23 -0500
committerJean Delvare <khali@arrakis.delvare>2007-01-18 16:14:23 -0500
commitddca933bd554b4f81f27776f3cb9daa67cf241b1 (patch)
tree7aa51286d08d67a807e453f8d5da3fb6389dad4b /drivers/hwmon/w83793.c
parenta8b3485287731978899ced11f24628c927890e78 (diff)
hwmon/w83793: Remove the description of AMDSI and update the voltage formula
Fix the driver to match the information in datasheet 1.0. AMD SI interface is marked as reserved, computing formula for 5VDD and 5VSB is updated. Signed-off-by: Gong Jun <jgong@winbond.com> Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83793.c')
-rw-r--r--drivers/hwmon/w83793.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index c12ac5abc2bb..99e603a6a667 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -117,6 +117,7 @@ static const u16 W83793_REG_IN[][3] = {
117/* Low Bits of Vcore A/B Vtt Read/High/Low */ 117/* Low Bits of Vcore A/B Vtt Read/High/Low */
118static const u16 W83793_REG_IN_LOW_BITS[] = { 0x1b, 0x68, 0x69 }; 118static const u16 W83793_REG_IN_LOW_BITS[] = { 0x1b, 0x68, 0x69 };
119static u8 scale_in[] = { 2, 2, 2, 16, 16, 16, 8, 24, 24, 16 }; 119static u8 scale_in[] = { 2, 2, 2, 16, 16, 16, 8, 24, 24, 16 };
120static u8 scale_in_add[] = { 0, 0, 0, 0, 0, 0, 0, 150, 150, 0 };
120 121
121#define W83793_REG_FAN(index) (0x23 + 2 * (index)) /* High byte */ 122#define W83793_REG_FAN(index) (0x23 + 2 * (index)) /* High byte */
122#define W83793_REG_FAN_MIN(index) (0x90 + 2 * (index)) /* High byte */ 123#define W83793_REG_FAN_MIN(index) (0x90 + 2 * (index)) /* High byte */
@@ -500,7 +501,7 @@ store_temp(struct device *dev, struct device_attribute *attr,
500 each has 4 mode:(2 bits) 501 each has 4 mode:(2 bits)
501 0: Stop monitor 502 0: Stop monitor
502 1: Use internal temp sensor(default) 503 1: Use internal temp sensor(default)
503 2: Use sensor in AMD CPU and get result by AMDSI 504 2: Reserved
504 3: Use sensor in Intel CPU and get result by PECI 505 3: Use sensor in Intel CPU and get result by PECI
505 506
506 TR1-TR2 507 TR1-TR2
@@ -509,8 +510,8 @@ store_temp(struct device *dev, struct device_attribute *attr,
509 1: To enable temp sensors monitor 510 1: To enable temp sensors monitor
510*/ 511*/
511 512
512/* 0 disable, 5 AMDSI, 6 PECI */ 513/* 0 disable, 6 PECI */
513static u8 TO_TEMP_MODE[] = { 0, 0, 5, 6 }; 514static u8 TO_TEMP_MODE[] = { 0, 0, 0, 6 };
514 515
515static ssize_t 516static ssize_t
516show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf) 517show_temp_mode(struct device *dev, struct device_attribute *attr, char *buf)
@@ -550,7 +551,7 @@ store_temp_mode(struct device *dev, struct device_attribute *attr,
550 u8 val = simple_strtoul(buf, NULL, 10); 551 u8 val = simple_strtoul(buf, NULL, 10);
551 552
552 /* transform the sysfs interface values into table above */ 553 /* transform the sysfs interface values into table above */
553 if ((val == 5 || val == 6) && (index < 4)) { 554 if ((val == 6) && (index < 4)) {
554 val -= 3; 555 val -= 3;
555 } else if ((val == 3 && index < 4) 556 } else if ((val == 3 && index < 4)
556 || (val == 4 && index >= 4) 557 || (val == 4 && index >= 4)
@@ -839,7 +840,9 @@ show_in(struct device *dev, struct device_attribute *attr, char *buf)
839 val <<= 2; 840 val <<= 2;
840 val += (data->in_low_bits[nr] >> (index * 2)) & 0x3; 841 val += (data->in_low_bits[nr] >> (index * 2)) & 0x3;
841 } 842 }
842 return sprintf(buf, "%d\n", val * scale_in[index]); 843 /* voltage inputs 5VDD and 5VSB needs 150mV offset */
844 val = val * scale_in[index] + scale_in_add[index];
845 return sprintf(buf, "%d\n", val);
843} 846}
844 847
845static ssize_t 848static ssize_t
@@ -859,6 +862,10 @@ store_in(struct device *dev, struct device_attribute *attr,
859 scale_in[index] / 2) / scale_in[index]; 862 scale_in[index] / 2) / scale_in[index];
860 mutex_lock(&data->update_lock); 863 mutex_lock(&data->update_lock);
861 if (index > 2) { 864 if (index > 2) {
865 /* fix the limit values of 5VDD and 5VSB to ALARM mechanism */
866 if (1 == nr || 2 == nr) {
867 val -= scale_in_add[index] / scale_in[index];
868 }
862 val = SENSORS_LIMIT(val, 0, 255); 869 val = SENSORS_LIMIT(val, 0, 255);
863 } else { 870 } else {
864 val = SENSORS_LIMIT(val, 0, 0x3FF); 871 val = SENSORS_LIMIT(val, 0, 0x3FF);