Changeset 20
- Timestamp:
- 12/02/98 01:47:37 (14 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 6 modified
-
TODO (modified) (1 diff)
-
i2c/i2c-core.c (modified) (2 diffs)
-
kernel/chips/lm78.c (modified) (10 diffs)
-
kernel/sensors.c (modified) (4 diffs)
-
src/lm78.c (modified) (10 diffs)
-
src/sensors.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/TODO
r19 r20 4 4 * Make it SMP-safe: there are no spinlocks yet. They are needed at many 5 5 places, probably (everywhere where global vars are accessed). 6 * Extend sensors.c with a file /proc/sys/dev/sensors/chips, which lists 7 all directories under /proc/sys/dev/sensors with their SYSCTL id 8 (needed for good sysctl access). 6 9 * Write smbus_access_i2c in smbus.c 7 10 * Write piix4_* in piix4.c 8 * Complete lm78 driver 9 * Extend dev interface for SMBus 10 * Create entries in /proc/bus: a list of all registered busses, and for 11 each bus, a file with registered clients (partially done) 11 * Make lm78.c detect 'double hits', (same chip connected to both SMBus and 12 ISA). 13 * Check whether some lm78 functionality is chip-generic and can be moved to 14 sensors.c. 15 * Rename i2c-proc.c to i2c-user.c, and extend it with /dev entries; 16 or, create a better i2c-dev.c, that understands SMBus commands. 12 17 * Write all other drivers 13 18 * How to make drivers detect thing *not*; for example, if a Winbond is 14 19 present, the LM75 driver should not try to access its simulated 15 LM75 chips! 20 LM75 chips (in this case, simply disable them - but what if the LM75 21 driver was loaded first?). 16 22 * Write a userland-library for SMBus/i2c access (through the /dev interface) 17 23 * Write a userland detection program for busses (clients are less important; -
lm-sensors/trunk/i2c/i2c-core.c
r19 r20 18 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 19 /* ------------------------------------------------------------------------- */ 20 #define RCSID "$Id: i2c-core.c,v 1. 4 1998/11/27 22:02:09frodo Exp $"20 #define RCSID "$Id: i2c-core.c,v 1.5 1998/12/01 21:11:32 frodo Exp $" 21 21 /* ------------------------------------------------------------------------- */ 22 22 … … 249 249 DEB2(printk("i2c: detaching client %s:\n", 250 250 client->name)); 251 i2c_detach_client(client);251 /* i2c_detach_client(client); */ 252 252 driver->detach_client(client); 253 253 } -
lm-sensors/trunk/kernel/chips/lm78.c
r19 r20 92 92 #define LM78_INIT_IN_6 -500 93 93 94 #define LM78_INIT_IN_PERCENTAGE 10 094 #define LM78_INIT_IN_PERCENTAGE 10 95 95 96 96 #define LM78_INIT_IN_MIN_0 \ … … 257 257 { LM78_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 258 258 { LM78_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 259 { LM78_SYSCTL_FAN2, "fan 1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl },260 { LM78_SYSCTL_FAN3, "fan 1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl },259 { LM78_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 260 { LM78_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 261 261 { LM78_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 262 262 { LM78_SYSCTL_VID, "vid", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 263 263 { LM78_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 264 265 { LM78_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl}264 { LM78_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 265 { 0 } 266 266 }; 267 267 … … 338 338 /* Register a new directory entry with module sensors */ 339 339 if ((err = sensors_register_entry((struct i2c_client *) new_client,"lm78", 340 lm78_dir_table_template) < 0))340 lm78_dir_table_template)) < 0) 341 341 goto ERROR4; 342 342 ((struct lm78_data *) (new_client->data)) -> sysctl_id = err; … … 381 381 } 382 382 lm78_remove_client((struct i2c_client *) client); 383 release_region(client->isa_addr,LM78_EXTENT); 383 384 kfree(client); 384 release_region(client->isa_addr,LM78_EXTENT);385 385 return 0; 386 386 } … … 423 423 /* Register a new directory entry with module sensors */ 424 424 if ((err = sensors_register_entry(new_client,"lm78", 425 lm78_dir_table_template) < 0))425 lm78_dir_table_template)) < 0) 426 426 goto ERROR4; 427 427 ((struct lm78_data *) (new_client->data))->sysctl_id = err; … … 593 593 void lm78_update_client(struct i2c_client *client) 594 594 { 595 struct lm78_data *data = client->data;595 struct lm78_data *data = client->data; 596 596 int i; 597 597 … … 601 601 (jiffies < data->last_updated) || ! data->valid) { 602 602 603 #ifdef DEBUG 604 printk("Starting lm78 update\n"); 605 #endif 603 606 for (i = 0; i <= 6; i++) { 604 607 data->in[i] = lm78_read_value(client,LM78_REG_IN(i)); … … 651 654 mag=2; 652 655 break; 653 case LM78_SYSCTL_ FAN_DIV: case LM78_SYSCTL_TEMP:656 case LM78_SYSCTL_TEMP: 654 657 nrels=3; 655 658 mag=0; 656 659 break; 657 660 case LM78_SYSCTL_FAN1: case LM78_SYSCTL_FAN2: case LM78_SYSCTL_FAN3: 661 case LM78_SYSCTL_FAN_DIV: 658 662 nrels=2; 659 663 mag=0; … … 737 741 case LM78_SYSCTL_IN0: case LM78_SYSCTL_IN1: case LM78_SYSCTL_IN2: 738 742 case LM78_SYSCTL_IN3: case LM78_SYSCTL_IN4: case LM78_SYSCTL_IN5: 739 case LM78_SYSCTL_IN6: case LM78_SYSCTL_TEMP: case LM78_SYSCTL_FAN_DIV:743 case LM78_SYSCTL_IN6: case LM78_SYSCTL_TEMP: 740 744 nrels=3; 741 745 break; 742 746 case LM78_SYSCTL_FAN1: case LM78_SYSCTL_FAN2: case LM78_SYSCTL_FAN3: 747 case LM78_SYSCTL_FAN_DIV: 743 748 nrels=2; 744 749 break; … … 826 831 struct lm78_data *data = client->data; 827 832 results[0] = IN_FROM_REG(data->in_min[nr],nr); 828 results[1] = IN_FROM_REG(data->in_m in[nr],nr);829 results[2] = IN_FROM_REG(data->in _min[nr],nr);833 results[1] = IN_FROM_REG(data->in_max[nr],nr); 834 results[2] = IN_FROM_REG(data->in[nr],nr); 830 835 } 831 836 -
lm-sensors/trunk/kernel/sensors.c
r19 r20 63 63 int id; 64 64 if (i2c_is_isa_adapter(adapter)) 65 sprintf(name_buffer,"%s-isa-% d",prefix,addr);65 sprintf(name_buffer,"%s-isa-%04x",prefix,addr); 66 66 else { 67 67 if ((id = i2c_adapter_id(adapter)) < 0); 68 68 return -ENOENT; 69 sprintf(name_buffer,"%s-i2c-%d-% d",prefix,id,addr);69 sprintf(name_buffer,"%s-i2c-%d-%02x",prefix,id,addr); 70 70 } 71 71 *name = kmalloc(strlen(name_buffer)+1,GFP_KERNEL); … … 95 95 return res; 96 96 97 for (id = 0; id < SENSORS_ENTRY_MAX; i ++)97 for (id = 0; id < SENSORS_ENTRY_MAX; id++) 98 98 if (! sensors_entries[id]) { 99 99 break; … … 130 130 } 131 131 132 sensors_entries[i ] = new_header;132 sensors_entries[id-256] = new_header; 133 133 134 134 return id; … … 142 142 table = sensors_entries[id]->ctl_table; 143 143 unregister_sysctl_table(sensors_entries[id]); 144 kfree((void *) (table ->procname));144 kfree((void *) (table[4].procname)); 145 145 kfree(table); 146 146 sensors_entries[id] = 0; -
lm-sensors/trunk/src/lm78.c
r19 r20 92 92 #define LM78_INIT_IN_6 -500 93 93 94 #define LM78_INIT_IN_PERCENTAGE 10 094 #define LM78_INIT_IN_PERCENTAGE 10 95 95 96 96 #define LM78_INIT_IN_MIN_0 \ … … 257 257 { LM78_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 258 258 { LM78_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 259 { LM78_SYSCTL_FAN2, "fan 1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl },260 { LM78_SYSCTL_FAN3, "fan 1", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl },259 { LM78_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 260 { LM78_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 261 261 { LM78_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 262 262 { LM78_SYSCTL_VID, "vid", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 263 263 { LM78_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 264 265 { LM78_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl}264 { LM78_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &lm78_proc, &lm78_sysctl }, 265 { 0 } 266 266 }; 267 267 … … 338 338 /* Register a new directory entry with module sensors */ 339 339 if ((err = sensors_register_entry((struct i2c_client *) new_client,"lm78", 340 lm78_dir_table_template) < 0))340 lm78_dir_table_template)) < 0) 341 341 goto ERROR4; 342 342 ((struct lm78_data *) (new_client->data)) -> sysctl_id = err; … … 381 381 } 382 382 lm78_remove_client((struct i2c_client *) client); 383 release_region(client->isa_addr,LM78_EXTENT); 383 384 kfree(client); 384 release_region(client->isa_addr,LM78_EXTENT);385 385 return 0; 386 386 } … … 423 423 /* Register a new directory entry with module sensors */ 424 424 if ((err = sensors_register_entry(new_client,"lm78", 425 lm78_dir_table_template) < 0))425 lm78_dir_table_template)) < 0) 426 426 goto ERROR4; 427 427 ((struct lm78_data *) (new_client->data))->sysctl_id = err; … … 593 593 void lm78_update_client(struct i2c_client *client) 594 594 { 595 struct lm78_data *data = client->data;595 struct lm78_data *data = client->data; 596 596 int i; 597 597 … … 601 601 (jiffies < data->last_updated) || ! data->valid) { 602 602 603 #ifdef DEBUG 604 printk("Starting lm78 update\n"); 605 #endif 603 606 for (i = 0; i <= 6; i++) { 604 607 data->in[i] = lm78_read_value(client,LM78_REG_IN(i)); … … 651 654 mag=2; 652 655 break; 653 case LM78_SYSCTL_ FAN_DIV: case LM78_SYSCTL_TEMP:656 case LM78_SYSCTL_TEMP: 654 657 nrels=3; 655 658 mag=0; 656 659 break; 657 660 case LM78_SYSCTL_FAN1: case LM78_SYSCTL_FAN2: case LM78_SYSCTL_FAN3: 661 case LM78_SYSCTL_FAN_DIV: 658 662 nrels=2; 659 663 mag=0; … … 737 741 case LM78_SYSCTL_IN0: case LM78_SYSCTL_IN1: case LM78_SYSCTL_IN2: 738 742 case LM78_SYSCTL_IN3: case LM78_SYSCTL_IN4: case LM78_SYSCTL_IN5: 739 case LM78_SYSCTL_IN6: case LM78_SYSCTL_TEMP: case LM78_SYSCTL_FAN_DIV:743 case LM78_SYSCTL_IN6: case LM78_SYSCTL_TEMP: 740 744 nrels=3; 741 745 break; 742 746 case LM78_SYSCTL_FAN1: case LM78_SYSCTL_FAN2: case LM78_SYSCTL_FAN3: 747 case LM78_SYSCTL_FAN_DIV: 743 748 nrels=2; 744 749 break; … … 826 831 struct lm78_data *data = client->data; 827 832 results[0] = IN_FROM_REG(data->in_min[nr],nr); 828 results[1] = IN_FROM_REG(data->in_m in[nr],nr);829 results[2] = IN_FROM_REG(data->in _min[nr],nr);833 results[1] = IN_FROM_REG(data->in_max[nr],nr); 834 results[2] = IN_FROM_REG(data->in[nr],nr); 830 835 } 831 836 -
lm-sensors/trunk/src/sensors.c
r19 r20 63 63 int id; 64 64 if (i2c_is_isa_adapter(adapter)) 65 sprintf(name_buffer,"%s-isa-% d",prefix,addr);65 sprintf(name_buffer,"%s-isa-%04x",prefix,addr); 66 66 else { 67 67 if ((id = i2c_adapter_id(adapter)) < 0); 68 68 return -ENOENT; 69 sprintf(name_buffer,"%s-i2c-%d-% d",prefix,id,addr);69 sprintf(name_buffer,"%s-i2c-%d-%02x",prefix,id,addr); 70 70 } 71 71 *name = kmalloc(strlen(name_buffer)+1,GFP_KERNEL); … … 95 95 return res; 96 96 97 for (id = 0; id < SENSORS_ENTRY_MAX; i ++)97 for (id = 0; id < SENSORS_ENTRY_MAX; id++) 98 98 if (! sensors_entries[id]) { 99 99 break; … … 130 130 } 131 131 132 sensors_entries[i ] = new_header;132 sensors_entries[id-256] = new_header; 133 133 134 134 return id; … … 142 142 table = sensors_entries[id]->ctl_table; 143 143 unregister_sysctl_table(sensors_entries[id]); 144 kfree((void *) (table ->procname));144 kfree((void *) (table[4].procname)); 145 145 kfree(table); 146 146 sensors_entries[id] = 0;
