Skip to contentSkip to conversation

hwmon: (hwmon-vid) Determine vrm during initialization, and add vrm mo

PATCH New Guenter Roeck 1 participant 1 message Feb 1, 2012

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH v2 1/24 hwmon: (hwmon-vid) Determine vrm during initialization, and add vrm mo

The vrm value is system-wide and only needs to be calculated once. Do it when the module is loaded. Provide a module parameter to enable overwriting the default value in case it is wrong or can not be calculated.

Modify the vid_from_reg and vid_to_reg API functions to accept the vrm value as optional parameter using varargs, but ignore the vrm parameter and use the internal value instead. This will enable us to drop the vrm attribute from individual drivers one at a time.

---
v2: vrm module parameter is now writable.
Updated module parameter description.
Added Documentation/hwmon/hwmon-vid.
Updated Documentation/hwmon/sysfs-interface (removed vrm from ABI). vid_from_reg() now returns an error code if vrm is unknown. module load now fails if the vrm module parameter is invalid. The vrm parameter to vid_from_reg is now optional and ignored. Moved vid_to_reg from hwmon-vid.h to hwmon-vid.c. Its vrm parameter is now optional and ignored.

 Documentation/hwmon/hwmon-vid       |   70 +++++++++++++++++++++++++++++++++++
 Documentation/hwmon/sysfs-interface |    8 ----
 drivers/hwmon/hwmon-vid.c           |   70 +++++++++++++++++++++++++++++------
 include/linux/hwmon-vid.h           |   19 +--------
 4 files changed, 130 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/hwmon/hwmon-vid
Documentation/hwmon/hwmon-vid new file +70 -0
new file mode 100644
index 0000000..aa1a34a
@@ -0,0 +1,70 @@
+VID pin settings
+--------------------
+
+The VID (Voltage Identification) pins on sensor chips
+are used to read the CPU Core voltage setting.
+
+The VID setting can be controlled by jumpers on the board,
+or, in newer motherboards, by settings in the BIOS.
+On these newer boards, the BIOS programs some device's
+pins which in turn controls a DC-DC Converter to set its
+output to a certain voltage. These pins are also connected to
+the sensor chip so that the VID setting can be read back
+by applications.
+
+There are between 4 and 8 VID pins (the more recent the CPU, the more
+numerous the VID pins.) The VID codes are defined by Intel in documents
+titled "VRM X.X DC-DC Converter Design Guidelines".
+(VRM = Voltage Regulator Module), or
+"Voltage Regulator-Down (VRD) X.X Design Guide".
+These documents are available at http://developer.intel.com.
+There are equivalent documents for AMD processors (look for a table
+named "VID Code Voltages" in processor specifications.)
+
+There are several different VRM document versions.
+The common versions are as follows:
+
+Document Version	Voltage Range	Increment	Processors
+----------------	-------------	---------	----------
+"2.4"			0.8 - 1.55	0.025V		AMD Opteron 24x
+
+8.2 (8.1, 8.3)		1.30 - 2.05V    0.05V		PII, PIII, Celeron
+			2.1 - 3.5V	0.10V
+
+8.4			1.30 - 2.05V    0.05V		PIII, Celeron
+							4 pins only
+
+8.5			1.050 - 1.825V	0.05V		PIII-S Tualatin
+
+9.0, (9.1)		1.100 - 1.850V	0.025V		P4, AMD Socket A
+
+10.0			0.8375 - 1.6000 0.0125V		Desktop Socket 478
+
+11.0			0.5 - 1.6V	0.00625V	Intel Conroe and later
+
+
+"2.4" is not an actual document version but simply a way to identify
+AMD Opteron 24x processors.
+Note that versions 8.1 - 8.4 are compatible.
+
+Since Linux 2.6.9, the correct VRM version is selected automatically
+based on the CPU brand and model. Thus you shouldn't have to care about
+it. If you are using a brand new CPU and even the latest kernel complains
+("Unknown VRM version of your CPU"), this means that the kernel must be
+taught about this new CPU model. Please report to us in this case.
+
+Starting with kernel version 3.4, you can specify the vrm model as parameter
+to the hwmon-vid kernel module.
+
+Example:
+	modprobe hwmon-vid vrm0
+selects vrm version 11.0.
+
+Only known vrm values will be accepted. hwmon-vid will fail to load if an
+unknown or unsupported vrm version is provided.
+
+Remember, the VID pins on the sensor chips are inputs only.
+You cannot use them to manipulate the actual processor core voltage.
+
+------------------
+Copyright (c) 2002-2004 Mark D. Studebaker
Documentation/hwmon/sysfs-interface +0 -8
index 1f4dd85..4e08ec5 100644
@@ -175,14 +175,6 @@ cpu[0-*]_vid	CPU core reference voltage.
 		RO
 		Not always correct.
 
-vrm		Voltage Regulator Module version number. 
-		RW (but changing it should no more be necessary)
-		Originally the VRM standard version multiplied by 10, but now
-		an arbitrary number, as not all standards have a version
-		number.
-		Affects the way the driver calculates the CPU core reference
-		voltage from the vid pins.
-
 Also see the Alarms section for status flags associated with voltages.
 
 
drivers/hwmon/hwmon-vid.c +58 -12

130 lines not on this page · raw message

include/linux/hwmon-vid.h +2 -17
index f346e4d..7e08ce4 100644
@@ -23,23 +23,8 @@
 #ifndef _LINUX_HWMON_VID_H
 #define _LINUX_HWMON_VID_H
 
-int vid_from_reg(int val, u8 vrm);
+int vid_from_reg(int val, ...);
 u8 vid_which_vrm(void);
-
-/* vrm is the VRM/VRD document version multiplied by 10.
-   val is in mV to avoid floating point in the kernel.
-   Returned value is the 4-, 5- or 6-bit VID code.
-   Note that only VRM 9.x is supported for now. */
-static inline int vid_to_reg(int val, u8 vrm)
-{
-	switch (vrm) {
-	case 91:		/* VRM 9.1 */
-	case 90:		/* VRM 9.0 */
-		return ((val >= 1100) && (val <= 1850) ?
-			((18499 - val * 10) / 25 + 5) / 10 : -1);
-	default:
-		return -1;
-	}
-}
+int vid_to_reg(int val, ...);
 
 #endif /* _LINUX_HWMON_VID_H */
Signature · 7 lines
1.7.5.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors