// SPDX-License-Identifier: GPL-2.0-or-later /* * hwmon-vid.c - VID/VRM/VRD voltage conversions * * Copyright (c) 2004 Rudolf Marek <[email protected]> * * Partly imported from i2c-vid.h of the lm_sensors project * Copyright (c) 2002 Mark D. Studebaker <[email protected]> * With assistance from Trent Piepho <[email protected]> */ #define pr_fmt(fmt) … #include <linux/module.h> #include <linux/kernel.h> #include <linux/hwmon-vid.h> /* * Common code for decoding VID pins. * * References: * * For VRM 8.4 to 9.1, "VRM x.y DC-DC Converter Design Guidelines", * available at http://developer.intel.com/. * * For VRD 10.0 and up, "VRD x.y Design Guide", * available at http://developer.intel.com/. * * AMD Athlon 64 and AMD Opteron Processors, AMD Publication 26094, * http://support.amd.com/us/Processor_TechDocs/26094.PDF * Table 74. VID Code Voltages * This corresponds to an arbitrary VRM code of 24 in the functions below. * These CPU models (K8 revision <= E) have 5 VID pins. See also: * Revision Guide for AMD Athlon 64 and AMD Opteron Processors, AMD Publication 25759, * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25759.pdf * * AMD NPT Family 0Fh Processors, AMD Publication 32559, * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf * Table 71. VID Code Voltages * This corresponds to an arbitrary VRM code of 25 in the functions below. * These CPU models (K8 revision >= F) have 6 VID pins. See also: * Revision Guide for AMD NPT Family 0Fh Processors, AMD Publication 33610, * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/33610.pdf * * The 17 specification is in fact Intel Mobile Voltage Positioning - * (IMVP-II). You can find more information in the datasheet of Max1718 * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452 * * The 13 specification corresponds to the Intel Pentium M series. There * doesn't seem to be any named specification for these. The conversion * tables are detailed directly in the various Pentium M datasheets: * https://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm * * The 14 specification corresponds to Intel Core series. There * doesn't seem to be any named specification for these. The conversion * tables are detailed directly in the various Pentium Core datasheets: * https://www.intel.com/design/mobile/datashts/309221.htm * * The 110 (VRM 11) specification corresponds to Intel Conroe based series. * https://www.intel.com/design/processor/applnots/313214.htm */ /* * vrm is the VRM/VRD document version multiplied by 10. * val is the 4-bit or more VID code. * Returned value is in mV to avoid floating point in the kernel. * Some VID have some bits in uV scale, this is rounded to mV. */ int vid_from_reg(int val, u8 vrm) { … } EXPORT_SYMBOL(…); /* * After this point is the code to automatically determine which * VRM/VRD specification should be used depending on the CPU. */ struct vrm_model { … }; #define ANY … #ifdef CONFIG_X86 /* * The stepping_to parameter is highest acceptable stepping for current line. * The model match must be exact for 4-bit values. For model values 0x10 * and above (extended model), all models below the parameter will match. */ static struct vrm_model vrm_models[] = …; /* * Special case for VIA model D: there are two different possible * VID tables, so we have to figure out first, which one must be * used. This resolves temporary drm value 134 to 14 (Intel Core * 7-bit VID), 13 (Pentium M 6-bit VID) or 131 (Pentium M 6-bit VID * + quirk for Eden ULV 500 MHz). * Note: something similar might be needed for model A, I'm not sure. */ static u8 get_via_model_d_vrm(void) { … } static u8 find_vrm(u8 family, u8 model, u8 stepping, u8 vendor) { … } u8 vid_which_vrm(void) { … } /* and now for something completely different for the non-x86 world */ #else u8 vid_which_vrm(void) { pr_info("Unknown VRM version of your CPU\n"); return 0; } #endif EXPORT_SYMBOL(…); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;