All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Herrmann <andreas.herrmann3@amd.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH 3/3] hwmon: (k8temp) fix temperature reporting
Date: Mon, 15 Dec 2008 23:12:13 +0000	[thread overview]
Message-ID: <20081215231213.GC7013@alberich.amd.com> (raw)

Current Temperature for K8 RevG desktop CPUs is a "normalized value"
which can be below ambient temperature.

As a consequence lots of RevG systems report temperatures like:

 sensors
 k8temp-pci-00c3
 Adapter: PCI adapter
 Core0 Temp:
              +17C
 Core0 Temp:
               +3C
 Core1 Temp:
              +21C
 Core1 Temp:
               +5C

being quite below ambient temperature.
There are even reports of negative temperature values.

This patch corrects the temperature reporting of k8temp for
RevG desktop CPUs.

Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 drivers/hwmon/k8temp.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index ff12281..b138f79 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -49,6 +49,7 @@ struct k8temp_data {
 	u8 sensorsp;		/* sensor presence bits - SEL_CORE & SEL_PLACE */
 	u32 temp[2][2];		/* core, place */
 	u8 swap_core_select;    /* meaning of SEL_CORE is inverted */
+	u32 temp_offset;
 };
 
 static struct k8temp_data *k8temp_update_device(struct device *dev)
@@ -116,13 +117,15 @@ static ssize_t show_temp(struct device *dev,
 	    to_sensor_dev_attr_2(devattr);
 	int core = attr->nr;
 	int place = attr->index;
+	int temp;
 	struct k8temp_data *data = k8temp_update_device(dev);
 
 	if (data->swap_core_select)
 		core = core ? 0 : 1;
 
-	return sprintf(buf, "%d\n",
-		       TEMP_FROM_REG(data->temp[core][place]));
+	temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
+
+	return sprintf(buf, "%d\n", temp);
 }
 
 /* core, place */
@@ -176,6 +179,16 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
 				 "wrong - check erratum #141\n");
 		}
 
+		if (((model >= 0x68) && (model != 0xc1)) &&
+		    !(model = 0x68) && !(model = 0x6c) &&
+		    !(model = 0x7c))
+			/*
+			 * RevG desktop CPUs (i.e. no socket S1G1 parts)
+			 * need additional offset, otherwise reported
+			 * temperature is below ambient temperature
+			 */
+			data->temp_offset = 21000;
+
 		break;
 	}
 
-- 
1.6.0.4




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

             reply	other threads:[~2008-12-15 23:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 23:12 Andreas Herrmann [this message]
2009-01-09 13:34 ` [lm-sensors] [PATCH 3/3] hwmon: (k8temp) fix temperature Jean Delvare
2009-01-09 14:41 ` Andreas Herrmann
2009-01-09 14:54 ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081215231213.GC7013@alberich.amd.com \
    --to=andreas.herrmann3@amd.com \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.