diff options
author | Rudolf Marek <r.marek@sh.cvut.cz> | 2006-04-25 08:24:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-22 14:10:33 -0400 |
commit | 177d165d7c2ec424007d6241a93d0cb83d953c51 (patch) | |
tree | 9ebddfb4b97fae069b99d1162334a95729bf4015 | |
parent | 0d0001dd956d4ae2c8739c2877fa660eec68ed5f (diff) |
[PATCH] HWMON: Trim VID values to correct number of bits
Following patch trims the VID value to correct number of bits
for each VRM.
Signed-off-by: Rudolf Marek <r.marek@sh.cvut.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/hwmon/hwmon-vid.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index a74a44f16f51..b0fd267635bb 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -70,6 +70,7 @@ int vid_from_reg(int val, u8 vrm) | |||
70 | switch(vrm) { | 70 | switch(vrm) { |
71 | 71 | ||
72 | case 100: /* VRD 10.0 */ | 72 | case 100: /* VRD 10.0 */ |
73 | val &= 0x3f; | ||
73 | if((val & 0x1f) == 0x1f) | 74 | if((val & 0x1f) == 0x1f) |
74 | return 0; | 75 | return 0; |
75 | if((val & 0x1f) <= 0x09 || val == 0x0a) | 76 | if((val & 0x1f) <= 0x09 || val == 0x0a) |
@@ -82,14 +83,17 @@ int vid_from_reg(int val, u8 vrm) | |||
82 | return vid; | 83 | return vid; |
83 | 84 | ||
84 | case 24: /* Opteron processor */ | 85 | case 24: /* Opteron processor */ |
86 | val &= 0x1f; | ||
85 | return(val == 0x1f ? 0 : 1550 - val * 25); | 87 | return(val == 0x1f ? 0 : 1550 - val * 25); |
86 | 88 | ||
87 | case 91: /* VRM 9.1 */ | 89 | case 91: /* VRM 9.1 */ |
88 | case 90: /* VRM 9.0 */ | 90 | case 90: /* VRM 9.0 */ |
91 | val &= 0x1f; | ||
89 | return(val == 0x1f ? 0 : | 92 | return(val == 0x1f ? 0 : |
90 | 1850 - val * 25); | 93 | 1850 - val * 25); |
91 | 94 | ||
92 | case 85: /* VRM 8.5 */ | 95 | case 85: /* VRM 8.5 */ |
96 | val &= 0x1f; | ||
93 | return((val & 0x10 ? 25 : 0) + | 97 | return((val & 0x10 ? 25 : 0) + |
94 | ((val & 0x0f) > 0x04 ? 2050 : 1250) - | 98 | ((val & 0x0f) > 0x04 ? 2050 : 1250) - |
95 | ((val & 0x0f) * 50)); | 99 | ((val & 0x0f) * 50)); |
@@ -98,14 +102,17 @@ int vid_from_reg(int val, u8 vrm) | |||
98 | val &= 0x0f; | 102 | val &= 0x0f; |
99 | /* fall through */ | 103 | /* fall through */ |
100 | case 82: /* VRM 8.2 */ | 104 | case 82: /* VRM 8.2 */ |
105 | val &= 0x1f; | ||
101 | return(val == 0x1f ? 0 : | 106 | return(val == 0x1f ? 0 : |
102 | val & 0x10 ? 5100 - (val) * 100 : | 107 | val & 0x10 ? 5100 - (val) * 100 : |
103 | 2050 - (val) * 50); | 108 | 2050 - (val) * 50); |
104 | case 17: /* Intel IMVP-II */ | 109 | case 17: /* Intel IMVP-II */ |
110 | val &= 0x1f; | ||
105 | return(val & 0x10 ? 975 - (val & 0xF) * 25 : | 111 | return(val & 0x10 ? 975 - (val & 0xF) * 25 : |
106 | 1750 - val * 50); | 112 | 1750 - val * 50); |
107 | case 13: | 113 | case 13: |
108 | return(1708 - (val & 0x3f) * 16); | 114 | val &= 0x3f; |
115 | return(1708 - val * 16); | ||
109 | default: /* report 0 for unknown */ | 116 | default: /* report 0 for unknown */ |
110 | printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); | 117 | printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); |
111 | return 0; | 118 | return 0; |