diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-07-25 15:46:10 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-07-25 15:46:10 -0400 |
commit | 0a88f4b55749239c4ec8b33da74ff924ccb87dad (patch) | |
tree | f9c32b39b6942385d648ad1f7eb2d25ad6169b44 /drivers/hwmon | |
parent | 0772a640793986d66fd3f89c3cc677bba5d5f94f (diff) |
hwmon-vid: Add support for VIA family 6 model D CPU
The VIA family 6 model D CPU (C7-D, Eden 90 nm) can use two different
VID tables, we have to check the value of a MSR to decide which one to
use.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Tested-by: Jeff Rickman <jrickman@myamigos.us>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/hwmon-vid.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index c8195a077da3..932da8a5aaf4 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -140,7 +140,11 @@ int vid_from_reg(int val, u8 vrm) | |||
140 | return(val & 0x10 ? 975 - (val & 0xF) * 25 : | 140 | return(val & 0x10 ? 975 - (val & 0xF) * 25 : |
141 | 1750 - val * 50); | 141 | 1750 - val * 50); |
142 | case 13: | 142 | case 13: |
143 | case 131: | ||
143 | val &= 0x3f; | 144 | val &= 0x3f; |
145 | /* Exception for Eden ULV 500 MHz */ | ||
146 | if (vrm == 131 && val == 0x3f) | ||
147 | val++; | ||
144 | return(1708 - val * 16); | 148 | return(1708 - val * 16); |
145 | case 14: /* Intel Core */ | 149 | case 14: /* Intel Core */ |
146 | /* compute in uV, round to mV */ | 150 | /* compute in uV, round to mV */ |
@@ -205,11 +209,45 @@ static struct vrm_model vrm_models[] = { | |||
205 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */ | 209 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */ |
206 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ | 210 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ |
207 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ | 211 | {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ |
208 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ | 212 | {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7-M, C7, Eden (Esther) */ |
213 | {X86_VENDOR_CENTAUR, 0x6, 0xD, ANY, 134}, /* C7-D, C7-M, C7, Eden (Esther) */ | ||
209 | 214 | ||
210 | {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ | 215 | {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ |
211 | }; | 216 | }; |
212 | 217 | ||
218 | /* | ||
219 | * Special case for VIA model D: there are two different possible | ||
220 | * VID tables, so we have to figure out first, which one must be | ||
221 | * used. This resolves temporary drm value 134 to 14 (Intel Core | ||
222 | * 7-bit VID), 13 (Pentium M 6-bit VID) or 131 (Pentium M 6-bit VID | ||
223 | * + quirk for Eden ULV 500 MHz). | ||
224 | * Note: something similar might be needed for model A, I'm not sure. | ||
225 | */ | ||
226 | static u8 get_via_model_d_vrm(void) | ||
227 | { | ||
228 | unsigned int vid, brand, dummy; | ||
229 | static const char *brands[4] = { | ||
230 | "C7-M", "C7", "Eden", "C7-D" | ||
231 | }; | ||
232 | |||
233 | rdmsr(0x198, dummy, vid); | ||
234 | vid &= 0xff; | ||
235 | |||
236 | rdmsr(0x1154, brand, dummy); | ||
237 | brand = ((brand >> 4) ^ (brand >> 2)) & 0x03; | ||
238 | |||
239 | if (vid > 0x3f) { | ||
240 | pr_info("Using %d-bit VID table for VIA %s CPU\n", | ||
241 | 7, brands[brand]); | ||
242 | return 14; | ||
243 | } else { | ||
244 | pr_info("Using %d-bit VID table for VIA %s CPU\n", | ||
245 | 6, brands[brand]); | ||
246 | /* Enable quirk for Eden */ | ||
247 | return brand == 2 ? 131 : 13; | ||
248 | } | ||
249 | } | ||
250 | |||
213 | static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) | 251 | static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) |
214 | { | 252 | { |
215 | int i = 0; | 253 | int i = 0; |
@@ -247,6 +285,8 @@ u8 vid_which_vrm(void) | |||
247 | eff_model += ((eax & 0x000F0000)>>16)<<4; | 285 | eff_model += ((eax & 0x000F0000)>>16)<<4; |
248 | } | 286 | } |
249 | vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor); | 287 | vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor); |
288 | if (vrm_ret == 134) | ||
289 | vrm_ret = get_via_model_d_vrm(); | ||
250 | if (vrm_ret == 0) | 290 | if (vrm_ret == 0) |
251 | pr_info("Unknown VRM version of your x86 CPU\n"); | 291 | pr_info("Unknown VRM version of your x86 CPU\n"); |
252 | return vrm_ret; | 292 | return vrm_ret; |