From: greg@kroah.com (Greg KH)
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: [PATCH] I2C update for 2.6.6
Date: Thu, 19 May 2005 06:24:58 +0000 [thread overview]
Message-ID: <10845773583910@kroah.com> (raw)
In-Reply-To: <1084577358220@kroah.com>
In-Reply-To: <10845773562431@kroah.com>
ChangeSet 1.1587.15.17, 2004/05/14 14:59:26-07:00, bjorn@mork.no
[PATCH] I2C: "probe" module param broken for it87 in Linux 2.6.6
Jean Delvare <khali@linux-fr.org> writes:
> So I'd suggest that you simply use the standard exit sequence in the
> it87 driver (the second one in your current patch). A patch for the 2.4
> driver would be appreciated as well.
OK. I've attached a new version of the patch against linux-2.6.6.
I'll send a patch against current lm_sensors CVS removing the extra
exit command in a separate mail.
Greg KH <greg@kroah.com> writes:
> On Wed, May 12, 2004 at 04:38:03PM +0200, Bj?rn Mork wrote:
>> + if (!it87_find(&addr)) {
>> + printk("it87.o: new ISA address: 0x%04x\n", addr);
>
> That printk is wrong (no KERN_ level, or dev_printk() style use).
> Please fix it in your next revision of this patch.
Errh, I just added it to document my sloppyness. It was never meant
to be in the patch I sent you. Sorry. Removed in the attached patch.
The style of these drivers seem to be "just working, making no noise"
so I assume informational printk's are unwanted.
drivers/i2c/chips/it87.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+)
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c Fri May 14 16:18:36 2004
+++ b/drivers/i2c/chips/it87.c Fri May 14 16:18:36 2004
@@ -49,6 +49,54 @@
/* Insmod parameters */
SENSORS_INSMOD_1(it87);
+#define REG 0x2e /* The register to read/write */
+#define DEV 0x07 /* Register: Logical device select */
+#define VAL 0x2f /* The value to read/write */
+#define PME 0x04 /* The device with the fan registers in it */
+#define DEVID 0x20 /* Register: Device ID */
+
+static inline void
+superio_outb(int reg, int val)
+{
+ outb(reg, REG);
+ outb(val, VAL);
+}
+
+static inline int
+superio_inb(int reg)
+{
+ outb(reg, REG);
+ return inb(VAL);
+}
+
+static inline void
+superio_select(void)
+{
+ outb(DEV, REG);
+ outb(PME, VAL);
+}
+
+static inline void
+superio_enter(void)
+{
+ outb(0x87, REG);
+ outb(0x01, REG);
+ outb(0x55, REG);
+ outb(0x55, REG);
+}
+
+static inline void
+superio_exit(void)
+{
+ outb(0x02, REG);
+ outb(0x02, VAL);
+}
+
+/* just IT8712F for now - this should be extended to support the other
+ chips as well */
+#define IT8712F_DEVID 0x8712
+#define IT87_ACT_REG 0x30
+#define IT87_BASE_REG 0x60
/* Update battery voltage after every reading if true */
static int update_vbat;
@@ -158,6 +206,7 @@
static int it87_attach_adapter(struct i2c_adapter *adapter);
+static int it87_find(int *address);
static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
static int it87_detach_client(struct i2c_client *client);
@@ -505,6 +554,30 @@
return i2c_detect(adapter, &addr_data, it87_detect);
}
+/* SuperIO detection - will change normal_isa[0] if a chip is found */
+static int it87_find(int *address)
+{
+ u16 val;
+
+ superio_enter();
+ val = (superio_inb(DEVID) << 8) |
+ superio_inb(DEVID + 1);
+ if (val != IT8712F_DEVID) {
+ superio_exit();
+ return -ENODEV;
+ }
+
+ superio_select();
+ val = (superio_inb(IT87_BASE_REG) << 8) |
+ superio_inb(IT87_BASE_REG + 1);
+ superio_exit();
+ *address = val & ~(IT87_EXTENT - 1);
+ if (*address = 0) {
+ return -ENODEV;
+ }
+ return 0;
+}
+
/* This function is called by i2c_detect */
int it87_detect(struct i2c_adapter *adapter, int address, int kind)
{
@@ -853,6 +926,11 @@
static int __init sm_it87_init(void)
{
+ int addr;
+
+ if (!it87_find(&addr)) {
+ normal_isa[0] = addr;
+ }
return i2c_add_driver(&it87_driver);
}
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] I2C update for 2.6.6
Date: Fri, 14 May 2004 16:29:18 -0700 [thread overview]
Message-ID: <10845773583910@kroah.com> (raw)
In-Reply-To: <1084577358220@kroah.com>
ChangeSet 1.1587.15.17, 2004/05/14 14:59:26-07:00, bjorn@mork.no
[PATCH] I2C: "probe" module param broken for it87 in Linux 2.6.6
Jean Delvare <khali@linux-fr.org> writes:
> So I'd suggest that you simply use the standard exit sequence in the
> it87 driver (the second one in your current patch). A patch for the 2.4
> driver would be appreciated as well.
OK. I've attached a new version of the patch against linux-2.6.6.
I'll send a patch against current lm_sensors CVS removing the extra
exit command in a separate mail.
Greg KH <greg@kroah.com> writes:
> On Wed, May 12, 2004 at 04:38:03PM +0200, Bj?rn Mork wrote:
>> + if (!it87_find(&addr)) {
>> + printk("it87.o: new ISA address: 0x%04x\n", addr);
>
> That printk is wrong (no KERN_ level, or dev_printk() style use).
> Please fix it in your next revision of this patch.
Errh, I just added it to document my sloppyness. It was never meant
to be in the patch I sent you. Sorry. Removed in the attached patch.
The style of these drivers seem to be "just working, making no noise"
so I assume informational printk's are unwanted.
drivers/i2c/chips/it87.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+)
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c Fri May 14 16:18:36 2004
+++ b/drivers/i2c/chips/it87.c Fri May 14 16:18:36 2004
@@ -49,6 +49,54 @@
/* Insmod parameters */
SENSORS_INSMOD_1(it87);
+#define REG 0x2e /* The register to read/write */
+#define DEV 0x07 /* Register: Logical device select */
+#define VAL 0x2f /* The value to read/write */
+#define PME 0x04 /* The device with the fan registers in it */
+#define DEVID 0x20 /* Register: Device ID */
+
+static inline void
+superio_outb(int reg, int val)
+{
+ outb(reg, REG);
+ outb(val, VAL);
+}
+
+static inline int
+superio_inb(int reg)
+{
+ outb(reg, REG);
+ return inb(VAL);
+}
+
+static inline void
+superio_select(void)
+{
+ outb(DEV, REG);
+ outb(PME, VAL);
+}
+
+static inline void
+superio_enter(void)
+{
+ outb(0x87, REG);
+ outb(0x01, REG);
+ outb(0x55, REG);
+ outb(0x55, REG);
+}
+
+static inline void
+superio_exit(void)
+{
+ outb(0x02, REG);
+ outb(0x02, VAL);
+}
+
+/* just IT8712F for now - this should be extended to support the other
+ chips as well */
+#define IT8712F_DEVID 0x8712
+#define IT87_ACT_REG 0x30
+#define IT87_BASE_REG 0x60
/* Update battery voltage after every reading if true */
static int update_vbat;
@@ -158,6 +206,7 @@
static int it87_attach_adapter(struct i2c_adapter *adapter);
+static int it87_find(int *address);
static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
static int it87_detach_client(struct i2c_client *client);
@@ -505,6 +554,30 @@
return i2c_detect(adapter, &addr_data, it87_detect);
}
+/* SuperIO detection - will change normal_isa[0] if a chip is found */
+static int it87_find(int *address)
+{
+ u16 val;
+
+ superio_enter();
+ val = (superio_inb(DEVID) << 8) |
+ superio_inb(DEVID + 1);
+ if (val != IT8712F_DEVID) {
+ superio_exit();
+ return -ENODEV;
+ }
+
+ superio_select();
+ val = (superio_inb(IT87_BASE_REG) << 8) |
+ superio_inb(IT87_BASE_REG + 1);
+ superio_exit();
+ *address = val & ~(IT87_EXTENT - 1);
+ if (*address == 0) {
+ return -ENODEV;
+ }
+ return 0;
+}
+
/* This function is called by i2c_detect */
int it87_detect(struct i2c_adapter *adapter, int address, int kind)
{
@@ -853,6 +926,11 @@
static int __init sm_it87_init(void)
{
+ int addr;
+
+ if (!it87_find(&addr)) {
+ normal_isa[0] = addr;
+ }
return i2c_add_driver(&it87_driver);
}
next prev parent reply other threads:[~2005-05-19 6:24 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-14 23:27 [BK PATCH] I2C update for 2.6.6 Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` [PATCH] " Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2004-05-14 23:29 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH [this message]
2005-05-19 6:24 ` Greg KH
2004-05-14 23:29 ` Greg KH
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Mark Studebaker
2005-05-19 6:24 ` 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=10845773583910@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 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.