diff --git a/README b/README index da13418d..91382fe0 100644 --- a/README +++ b/README @@ -23,6 +23,7 @@ At least the following hardware sensor chips are supported: Analog Devices ADM1021 and ADM9240 SiS Southbridge (integrated in the chipset; the I2C adapter will also be supported in the near future) + Maxtor MAX1617 We could use some testers of hardware. If you own a specific monitoring chip or I2C bus, and are willing to help us out, please contact us - even diff --git a/doc/chips/adm1021 b/doc/chips/adm1021 index 6e632621..9c8fb50c 100644 --- a/doc/chips/adm1021 +++ b/doc/chips/adm1021 @@ -1,15 +1,17 @@ This file documents the adm1021 directories for the Analog Devices ADM1021 -temperature sensor chip. +and MAX1617 temperature sensor chip. Note that this last chip should be +fully compatible; it is not yet well-tested, though. -There will be one directory created for each detected ADm1021 chip. As +There will be one directory created for each detected ADM1021 chip. As ADM1021 chips can only be on a SMBus, they will be called adm1021-i2c-?-??, with the first question mark being the number of the i2c bus (see /proc/bus/i2c for a list of them, if i2c-proc is loaded), and the SMBus (I2C) address of the chip at the end. An ADM1021 is uniquely characterised with these -two numbers. /proc/sys/dev/sensors/chips contains the SYSCTL values for +two numbers. Likewise, for each MAX1617 chip, a directory max1617-i2c-?-?? +will be created. /proc/sys/dev/sensors/chips contains the SYSCTL values for all chip directories. -Within each LM75 directory, you can find the following files: +Within each ADM1021 or MAX1617 directory, you can find the following files: * die_code (ADM1021_SYSCTL_DIE_CODE) Silicon die (mask) revision code. This driver was written using a sample device of die code 3. Normally this kind of information isn't reported @@ -17,16 +19,18 @@ Within each LM75 directory, you can find the following files: would hurt. * status (ADM1021_SYSCTL_STATUS) This is an intergral number composed of 8-bits, which indicate the - different alarms and conversion status's of the adm1021. Here is what + different alarms and conversion status's of the chip. Here is what each bit indicates: - 7 BUSY 1 When ADC Converting. - 6 LHIGH# 1 When Local High Temp Limit Tripped. - 5 LLOW# 1 When Local Low Temp Limit Tripped. - 4 RHIGH# 1 When Remote High Temp Limit Tripped. - 3 RLOW# 1 When Remote Low Temp Limit Tripped. - 2 OPEN# 1 When Remote Sensor Open-Circuit. (i.e., no connected remote sensor) - 1-0 Reserved. -Note: # - These flags stay high until the status register is read or they are reset by POR. + 7 BUSY 1 When ADC Converting. + 6 LHIGH# 1 When Local High Temp Limit Tripped. + 5 LLOW# 1 When Local Low Temp Limit Tripped. + 4 RHIGH# 1 When Remote High Temp Limit Tripped. + 3 RLOW# 1 When Remote Low Temp Limit Tripped. + 2 OPEN# 1 When Remote Sensor Open-Circuit. (i.e., no connected remote + sensor) + 1-0 Reserved. + Note: # - These flags stay high until the status register is read or they + are reset by POR. * temp (ADM1021_SYSCTL_TEMP) A list of three numbers. The first number is the Overtemperature Shutdown value, the second number is Low limit value, and the third number is the @@ -54,10 +58,10 @@ Note: # - These flags stay high until the status register is read or they are re the base to the collector. From the docs: "Transistors such as 2N3904, 2N3906 or equivalents in SOT-23 package are suitable to use." -The data for each ADM1021 is updated each 1.5 seconds, but only if it is actually -read. And, any alarms triggered between reads which always be present in -the next read just after the alarm was triggered (regardless if the alarm -situation has been resolved or not). +The data for each chip is updated each 1.5 seconds, but only if it is +actually read. And, any alarms triggered between reads which always be +present in the next read just after the alarm was triggered (regardless if +the alarm situation has been resolved or not). This driver was written and is maintained by Philip Edelbrock . Please send corrections/comments to him. For diff --git a/doc/modules b/doc/modules index bf82c635..991ead9b 100644 --- a/doc/modules +++ b/doc/modules @@ -83,7 +83,7 @@ at all! GL518SM revision 0x00 and 0x80 chip driver (src/chips) adm1021: sensors smbus i2c-core - ADM1021 chip driver + ADM1021 and MAX1617 chip driver (src/chips) adm9240: sensors smbus i2c-core ADM9240 chip driver diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index dcaba028..5f954cea 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -67,9 +67,13 @@ clearing it. Weird, ey? --Phil */ #define adm1021_INIT_REMOTE_TOS 60 #define adm1021_INIT_REMOTE_THYST 20 +/* Types of chips supported */ +enum adm1021_type { adm1021, max1617 }; + /* Each client has this additional data */ struct adm1021_data { int sysctl_id; + enum adm1021_type type; struct semaphore update_lock; char valid; /* !=0 if following fields are valid */ @@ -92,7 +96,6 @@ static int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg); static void adm1021_inc_use (struct i2c_client *client); static void adm1021_dec_use (struct i2c_client *client); -static u16 swap_bytes(u16 val); static int adm1021_read_value(struct i2c_client *client, u8 reg); static int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value); static void adm1021_temp(struct i2c_client *client, int operation, int ctl_name, @@ -108,7 +111,7 @@ static void adm1021_update_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver adm1021_driver = { - /* name */ "adm1021 sensor chip driver", + /* name */ "adm1021, MAX1617 sensor driver", /* id */ I2C_DRIVERID_ADM1021, /* flags */ DF_NOTIFY, /* attach_adapter */ &adm1021_attach_adapter, @@ -150,6 +153,9 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter) int address,err,i; struct i2c_client *new_client; struct adm1021_data *data; + enum adm1021_type type; + const char *type_name; + const char *client_name; err = 0; @@ -167,10 +173,15 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter) /* Verify device is 1021 by checked special DEVICE_ID register (I wish all SMBus chips had this..) */ + /* The MAX1617 does not have it, regrettably. */ if (smbus_read_byte_data(adapter,address,adm1021_REG_DEVICE_ID) != 0x41){ - continue; + type = adm1021; + type_name = "adm1021"; + client_name = "ADM1021 chip"; } else { - printk("dm1021.o: Device found and passed detection.\n"); + type = max1617; + type_name = "max1617"; + client_name = "MAX1617 chip"; } /* continue; */ @@ -201,7 +212,8 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter) new_client->addr = address; new_client->adapter = adapter; new_client->driver = &adm1021_driver; - strcpy(new_client->name,"adm1021 chip"); + strcpy(new_client->name,client_name); + data->type = type; data->valid = 0; data->update_lock = MUTEX; @@ -210,7 +222,7 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter) goto ERROR2; /* Register a new directory entry with module sensors */ - if ((err = sensors_register_entry(new_client,"adm1021", + if ((err = sensors_register_entry(new_client,type_name, adm1021_dir_table_template)) < 0) goto ERROR3; data->sysctl_id = err; @@ -287,11 +299,6 @@ void adm1021_dec_use (struct i2c_client *client) #endif } -u16 swap_bytes(u16 val) -{ - return (val >> 8) | (val << 8); -} - /* All registers are byte-sized */ int adm1021_read_value(struct i2c_client *client, u8 reg) {