mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-27 12:30:43 +00:00
Support IT8705F Super-I/O. Check for logical device activation.
Display chip name and revision when found. (backport from Linux 2.6) git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2846 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
b6f200507b
commit
b6728ccd48
1 file changed
+34
-21
+34
-21
@@ -64,6 +64,7 @@ SENSORS_INSMOD_4(it87, it8705, it8712, sis950);
|
||||
#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 */
|
||||
#define DEVREV 0x22 /* Register: Device Revision */
|
||||
|
||||
static inline int
|
||||
superio_inb(int reg)
|
||||
@@ -72,6 +73,16 @@ superio_inb(int reg)
|
||||
return inb(VAL);
|
||||
}
|
||||
|
||||
static int superio_inw(int reg)
|
||||
{
|
||||
int val;
|
||||
outb(reg++, REG);
|
||||
val = inb(VAL) << 8;
|
||||
outb(reg, REG);
|
||||
val |= inb(VAL);
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline void
|
||||
superio_select(void)
|
||||
{
|
||||
@@ -95,9 +106,7 @@ superio_exit(void)
|
||||
outb(0x02, VAL);
|
||||
}
|
||||
|
||||
/* just IT8712F for now - this should be extended to support the other
|
||||
chips as well */
|
||||
#define IT87_DEVID_MATCH(id) ((id) == 0x8712)
|
||||
#define IT87_DEVID_MATCH(id) ((id) == 0x8712 || (id) == 0x8705)
|
||||
|
||||
#define IT87_ACT_REG 0x30
|
||||
#define IT87_BASE_REG 0x60
|
||||
@@ -283,8 +292,6 @@ static struct i2c_driver it87_driver = {
|
||||
.detach_client = it87_detach_client,
|
||||
};
|
||||
|
||||
static int it87_id = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
|
||||
/* -- SENSORS SYSCTL START -- */
|
||||
@@ -418,25 +425,33 @@ static int it87_attach_adapter(struct i2c_adapter *adapter)
|
||||
|
||||
static int it87_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
int err = -ENODEV;
|
||||
u16 devid;
|
||||
|
||||
superio_enter();
|
||||
val = (superio_inb(DEVID) << 8) |
|
||||
superio_inb(DEVID + 1);
|
||||
if (!IT87_DEVID_MATCH(val)) {
|
||||
superio_exit();
|
||||
return -ENODEV;
|
||||
}
|
||||
devid = superio_inw(DEVID);
|
||||
if (!IT87_DEVID_MATCH(devid))
|
||||
goto exit;
|
||||
|
||||
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;
|
||||
if (!(superio_inb(IT87_ACT_REG)) & 0x01) {
|
||||
printk(KERN_INFO "it87: Device not activated, skipping\n");
|
||||
goto exit;
|
||||
}
|
||||
return 0;
|
||||
|
||||
*address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1);
|
||||
if (*address == 0) {
|
||||
printk(KERN_INFO "it87: Base address not set, skipping\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
printk(KERN_INFO "it87: Found IT%04xF chip at 0x%x, revision %d\n",
|
||||
devid, *address, superio_inb(DEVREV) & 0x0f);
|
||||
|
||||
exit:
|
||||
superio_exit();
|
||||
return err;
|
||||
}
|
||||
|
||||
/* This function is called by i2c_detect */
|
||||
@@ -545,8 +560,6 @@ int it87_detect(struct i2c_adapter *adapter, int address,
|
||||
/* Fill in the remaining client fields and put it into the global list */
|
||||
strcpy(new_client->name, client_name);
|
||||
data->type = kind;
|
||||
|
||||
new_client->id = it87_id++;
|
||||
data->valid = 0;
|
||||
init_MUTEX(&data->update_lock);
|
||||
|
||||
|
||||
Reference in new issue
Block a user