From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] i2c driver fixes for 2.6.4
Date: Mon, 15 Mar 2004 14:56:31 -0800 [thread overview]
Message-ID: <10793913911123@kroah.com> (raw)
In-Reply-To: <10793913912632@kroah.com>
ChangeSet 1.1557.61.12, 2004/02/23 16:29:51-08:00, khali@linux-fr.org
[PATCH] I2C: fix it87 sensor type
Here comes a patch by Takeru Komoriya which fixes the way the it87
driver handles temperature sensor types selection.
* Use the same values as the CVS driver and sensors program.
* Better comments.
* Get rid of the old setting method (already gone in CVS).
* Handle invalid values correctly.
drivers/i2c/chips/it87.c | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c Mon Mar 15 14:36:59 2004
+++ b/drivers/i2c/chips/it87.c Mon Mar 15 14:36:59 2004
@@ -6,7 +6,7 @@
IT8712F Super I/O chip w/LPC interface & SMbus
Sis950 A clone of the IT8705F
- Copyright (c) 2001 Chris Gauthron <chrisg@0-in.com>
+ Copyright (C) 2001 Chris Gauthron <chrisg@0-in.com>
Largely inspired by lm78.c of the same package
This program is free software; you can redistribute it and/or modify
@@ -57,12 +57,6 @@
/* Update battery voltage after every reading if true */
static int update_vbat = 0;
-
-/* Enable Temp1 as thermal resistor */
-/* Enable Temp2 as thermal diode */
-/* Enable Temp3 as thermal resistor */
-static int temp_type = 0x2a;
-
/* Many IT87 constants specified below */
/* Length of ISA address segment */
@@ -422,10 +416,10 @@
struct it87_data *data = i2c_get_clientdata(client);
it87_update_client(client);
if (data->sensor & (1 << nr))
- return sprintf(buf, "1\n");
+ return sprintf(buf, "3\n"); /* thermal diode */
if (data->sensor & (8 << nr))
- return sprintf(buf, "2\n");
- return sprintf(buf, "0\n");
+ return sprintf(buf, "2\n"); /* thermistor */
+ return sprintf(buf, "0\n"); /* disabled */
}
static ssize_t set_sensor(struct device *dev, const char *buf,
size_t count, int nr)
@@ -436,10 +430,13 @@
data->sensor &= ~(1 << nr);
data->sensor &= ~(8 << nr);
- if (val == 1)
+ /* 3 = thermal diode; 2 = thermistor; 0 = disabled */
+ if (val == 3)
data->sensor |= 1 << nr;
else if (val == 2)
data->sensor |= 8 << nr;
+ else if (val != 0)
+ return -1;
it87_write_value(client, IT87_REG_TEMP_ENABLE, data->sensor);
return count;
}
@@ -888,7 +885,7 @@
/* Enable Temp1-Temp3 */
data->sensor = (it87_read_value(client, IT87_REG_TEMP_ENABLE) & 0xc0);
- data->sensor |= temp_type & 0x3f;
+ data->sensor |= 0x2a; /* Temp1,Temp3=thermistor; Temp2=thermal diode */
it87_write_value(client, IT87_REG_TEMP_ENABLE, data->sensor);
/* Enable fans */
@@ -967,6 +964,8 @@
(it87_read_value(client, IT87_REG_ALARM2) << 8) |
(it87_read_value(client, IT87_REG_ALARM3) << 16);
+ data->sensor = it87_read_value(client, IT87_REG_TEMP_ENABLE);
+
data->last_updated = jiffies;
data->valid = 1;
}
@@ -989,8 +988,6 @@
MODULE_DESCRIPTION("IT8705F, IT8712F, Sis950 driver");
MODULE_PARM(update_vbat, "i");
MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
-MODULE_PARM(temp_type, "i");
-MODULE_PARM_DESC(temp_type, "Temperature sensor type, normally leave unset");
MODULE_LICENSE("GPL");
module_init(sm_it87_init);
next prev parent reply other threads:[~2004-03-16 2:56 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-15 22:48 [BK PATCH] i2c driver fixes for 2.6.4 Greg KH
2004-03-15 22:56 ` [PATCH] " Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH [this message]
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
2004-03-15 22:56 ` Greg KH
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=10793913911123@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sensors@stimpy.netroedge.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox