From a45a8c8571c0be6a6bd72ae5a14255c26b14b504 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 16 Sep 2011 21:24:02 +0200 Subject: hwmon: (coretemp) Let the user force TjMax On old CPUs (and even some recent Atom CPUs) TjMax can't be read from the CPU registers, so it is guessed by the driver using a complex heuristic which isn't reliable. So let users who know their CPU's TjMax pass it as a module parameter. Signed-off-by: Jean Delvare Cc: Fenghua Yu Cc: "R, Durgadoss" Cc: Guenter Roeck Cc: Alexander Stein Acked-by: Fenghua Yu Signed-off-by: Guenter Roeck --- drivers/hwmon/coretemp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/hwmon/coretemp.c') diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 256f70803eb3..5a41e9dda909 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -36,11 +36,20 @@ #include #include #include +#include #include #include #define DRVNAME "coretemp" +/* + * force_tjmax only matters when TjMax can't be read from the CPU itself. + * When set, it replaces the driver's suboptimal heuristic. + */ +static int force_tjmax; +module_param_named(tjmax, force_tjmax, int, 0444); +MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); + #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ @@ -398,6 +407,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) } } + if (force_tjmax) { + dev_notice(dev, "TjMax forced to %d degrees C by user\n", + force_tjmax); + return force_tjmax * 1000; + } + /* * An assumption is made for early CPUs and unreadable MSR. * NOTE: the calculated value may not be correct. -- cgit v1.2.3-59-g8ed1b