Changeset 1318
- Timestamp:
- 02/11/02 00:15:12 (7 years ago)
- Files:
-
- lm-sensors/trunk/CHANGES (modified) (2 diffs)
- lm-sensors/trunk/doc/chips/SUMMARY (modified) (1 diff)
- lm-sensors/trunk/doc/chips/pcf8574 (added)
- lm-sensors/trunk/kernel/chips/pcf8574.c (modified) (12 diffs)
- lm-sensors/trunk/kernel/chips/pcf8591.c (modified) (2 diffs)
- lm-sensors/trunk/kernel/include/sensors.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/CHANGES
r1313 r1318 19 19 20 20 2.6.3 (2002????) 21 Chip modules (most): Allow THIS_MODULE definition for kernels 2.2.18+ 21 22 File doc/chips/it87: add more temp_type help 22 23 File sensors.conf.eg: Un-ignore it87 in8, temp3, fan3; … … 35 36 Module i2c-i810: Add support for 810E 36 37 Module i2c-piix4: Check for uninitialized base address 38 Module i2c-sis5595: Blacklist 735 37 39 Module i2c-viapro: Check for uninitialized base address 38 40 Module gl518sm: Standardize /proc entries in0-3 39 41 Module lm87: Fix in0, in1, in5 initial limits; ain[1,2] -> in[6,7]; 40 42 fan -> fan1; fix temp2 limit writes 43 Module pcf8574: Add support for PCF8574A; /proc interface changed 41 44 Module pcf8591: new 45 Module sis5595: Blacklist 735 42 46 Module w83781d: Add W83697HF support; allow force_subclients parameter 43 47 for Tyan 2460 lm-sensors/trunk/doc/chips/SUMMARY
r1307 r1318 163 163 Matrix Orbital LCD displays 164 164 165 pcf8574 165 pcf8574 & pcf8574a 166 166 Simple eight-bit parallel I/O 167 167 lm-sensors/trunk/kernel/chips/pcf8574.c
r1317 r1318 62 62 /* Addresses to scan */ 63 63 static unsigned short normal_i2c[] = { SENSORS_I2C_END }; 64 static unsigned short normal_i2c_range[] = { 0x20, 0x27, SENSORS_I2C_END };64 static unsigned short normal_i2c_range[] = { 0x20, 0x27, 0x38, 0x3f, SENSORS_I2C_END }; 65 65 static unsigned int normal_isa[] = { SENSORS_ISA_END }; 66 66 static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; 67 67 68 68 /* Insmod parameters */ 69 SENSORS_INSMOD_ 1(pcf8574);69 SENSORS_INSMOD_2(pcf8574, pcf8574a); 70 70 71 71 /* The PCF8574 registers */ … … 74 74 75 75 /* Initial values */ 76 #define PCF8574_INIT 0 /* Both off*/76 #define PCF8574_INIT 255 /* All outputs on (input mode) */ 77 77 78 78 /* Each client has this additional data */ … … 84 84 unsigned long last_updated; /* In jiffies */ 85 85 86 u8 status;/* Register values */86 u8 read, write; /* Register values */ 87 87 }; 88 88 … … 107 107 static void pcf8574_inc_use(struct i2c_client *client); 108 108 static void pcf8574_dec_use(struct i2c_client *client); 109 static void pcf8574_status(struct i2c_client *client, int operation, 109 static void pcf8574_read(struct i2c_client *client, int operation, 110 int ctl_name, int *nrels_mag, long *results); 111 static void pcf8574_write(struct i2c_client *client, int operation, 110 112 int ctl_name, int *nrels_mag, long *results); 111 113 static void pcf8574_update_client(struct i2c_client *client); 112 114 static void pcf8574_init_client(struct i2c_client *client); 113 115 114 116 /* This is the driver that will be inserted */ … … 130 132 when a new copy is allocated. */ 131 133 static ctl_table pcf8574_dir_table_template[] = { 132 {PCF8574_SYSCTL_STAT, "status", NULL, 0, 0644, NULL, &i2c_proc_real, 133 &i2c_sysctl_real, NULL, &pcf8574_status}, 134 {PCF8574_SYSCTL_READ, "read", NULL, 0, 0444, NULL, &i2c_proc_real, 135 &i2c_sysctl_real, NULL, &pcf8574_read}, 136 {PCF8574_SYSCTL_WRITE, "write", NULL, 0, 0644, NULL, &i2c_proc_real, 137 &i2c_sysctl_real, NULL, &pcf8574_write}, 134 138 {0} 135 139 }; … … 191 195 impossible to detect! Stupid chip. */ 192 196 193 /* Determine the chip type - only one kind supported! */ 194 if (kind <= 0) 195 kind = pcf8574; 197 /* Determine the chip type */ 198 if (kind <= 0) { 199 if (address >= 0x20 && address <= 0x27) 200 kind = pcf8574; 201 else if (address >= 0x38 && address <= 0x3f) 202 kind = pcf8574a; 203 else goto ERROR1; 204 } 196 205 197 206 if (kind == pcf8574) { 198 207 type_name = "pcf8574"; 199 208 client_name = "PCF8574 chip"; 209 } else 210 if (kind == pcf8574a) { 211 type_name = "pcf8574a"; 212 client_name = "PCF8574A chip"; 200 213 } else { 201 214 #ifdef DEBUG … … 226 239 data->sysctl_id = i; 227 240 241 /* Initialize the PCF8574 chip */ 242 pcf8574_init_client(new_client); 228 243 return 0; 229 244 … … 282 297 } 283 298 299 /* Called when we have found a new PCF8574. */ 300 void pcf8574_init_client(struct i2c_client *client) 301 { 302 struct pcf8574_data *data = client->data; 303 data->write = PCF8574_INIT; 304 i2c_smbus_write_byte(client, data->write); 305 } 306 284 307 285 308 void pcf8574_update_client(struct i2c_client *client) … … 296 319 #endif 297 320 298 data-> status= i2c_smbus_read_byte(client);321 data->read = i2c_smbus_read_byte(client); 299 322 data->last_updated = jiffies; 300 323 data->valid = 1; … … 305 328 306 329 307 void pcf8574_ status(struct i2c_client *client, int operation,330 void pcf8574_read(struct i2c_client *client, int operation, 308 331 int ctl_name, int *nrels_mag, long *results) 309 332 { 310 u8 tmpstatus;311 312 333 struct pcf8574_data *data = client->data; 313 334 if (operation == SENSORS_PROC_REAL_INFO) … … 315 336 else if (operation == SENSORS_PROC_REAL_READ) { 316 337 pcf8574_update_client(client); 317 tmpstatus = data->status; 318 tmpstatus = (tmpstatus & 0xf0) >> 4; 319 results[0] = tmpstatus; 320 tmpstatus = data->status; 321 tmpstatus &= 0x0f; 322 results[1] = tmpstatus; 323 *nrels_mag = 2; 338 results[0] = data->read; 339 *nrels_mag = 1; 340 } 341 } 342 void pcf8574_write(struct i2c_client *client, int operation, 343 int ctl_name, int *nrels_mag, long *results) 344 { 345 u8 tmpstatus; 346 347 struct pcf8574_data *data = client->data; 348 if (operation == SENSORS_PROC_REAL_INFO) 349 *nrels_mag = 0; 350 else if (operation == SENSORS_PROC_REAL_READ) { 351 results[0] = data->write; 352 *nrels_mag = 1; 324 353 } else if (operation == SENSORS_PROC_REAL_WRITE) { 325 if (*nrels_mag >= 1) {326 data-> status = (data->status & 2) |results[0];327 i2c_smbus_write_byte(client, data-> status);354 if (*nrels_mag = 1) { 355 data->write = results[0]; 356 i2c_smbus_write_byte(client, data->write); 328 357 } 329 358 } 330 359 } 360 331 361 332 362 int __init sensors_pcf8574_init(void) … … 367 397 368 398 MODULE_AUTHOR 369 ("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com and Dan Eaton <dan.eaton@rocketlogix.com>");399 ("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Dan Eaton <dan.eaton@rocketlogix.com> and Aurelien Jarno <aurelien@aurel32.net>"); 370 400 MODULE_DESCRIPTION("PCF8574 driver"); 371 401 lm-sensors/trunk/kernel/chips/pcf8591.c
r1253 r1318 201 201 if (i2c_is_isa_adapter(adapter)) { 202 202 printk 203 (KERN_ERR "pcf85 74.o: pcf8574_detect called for an ISA bus adapter?!?\n");203 (KERN_ERR "pcf8591.o: pcf8591_detect called for an ISA bus adapter?!?\n"); 204 204 return 0; 205 205 } … … 225 225 new_client->flags = 0; 226 226 227 /* Now, we would do the remaining detection. But the PCF85 74is plainly227 /* Now, we would do the remaining detection. But the PCF8591 is plainly 228 228 impossible to detect! Stupid chip. */ 229 229 lm-sensors/trunk/kernel/include/sensors.h
r1310 r1318 432 432 #define LM87_ALARM_TEMP3_FAULT 0x08000 433 433 434 #define PCF8574_SYSCTL_STAT 1000 434 #define PCF8574_SYSCTL_READ 1000 435 #define PCF8574_SYSCTL_WRITE 1001 435 436 436 437 #define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */
