All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Hardware monitoring subsystem maintainer position is
@ 2007-04-10 13:02 Jean Delvare
  2007-04-10 13:56   ` [lm-sensors] Hardware monitoring subsystem maintainer position is open David Hubbard
                   ` (3 more replies)
  0 siblings, 4 replies; 109+ messages in thread
From: Jean Delvare @ 2007-04-10 13:02 UTC (permalink / raw)
  To: lm-sensors

Hi all,

I am resigning from my role as hardware monitoring subsystem
(drivers/hwmon) maintainer. This is too much work for me, I do not have
the necessary bandwidth to review all the incoming patches, in
particular new drivers, in a timely manner. Patch authors have been
complaining about this repeatedly. This is no fun for them, and even
less for me, so I'd rather let someone else with more spare time take
care of it. If there are volunteers, this is the right time to speak up.

I will still be maintaining the individual hardware monitoring drivers
I am listed for in file MAINTAINERS (adm1025, f71805f, lm83 and lm90)
as well as the I2C subsystem. No change here.

I will continue to feed -mm with pending hwmon patches until 2.6.21
final is released, then I'll send everything I have to Linus for
2.6.22-rc1, the last of which will be:

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 MAINTAINERS |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- linux-2.6.21-rc6.orig/MAINTAINERS	2007-04-10 13:49:09.000000000 +0200
+++ linux-2.6.21-rc6/MAINTAINERS	2007-04-10 14:28:31.000000000 +0200
@@ -1467,12 +1467,9 @@ W:	http://gigaset307x.sourceforge.net/
 S:	Maintained
 
 HARDWARE MONITORING
-P:	Jean Delvare
-M:	khali@linux-fr.org
 L:	lm-sensors@lm-sensors.org
 W:	http://www.lm-sensors.org/
-T:	quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-hwmon/
-S:	Maintained
+S:	Orphan
 
 HARDWARE RANDOM NUMBER GENERATOR CORE
 P:	Michael Buesch

Then I'll probably keep an eye on hwmon in Linus' tree until 2.6.22
final is released, and after that I'm done with it.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 109+ messages in thread
* [lm-sensors] patch[1/1]:hwmon:Adding_Threshold_support_to_coretemp
@ 2011-01-20  7:57 R, Durgadoss
  2011-01-20 22:17 ` [lm-sensors] Fenghua Yu
  0 siblings, 1 reply; 109+ messages in thread
From: R, Durgadoss @ 2011-01-20  7:57 UTC (permalink / raw)
  To: lm-sensors

Hi,

This patch adds the core temperature threshold support to
coretemp.c. These thresholds can be configured via the sysfs interfaces
temp1_max and temp1_max_hyst. An interrupt is generated when CPU temperature
goes above temp1_max or drops below temp1_max_hyst.

This patch needs the x86 patch, that can be downloaded
from here:
http://git.kernel.org/tip/9e76a97efd31a08cb19d0ba12013b8fb4ad3e474

---------------------------------------------
From: Durgadoss R <durgadoss.r@intel.com>

Date: Wed, 19 Jan 2011 03:52:19 +0530
Subject: PATCH[1/1] hwmon:Adding_Threshold_support_to_coretemp

This patch adds the core temperature threshold support to
coretemp.c. These thresholds can be configured via the sysfs interfaces
temp1_max and temp1_max_hyst. An interrupt is generated when CPU temperature
goes above temp1_max or drops below temp1_max_hyst.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>

---
 Documentation/hwmon/coretemp |    8 ++
 drivers/hwmon/coretemp.c     |  222 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 210 insertions(+), 20 deletions(-)

diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index 25568f8..2b89ae1 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -29,6 +29,14 @@ the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
 
 temp1_input	 - Core temperature (in millidegrees Celsius).
 temp1_max	 - All cooling devices should be turned on (on Core2).
+		   Initialized with IA32_TEMPERATURE_TARGET if supported,
+		   otherwise initialized with (tjmax - 20). When the CPU
+		   temperature reaches this temperature, an interrupt is
+		   generated and temp1_max_alarm is set.
+temp1_max_hyst	 - If the CPU temperature falls below this temperature,
+		   an interrupt is generated and temp1_max_alarm is reset.
+temp1_max_alarm - Set if the temperature reaches or exceeds temp1_max.
+		   Reset if the temperature drops to or below temp1_max_hyst.
 temp1_crit	 - Maximum junction temperature (in millidegrees Celsius).
 temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
 		   Correct CPU operation is no longer guaranteed.
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 42de98d..0d09255 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -36,17 +36,21 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/smp.h>
+#include <asm/mce.h>
+#include <asm/apic.h>
 
 #define DRVNAME	"coretemp"
 
-typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL,
-		SHOW_NAME } SHOW;
+enum attributes { SHOW_TEMP, SHOW_TJMAX, CORE_TTARGET, CORE_TMIN, SHOW_LABEL,
+		SHOW_NAME, SHOW_CRIT_ALARM, SHOW_MAX_ALARM };
 
 /*
  * Functions declaration
  */
 
 static struct coretemp_data *coretemp_update_device(struct device *dev);
+static void update_alarm(struct coretemp_data *data);
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres);
 
 struct coretemp_data {
 	struct device *hwmon_dev;
@@ -59,7 +63,9 @@ struct coretemp_data {
 	int temp;
 	int tjmax;
 	int ttarget;
-	u8 alarm;
+	int tmin;
+	u8 max_alarm;
+	u8 crit_alarm;
 };
 
 /*
@@ -83,9 +89,16 @@ static ssize_t show_name(struct device *dev, struct device_attribute
 static ssize_t show_alarm(struct device *dev, struct device_attribute
 			  *devattr, char *buf)
 {
-	struct coretemp_data *data = coretemp_update_device(dev);
-	/* read the Out-of-spec log, never clear */
-	return sprintf(buf, "%d\n", data->alarm);
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+
+	update_alarm(data);
+	if (attr->index = SHOW_CRIT_ALARM) {
+		/* read the Out-of-spec log, never clear */
+		return sprintf(buf, "%d\n", data->crit_alarm);
+	}
+
+	return sprintf(buf, "%d\n", data->max_alarm);
 }
 
 static ssize_t show_temp(struct device *dev,
@@ -93,33 +106,67 @@ static ssize_t show_temp(struct device *dev,
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 	struct coretemp_data *data = coretemp_update_device(dev);
-	int err;
+	int err = -EINVAL;
 
-	if (attr->index = SHOW_TEMP)
+	switch (attr->index) {
+	case SHOW_TEMP:
 		err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN;
-	else if (attr->index = SHOW_TJMAX)
+		break;
+	case SHOW_TJMAX:
 		err = sprintf(buf, "%d\n", data->tjmax);
-	else
+		break;
+	case CORE_TTARGET:
 		err = sprintf(buf, "%d\n", data->ttarget);
+		break;
+	case CORE_TMIN:
+		err = sprintf(buf, "%d\n", data->tmin);
+		break;
+	}
+
 	return err;
 }
 
+
+static ssize_t store_temp(struct device *dev,
+		struct device_attribute *devattr, const char *buf, size_t count)
+{
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+	unsigned long val;
+	int err;
+
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+
+	err = set_core_threshold(data, val, attr->index);
+
+	return err ? err : count;
+}
+
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
 			  SHOW_TEMP);
 static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL,
 			  SHOW_TJMAX);
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL,
-			  SHOW_TTARGET);
-static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL);
+static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TTARGET);
+static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TMIN);
+static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_CRIT_ALARM);
+static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_MAX_ALARM);
 static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
 static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
 
 static struct attribute *coretemp_attributes[] = {
 	&sensor_dev_attr_name.dev_attr.attr,
 	&sensor_dev_attr_temp1_label.dev_attr.attr,
-	&dev_attr_temp1_crit_alarm.attr,
+	&sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_crit.dev_attr.attr,
+	&sensor_dev_attr_temp1_max.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
 	NULL
 };
 
@@ -127,6 +174,26 @@ static const struct attribute_group coretemp_group = {
 	.attrs = coretemp_attributes,
 };
 
+static void update_alarm(struct coretemp_data *data)
+{
+	u32 eax, edx;
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
+
+	/* Update the critical temperature alarm */
+	data->crit_alarm = (eax >> 5) & 1;
+
+	/* Temperature reached threshold1 */
+	if (eax & THERM_LOG_THRESHOLD1)
+		data->max_alarm = 1;
+	/* Temperature reached threshold0 */
+	else if (eax & THERM_LOG_THRESHOLD0)
+		data->max_alarm = 0;
+	/* If none of these cases, don't update max_alarm */
+
+	return;
+}
+
 static struct coretemp_data *coretemp_update_device(struct device *dev)
 {
 	struct coretemp_data *data = dev_get_drvdata(dev);
@@ -138,7 +205,6 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
 
 		data->valid = 0;
 		rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
-		data->alarm = (eax >> 5) & 1;
 		/* update only if data has been valid */
 		if (eax & 0x80000000) {
 			data->temp = data->tjmax - (((eax >> 16)
@@ -298,6 +364,110 @@ static void __devinit get_ucode_rev_on_cpu(void *edx)
 	rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
 }
 
+#ifdef CONFIG_X86_MCE
+/* Platform thermal Interrupt Handler */
+static int coretemp_interrupt(__u64 msr_val)
+{
+	if (msr_val & THERM_LOG_THRESHOLD0) {
+		if (!(msr_val & THERM_STATUS_THRESHOLD0))
+			pr_info(":Lower Threshold Reached\n");
+		/* Reset the Threshold0 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD0);
+	}
+
+	if (msr_val & THERM_LOG_THRESHOLD1) {
+		if (msr_val & THERM_STATUS_THRESHOLD1)
+			pr_info(":Upper Threshold Reached\n");
+		/* Reset the Threshold1 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD1);
+	}
+
+	return 0;
+}
+#endif
+
+static void configure_apic(void *info)
+{
+	u32 l;
+	int *flag = (int *)info;
+
+	l = apic_read(APIC_LVTTHMR);
+
+	if (*flag)	/* Non-Zero flag Masks the APIC */
+		apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED);
+	else		/* Zero flag UnMasks the APIC */
+		apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
+}
+
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres)
+{
+	u32 eax, edx;
+	int diff;
+	int flag = 1;
+
+	if (temp > data->tjmax)
+		return -EINVAL;
+
+	mutex_lock(&data->update_lock);
+
+	diff = (data->tjmax - temp)/1000;
+
+	/* Mask the APIC */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (thres = CORE_TMIN) {
+		eax = (eax & ~THERM_MASK_THRESHOLD0) |
+					(diff << THERM_SHIFT_THRESHOLD0);
+		data->tmin = temp;
+	} else {
+		eax = (eax & ~THERM_MASK_THRESHOLD1) |
+					(diff << THERM_SHIFT_THRESHOLD1);
+		data->ttarget = temp;
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	/* Unmask the APIC */
+	flag = 0;
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	mutex_unlock(&data->update_lock);
+	return 0;
+}
+
+static int config_thresh_intrpt(struct coretemp_data *data, int enable)
+{
+	u32 eax, edx;
+	int flag = 1; /* Non-Zero Flag masks the apic */
+
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (enable) {
+		eax |= (THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE);
+	} else {
+		eax &= (~(THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE));
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	flag = 0; /*Flag should be zero to unmask the apic */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+#ifdef CONFIG_X86_MCE
+	if (enable)
+		platform_thermal_notify = coretemp_interrupt;
+	else
+		platform_thermal_notify = NULL;
+#endif
+	return 0;
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -351,6 +521,10 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 	}
 
 	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
+	/* Initialize ttarget value. If IA32_TEMPERATURE_TARGET is
+	 * supported, this value will be overwritten below
+	 */
+	data->ttarget = data->tjmax - 20000;
 	platform_set_drvdata(pdev, data);
 
 	/*
@@ -368,13 +542,21 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 		} else {
 			data->ttarget = data->tjmax -
 					(((eax >> 8) & 0xff) * 1000);
-			err = device_create_file(&pdev->dev,
-					&sensor_dev_attr_temp1_max.dev_attr);
-			if (err)
-				goto exit_free;
 		}
 	}
 
+	/* Threshold support is available if the ACPI flag (bit 22) is set */
+	if (cpu_has(c, X86_FEATURE_ACPI)) {
+		/* Enable threshold interrupt support */
+		config_thresh_intrpt(data, 1);
+
+		/* Set Initial Core thresholds.
+		 * The lower and upper threshold values here are assumed
+		 */
+		set_core_threshold(data, 0, CORE_TMIN);
+		set_core_threshold(data, data->ttarget, CORE_TTARGET);
+	}
+
 	if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
 		goto exit_dev;
 
@@ -404,7 +586,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev)
 
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
-	device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
+	config_thresh_intrpt(data, 0);
 	platform_set_drvdata(pdev, NULL);
 	kfree(data);
 	return 0;
-- 
1.6.5.2


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 109+ messages in thread
* [lm-sensors] Patch[2/2]:hwmon:Adding_Threshold_Support_to_Coretemp.c
@ 2010-12-28 10:38 R, Durgadoss
  2011-01-04 19:40 ` [lm-sensors] Guenter Roeck
  0 siblings, 1 reply; 109+ messages in thread
From: R, Durgadoss @ 2010-12-28 10:38 UTC (permalink / raw)
  To: Yu, Fenghua, khali@linux-fr.org, Brown, Len, mingo@redhat.com,
	hpa@zytor.com, Guenter Roeck
  Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	lm-sensors@lm-sensors.org

[-- Attachment #1: Type: text/plain, Size: 11798 bytes --]

Hi,

I am submitting a patch to enable core thermal threshold
Support to coretemp.c. There are two core thermal thresholds
available through sysfs interfaces temp1_max and temp1_max_hyst.
The temp1_max_alarm is set when temperature reaches or crosses
above temp1_max or drops below temp1_max_hyst.

This patch is generated against stable Linux-2.6 kernel.

Kindly review and merge.
----------------------------------------------------------------
From: Durgadoss R <durgadoss.r@intel.com>

Date: Sun, 19 Dec 2010 22:44:54 +0530
Subject: [PATCH 2/2] hwmon:Adding_Threshold_Support_to_Coretemp

This patch adds core thermal thresholds support to coretemp.
These thresholds can be configured via the sysfs interfaces temp1_max
and temp1_max_hyst. An interrupt is generated when CPU temperature
goes above temp1_max or drops below temp1_max_hyst.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>

---
 Documentation/hwmon/coretemp |    8 ++
 drivers/hwmon/coretemp.c     |  214 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 202 insertions(+), 20 deletions(-)

diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index 25568f8..615fdbe 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -29,6 +29,14 @@ the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
 
 temp1_input	 - Core temperature (in millidegrees Celsius).
 temp1_max	 - All cooling devices should be turned on (on Core2).
+		   Initialized with IA32_TEMPERATURE_TARGET if supported,
+		   otherwise initialized with (tjmax - 20). When the CPU
+		   temperature reaches this temperature, an interrupt is
+		   generated and temp1_max_alarm is set.
+temp1_max_hyst	 - If the CPU temperature falls below than temperature,
+		   an interrupt is generated and temp1_max_alarm is reset.
+temp1_max_alarm - Set if the temperature reaches or exceeds temp1_max.
+		   Reset if the temperature drops to or below temp1_max_hyst.
 temp1_crit	 - Maximum junction temperature (in millidegrees Celsius).
 temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
 		   Correct CPU operation is no longer guaranteed.
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 42de98d..025902f 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -36,11 +36,12 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/smp.h>
+#include <asm/mce.h>
 
 #define DRVNAME	"coretemp"
 
-typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL,
-		SHOW_NAME } SHOW;
+enum attributes { SHOW_TEMP, SHOW_TJMAX, CORE_TTARGET, CORE_TMIN, SHOW_LABEL,
+		SHOW_NAME, SHOW_CRIT_ALARM, SHOW_MAX_ALARM } attrs;
 
 /*
  * Functions declaration
@@ -59,9 +60,14 @@ struct coretemp_data {
 	int temp;
 	int tjmax;
 	int ttarget;
-	u8 alarm;
+	int tmin;
+	u8 max_alarm;
+	u8 crit_alarm;
 };
 
+static void update_alarm(struct coretemp_data *data);
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres);
+
 /*
  * Sysfs stuff
  */
@@ -83,9 +89,15 @@ static ssize_t show_name(struct device *dev, struct device_attribute
 static ssize_t show_alarm(struct device *dev, struct device_attribute
 			  *devattr, char *buf)
 {
-	struct coretemp_data *data = coretemp_update_device(dev);
-	/* read the Out-of-spec log, never clear */
-	return sprintf(buf, "%d\n", data->alarm);
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+
+	update_alarm(data);
+	if (attr->index == SHOW_CRIT_ALARM)
+		/* read the Out-of-spec log, never clear */
+		return sprintf(buf, "%d\n", data->crit_alarm);
+
+	return sprintf(buf, "%d\n", data->max_alarm);
 }
 
 static ssize_t show_temp(struct device *dev,
@@ -93,33 +105,67 @@ static ssize_t show_temp(struct device *dev,
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 	struct coretemp_data *data = coretemp_update_device(dev);
-	int err;
+	int err = -EINVAL;
 
-	if (attr->index == SHOW_TEMP)
+	switch (attr->index) {
+	case SHOW_TEMP:
 		err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN;
-	else if (attr->index == SHOW_TJMAX)
+		break;
+	case SHOW_TJMAX:
 		err = sprintf(buf, "%d\n", data->tjmax);
-	else
+		break;
+	case CORE_TTARGET:
 		err = sprintf(buf, "%d\n", data->ttarget);
+		break;
+	case CORE_TMIN:
+		err = sprintf(buf, "%d\n", data->tmin);
+		break;
+	}
+
 	return err;
 }
 
+
+static ssize_t store_temp(struct device *dev,
+		struct device_attribute *devattr, const char *buf, size_t count)
+{
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+	unsigned long val;
+	int err;
+
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+
+	err = set_core_threshold(data, val, attr->index);
+
+	return err ? err : count;
+}
+
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
 			  SHOW_TEMP);
 static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL,
 			  SHOW_TJMAX);
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL,
-			  SHOW_TTARGET);
-static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL);
+static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TTARGET);
+static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TMIN);
+static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_CRIT_ALARM);
+static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_MAX_ALARM);
 static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
 static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
 
 static struct attribute *coretemp_attributes[] = {
 	&sensor_dev_attr_name.dev_attr.attr,
 	&sensor_dev_attr_temp1_label.dev_attr.attr,
-	&dev_attr_temp1_crit_alarm.attr,
+	&sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_crit.dev_attr.attr,
+	&sensor_dev_attr_temp1_max.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
 	NULL
 };
 
@@ -127,6 +173,26 @@ static const struct attribute_group coretemp_group = {
 	.attrs = coretemp_attributes,
 };
 
+static void update_alarm(struct coretemp_data *data)
+{
+	u32 eax, edx;
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
+
+	/* Update the critical temperature alarm */
+	data->crit_alarm = (eax >> 5) & 1;
+
+	/* Temperature reached threshold1 */
+	if (eax & THERM_LOG_THRESHOLD1)
+		data->max_alarm = 1;
+	/* Temperature reached threshold0 */
+	else if (eax & THERM_LOG_THRESHOLD0)
+		data->max_alarm = 0;
+	/* If none of these cases, don't update max_alarm */
+
+	return;
+}
+
 static struct coretemp_data *coretemp_update_device(struct device *dev)
 {
 	struct coretemp_data *data = dev_get_drvdata(dev);
@@ -138,7 +204,6 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
 
 		data->valid = 0;
 		rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
-		data->alarm = (eax >> 5) & 1;
 		/* update only if data has been valid */
 		if (eax & 0x80000000) {
 			data->temp = data->tjmax - (((eax >> 16)
@@ -298,6 +363,106 @@ static void __devinit get_ucode_rev_on_cpu(void *edx)
 	rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
 }
 
+/* Platform thermal Interrupt Handler */
+static int coretemp_interrupt(__u64 msr_val)
+{
+
+	if (msr_val & THERM_LOG_THRESHOLD0) {
+		if (!(msr_val & THERM_STATUS_THRESHOLD0))
+			pr_info("%s:Lower Threshold Reached\n", __func__);
+		/* Reset the Threshold0 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD0);
+	}
+
+	if (msr_val & THERM_LOG_THRESHOLD1) {
+		if (msr_val & THERM_STATUS_THRESHOLD1)
+			pr_info("%s:Upper Threshold Reached\n", __func__);
+		/* Reset the Threshold1 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD1);
+	}
+
+	return 0;
+}
+
+static void configure_apic(void *info)
+{
+	u32 l;
+	int *flag = (int *)info;
+
+	l = apic_read(APIC_LVTTHMR);
+
+	if (*flag)	/* Non-Zero flag Masks the APIC */
+		apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED);
+	else		/* Zero flag UnMasks the APIC */
+		apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
+}
+
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres)
+{
+	u32 eax, edx;
+	int diff;
+	int flag = 1;
+
+	if (temp > data->tjmax)
+		return -EINVAL;
+
+	mutex_lock(&data->update_lock);
+
+	diff = (data->tjmax - temp)/1000;
+
+	/* Mask the APIC */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (thres == CORE_TMIN) {
+		eax = (eax & ~THERM_MASK_THRESHOLD0) |
+					(diff << THERM_SHIFT_THRESHOLD0);
+		data->tmin = temp;
+	} else {
+		eax = (eax & ~THERM_MASK_THRESHOLD1) |
+					(diff << THERM_SHIFT_THRESHOLD1);
+		data->ttarget = temp;
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	/* Unmask the APIC */
+	flag = 0;
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	mutex_unlock(&data->update_lock);
+	return 0;
+}
+
+static int __devinit config_thresh_intrpt(struct coretemp_data *data,
+								int enable)
+{
+	u32 eax, edx;
+	int flag = 1; /* Non-Zero Flag masks the apic */
+
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (enable) {
+		eax |= (THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE);
+		platform_thermal_notify = coretemp_interrupt;
+	} else {
+		eax &= (~(THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE));
+		platform_thermal_notify = NULL;
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	flag = 0; /*Flag should be zero to unmask the apic */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	return 0;
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -351,6 +516,10 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 	}
 
 	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
+	/* Initialize ttarget value. If IA32_TEMPERATURE_TARGET is
+	 * supported, this value will be over written below
+	 */
+	data->ttarget = data->tjmax - 20000;
 	platform_set_drvdata(pdev, data);
 
 	/*
@@ -368,13 +537,18 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 		} else {
 			data->ttarget = data->tjmax -
 					(((eax >> 8) & 0xff) * 1000);
-			err = device_create_file(&pdev->dev,
-					&sensor_dev_attr_temp1_max.dev_attr);
-			if (err)
-				goto exit_free;
 		}
 	}
 
+	/* Enable threshold interrupt support */
+	config_thresh_intrpt(data, 1);
+
+	/* Set Initial Core thresholds.
+	 * The lower and upper threshold values here are assumed
+	 */
+	set_core_threshold(data, 0, CORE_TMIN);
+	set_core_threshold(data, data->ttarget, CORE_TTARGET);
+
 	if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
 		goto exit_dev;
 
@@ -404,7 +578,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev)
 
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
-	device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
+	config_thresh_intrpt(data, 0);
 	platform_set_drvdata(pdev, NULL);
 	kfree(data);
 	return 0;
-- 
1.6.5.2


[-- Attachment #2: 0002-hwmon-Adding_Threshold_Support_to_Coretemp.patch --]
[-- Type: application/octet-stream, Size: 10983 bytes --]

From: Durgadoss R <durgadoss.r@intel.com>
Date: Sun, 19 Dec 2010 22:44:54 +0530
Subject: [PATCH 2/2] hwmon:Adding_Threshold_Support_to_Coretemp

This patch adds core thermal thresholds support to coretemp.
These thresholds can be configured via the sysfs interfaces temp1_max
and temp1_max_hyst. An interrupt is generated when CPU temperature
goes above temp1_max or drops below temp1_max_hyst.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
---
 Documentation/hwmon/coretemp |    8 ++
 drivers/hwmon/coretemp.c     |  214 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 202 insertions(+), 20 deletions(-)

diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index 25568f8..615fdbe 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -29,6 +29,14 @@ the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
 
 temp1_input	 - Core temperature (in millidegrees Celsius).
 temp1_max	 - All cooling devices should be turned on (on Core2).
+		   Initialized with IA32_TEMPERATURE_TARGET if supported,
+		   otherwise initialized with (tjmax - 20). When the CPU
+		   temperature reaches this temperature, an interrupt is
+		   generated and temp1_max_alarm is set.
+temp1_max_hyst	 - If the CPU temperature falls below than temperature,
+		   an interrupt is generated and temp1_max_alarm is reset.
+temp1_max_alarm - Set if the temperature reaches or exceeds temp1_max.
+		   Reset if the temperature drops to or below temp1_max_hyst.
 temp1_crit	 - Maximum junction temperature (in millidegrees Celsius).
 temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
 		   Correct CPU operation is no longer guaranteed.
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 42de98d..025902f 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -36,11 +36,12 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/smp.h>
+#include <asm/mce.h>
 
 #define DRVNAME	"coretemp"
 
-typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL,
-		SHOW_NAME } SHOW;
+enum attributes { SHOW_TEMP, SHOW_TJMAX, CORE_TTARGET, CORE_TMIN, SHOW_LABEL,
+		SHOW_NAME, SHOW_CRIT_ALARM, SHOW_MAX_ALARM } attrs;
 
 /*
  * Functions declaration
@@ -59,9 +60,14 @@ struct coretemp_data {
 	int temp;
 	int tjmax;
 	int ttarget;
-	u8 alarm;
+	int tmin;
+	u8 max_alarm;
+	u8 crit_alarm;
 };
 
+static void update_alarm(struct coretemp_data *data);
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres);
+
 /*
  * Sysfs stuff
  */
@@ -83,9 +89,15 @@ static ssize_t show_name(struct device *dev, struct device_attribute
 static ssize_t show_alarm(struct device *dev, struct device_attribute
 			  *devattr, char *buf)
 {
-	struct coretemp_data *data = coretemp_update_device(dev);
-	/* read the Out-of-spec log, never clear */
-	return sprintf(buf, "%d\n", data->alarm);
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+
+	update_alarm(data);
+	if (attr->index == SHOW_CRIT_ALARM)
+		/* read the Out-of-spec log, never clear */
+		return sprintf(buf, "%d\n", data->crit_alarm);
+
+	return sprintf(buf, "%d\n", data->max_alarm);
 }
 
 static ssize_t show_temp(struct device *dev,
@@ -93,33 +105,67 @@ static ssize_t show_temp(struct device *dev,
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 	struct coretemp_data *data = coretemp_update_device(dev);
-	int err;
+	int err = -EINVAL;
 
-	if (attr->index == SHOW_TEMP)
+	switch (attr->index) {
+	case SHOW_TEMP:
 		err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN;
-	else if (attr->index == SHOW_TJMAX)
+		break;
+	case SHOW_TJMAX:
 		err = sprintf(buf, "%d\n", data->tjmax);
-	else
+		break;
+	case CORE_TTARGET:
 		err = sprintf(buf, "%d\n", data->ttarget);
+		break;
+	case CORE_TMIN:
+		err = sprintf(buf, "%d\n", data->tmin);
+		break;
+	}
+
 	return err;
 }
 
+
+static ssize_t store_temp(struct device *dev,
+		struct device_attribute *devattr, const char *buf, size_t count)
+{
+	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+	struct coretemp_data *data = dev_get_drvdata(dev);
+	unsigned long val;
+	int err;
+
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+
+	err = set_core_threshold(data, val, attr->index);
+
+	return err ? err : count;
+}
+
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
 			  SHOW_TEMP);
 static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL,
 			  SHOW_TJMAX);
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL,
-			  SHOW_TTARGET);
-static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL);
+static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TTARGET);
+static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, show_temp,
+						store_temp, CORE_TMIN);
+static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_CRIT_ALARM);
+static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
+							SHOW_MAX_ALARM);
 static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
 static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
 
 static struct attribute *coretemp_attributes[] = {
 	&sensor_dev_attr_name.dev_attr.attr,
 	&sensor_dev_attr_temp1_label.dev_attr.attr,
-	&dev_attr_temp1_crit_alarm.attr,
+	&sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_crit.dev_attr.attr,
+	&sensor_dev_attr_temp1_max.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
 	NULL
 };
 
@@ -127,6 +173,26 @@ static const struct attribute_group coretemp_group = {
 	.attrs = coretemp_attributes,
 };
 
+static void update_alarm(struct coretemp_data *data)
+{
+	u32 eax, edx;
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
+
+	/* Update the critical temperature alarm */
+	data->crit_alarm = (eax >> 5) & 1;
+
+	/* Temperature reached threshold1 */
+	if (eax & THERM_LOG_THRESHOLD1)
+		data->max_alarm = 1;
+	/* Temperature reached threshold0 */
+	else if (eax & THERM_LOG_THRESHOLD0)
+		data->max_alarm = 0;
+	/* If none of these cases, don't update max_alarm */
+
+	return;
+}
+
 static struct coretemp_data *coretemp_update_device(struct device *dev)
 {
 	struct coretemp_data *data = dev_get_drvdata(dev);
@@ -138,7 +204,6 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
 
 		data->valid = 0;
 		rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
-		data->alarm = (eax >> 5) & 1;
 		/* update only if data has been valid */
 		if (eax & 0x80000000) {
 			data->temp = data->tjmax - (((eax >> 16)
@@ -298,6 +363,106 @@ static void __devinit get_ucode_rev_on_cpu(void *edx)
 	rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
 }
 
+/* Platform thermal Interrupt Handler */
+static int coretemp_interrupt(__u64 msr_val)
+{
+
+	if (msr_val & THERM_LOG_THRESHOLD0) {
+		if (!(msr_val & THERM_STATUS_THRESHOLD0))
+			pr_info("%s:Lower Threshold Reached\n", __func__);
+		/* Reset the Threshold0 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD0);
+	}
+
+	if (msr_val & THERM_LOG_THRESHOLD1) {
+		if (msr_val & THERM_STATUS_THRESHOLD1)
+			pr_info("%s:Upper Threshold Reached\n", __func__);
+		/* Reset the Threshold1 interrupt */
+		wrmsrl(MSR_IA32_THERM_STATUS, msr_val & ~THERM_LOG_THRESHOLD1);
+	}
+
+	return 0;
+}
+
+static void configure_apic(void *info)
+{
+	u32 l;
+	int *flag = (int *)info;
+
+	l = apic_read(APIC_LVTTHMR);
+
+	if (*flag)	/* Non-Zero flag Masks the APIC */
+		apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED);
+	else		/* Zero flag UnMasks the APIC */
+		apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
+}
+
+static int set_core_threshold(struct coretemp_data *data, int temp, int thres)
+{
+	u32 eax, edx;
+	int diff;
+	int flag = 1;
+
+	if (temp > data->tjmax)
+		return -EINVAL;
+
+	mutex_lock(&data->update_lock);
+
+	diff = (data->tjmax - temp)/1000;
+
+	/* Mask the APIC */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (thres == CORE_TMIN) {
+		eax = (eax & ~THERM_MASK_THRESHOLD0) |
+					(diff << THERM_SHIFT_THRESHOLD0);
+		data->tmin = temp;
+	} else {
+		eax = (eax & ~THERM_MASK_THRESHOLD1) |
+					(diff << THERM_SHIFT_THRESHOLD1);
+		data->ttarget = temp;
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	/* Unmask the APIC */
+	flag = 0;
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	mutex_unlock(&data->update_lock);
+	return 0;
+}
+
+static int __devinit config_thresh_intrpt(struct coretemp_data *data,
+								int enable)
+{
+	u32 eax, edx;
+	int flag = 1; /* Non-Zero Flag masks the apic */
+
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	rdmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, &eax, &edx);
+
+	if (enable) {
+		eax |= (THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE);
+		platform_thermal_notify = coretemp_interrupt;
+	} else {
+		eax &= (~(THERM_INT_THRESHOLD0_ENABLE |
+						THERM_INT_THRESHOLD1_ENABLE));
+		platform_thermal_notify = NULL;
+	}
+
+	wrmsr_on_cpu(data->id, MSR_IA32_THERM_INTERRUPT, eax, edx);
+
+	flag = 0; /*Flag should be zero to unmask the apic */
+	smp_call_function_single(data->id, &configure_apic, &flag, 1);
+
+	return 0;
+}
+
 static int __devinit coretemp_probe(struct platform_device *pdev)
 {
 	struct coretemp_data *data;
@@ -351,6 +516,10 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 	}
 
 	data->tjmax = get_tjmax(c, data->id, &pdev->dev);
+	/* Initialize ttarget value. If IA32_TEMPERATURE_TARGET is
+	 * supported, this value will be over written below
+	 */
+	data->ttarget = data->tjmax - 20000;
 	platform_set_drvdata(pdev, data);
 
 	/*
@@ -368,13 +537,18 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 		} else {
 			data->ttarget = data->tjmax -
 					(((eax >> 8) & 0xff) * 1000);
-			err = device_create_file(&pdev->dev,
-					&sensor_dev_attr_temp1_max.dev_attr);
-			if (err)
-				goto exit_free;
 		}
 	}
 
+	/* Enable threshold interrupt support */
+	config_thresh_intrpt(data, 1);
+
+	/* Set Initial Core thresholds.
+	 * The lower and upper threshold values here are assumed
+	 */
+	set_core_threshold(data, 0, CORE_TMIN);
+	set_core_threshold(data, data->ttarget, CORE_TTARGET);
+
 	if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
 		goto exit_dev;
 
@@ -404,7 +578,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev)
 
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
-	device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
+	config_thresh_intrpt(data, 0);
 	platform_set_drvdata(pdev, NULL);
 	kfree(data);
 	return 0;
-- 
1.6.5.2


[-- Attachment #3: ATT00001..txt --]
[-- Type: text/plain, Size: 156 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

[-- Attachment #4: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 109+ messages in thread
* Re: [lm-sensors] +
@ 2009-11-14  9:09 Jean Delvare
  0 siblings, 0 replies; 109+ messages in thread
From: Jean Delvare @ 2009-11-14  9:09 UTC (permalink / raw)
  To: lm-sensors

Hi Andrew,

On Fri, 13 Nov 2009 19:56:28 -0800, akpm@linux-foundation.org wrote:
> 
> The patch titled
>      drivers/hwmon/f75375s.c: fix warning, and probable bug
> has been added to the -mm tree.  Its filename is
>      drivers-hwmon-f75375sc-fix-warning-and-probable-bug.patch
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
> 
> See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
> out what to do about this
> 
> The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
> 
> ------------------------------------------------------
> Subject: drivers/hwmon/f75375s.c: fix warning, and probable bug
> From: Andrew Morton <akpm@linux-foundation.org>
> 
> drivers/hwmon/f75375s.c: In function 'f75375_detect':
> drivers/hwmon/f75375s.c:689: warning: comparison is always false due to limited range of data type
> drivers/hwmon/f75375s.c:689: warning: comparison is always false due to limited range of data type
> drivers/hwmon/f75375s.c:691: warning: comparison is always false due to limited range of data type
> drivers/hwmon/f75375s.c:691: warning: comparison is always false due to limited range of data type
> 
> Cc: Riku Voipio <riku.voipio@iki.fi>
> Cc: Jean Delvare <khali@linux-fr.org>
> Cc: Corentin Labbe <corentin.labbe@geomatys.fr>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/hwmon/f75375s.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN drivers/hwmon/f75375s.c~a drivers/hwmon/f75375s.c
> --- a/drivers/hwmon/f75375s.c~a
> +++ a/drivers/hwmon/f75375s.c
> @@ -681,7 +681,7 @@ static int f75375_detect(struct i2c_clie
>  			 struct i2c_board_info *info)
>  {
>  	struct i2c_adapter *adapter = client->adapter;
> -	u8 vendid, chipid, version;
> +	u16 vendid, chipid, version;
>  	const char *name;
>  
>  	vendid = f75375_read16(client, F75375_REG_VENDOR);

Good catch. I am responsible for this bug, which was introduced by my
patch hwmon-cleanup-detect-functions.patch. I wonder why your gcc
warned you about the problem and did not tell me. Anyway, thanks for
reporting, it's fixed now.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 109+ messages in thread
* [lm-sensors] =?UTF-8?Q?Re: [PATCH] hwmon: Add driver for VIA CPU
@ 2009-06-12 18:16 tomaz.mertelj
  2009-06-12 18:20 ` [lm-sensors] Michael S. Zick
  0 siblings, 1 reply; 109+ messages in thread
From: tomaz.mertelj @ 2009-06-12 18:16 UTC (permalink / raw)
  To: Michael S. Zick, tomaz.mertelj
  Cc: Harald Welte, Jean Delvare, Andrew Morton, linux-kernel,
	lm-sensors

> On Fri June 12 2009, Michael S. Zick wrote:
> 
> And the output of sensors with H.W. driver built-in:
> 
> root@cb01:~# sensors
> acpitz-virtual-0
> Adapter: Virtual device
> temp1:       +48.8�C  (crit = +94.8�C)
> 
> via-cputemp-isa-0000
> Adapter: ISA adapter
> Core 0:      +50.0�C
> 
> Which looks reasonable to me, on this machine.
> 
> Mike 

On VIA VB7002  acpitz  obviously does not work so I can not compare. I 
guess BIOS does not support the temperature reading since there is no 
temperature readout in BIOS. 

acpitz-virtual-0
Adapter: Virtual device
temp1:      -247.7 C  (crit = +140.0 C)

via-cputemp-isa-0000
Adapter: ISA adapter
Core 0:      +27.0 C

Is there a way to reset the CPU temperature calibration to the factory 
default?  

Tomaz Mertelj 


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 109+ messages in thread
* [lm-sensors] =?UTF-8?Q?Re: [PATCH] hwmon: Add driver for VIA CPU
@ 2009-06-12 15:25 tomaz.mertelj
  2009-06-12 15:31 ` [lm-sensors] " Michael S. Zick
  0 siblings, 1 reply; 109+ messages in thread
From: tomaz.mertelj @ 2009-06-12 15:25 UTC (permalink / raw)
  To: Michael S. Zick, tomaz.mertelj
  Cc: Harald Welte, Jean Delvare, Andrew Morton, linux-kernel,
	lm-sensors

> 
> The author had a problem in that routine -
> try this one (32bit machines only) -
> 
> Mike 

DEBNAS:/home# for r in 0x1160 0x1161 0x1162 0x1163 0x1164 0x1165 0x1166 
0x1167
0x1168 0x1169 0x116a 0x116b 0x116c 0x1152 0x1153 ; do  ./rdmsrll $r ; 
done
MSR register 0x1160 => 08:04:83:94:bf:c2:39:c8
MSR register 0x1161 => 08:04:83:94:bf:ce:12:88
MSR register 0x1162 => 08:04:83:94:bf:d0:7a:a8
MSR register 0x1163 => 08:04:83:94:bf:9e:1f:88
MSR register 0x1164 => 08:04:83:94:bf:9c:ff:78
MSR register 0x1165 => 08:04:83:94:bf:87:6e:18
MSR register 0x1166 => 08:04:83:94:bf:a1:87:b8
MSR register 0x1167 => 08:04:83:94:bf:f1:cc:b8
MSR register 0x1168 => 08:04:83:94:bf:c6:22:08
MSR register 0x1169 => 08:04:83:94:bf:cf:b8:68
MSR register 0x116a => 08:04:83:94:bf:a3:57:d8
MSR register 0x116b => 08:04:83:94:bf:b3:a8:d8
MSR register 0x116c => 08:04:83:94:bf:ea:04:48
MSR register 0x1152 => 08:04:83:94:bf:84:85:e8
MSR register 0x1153 => 08:04:83:94:bf:d6:fb:18

I 
I hope this is better.

Tomaz



_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 109+ messages in thread
* Re: [lm-sensors] +
@ 2008-09-18  8:12 Sebastian Siewior
  2008-09-18  8:15 ` Sebastian Siewior
                   ` (5 more replies)
  0 siblings, 6 replies; 109+ messages in thread
From: Sebastian Siewior @ 2008-09-18  8:12 UTC (permalink / raw)
  To: lm-sensors

akpm@linux-foundation.org wrote:
> The patch titled
>      hwmon: add support for MAX1618 in MAX1619 driver
> has been added to the -mm tree.  Its filename is
>      hwmon-add-support-for-max1618-in-max1619-driver.patch
> 
Andrew, what about Jean Delvare's issues which came up during the review? 
Or will this remain in -mm until his issues got fixed up?

Sebastian

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 109+ messages in thread
* [lm-sensors]
@ 2005-06-11 10:20 wore
  2005-10-26 22:17 ` [lm-sensors] Mauro Carvalho Chehab
                   ` (55 more replies)
  0 siblings, 56 replies; 109+ messages in thread
From: wore @ 2005-06-11 10:20 UTC (permalink / raw)
  To: lm-sensors

I don't know about 2.6 kernel, but I wrote for 2.4 kernel.
Currently working on my 2.4 kernel box with no trouble.
All you have to do is port to 2.6 kernel. :-)

My mail and code(attached) are there.
http://lists.lm-sensors.org/pipermail/lm-sensors/2005-April/011709.html

Regards,
wore

^ permalink raw reply	[flat|nested] 109+ messages in thread

end of thread, other threads:[~2011-12-22  9:33 UTC | newest]

Thread overview: 109+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-10 13:02 [lm-sensors] Hardware monitoring subsystem maintainer position is Jean Delvare
2007-04-10 13:56 ` [lm-sensors] Hardware monitoring subsystem maintainer position David Hubbard
2007-04-10 13:56   ` [lm-sensors] Hardware monitoring subsystem maintainer position is open David Hubbard
2007-04-10 15:40 ` [lm-sensors] Hardware monitoring subsystem maintainer position Hans de Goede
2007-04-10 15:40   ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Hans de Goede
2007-04-10 15:46   ` [lm-sensors] Hardware monitoring subsystem maintainer position David Hubbard
2007-04-10 15:46     ` [lm-sensors] Hardware monitoring subsystem maintainer position is open David Hubbard
2007-04-10 22:22     ` [lm-sensors] Hardware monitoring subsystem maintainer position Rudolf Marek
2007-04-10 22:22       ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Rudolf Marek
2007-04-10 22:59       ` [lm-sensors] Hardware monitoring subsystem maintainer position David Hubbard
2007-04-10 23:02         ` [lm-sensors] Hardware monitoring subsystem maintainer position is open David Hubbard
2007-04-11  9:24       ` [lm-sensors] Hardware monitoring subsystem maintainer position Hans de Goede
2007-04-11  9:24         ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Hans de Goede
2007-04-11 15:08         ` [lm-sensors] Hardware monitoring subsystem maintainer position Juerg Haefliger
2007-04-11 15:08           ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Juerg Haefliger
2007-04-12  5:57         ` [lm-sensors] Hardware monitoring subsystem maintainer Krzysztof Helt
2007-04-12  7:27           ` [lm-sensors] Hardware monitoring subsystem Hans de Goede
2007-04-12  7:27             ` [lm-sensors] Hardware monitoring subsystem maintainer positionis open Hans de Goede
2007-04-15  2:07             ` [lm-sensors] Dmitry Torokhov
2007-04-15  2:07               ` [lm-sensors] Hardware monitoring subsystem maintainer positionis open Dmitry Torokhov
2007-04-13 14:08           ` [lm-sensors] Hardware monitoring subsystem maintainer Jean Delvare
2007-04-11  9:49   ` [lm-sensors] Hardware monitoring subsystem maintainer position Jean Delvare
2007-04-11  9:49     ` Hardware monitoring subsystem maintainer position is open Jean Delvare
2007-04-11 10:06     ` [lm-sensors] Hardware monitoring subsystem maintainer position David Hubbard
2007-04-11 10:06       ` [lm-sensors] Hardware monitoring subsystem maintainer position is open David Hubbard
2007-04-11 14:49     ` Gene Heskett
2007-04-15 15:03 ` [lm-sensors] Hardware monitoring subsystem maintainer position Mark M. Hoffman
2007-04-15 15:03   ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Mark M. Hoffman
2007-04-15 17:54   ` [lm-sensors] Hardware monitoring subsystem maintainer position Juerg Haefliger
2007-04-15 17:54     ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Juerg Haefliger
2007-04-15 18:16   ` [lm-sensors] Hardware monitoring subsystem maintainer position Rudolf Marek
2007-04-15 18:16     ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Rudolf Marek
2007-04-17  8:45   ` [lm-sensors] Hardware monitoring subsystem maintainer position Jean Delvare
2007-04-17  8:45     ` [lm-sensors] Hardware monitoring subsystem maintainer position is open Jean Delvare
2007-04-18 16:42 ` [lm-sensors] Hardware monitoring subsystem maintainer position Ivo Manca
  -- strict thread matches above, loose matches on Subject: below --
2011-01-20  7:57 [lm-sensors] patch[1/1]:hwmon:Adding_Threshold_support_to_coretemp R, Durgadoss
2011-01-20 22:17 ` [lm-sensors] Fenghua Yu
2011-01-21  2:26   ` [lm-sensors] Guenter Roeck
2010-12-28 10:38 [lm-sensors] Patch[2/2]:hwmon:Adding_Threshold_Support_to_Coretemp.c R, Durgadoss
2011-01-04 19:40 ` [lm-sensors] Guenter Roeck
2009-11-14  9:09 [lm-sensors] + Jean Delvare
2009-06-12 18:16 [lm-sensors] =?UTF-8?Q?Re: [PATCH] hwmon: Add driver for VIA CPU tomaz.mertelj
2009-06-12 18:20 ` [lm-sensors] Michael S. Zick
2009-06-12 15:25 [lm-sensors] =?UTF-8?Q?Re: [PATCH] hwmon: Add driver for VIA CPU tomaz.mertelj
2009-06-12 15:31 ` [lm-sensors] " Michael S. Zick
2009-06-12 16:04   ` Michael S. Zick
2009-06-12 17:38     ` [lm-sensors] Michael S. Zick
2008-09-18  8:12 [lm-sensors] + Sebastian Siewior
2008-09-18  8:15 ` Sebastian Siewior
2008-09-18  8:25 ` Andrew Morton
2008-09-18  9:08 ` Sebastian Siewior
2008-09-18 20:02 ` Jean Delvare
2008-09-18 21:13 ` Andrew Morton
2008-09-19 13:13 ` Jean Delvare
2005-06-11 10:20 [lm-sensors] wore
2005-10-26 22:17 ` [lm-sensors] Mauro Carvalho Chehab
2005-10-26 22:40 ` [lm-sensors] Greg KH
2005-10-26 22:46 ` [lm-sensors] Jean Delvare
2005-10-27 14:03 ` [lm-sensors] Mauro Carvalho Chehab
2005-10-27 16:53 ` [lm-sensors] Mauro Carvalho Chehab
2005-10-27 23:07 ` [lm-sensors] Jean Delvare
2005-10-27 23:43 ` [lm-sensors] Jean Delvare
2006-05-05 19:34 ` [lm-sensors] Dieter Jurzitza
2006-05-05 20:53 ` [lm-sensors] Dieter Jurzitza
2006-05-30  8:53 ` [lm-sensors] Laurent Pinchart
2006-12-03  8:22 ` [lm-sensors] Udo van den Heuvel
2006-12-03  8:38 ` [lm-sensors] Thomas Dohl
2006-12-03  8:49 ` [lm-sensors] Udo van den Heuvel
2006-12-03 20:20 ` [lm-sensors] Thomas Dohl
2007-01-08  7:39 ` [lm-sensors] Christophe de Rivière
2007-04-15  7:48 ` [lm-sensors] jk
2007-05-10 17:36 ` [lm-sensors] Dieter Rogiest
2007-05-10 18:02 ` [lm-sensors] Hans-Jürgen Koch
2007-05-10 18:46 ` [lm-sensors] Stephen Cormier
2007-05-10 19:31 ` [lm-sensors] Rudolf Marek
2007-05-10 20:34 ` [lm-sensors] Dieter Rogiest
2007-05-10 22:28 ` [lm-sensors] Rudolf Marek
2007-05-10 22:40 ` [lm-sensors] Dieter Rogiest
2007-07-24 12:06 ` [lm-sensors] Jean Delvare
2007-07-24 12:57 ` [lm-sensors] Christian Hohnstaedt
2007-07-24 13:09 ` [lm-sensors] Jean Delvare
2007-07-24 13:43 ` [lm-sensors] Christian Hohnstaedt
2007-08-12 11:13 ` [lm-sensors] Jean Delvare
2007-08-13  8:39 ` [lm-sensors] Christian Hohnstaedt
2007-08-13 12:29 ` [lm-sensors] Jean Delvare
2007-08-15 15:32 ` [lm-sensors] Christian Hohnstaedt
2007-08-15 19:28 ` [lm-sensors] Jean Delvare
2007-08-16  8:08 ` [lm-sensors] Christian Hohnstaedt
2007-10-07 18:38 ` [lm-sensors] Hans de Goede
2007-10-07 19:33 ` [lm-sensors] Mark M. Hoffman
2007-10-31 15:29 ` [lm-sensors] Hans de Goede
2008-06-01 10:15 ` [lm-sensors] Dominik Geyer
2008-09-17 13:50 ` [lm-sensors] Frank Myhr
2010-03-09 22:50 ` [lm-sensors] Phillip Pi
2010-10-31  7:42 ` [lm-sensors] Zamzit
2010-12-20  6:18 ` [lm-sensors] R, Durgadoss
2010-12-28 10:37 ` [lm-sensors] R, Durgadoss
2011-01-03 11:54 ` [lm-sensors] R, Durgadoss
2011-01-03 15:03   ` [lm-sensors] Guenter Roeck
2011-01-03 15:23     ` [lm-sensors] R, Durgadoss
2011-01-03 15:38       ` [lm-sensors] Guenter Roeck
2011-01-04  9:08         ` [lm-sensors] R, Durgadoss
2011-01-20 20:04 ` [lm-sensors] Guenter Roeck
2011-01-24 21:20 ` [lm-sensors] Yu, Fenghua
2011-03-28 18:11 ` [lm-sensors] R, Durgadoss
2011-04-05 17:47 ` [lm-sensors] Guenter Roeck
2011-04-06  6:54 ` [lm-sensors] R, Durgadoss
2011-04-06  7:18 ` [lm-sensors] Guenter Roeck
2011-06-21  9:44 ` [lm-sensors] Jay Alexander Fleming
2011-06-23 21:30 ` [lm-sensors] Valentijn Scholten
2011-06-24 22:01 ` [lm-sensors] Valentijn Scholten
2011-06-25 18:44 ` [lm-sensors] Valentijn Scholten
2011-10-01 13:38 ` [lm-sensors] Maryvonne JUDIT
2011-10-23 14:53 ` [lm-sensors] Malika et Christophe CHARBONNIER
2011-12-22  9:33 ` [lm-sensors] serge chartrain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.