25 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27 #include <linux/module.h>
28 #include <linux/kernel.h>
91 if ((val & 0x1f) == 0x1f)
93 if ((val & 0x1f) <= 0x09 || val == 0x0a)
94 vid = 1087500 - (val & 0x1f) * 25000;
96 vid = 1862500 - (val & 0x1f) * 25000;
99 return (vid + 500) / 1000;
104 if (val < 0x02 || val > 0xb2)
106 return (1600000 - (val - 2) * 6250 + 500) / 1000;
115 return (val < 32) ? 1550 - 25 * val
116 : 775 - (25 * (val - 31)) / 2;
121 return val == 0x1f ? 0 :
126 return (val & 0x10 ? 25 : 0) +
127 ((val & 0x0f) > 0x04 ? 2050 : 1250) -
135 return val == 0x1f ? 0 :
136 val & 0x10 ? 5100 - (
val) * 100 :
140 return val & 0x10 ? 975 - (val & 0xF) * 25 :
146 if (vrm == 131 && val == 0x3f)
148 return 1708 - val * 16;
152 return val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000;
155 pr_warn(
"Requested unsupported VRM version (%u)\n",
237 static u8 get_via_model_d_vrm(
void)
240 static const char *brands[4] = {
241 "C7-M",
"C7",
"Eden",
"C7-D"
244 rdmsr(0x198, dummy, vid);
247 rdmsr(0x1154, brand, dummy);
248 brand = ((brand >> 4) ^ (brand >> 2)) & 0x03;
251 pr_info(
"Using %d-bit VID table for VIA %s CPU\n",
255 pr_info(
"Using %d-bit VID table for VIA %s CPU\n",
258 return brand == 2 ? 131 : 13;
266 for (i = 0; i <
ARRAY_SIZE(vrm_models); i++) {
267 if (vendor == vrm_models[i].vendor &&
268 family == vrm_models[i].family &&
288 vrm_ret = get_via_model_d_vrm();
290 pr_info(
"Unknown VRM version of your x86 CPU\n");
298 pr_info(
"Unknown VRM version of your CPU\n");