Changeset 963
- Timestamp:
- 12/22/00 20:26:21 (12 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 6 modified
-
kernel/busses/i2c-piix4.c (modified) (7 diffs)
-
kernel/chips/lm87.c (modified) (38 diffs)
-
kernel/include/sensors.h (modified) (2 diffs)
-
lib/chips.c (modified) (6 diffs)
-
lib/chips.h (modified) (3 diffs)
-
prog/sensors/chips.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/busses/i2c-piix4.c
r949 r963 34 34 35 35 #include <linux/init.h> 36 37 /* Note: Since the ServerWorks OSB4 SMBus host interface is identical 38 to the Intel PIIX4's, we only mention it during detection. */ 39 40 #ifndef PCI_DEVICE_ID_SERVERWORKS_OSB4 41 #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 42 #endif 43 44 #ifndef PCI_VENDOR_ID_SERVERWORKS 45 #define PCI_VENDOR_ID_SERVERWORKS 0x01166 46 #endif 47 36 48 37 49 /* PIIX4 SMBus address offsets */ … … 130 142 static int __initdata piix4_initialized; 131 143 static unsigned short piix4_smba = 0; 132 144 static kind = 0; 133 145 134 146 /* Detect whether a PIIX4 can be found, and initialize it, where necessary. … … 150 162 } 151 163 152 /* Look for the PIIX4, function 3 */153 /* Note: we keep on searching until we have found 'function 3'*/164 /* Look for the PIIX4, function 3 or Serverworks PSB4 func 0 */ 165 /* Note: we keep on searching until we have found the proper function */ 154 166 PIIX4_dev = NULL; 155 do 167 PIIX4_dev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS, 168 PCI_DEVICE_ID_SERVERWORKS_OSB4, 169 PIIX4_dev); 170 while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 0)); 171 if (PIIX4_dev == NULL) { 156 172 PIIX4_dev = pci_find_device(PCI_VENDOR_ID_INTEL, 157 173 PCI_DEVICE_ID_INTEL_82371AB_3, 158 174 PIIX4_dev); 159 while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3)); 160 if (PIIX4_dev == NULL) { 161 printk 162 ("i2c-piix4.o: Error: Can't detect PIIX4, function 3!\n"); 163 error_return = -ENODEV; 164 goto END; 165 } 175 while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3)); 176 if (PIIX4_dev == NULL) { 177 printk 178 ("i2c-piix4.o: Error: Can't detect PIIX4 function 3 nor OSB4 function 0!\n"); 179 error_return = -ENODEV; 180 goto END; 181 } else { kind=1; /* Intel PIIX4 found */ } 182 } else { kind=2; /* Serverworks OSB4 found */ } 183 166 184 167 185 /* Determine the address of the SMBus areas */ … … 215 233 216 234 /* Everything is happy, let's grab the memory and set things up. */ 217 request_region(piix4_smba, 8, "piix4-smbus");235 request_region(piix4_smba, 8, kind==1?"piix4-smbus":"osb4-smbus"); 218 236 219 237 #ifdef DEBUG … … 451 469 { 452 470 int res; 453 printk("i2c-piix4.o version %s (%s)\n", LM_VERSION, LM_DATE); 454 #ifdef DEBUG 455 /* PE- It might be good to make this a permanent part of the code! */ 471 printk("piix4.o version %s (%s)\n", LM_VERSION, LM_DATE); 456 472 if (piix4_initialized) { 457 473 printk … … 459 475 return -EBUSY; 460 476 } 461 #endif462 477 piix4_initialized = 0; 463 478 if ((res = piix4_setup())) { … … 468 483 } 469 484 piix4_initialized++; 470 sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x",485 sprintf(piix4_adapter.name, kind==1?"SMBus PIIX4 adapter at %04x":"SMBus OSB4 adapter at %04x", 471 486 piix4_smba); 472 487 if ((res = i2c_add_adapter(&piix4_adapter))) { -
lm-sensors/trunk/kernel/chips/lm87.c
r958 r963 1 1 /* 2 lm87.c - Part of lm_sensors, Linux kernel modules for hardware2 LM87.c - Part of lm_sensors, Linux kernel modules for hardware 3 3 monitoring 4 4 Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl> … … 38 38 #include <linux/init.h> 39 39 40 41 /* Chip configuration settings. These should be set to reflect 42 the HARDWARE configuration of your chip. By default (read: when all 43 of these are left zero), this driver assumes that the configuration 44 is the same as National's defaults for the Channel Mode register. 45 46 Set to '1' the appropriate defines, as nessesary: 47 48 - External temp sensors 2 (possible second CPU temp) 49 This will disable the 2.5V and Vccp2 readings. 50 Ironicly, National decided that you can read the 51 temperature of a second CPU or it's core voltage, 52 but not both! Comment out if FAULT is reported. */ 53 54 /* #define LM87_EXT2 1 */ 55 56 /* Aux analog input. When enabled, the Fan 1 reading 57 will be disabled */ 58 59 /* #define LM87_AIN1 1 */ 60 61 /* Aux analog input 2. When enabled, the Fan 2 reading 62 will be disabled */ 63 64 /* #define LM87_AIN2 1 */ 65 66 /* Internal Vcc is 5V instead of 3.3V */ 67 68 /* #define LM87_5V_VCC 1 */ 69 70 /* That's the end of the hardware config defines. I would have made 71 them insmod params, but it would be too much work. ;') */ 72 73 40 74 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \ 41 75 (LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0)) … … 49 83 /* Addresses to scan */ 50 84 static unsigned short normal_i2c[] = { SENSORS_I2C_END }; 51 static unsigned short normal_i2c_range[] = { 0x2c, 0x2 e, SENSORS_I2C_END };85 static unsigned short normal_i2c_range[] = { 0x2c, 0x2f, SENSORS_I2C_END }; 52 86 static unsigned int normal_isa[] = { SENSORS_ISA_END }; 53 87 static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; 54 88 55 89 /* Insmod parameters */ 56 SENSORS_INSMOD_1( lm87);90 SENSORS_INSMOD_1(LM87); 57 91 58 92 /* The following is the calculation for the register offset 59 93 * for the monitored items minimum and maximum locations. 60 94 */ 61 #define LM87_REG_IN_MAX(nr) (0x2b + ( nr) * 2)62 #define LM87_REG_IN_MIN(nr) (0x2c + ( nr) * 2)95 #define LM87_REG_IN_MAX(nr) (0x2b + ((nr) * 2)) 96 #define LM87_REG_IN_MIN(nr) (0x2c + ((nr) * 2)) 63 97 #define LM87_REG_IN(nr) (0x20 + (nr)) 64 65 #define AIN1 066 #define VCCP1 167 #define VCCP2 568 98 69 99 /* Initial limits */ … … 84 114 85 115 /* These are all read-only */ 86 #define LM87_REG_2_5V_EXT_TEMP_2 0x20 /* front ambient for us */87 #define LM87_REG_VCCP1 0x21 /* CPU core voltage */116 #define LM87_REG_2_5V_EXT_TEMP_2 0x20 117 #define LM87_REG_VCCP1 0x21 88 118 #define LM87_REG_3_3V 0x22 89 119 #define LM87_REG_5V 0x23 90 120 #define LM87_REG_12V 0x24 91 121 #define LM87_REG_VCCP2 0x25 92 #define LM87_REG_EXT_TEMP_1 0x26 /* CPU temp for us */122 #define LM87_REG_EXT_TEMP_1 0x26 93 123 #define LM87_REG_INT_TEMP 0x27 /* LM87 temp. */ 94 #define LM87_REG_FAN1_AIN1 0x28 /* this is AIN: 2.5V monitored */124 #define LM87_REG_FAN1_AIN1 0x28 95 125 #define LM87_REG_FAN2_AIN2 0x29 96 126 97 127 /* These are read/write */ 128 #define LM87_REG_AIN1_LOW 0x1A 129 #define LM87_REG_AIN2_LOW 0x1B 98 130 #define LM87_REG_2_5V_EXT_TEMP_2_HIGH 0x2B 99 131 #define LM87_REG_2_5V_EXT_TEMP_2_LOW 0x2C … … 112 144 #define LM87_REG_INT_TEMP_HIGH 0x39 113 145 #define LM87_REG_INT_TEMP_LOW 0x3A 114 #define LM87_REG_FAN1_AIN1_LIMIT 0x3B /* 2.5V high limit */146 #define LM87_REG_FAN1_AIN1_LIMIT 0x3B 115 147 #define LM87_REG_FAN2_AIN2_LIMIT 0x3C 116 148 #define LM87_REG_COMPANY_ID 0x3E … … 136 168 these macros are called: arguments may be evaluated more than once. 137 169 Fixing this is just not worth it. */ 170 138 171 #define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255)) 139 172 #define IN_FROM_REG(val,nr) (val) … … 175 208 #define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ 176 209 205-(val)*5) 177 178 #define LM87_INIT_IN_0 190 179 #define LM87_INIT_IN_1 190 180 #define LM87_INIT_IN_2 190 181 #define LM87_INIT_IN_3 190 182 #define LM87_INIT_IN_4 190 183 #define LM87_INIT_IN_5 190 184 185 #define LM87_INIT_IN_PERCENTAGE 10 186 187 /********* 2.5V monitoring limits **********/ 188 #define LM87_INIT_IN_MIN_0 \ 189 (LM87_INIT_IN_0 - ((LM87_INIT_IN_0 * LM87_INIT_IN_PERCENTAGE) / 100)) 190 #define LM87_INIT_IN_MAX_0 \ 191 (LM87_INIT_IN_0 + ((LM87_INIT_IN_0 * LM87_INIT_IN_PERCENTAGE) / 100)) 192 193 /********* Vccp1 monitoring limits **********/ 194 #define LM87_INIT_IN_MIN_1 \ 195 (LM87_INIT_IN_1 - ((LM87_INIT_IN_1 * LM87_INIT_IN_PERCENTAGE) / 100)) 196 #define LM87_INIT_IN_MAX_1 \ 197 (LM87_INIT_IN_1 + ((LM87_INIT_IN_1 * LM87_INIT_IN_PERCENTAGE) / 100)) 198 199 /********* 3.3V monitoring limits **********/ 200 #define LM87_INIT_IN_MIN_2 \ 201 (LM87_INIT_IN_2 - ((LM87_INIT_IN_2 * LM87_INIT_IN_PERCENTAGE) / 100)) 202 #define LM87_INIT_IN_MAX_2 \ 203 (LM87_INIT_IN_2 + ((LM87_INIT_IN_2 * LM87_INIT_IN_PERCENTAGE) / 100)) 204 205 /********* 5V monitoring limits **********/ 206 #define LM87_INIT_IN_MIN_3 \ 207 (LM87_INIT_IN_3 - ((LM87_INIT_IN_3 * LM87_INIT_IN_PERCENTAGE) / 100)) 208 #define LM87_INIT_IN_MAX_3 \ 209 (LM87_INIT_IN_3 + ((LM87_INIT_IN_3 * LM87_INIT_IN_PERCENTAGE) / 100)) 210 211 /********* 12V monitoring limits **********/ 212 #define LM87_INIT_IN_MIN_4 \ 213 (LM87_INIT_IN_4 - ((LM87_INIT_IN_4 * LM87_INIT_IN_PERCENTAGE) / 100)) 214 #define LM87_INIT_IN_MAX_4 \ 215 (LM87_INIT_IN_4 + ((LM87_INIT_IN_4 * LM87_INIT_IN_PERCENTAGE) / 100)) 216 217 /********* Vccp2 monitoring limits **********/ 218 #define LM87_INIT_IN_MIN_5 \ 219 (LM87_INIT_IN_5 - ((LM87_INIT_IN_5 * LM87_INIT_IN_PERCENTAGE) / 100)) 220 #define LM87_INIT_IN_MAX_5 \ 221 (LM87_INIT_IN_5 + ((LM87_INIT_IN_5 * LM87_INIT_IN_PERCENTAGE) / 100)) 222 210 223 211 #define LM87_INIT_FAN_MIN 3000 224 212 225 213 #define LM87_INIT_EXT_TEMP_MAX 600 226 #define LM87_INIT_EXT_TEMP_MIN 50214 #define LM87_INIT_EXT_TEMP_MIN 100 227 215 #define LM87_INIT_INT_TEMP_MAX 600 228 #define LM87_INIT_INT_TEMP_MIN 50216 #define LM87_INIT_INT_TEMP_MIN 100 229 217 230 218 #ifdef MODULE … … 237 225 dynamically allocated, at the same time when a new LM87 client is 238 226 allocated. */ 239 struct lm87_data {227 struct LM87_data { 240 228 int sysctl_id; 241 229 enum chips type; … … 248 236 u8 in_max[6]; /* Register value */ 249 237 u8 in_min[6]; /* Register value */ 250 u8 fan[2]; /* Register value */ 251 u8 fan_min[2]; /* Register value */ 252 u8 fan_div[2]; /* Register encoding, shifted right */ 253 int front_amb_temp; /* Temp, shifted right */ 254 int cpu_temp; /* Temp, shifted right */ 238 u8 ain1; /* Register value */ 239 u8 ain1_min; /* Register value */ 240 u8 ain1_max; /* Register value */ 241 u8 ain2; /* Register value */ 242 u8 ain2_min; /* Register value */ 243 u8 ain2_max; /* Register value */ 244 u8 fan; /* Register value */ 245 u8 fan_min; /* Register value */ 246 u8 fan_div; /* Register encoding, shifted right */ 247 u8 fan2; /* Register value */ 248 u8 fan2_min; /* Register value */ 249 u8 fan2_div; /* Register encoding, shifted right */ 250 int ext2_temp; /* Temp, shifted right */ 251 int ext_temp; /* Temp, shifted right */ 255 252 int int_temp; /* Temp, shifted right */ 256 u8 cpu_temp_max; /* Register value */257 u8 cpu_temp_min; /* Register value */258 u8 front_amb_temp_max;/* Register value */259 u8 front_amb_temp_min;/* Register value */253 u8 ext_temp_max; /* Register value */ 254 u8 ext_temp_min; /* Register value */ 255 u8 ext2_temp_max; /* Register value */ 256 u8 ext2_temp_min; /* Register value */ 260 257 u8 int_temp_max; /* Register value */ 261 258 u8 int_temp_min; /* Register value */ … … 265 262 }; 266 263 267 268 264 #ifdef MODULE 269 265 static … … 271 267 extern 272 268 #endif 273 int __init sensors_ lm87_init(void);274 static int __init lm87_cleanup(void);275 276 static int lm87_attach_adapter(struct i2c_adapter *adapter);277 static int lm87_detect(struct i2c_adapter *adapter, int address,269 int __init sensors_LM87_init(void); 270 static int __init LM87_cleanup(void); 271 272 static int LM87_attach_adapter(struct i2c_adapter *adapter); 273 static int LM87_detect(struct i2c_adapter *adapter, int address, 278 274 unsigned short flags, int kind); 279 static int lm87_detach_client(struct i2c_client *client);280 static int lm87_command(struct i2c_client *client, unsigned int cmd,275 static int LM87_detach_client(struct i2c_client *client); 276 static int LM87_command(struct i2c_client *client, unsigned int cmd, 281 277 void *arg); 282 static void lm87_inc_use(struct i2c_client *client);283 static void lm87_dec_use(struct i2c_client *client);284 285 static int lm87_read_value(struct i2c_client *client, u8 register);286 static int lm87_write_value(struct i2c_client *client, u8 register,278 static void LM87_inc_use(struct i2c_client *client); 279 static void LM87_dec_use(struct i2c_client *client); 280 281 static int LM87_read_value(struct i2c_client *client, u8 register); 282 static int LM87_write_value(struct i2c_client *client, u8 register, 287 283 u8 value); 288 static void lm87_update_client(struct i2c_client *client);289 static void lm87_init_client(struct i2c_client *client);290 291 292 static void lm87_in(struct i2c_client *client, int operation,284 static void LM87_update_client(struct i2c_client *client); 285 static void LM87_init_client(struct i2c_client *client); 286 287 288 static void LM87_in(struct i2c_client *client, int operation, 293 289 int ctl_name, int *nrels_mag, long *results); 294 static void lm87_fan(struct i2c_client *client, int operation, 290 static void LM87_ain(struct i2c_client *client, int operation, 291 int ctl_name, int *nrels_mag, long *results); 292 static void LM87_fan(struct i2c_client *client, int operation, 295 293 int ctl_name, int *nrels_mag, long *results); 296 static void lm87_temp(struct i2c_client *client, int operation,294 static void LM87_temp(struct i2c_client *client, int operation, 297 295 int ctl_name, int *nrels_mag, long *results); 298 static void lm87_alarms(struct i2c_client *client, int operation,296 static void LM87_alarms(struct i2c_client *client, int operation, 299 297 int ctl_name, int *nrels_mag, long *results); 300 static void lm87_fan_div(struct i2c_client *client, int operation,298 static void LM87_fan_div(struct i2c_client *client, int operation, 301 299 int ctl_name, int *nrels_mag, long *results); 302 static void lm87_analog_out(struct i2c_client *client, int operation,300 static void LM87_analog_out(struct i2c_client *client, int operation, 303 301 int ctl_name, int *nrels_mag, 304 302 long *results); 305 static void lm87_vid(struct i2c_client *client, int operation,303 static void LM87_vid(struct i2c_client *client, int operation, 306 304 int ctl_name, int *nrels_mag, long *results); 307 305 … … 309 307 allocation could also be used; the code needed for this would probably 310 308 take more memory than the datastructure takes now. */ 311 static int lm87_id = 0;312 313 static struct i2c_driver lm87_driver = {309 static int LM87_id = 0; 310 311 static struct i2c_driver LM87_driver = { 314 312 /* name */ "LM87 sensor driver", 315 313 /* id */ I2C_DRIVERID_LM87, 316 314 /* flags */ I2C_DF_NOTIFY, 317 /* attach_adapter */ & lm87_attach_adapter,318 /* detach_client */ & lm87_detach_client,319 /* command */ & lm87_command,320 /* inc_use */ & lm87_inc_use,321 /* dec_use */ & lm87_dec_use315 /* attach_adapter */ &LM87_attach_adapter, 316 /* detach_client */ &LM87_detach_client, 317 /* command */ &LM87_command, 318 /* inc_use */ &LM87_inc_use, 319 /* dec_use */ &LM87_dec_use 322 320 }; 323 321 324 /* Used by lm87_init/cleanup */325 static int __initdata lm87_initialized = 0;322 /* Used by LM87_init/cleanup */ 323 static int __initdata LM87_initialized = 0; 326 324 327 325 /* The /proc/sys entries */ … … 332 330 when a new copy is allocated. */ 333 331 334 static ctl_table lm87_dir_table_template[] = { 332 static ctl_table LM87_dir_table_template[] = { 333 #ifdef LM87_AIN1 334 {LM87_SYSCTL_AIN1, "ain1", NULL, 0, 0644, NULL, &sensors_proc_real, 335 &sensors_sysctl_real, NULL, &LM87_ain}, 336 #endif 337 #ifdef LM87_AIN2 338 {LM87_SYSCTL_AIN2, "ain2", NULL, 0, 0644, NULL, &sensors_proc_real, 339 &sensors_sysctl_real, NULL, &LM87_ain}, 340 #endif 341 #ifndef LM87_EXT2 335 342 {LM87_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &sensors_proc_real, 336 &sensors_sysctl_real, NULL, &lm87_in}, 343 &sensors_sysctl_real, NULL, &LM87_in}, 344 {LM87_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &sensors_proc_real, 345 &sensors_sysctl_real, NULL, &LM87_in}, 346 #endif 337 347 {LM87_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &sensors_proc_real, 338 &sensors_sysctl_real, NULL, & lm87_in},348 &sensors_sysctl_real, NULL, &LM87_in}, 339 349 {LM87_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &sensors_proc_real, 340 &sensors_sysctl_real, NULL, & lm87_in},350 &sensors_sysctl_real, NULL, &LM87_in}, 341 351 {LM87_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &sensors_proc_real, 342 &sensors_sysctl_real, NULL, & lm87_in},352 &sensors_sysctl_real, NULL, &LM87_in}, 343 353 {LM87_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &sensors_proc_real, 344 &sensors_sysctl_real, NULL, &lm87_in}, 345 {LM87_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &sensors_proc_real, 346 &sensors_sysctl_real, NULL, &lm87_in}, 347 {LM87_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &sensors_proc_real, 348 &sensors_sysctl_real, NULL, &lm87_fan}, 354 &sensors_sysctl_real, NULL, &LM87_in}, 355 #ifndef LM87_AIN1 356 {LM87_SYSCTL_FAN1, "fan", NULL, 0, 0644, NULL, &sensors_proc_real, 357 &sensors_sysctl_real, NULL, &LM87_fan}, 358 {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &sensors_proc_real, 359 &sensors_sysctl_real, NULL, &LM87_fan_div}, 360 #define LM87_FANDIV_FLAG 361 #endif 362 #ifndef LM87_AIN2 349 363 {LM87_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &sensors_proc_real, 350 &sensors_sysctl_real, NULL, &lm87_fan}, 364 &sensors_sysctl_real, NULL, &LM87_fan}, 365 #ifndef LM87_FANDIV_FLAG 366 {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &sensors_proc_real, 367 &sensors_sysctl_real, NULL, &LM87_fan_div}, 368 #endif /* LM87_FANDIV_FLAG */ 369 #endif /* LM87_AIN2 */ 370 #ifdef LM87_EXT2 371 {LM87_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &sensors_proc_real, 372 &sensors_sysctl_real, NULL, &LM87_temp}, 373 #endif 374 {LM87_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &sensors_proc_real, 375 &sensors_sysctl_real, NULL, &LM87_temp}, 351 376 {LM87_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &sensors_proc_real, 352 &sensors_sysctl_real, NULL, &lm87_temp}, 353 {LM87_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &sensors_proc_real, 354 &sensors_sysctl_real, NULL, &lm87_temp}, 355 {LM87_SYSCTL_TEMP3, "temp3", NULL, 356 0, 0644, NULL, &sensors_proc_real, 357 &sensors_sysctl_real, NULL, &lm87_temp}, 358 {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 359 0, 0644, NULL, &sensors_proc_real, 360 &sensors_sysctl_real, NULL, &lm87_fan_div}, 377 &sensors_sysctl_real, NULL, &LM87_temp}, 361 378 {LM87_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &sensors_proc_real, 362 &sensors_sysctl_real, NULL, &lm87_alarms}, 363 {LM87_SYSCTL_ANALOG_OUT, "analog_out", NULL, 364 0, 0644, NULL, &sensors_proc_real, 365 &sensors_sysctl_real, NULL, &lm87_analog_out}, 379 &sensors_sysctl_real, NULL, &LM87_alarms}, 380 {LM87_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &sensors_proc_real, 381 &sensors_sysctl_real, NULL, &LM87_analog_out}, 366 382 {LM87_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &sensors_proc_real, 367 &sensors_sysctl_real, NULL, & lm87_vid},383 &sensors_sysctl_real, NULL, &LM87_vid}, 368 384 {0} 369 385 }; 370 386 371 int lm87_attach_adapter(struct i2c_adapter *adapter)387 int LM87_attach_adapter(struct i2c_adapter *adapter) 372 388 { 373 389 int error; … … 382 398 lm87_client_data.force = addr_data.forces->force; 383 399 384 error = i2c_probe(adapter, &lm87_client_data, lm87_detect);385 sensors_detect(adapter, &addr_data, lm87_detect);400 error = i2c_probe(adapter, &lm87_client_data, LM87_detect); 401 sensors_detect(adapter, &addr_data, LM87_detect); 386 402 387 403 return error; 388 404 } 389 405 390 static int lm87_detect(struct i2c_adapter *adapter, int address,406 static int LM87_detect(struct i2c_adapter *adapter, int address, 391 407 unsigned short flags, int kind) 392 408 { 393 409 int i; 394 410 struct i2c_client *new_client; 395 struct lm87_data *data;411 struct LM87_data *data; 396 412 int err = 0; 397 413 const char *type_name = ""; … … 406 422 407 423 if (!(new_client = kmalloc(sizeof(struct i2c_client) + 408 sizeof(struct lm87_data),424 sizeof(struct LM87_data), 409 425 GFP_KERNEL))) { 410 426 err = -ENOMEM; … … 412 428 } 413 429 414 data = (struct lm87_data *) (new_client + 1);430 data = (struct LM87_data *) (new_client + 1); 415 431 new_client->addr = address; 416 432 new_client->data = data; 417 433 new_client->adapter = adapter; 418 new_client->driver = & lm87_driver;434 new_client->driver = &LM87_driver; 419 435 new_client->flags = 0; 420 436 … … 422 438 423 439 if (kind < 0) { 424 if ((( lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80)440 if (((LM87_read_value(new_client, LM87_REG_CONFIG) & 0x80) 425 441 != 0x00) || 426 ( lm87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02))442 (LM87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02)) 427 443 goto ERROR1; 428 444 } 429 445 430 /* Fill in the remaining client fields and put i nto the global list */446 /* Fill in the remaining client fields and put it into the global list */ 431 447 type_name = "lm87"; 432 448 client_name = "LM87 chip"; … … 434 450 data->type = kind; 435 451 436 new_client->id = lm87_id++;452 new_client->id = LM87_id++; 437 453 data->valid = 0; 438 454 init_MUTEX(&data->update_lock); … … 445 461 if ((i = sensors_register_entry(new_client, 446 462 type_name, 447 lm87_dir_table_template,463 LM87_dir_table_template, 448 464 THIS_MODULE)) < 0) { 449 465 err = i; … … 453 469 454 470 /* Initialize the LM87 chip */ 455 lm87_init_client(new_client);471 LM87_init_client(new_client); 456 472 return 0; 457 473 … … 468 484 } 469 485 470 int lm87_detach_client(struct i2c_client *client)486 int LM87_detach_client(struct i2c_client *client) 471 487 { 472 488 int err; 473 489 474 sensors_deregister_entry(((struct lm87_data *) (client->data))->490 sensors_deregister_entry(((struct LM87_data *) (client->data))-> 475 491 sysctl_id); 476 492 477 493 if ((err = i2c_detach_client(client))) { 478 494 printk 479 ("lm87.o: Client deregistration failed, client not detached.\n");495 ("LM87.o: Client deregistration failed, client not detached.\n"); 480 496 return err; 481 497 } … … 488 504 489 505 /* No commands defined yet */ 490 int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)506 int LM87_command(struct i2c_client *client, unsigned int cmd, void *arg) 491 507 { 492 508 return 0; 493 509 } 494 510 495 void lm87_inc_use(struct i2c_client *client)511 void LM87_inc_use(struct i2c_client *client) 496 512 { 497 513 #ifdef MODULE … … 500 516 } 501 517 502 void lm87_dec_use(struct i2c_client *client)518 void LM87_dec_use(struct i2c_client *client) 503 519 { 504 520 #ifdef MODULE … … 507 523 } 508 524 509 int lm87_read_value(struct i2c_client *client, u8 reg)525 int LM87_read_value(struct i2c_client *client, u8 reg) 510 526 { 511 527 return 0xFF & i2c_smbus_read_byte_data(client, reg); 512 528 } 513 529 514 int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)530 int LM87_write_value(struct i2c_client *client, u8 reg, u8 value) 515 531 { 516 532 return i2c_smbus_write_byte_data(client, reg, value); … … 518 534 519 535 /* Called when we have found a new LM87. It should set limits, etc. */ 520 void lm87_init_client(struct i2c_client *client) 521 { 536 void LM87_init_client(struct i2c_client *client) 537 { 538 long vid; 539 522 540 /* Reset all except Watchdog values and last conversion values 523 541 This sets fan-divs to 2, among others. This makes most other 524 542 initializations unnecessary */ 525 lm87_write_value(client, LM87_REG_CONFIG, 0x80);543 LM87_write_value(client, LM87_REG_CONFIG, 0x80); 526 544 527 545 /* Setup Channel Mode register for configuration of monitoring 546 * Default is 00000000b 528 547 * bit 0 - Configures Fan 1/AIN 1 input (1 = AIN) 529 * bit 2 - Configures 2.5V/D2 input (1 = 2nd Therm.) 548 * bit 1 - Configures Fan 2/AIN 2 input (1 = AIN) 549 * bit 2 - Configures 2.5V&Vccp2/D2 input (1 = 2nd Therm.) 550 * bit 3 - Configures Vcc for 5V/3.3V reading (0 = 3.3V) 551 * bit 4 - Configures IRQ0 Enable if = 1 552 * bit 5 - Configures IRQ1 Enable if = 1 553 * bit 6 - Configures IRQ2 Enable if = 1 554 * bit 7 - Configures VID/IRQ input as interrupts if = 1 530 555 */ 531 lm87_write_value(client, LM87_REG_CHANNEL_MODE, 0x05); 532 533 534 lm87_write_value(client, LM87_REG_IN_MIN(1), 535 IN_TO_REG(LM87_INIT_IN_MIN_1, 1)); 536 lm87_write_value(client, LM87_REG_IN_MAX(1), 537 IN_TO_REG(LM87_INIT_IN_MAX_1, 1)); 538 lm87_write_value(client, LM87_REG_IN_MIN(2), 539 IN_TO_REG(LM87_INIT_IN_MIN_2, 2)); 540 lm87_write_value(client, LM87_REG_IN_MAX(2), 541 IN_TO_REG(LM87_INIT_IN_MAX_2, 2)); 542 lm87_write_value(client, LM87_REG_IN_MIN(3), 543 IN_TO_REG(LM87_INIT_IN_MIN_3, 3)); 544 lm87_write_value(client, LM87_REG_IN_MAX(3), 545 IN_TO_REG(LM87_INIT_IN_MAX_3, 3)); 546 lm87_write_value(client, LM87_REG_IN_MIN(4), 547 IN_TO_REG(LM87_INIT_IN_MIN_4, 4)); 548 lm87_write_value(client, LM87_REG_IN_MAX(4), 549 IN_TO_REG(LM87_INIT_IN_MAX_4, 4)); 550 lm87_write_value(client, LM87_REG_IN_MIN(5), 551 IN_TO_REG(LM87_INIT_IN_MIN_5, 5)); 552 lm87_write_value(client, LM87_REG_IN_MAX(5), 553 IN_TO_REG(LM87_INIT_IN_MAX_5, 5)); 554 555 lm87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 556 557 /* I know, not clean, but it works. :'p */ 558 LM87_write_value(client, LM87_REG_CHANNEL_MODE, 559 #ifdef LM87_AIN1 560 0x01 561 #else 562 0 563 #endif 564 | 565 #ifdef LM87_AIN2 566 0x02 567 #else 568 0 569 #endif 570 | 571 #ifdef LM87_EXT2 572 0x04 573 #else 574 0 575 #endif 576 | 577 #ifdef LM87_5V_VCC 578 0x08 579 #else 580 0 581 #endif 582 ); 583 584 /* Set IN (voltage) initial limits to sane values +/- 5% */ 585 LM87_write_value(client, LM87_REG_IN_MIN(1),182); 586 LM87_write_value(client, LM87_REG_IN_MAX(1),202); 587 LM87_write_value(client, LM87_REG_IN_MIN(2),182); 588 LM87_write_value(client, LM87_REG_IN_MAX(2),202); 589 LM87_write_value(client, LM87_REG_IN_MIN(3),182); 590 LM87_write_value(client, LM87_REG_IN_MAX(3),202); 591 LM87_write_value(client, LM87_REG_IN_MIN(4),182); 592 LM87_write_value(client, LM87_REG_IN_MAX(4),202); 593 594 /* Set CPU core voltage limits relative to vid readings */ 595 vid = (LM87_read_value(client, LM87_REG_VID_FAN_DIV) & 0x0f) 596 | ((LM87_read_value(client, LM87_REG_VID4) & 0x01) 597 << 4 ); 598 if ((vid == 0x1f) || (vid == 0x0f)) { 599 vid = 0; 600 } else if (vid > 0x0f) { 601 vid = (1275 - ((vid - 0x10) * 25))/10; 602 } else { 603 vid = 200 - (vid * 5); 604 } 605 LM87_write_value(client, LM87_REG_IN_MIN(0), 606 (u8)(0x0FF & (((1920/270)*(vid*95))/1000) )); 607 LM87_write_value(client, LM87_REG_IN_MAX(0), 608 (u8)(0x0FF & (((1920/270)*(vid*105))/1000) )); 609 LM87_write_value(client, LM87_REG_IN_MIN(5), 610 (u8)(0x0FF & (((1920/270)*(vid*95))/1000) )); 611 LM87_write_value(client, LM87_REG_IN_MAX(5), 612 (u8)(0x0FF & (((1920/270)*(vid*105))/1000) )); 613 614 /* Set Temp initial limits to sane values */ 615 LM87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 556 616 TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MAX)); 557 lm87_write_value(client, LM87_REG_EXT_TEMP_1_LOW,617 LM87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 558 618 TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MIN)); 559 lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 619 #ifdef LM87_EXT2 620 LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 560 621 TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MAX)); 561 lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW,622 LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 562 623 TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MIN)); 563 lm87_write_value(client, LM87_REG_INT_TEMP_HIGH, 624 #endif 625 LM87_write_value(client, LM87_REG_INT_TEMP_HIGH, 564 626 TEMP_LIMIT_TO_REG(LM87_INIT_INT_TEMP_MAX)); 565 lm87_write_value(client, LM87_REG_INT_TEMP_LOW,627 LM87_write_value(client, LM87_REG_INT_TEMP_LOW, 566 628 TEMP_LIMIT_TO_REG(LM87_INIT_INT_TEMP_MIN)); 567 629 568 lm87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 569 IN_TO_REG(LM87_INIT_IN_MAX_0, 0)); 570 571 lm87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 630 #ifndef LM87_AIN1 631 LM87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 572 632 FAN_TO_REG(LM87_INIT_FAN_MIN, 2)); 633 #endif 634 #ifndef LM87_AIN2 635 LM87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 636 FAN_TO_REG(LM87_INIT_FAN_MIN, 2)); 637 #endif 573 638 574 639 /* Start monitoring */ 575 lm87_write_value(client, LM87_REG_CONFIG, 0x01);576 } 577 578 void lm87_update_client(struct i2c_client *client)579 { 580 struct lm87_data *data = client->data;581 u8i;640 LM87_write_value(client, LM87_REG_CONFIG, 0x01); 641 } 642 643 void LM87_update_client(struct i2c_client *client) 644 { 645 struct LM87_data *data = client->data; 646 int i; 582 647 583 648 down(&data->update_lock); … … 586 651 (jiffies < data->last_updated) || 587 652 !data->valid) { 588 589 #ifdef DEBUG590 printk("Starting LM87 update\n");591 #endif592 653 for (i = 0; i <= 5; i++) { 593 /* Since we are using AIN 1 as our 2.5V monitoring, need to 594 * accomodate with a hardcode 595 * register address and we only get 596 * to look at one threshold. 597 */ 598 if (i == 0) { 599 data->in[i] = 600 lm87_read_value(client, LM87_REG_FAN1_AIN1); 601 data->in_min[i] = 0; 602 data->in_max[i] = 603 lm87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); 604 } 605 else { 606 data->in[i] = 607 lm87_read_value(client, LM87_REG_IN(i)); 608 data->in_min[i] = 609 lm87_read_value(client, 610 LM87_REG_IN_MIN(i)); 611 data->in_max[i] = 612 lm87_read_value(client, 613 LM87_REG_IN_MAX(i)); 614 } 615 } 616 617 data->fan[0] = 618 lm87_read_value(client, LM87_REG_FAN1_AIN1); 619 data->fan_min[0] = 620 lm87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); 621 data->fan[1] = 622 lm87_read_value(client, LM87_REG_FAN2_AIN2); 623 data->fan_min[1] = 624 lm87_read_value(client, LM87_REG_FAN2_AIN2_LIMIT); 625 626 data->front_amb_temp = 627 lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2); 628 data->cpu_temp = 629 lm87_read_value(client, LM87_REG_EXT_TEMP_1); 654 data->in[i] = 655 LM87_read_value(client,LM87_REG_IN(i)); 656 data->in_min[i] = 657 LM87_read_value(client,LM87_REG_IN_MIN(i)); 658 data->in_max[i] = 659 LM87_read_value(client,LM87_REG_IN_MAX(i)); 660 } 661 data->ain1 = 662 LM87_read_value(client,LM87_REG_FAN1_AIN1); 663 data->ain1_min = 664 LM87_read_value(client,LM87_REG_AIN1_LOW); 665 data->ain1_max = 666 LM87_read_value(client,LM87_REG_FAN1_AIN1_LIMIT); 667 data->ain2 = 668 LM87_read_value(client,LM87_REG_FAN1_AIN1); 669 data->ain2_min = 670 LM87_read_value(client,LM87_REG_AIN2_LOW); 671 data->ain2_max = 672 LM87_read_value(client,LM87_REG_FAN2_AIN2_LIMIT); 673 674 data->fan = 675 LM87_read_value(client, LM87_REG_FAN1_AIN1); 676 data->fan_min = 677 LM87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); 678 data->fan2 = 679 LM87_read_value(client, LM87_REG_FAN2_AIN2); 680 data->fan2_min = 681 LM87_read_value(client, LM87_REG_FAN2_AIN2_LIMIT); 682 683 data->ext2_temp = 684 LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2); 685 data->ext_temp = 686 LM87_read_value(client, LM87_REG_EXT_TEMP_1); 630 687 data->int_temp = 631 lm87_read_value(client, LM87_REG_INT_TEMP);632 633 data-> front_amb_temp_max =634 lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH);635 data-> front_amb_temp_min =636 lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW);637 638 data-> cpu_temp_max =639 lm87_read_value(client, LM87_REG_EXT_TEMP_1_HIGH);640 data-> cpu_temp_min =641 lm87_read_value(client, LM87_REG_EXT_TEMP_1_LOW);688 LM87_read_value(client, LM87_REG_INT_TEMP); 689 690 data->ext2_temp_max = 691 LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH); 692 data->ext2_temp_min = 693 LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW); 694 695 data->ext_temp_max = 696 LM87_read_value(client, LM87_REG_EXT_TEMP_1_HIGH); 697 data->ext_temp_min = 698 LM87_read_value(client, LM87_REG_EXT_TEMP_1_LOW); 642 699 643 700 data->int_temp_max = 644 lm87_read_value(client, LM87_REG_INT_TEMP_HIGH);701 LM87_read_value(client, LM87_REG_INT_TEMP_HIGH); 645 702 data->int_temp_min = 646 lm87_read_value(client, LM87_REG_INT_TEMP_LOW);647 648 i = lm87_read_value(client, LM87_REG_VID_FAN_DIV);649 data->fan_div [0]= (i >> 4) & 0x03;650 data->fan _div[1]= (i >> 6) & 0x03;703 LM87_read_value(client, LM87_REG_INT_TEMP_LOW); 704 705 i = LM87_read_value(client, LM87_REG_VID_FAN_DIV); 706 data->fan_div = (i >> 4) & 0x03; 707 data->fan2_div = (i >> 6) & 0x03; 651 708 data->vid = i & 0x0f; 652 709 data->vid |= 653 ( lm87_read_value(client, LM87_REG_VID4) & 0x01)710 (LM87_read_value(client, LM87_REG_VID4) & 0x01) 654 711 << 4; 655 656 712 data->alarms = 657 lm87_read_value(client, 658 LM87_REG_INT1_STAT) + 659 (lm87_read_value(client, LM87_REG_INT2_STAT) << 713 LM87_read_value(client, LM87_REG_INT1_STAT) + 714 (LM87_read_value(client, LM87_REG_INT2_STAT) << 660 715 8); 661 716 data->analog_out = 662 lm87_read_value(client, LM87_REG_ANALOG_OUT);717 LM87_read_value(client, LM87_REG_ANALOG_OUT); 663 718 data->last_updated = jiffies; 664 719 data->valid = 1; 665 720 } 666 667 721 up(&data->update_lock); 668 722 } … … 682 736 good practice, but as long as you put less than about 5 values in results, 683 737 you can assume it is large enough. */ 684 void lm87_in(struct i2c_client *client, int operation, int ctl_name,738 void LM87_in(struct i2c_client *client, int operation, int ctl_name, 685 739 int *nrels_mag, long *results) 686 740 { 687 688 /************************************************************ 689 * These values represent 2.5V, Vccp1, 3.3V, 5V, 12V & Vccp2 690 * The 2.5V is 50% sampled for our application, so check 691 * against 1.25V value. 692 ************************************************************/ 693 int scales[6] = { 260, 200, 344, 520, 1250, 260 };694 695 struct lm87_data *data = client->data;741 long scales[6] = { 270, 100, 742 #ifdef LM87_5V_VCC 743 500, 744 #else 745 330, 746 #endif 747 500, 1200, 270 }; 748 749 struct LM87_data *data = client->data; 696 750 int nr = ctl_name - LM87_SYSCTL_IN0; 697 751 … … 699 753 *nrels_mag = 2; 700 754 else if (operation == SENSORS_PROC_REAL_READ) { 701 lm87_update_client(client); 702 755 LM87_update_client(client); 703 756 results[0] = 704 IN_FROM_REG(data->in_min[nr], nr) * scales[nr]/ 192;757 ((long)data->in_min[nr] * scales[nr]) / 192; 705 758 results[1] = 706 IN_FROM_REG(data->in_max[nr], nr) * scales[nr] / 192; 707 708 if (nr == AIN1) { 709 results[2] = ((data->in[nr] * 10) * 98) / 1000; 710 } 711 else if (nr == VCCP1 || nr == VCCP2) { 712 results[2] = ((data->in[nr] * 10) * 141) / 1000; 713 } 714 else { 715 results[2] = 716 IN_FROM_REG(data->in[nr], nr) * scales[nr] / 192; 717 } 718 759 ((long)data->in_max[nr] * scales[nr]) / 192; 760 results[2] = 761 ((long)data->in[nr] * scales[nr]) / 192; 719 762 *nrels_mag = 3; 720 763 } else if (operation == SENSORS_PROC_REAL_WRITE) { 721 764 if (*nrels_mag >= 1) { 722 765 data->in_min[nr] = 723 IN_TO_REG((results[0] * 192) / scales[nr], nr);724 lm87_write_value(client, LM87_REG_IN_MIN(nr),766 (results[0] * 192) / scales[nr]; 767 LM87_write_value(client, LM87_REG_IN_MIN(nr), 725 768 data->in_min[nr]); 726 769 } 727 770 if (*nrels_mag >= 2) { 728 771 data->in_max[nr] = 729 IN_TO_REG((results[1] * 192) / scales[nr], nr);730 lm87_write_value(client, LM87_REG_IN_MAX(nr),772 (results[1] * 192) / scales[nr]; 773 LM87_write_value(client, LM87_REG_IN_MAX(nr), 731 774 data->in_max[nr]); 732 775 } … … 734 777 } 735 778 736 void lm87_fan(struct i2c_client *client, int operation, int ctl_name, 737 int *nrels_mag, long *results) 738 { 739 struct lm87_data *data = client->data; 740 int nr = ctl_name - LM87_SYSCTL_FAN1 + 1; 779 void LM87_ain(struct i2c_client *client, int operation, int ctl_name, 780 int *nrels_mag, long *results) 781 { 782 struct LM87_data *data = client->data; 741 783 742 784 if (operation == SENSORS_PROC_REAL_INFO) 743 785 *nrels_mag = 0; 744 786 else if (operation == SENSORS_PROC_REAL_READ) { 745 lm87_update_client(client); 746 results[0] = FAN_FROM_REG(data->fan_min[nr-1], 747 DIV_FROM_REG(data->fan_div[nr-1])); 748 results[1] = FAN_FROM_REG(data->fan[nr-1], 749 DIV_FROM_REG(data->fan_div[nr-1])); 787 LM87_update_client(client); 788 if (ctl_name == LM87_SYSCTL_AIN1) { 789 results[0] = data->ain1_min; 790 results[1] = data->ain1_max; 791 results[2] = data->ain1; 792 } else { 793 results[0] = data->ain2_min; 794 results[1] = data->ain2_max; 795 results[2] = data->ain2; 796 } 797 *nrels_mag = 3; 798 } else if (operation == SENSORS_PROC_REAL_WRITE) { 799 if (*nrels_mag >= 1) { 800 if (ctl_name == LM87_SYSCTL_AIN1) { 801 data->ain1_min = results[0]; 802 LM87_write_value(client, LM87_REG_AIN1_LOW, 803 data->ain1_min); 804 } else { 805 data->ain2_min = results[0]; 806 LM87_write_value(client, LM87_REG_AIN2_LOW, 807 data->ain2_min); 808 } 809 } 810 if (*nrels_mag >= 2) { 811 if (ctl_name == LM87_SYSCTL_AIN1) { 812 data->ain1_max = results[1]; 813 LM87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 814 data->ain1_max); 815 } else { 816 data->ain2_max = results[1]; 817 LM87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 818 data->ain2_max); 819 } 820 } 821 } 822 } 823 824 825 void LM87_fan(struct i2c_client *client, int operation, int ctl_name, 826 int *nrels_mag, long *results) 827 { 828 struct LM87_data *data = client->data; 829 int nr = ctl_name - LM87_SYSCTL_FAN1; 830 831 if (operation == SENSORS_PROC_REAL_INFO) 832 *nrels_mag = 0; 833 else if (operation == SENSORS_PROC_REAL_READ) { 834 LM87_update_client(client); 835 if (ctl_name == LM87_SYSCTL_FAN1) { 836 results[0] = FAN_FROM_REG(data->fan_min, 837 DIV_FROM_REG(data->fan_div)); 838 results[1] = FAN_FROM_REG(data->fan, 839 DIV_FROM_REG(data->fan_div)); 840 } else { 841 results[0] = FAN_FROM_REG(data->fan2_min, 842 DIV_FROM_REG(data->fan2_div)); 843 results[1] = FAN_FROM_REG(data->fan2, 844 DIV_FROM_REG(data->fan2_div)); 845 } 750 846 *nrels_mag = 2; 751 847 } else if (operation == SENSORS_PROC_REAL_WRITE) { 752 848 if (*nrels_mag >= 0) { 753 data->fan_min[nr-1] = FAN_TO_REG(results[0], 849 if (ctl_name == LM87_SYSCTL_FAN1) { 850 data->fan_min = FAN_TO_REG(results[0], 754 851 DIV_FROM_REG 755 (data->fan_div[nr-1])); 756 lm87_write_value(client, (nr == 2) ? 757 LM87_REG_FAN2_AIN2_LIMIT : LM87_REG_FAN1_AIN1_LIMIT, 758 data->fan_min[nr-1]); 759 } 760 } 761 } 762 763 764 void lm87_temp(struct i2c_client *client, int operation, int ctl_name, 852 (data->fan_div)); 853 LM87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 854 data->fan_min); 855 } else { 856 data->fan2_min = FAN_TO_REG(results[0], 857 DIV_FROM_REG 858 (data->fan2_div)); 859 LM87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 860 data->fan2_min); 861 } 862 } 863 } 864 } 865 866 867 void LM87_temp(struct i2c_client *client, int operation, int ctl_name, 765 868 int *nrels_mag, long *results) 766 869 { 767 struct lm87_data *data = client->data;870 struct LM87_data *data = client->data; 768 871 769 872 if (operation == SENSORS_PROC_REAL_INFO) … … 771 874 else if (operation == SENSORS_PROC_REAL_READ) 772 875 { 773 lm87_update_client(client);876 LM87_update_client(client); 774 877 775 878 /* find out which temp. is being requested */ 776 879 if (ctl_name == LM87_SYSCTL_TEMP3) 777 880 { 778 results[0] = TEMP_LIMIT_FROM_REG(data-> front_amb_temp_max);779 results[1] = TEMP_LIMIT_FROM_REG(data-> front_amb_temp_min);780 results[2] = TEMP_FROM_REG(data-> front_amb_temp);881 results[0] = TEMP_LIMIT_FROM_REG(data->ext2_temp_max); 882 results[1] = TEMP_LIMIT_FROM_REG(data->ext2_temp_min); 883 results[2] = TEMP_FROM_REG(data->ext2_temp); 781 884 } 782 885 else if(ctl_name == LM87_SYSCTL_TEMP2) 783 886 { 784 results[0] = TEMP_LIMIT_FROM_REG(data-> cpu_temp_max);785 results[1] = TEMP_LIMIT_FROM_REG(data-> cpu_temp_min);786 results[2] = TEMP_FROM_REG(data-> cpu_temp);887 results[0] = TEMP_LIMIT_FROM_REG(data->ext_temp_max); 888 results[1] = TEMP_LIMIT_FROM_REG(data->ext_temp_min); 889 results[2] = TEMP_FROM_REG(data->ext_temp); 787 890 } 788 891 else if(ctl_name == LM87_SYSCTL_TEMP1) … … 796 899 if (*nrels_mag >= 1) { 797 900 if (ctl_name == LM87_SYSCTL_TEMP3) { 798 data->front_amb_temp_max = 799 TEMP_LIMIT_TO_REG(results[0]); 800 lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 801 data->front_amb_temp_max); 901 data->ext2_temp_max = TEMP_LIMIT_TO_REG(results[0]); 902 LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 903 data->ext2_temp_max); 802 904 } 803 905 if (ctl_name == LM87_SYSCTL_TEMP2) { 804 data-> cpu_temp_max = TEMP_LIMIT_TO_REG(results[0]);805 lm87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH,906 data->ext_temp_max = TEMP_LIMIT_TO_REG(results[0]); 907 LM87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 806 908 data->int_temp_max); 807 909 } 808 910 if (ctl_name == LM87_SYSCTL_TEMP1) { 809 911 data->int_temp_max = TEMP_LIMIT_TO_REG(results[0]); 810 lm87_write_value(client, LM87_REG_INT_TEMP_HIGH,912 LM87_write_value(client, LM87_REG_INT_TEMP_HIGH, 811 913 data->int_temp_max); 812 914 } … … 814 916 if (*nrels_mag >= 2) { 815 917 if (ctl_name == LM87_SYSCTL_TEMP3) { 816 data->front_amb_temp_min = 817 TEMP_LIMIT_TO_REG(results[0]); 818 lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 819 data->front_amb_temp_min); 918 data->ext2_temp_min = TEMP_LIMIT_TO_REG(results[1]); 919 LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 920 data->ext2_temp_min); 820 921 } 821 922 if (ctl_name == LM87_SYSCTL_TEMP2) { 822 data-> cpu_temp_min = TEMP_LIMIT_TO_REG(results[0]);823 lm87_write_value(client, LM87_REG_EXT_TEMP_1_LOW,923 data->ext_temp_min = TEMP_LIMIT_TO_REG(results[1]); 924 LM87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 824 925 data->int_temp_min); 825 926 } 826 927 if (ctl_name == LM87_SYSCTL_TEMP1) { 827 928 data->int_temp_min = TEMP_LIMIT_TO_REG(results[1]); 828 lm87_write_value(client, LM87_REG_INT_TEMP_LOW,929 LM87_write_value(client, LM87_REG_INT_TEMP_LOW, 829 930 data->int_temp_min); 830 931 } … … 833 934 } 834 935 835 void lm87_alarms(struct i2c_client *client, int operation, int ctl_name,936 void LM87_alarms(struct i2c_client *client, int operation, int ctl_name, 836 937 int *nrels_mag, long *results) 837 938 { 838 struct lm87_data *data = client->data;939 struct LM87_data *data = client->data; 839 940 if (operation == SENSORS_PROC_REAL_INFO) 840 941 *nrels_mag = 0; 841 942 else if (operation == SENSORS_PROC_REAL_READ) { 842 lm87_update_client(client);943 LM87_update_client(client); 843 944 results[0] = ALARMS_FROM_REG(data->alarms); 844 945 *nrels_mag = 1; … … 846 947 } 847 948 848 void lm87_fan_div(struct i2c_client *client, int operation,949 void LM87_fan_div(struct i2c_client *client, int operation, 849 950 int ctl_name, int *nrels_mag, long *results) 850 951 { 851 struct lm87_data *data = client->data; 952 /* This gets a little hairy depending on the hardware config */ 953 954 struct LM87_data *data = client->data; 852 955 int old; 853 956 … … 855 958 *nrels_mag = 0; 856 959 else if (operation == SENSORS_PROC_REAL_READ) { 857 lm87_update_client(client); 858 results[0] = DIV_FROM_REG(data->fan_div[0]); 859 results[1] = DIV_FROM_REG(data->fan_div[1]); 960 LM87_update_client(client); 961 #ifndef LM87_AIN1 962 results[0] = DIV_FROM_REG(data->fan_div); 963 # ifndef LM87_AIN2 964 results[1] = DIV_FROM_REG(data->fan2_div); 860 965 *nrels_mag = 2; 966 # else 967 *nrels_mag = 1; 968 # endif 969 #else /* Must be referring to fan 2 */ 970 results[0] = DIV_FROM_REG(data->fan2_div); 971 *nrels_mag = 1; 972 #endif 861 973 } else if (operation == SENSORS_PROC_REAL_WRITE) { 862 old = lm87_read_value(client, LM87_REG_VID_FAN_DIV); 974 old = LM87_read_value(client, LM87_REG_VID_FAN_DIV); 975 /* Note: it's OK to change fan2 div even if fan2 isn't enabled */ 976 #ifndef LM87_AIN1 863 977 if (*nrels_mag >= 2) { 864 data->fan _div[1]= DIV_TO_REG(results[1]);865 old = (old & 0x3f) | (data->fan _div[1]<< 6);978 data->fan2_div = DIV_TO_REG(results[1]); 979 old = (old & 0x3f) | (data->fan2_div << 6); 866 980 } 867 981 if (*nrels_mag >= 1) { 868 data->fan_div[0] = DIV_TO_REG(results[0]); 869 old = (old & 0xcf) | (data->fan_div[0] << 4); 870 lm87_write_value(client, LM87_REG_VID_FAN_DIV, old); 871 } 872 } 873 } 874 875 void lm87_analog_out(struct i2c_client *client, int operation, 982 data->fan_div = DIV_TO_REG(results[0]); 983 old = (old & 0xcf) | (data->fan_div << 4); 984 LM87_write_value(client, LM87_REG_VID_FAN_DIV, old); 985 } 986 #else /* Must be referring to fan 2 */ 987 if (*nrels_mag >= 1) { 988 data->fan2_div = DIV_TO_REG(results[0]); 989 old = (old & 0xcf) | (data->fan2_div << 6); 990 LM87_write_value(client, LM87_REG_VID_FAN_DIV, old); 991 } 992 #endif 993 } 994 } 995 996 void LM87_analog_out(struct i2c_client *client, int operation, 876 997 int ctl_name, int *nrels_mag, long *results) 877 998 { 878 struct lm87_data *data = client->data;999 struct LM87_data *data = client->data; 879 1000 880 1001 if (operation == SENSORS_PROC_REAL_INFO) 881 1002 *nrels_mag = 0; 882 1003 else if (operation == SENSORS_PROC_REAL_READ) { 883 lm87_update_client(client);1004 LM87_update_client(client); 884 1005 results[0] = data->analog_out; 885 1006 *nrels_mag = 1; … … 887 1008 if (*nrels_mag >= 1) { 888 1009 data->analog_out = results[0]; 889 lm87_write_value(client, LM87_REG_ANALOG_OUT,1010 LM87_write_value(client, LM87_REG_ANALOG_OUT, 890 1011 data->analog_out); 891 1012 } … … 893 1014 } 894 1015 895 void lm87_vid(struct i2c_client *client, int operation, int ctl_name,1016 void LM87_vid(struct i2c_client *client, int operation, int ctl_name, 896 1017 int *nrels_mag, long *results) 897 1018 { 898 struct lm87_data *data = client->data; 899 1019 struct LM87_data *data = client->data; 900 1020 901 1021 if (operation == SENSORS_PROC_REAL_INFO) 902 1022 *nrels_mag = 2; 903 1023 else if (operation == SENSORS_PROC_REAL_READ) { 904 lm87_update_client(client);1024 LM87_update_client(client); 905 1025 results[0] = VID_FROM_REG(data->vid); 906 *nrels_mag = 1;907 } 908 } 909 910 int __init sensors_ lm87_init(void)1026 *nrels_mag = 1; 1027 } 1028 } 1029 1030 int __init sensors_LM87_init(void) 911 1031 { 912 1032 int res; 913 1033 914 printk(" lm87.o version %s (%s)\n", LM_VERSION, LM_DATE);915 lm87_initialized = 0;916 917 if ((res = i2c_add_driver(& lm87_driver))) {1034 printk("LM87.o version %s (%s)\n", LM_VERSION, LM_DATE); 1035 LM87_initialized = 0; 1036 1037 if ((res = i2c_add_driver(&LM87_driver))) { 918 1038 printk 919 ("lm87.o: Driver registration failed, module not inserted.\n");920 lm87_cleanup();1039 ("LM87.o: Driver registration failed, module not inserted.\n"); 1040 LM87_cleanup(); 921 1041 return res; 922 1042 } 923 lm87_initialized++;1043 LM87_initialized++; 924 1044 return 0; 925 1045 } 926 1046 927 int __init lm87_cleanup(void)1047 int __init LM87_cleanup(void) 928 1048 { 929 1049 int res; 930 1050 931 if ( lm87_initialized >= 1) {932 if ((res = i2c_del_driver(& lm87_driver))) {1051 if (LM87_initialized >= 1) { 1052 if ((res = i2c_del_driver(&LM87_driver))) { 933 1053 printk 934 ("lm87.o: Driver deregistration failed, module not removed.\n");1054 ("LM87.o: Driver deregistration failed, module not removed.\n"); 935 1055 return res; 936 1056 } 937 lm87_initialized--;1057 LM87_initialized--; 938 1058 } 939 1059 return 0; … … 945 1065 946 1066 MODULE_AUTHOR 947 ("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, 1067 ("Frodo Looijaard <frodol@dds.nl>, 1068 Philip Edelbrock <phil@netroedge.com>, 1069 Mark Studebaker <mdsxyz123@yahoo.com>, 948 1070 and Stephen Rousset <stephen.rousset@rocketlogix.com>"); 949 1071 950 MODULE_DESCRIPTION(" lm87 driver");1072 MODULE_DESCRIPTION("LM87 driver"); 951 1073 952 1074 int init_module(void) 953 1075 { 954 return sensors_ lm87_init();1076 return sensors_LM87_init(); 955 1077 } 956 1078 957 1079 int cleanup_module(void) 958 1080 { 959 return lm87_cleanup();1081 return LM87_cleanup(); 960 1082 } 961 1083 -
lm-sensors/trunk/kernel/include/sensors.h
r953 r963 757 757 #define LM87_SYSCTL_IN4 1004 758 758 #define LM87_SYSCTL_IN5 1005 759 #define LM87_SYSCTL_FAN1 1101 760 #define LM87_SYSCTL_FAN2 1102 761 #define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */ 762 #define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */ 763 #define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */ 759 #define LM87_SYSCTL_AIN1 1006 760 #define LM87_SYSCTL_AIN2 1007 761 #define LM87_SYSCTL_FAN1 1102 762 #define LM87_SYSCTL_FAN2 1103 763 #define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */ 764 #define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */ 765 #define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */ 764 766 #define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ 765 767 #define LM87_SYSCTL_ALARMS 2001 /* bitvector */ … … 767 769 #define LM87_SYSCTL_VID 2003 768 770 769 #define LM87_ALARM_IN0 0x0001 770 #define LM87_ALARM_IN1 0x0002 771 #define LM87_ALARM_IN2 0x0004 772 #define LM87_ALARM_IN3 0x0008 773 #define LM87_ALARM_IN4 0x0100 774 #define LM87_ALARM_IN5 0x0200 775 #define LM87_ALARM_TEMP1 0x0010 776 #define LM87_ALARM_TEMP2 0x4020 /* include D1 fault */ 777 #define LM87_ALARM_TEMP3 0x8001 /* include D2 fault */ 778 #define LM87_ALARM_FAN1 0x0040 779 #define LM87_ALARM_FAN2 0x0080 780 #define LM87_ALARM_CHAS 0x1000 771 #define LM87_ALARM_IN0 0x0001 772 #define LM87_ALARM_IN1 0x0002 773 #define LM87_ALARM_IN2 0x0004 774 #define LM87_ALARM_IN3 0x0008 775 #define LM87_ALARM_TEMP1 0x0010 776 #define LM87_ALARM_TEMP2 0x0020 777 #define LM87_ALARM_TEMP3 0x0020 /* same?? */ 778 #define LM87_ALARM_FAN1 0x0040 779 #define LM87_ALARM_FAN2 0x0080 780 #define LM87_ALARM_IN4 0x0100 781 #define LM87_ALARM_IN5 0x0200 782 #define LM87_ALARM_RESERVED1 0x0400 783 #define LM87_ALARM_RESERVED2 0x0800 784 #define LM87_ALARM_CHAS 0x1000 785 #define LM87_ALARM_THERM_SIG 0x2000 786 #define LM87_ALARM_TEMP2_FAULT 0x4000 787 #define LM87_ALARM_TEMP3_FAULT 0x08000 781 788 782 789 #define PCF8574_SYSCTL_STAT 1000 -
lm-sensors/trunk/lib/chips.c
r953 r963 1778 1778 { 1779 1779 { SENSORS_LM87_IN0, "2.5V", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1780 SENSORS_MODE_R, LM87_SYSCTL_IN0, VALUE( 2), 2 },1780 SENSORS_MODE_R, LM87_SYSCTL_IN0, VALUE(3), 2 }, 1781 1781 { SENSORS_LM87_IN1, "Vccp1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1782 1782 SENSORS_MODE_R, LM87_SYSCTL_IN1, VALUE(3), 2 }, … … 1789 1789 { SENSORS_LM87_IN5, "Vccp2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1790 1790 SENSORS_MODE_R, LM87_SYSCTL_IN5, VALUE(3), 2 }, 1791 { SENSORS_LM87_AIN1, "AIN1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1792 SENSORS_MODE_R, LM87_SYSCTL_AIN1, VALUE(3), 0 }, 1793 { SENSORS_LM87_AIN2, "AIN2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1794 SENSORS_MODE_R, LM87_SYSCTL_AIN2, VALUE(3), 0 }, 1791 1795 { SENSORS_LM87_IN0_MIN, "AmbTemp_min", SENSORS_LM87_IN0, 1792 1796 SENSORS_LM87_IN0, SENSORS_MODE_RW, … … 1807 1811 SENSORS_LM87_IN5, SENSORS_MODE_RW, 1808 1812 LM87_SYSCTL_IN5, VALUE(1), 2 }, 1813 { SENSORS_LM87_AIN1_MIN, "AIN1_min", SENSORS_LM87_AIN1, 1814 SENSORS_LM87_AIN1, SENSORS_MODE_RW, 1815 LM87_SYSCTL_AIN1, VALUE(1), 0 }, 1816 { SENSORS_LM87_AIN2_MIN, "AIN2_min", SENSORS_LM87_AIN2, 1817 SENSORS_LM87_AIN2, SENSORS_MODE_RW, 1818 LM87_SYSCTL_AIN2, VALUE(1), 0 }, 1809 1819 { SENSORS_LM87_IN0_MAX, "AmbTemp_max", SENSORS_LM87_IN0, 1810 1820 SENSORS_LM87_IN0, SENSORS_MODE_RW, … … 1825 1835 SENSORS_LM87_IN5, SENSORS_MODE_RW, 1826 1836 LM87_SYSCTL_IN5, VALUE(2), 2 }, 1837 { SENSORS_LM87_AIN1_MAX, "AIN1_max", SENSORS_LM87_AIN1, 1838 SENSORS_LM87_AIN1, SENSORS_MODE_RW, 1839 LM87_SYSCTL_AIN1, VALUE(2), 0 }, 1840 { SENSORS_LM87_AIN2_MAX, "AIN2_max", SENSORS_LM87_AIN2, 1841 SENSORS_LM87_AIN2, SENSORS_MODE_RW, 1842 LM87_SYSCTL_AIN2, VALUE(2), 0 }, 1827 1843 { SENSORS_LM87_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1828 1844 SENSORS_MODE_R, LM87_SYSCTL_FAN1, VALUE(2), 0 }, … … 1835 1851 SENSORS_LM87_FAN2, SENSORS_MODE_RW, 1836 1852 LM87_SYSCTL_FAN2, VALUE(1), 0 }, 1837 { SENSORS_LM87_TEMP3, " temp3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,1853 { SENSORS_LM87_TEMP3, "CPU2 Temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1838 1854 SENSORS_MODE_R, LM87_SYSCTL_TEMP3, VALUE(3), 1 }, 1839 1855 { SENSORS_LM87_TEMP2, "CPU Temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, … … 1861 1877 { SENSORS_LM87_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 1862 1878 SENSORS_MODE_R, LM87_SYSCTL_VID, VALUE(1), 2 }, 1879 /* Ho hum, this will be wrong if fan1 is disabled, but fan2 isn't.. fix?? */ 1863 1880 { SENSORS_LM87_FAN1_DIV, "fan_div", SENSORS_LM87_FAN1, 1864 1881 SENSORS_NO_MAPPING, SENSORS_MODE_RW, -
lm-sensors/trunk/lib/chips.h
r953 r963 829 829 #define SENSORS_LM87_IN4 5 /* R */ 830 830 #define SENSORS_LM87_IN5 6 /* R */ 831 #define SENSORS_LM87_AIN1 7 /* R */ 832 #define SENSORS_LM87_AIN2 8 /* R */ 831 833 #define SENSORS_LM87_IN0_MIN 11 /* RW */ 832 834 #define SENSORS_LM87_IN1_MIN 12 /* RW */ … … 835 837 #define SENSORS_LM87_IN4_MIN 15 /* RW */ 836 838 #define SENSORS_LM87_IN5_MIN 16 /* RW */ 839 #define SENSORS_LM87_AIN1_MIN 17 /* RW */ 840 #define SENSORS_LM87_AIN2_MIN 18 /* RW */ 837 841 #define SENSORS_LM87_IN0_MAX 21 /* RW */ 838 842 #define SENSORS_LM87_IN1_MAX 22 /* RW */ … … 841 845 #define SENSORS_LM87_IN4_MAX 25 /* RW */ 842 846 #define SENSORS_LM87_IN5_MAX 26 /* RW */ 847 #define SENSORS_LM87_AIN1_MAX 27 /* RW */ 848 #define SENSORS_LM87_AIN2_MAX 28 /* RW */ 843 849 #define SENSORS_LM87_FAN1 31 /* R */ 844 850 #define SENSORS_LM87_FAN2 32 /* R */ -
lm-sensors/trunk/prog/sensors/chips.c
r959 r963 1363 1363 printf("ERROR: Can't get IN5 data!\n"); 1364 1364 free_the_label(&label); 1365 if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN1,&label,&valid) && 1366 !sensors_get_feature(*name,SENSORS_LM87_AIN1,&cur) && 1367 !sensors_get_feature(*name,SENSORS_LM87_AIN1_MIN,&min) && 1368 !sensors_get_feature(*name,SENSORS_LM87_AIN1_MAX,&max)) { 1369 if (valid) { 1370 print_label(label,10); 1371 printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", 1372 cur,min,max,alarms&LM87_ALARM_FAN1?"ALARM":""); 1373 } 1374 } else 1375 printf("ERROR: Can't get AIN1 data!\n"); 1376 free_the_label(&label); 1377 if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN2,&label,&valid) && 1378 !sensors_get_feature(*name,SENSORS_LM87_AIN2,&cur) && 1379 !sensors_get_feature(*name,SENSORS_LM87_AIN2_MIN,&min) && 1380 !sensors_get_feature(*name,SENSORS_LM87_AIN2_MAX,&max)) { 1381 if (valid) { 1382 print_label(label,10); 1383 printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", 1384 cur,min,max,alarms&LM87_ALARM_FAN2?"ALARM":""); 1385 } 1386 } else 1387 printf("ERROR: Can't get AIN2 data!\n"); 1388 free_the_label(&label); 1365 1389 1366 1390 if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN1,&label,&valid) && … … 1396 1420 print_label(label,10); 1397 1421 print_temp_info( cur, max, min, MINMAX ); 1398 printf(" %s\n", alarms&LM87_ALARM_TEMP1?"ALARM":""); 1422 printf(" %s%s\n", alarms&LM87_ALARM_TEMP1?"ALARM":"", 1423 alarms&LM87_ALARM_THERM_SIG?" THERM#":""); 1399 1424 } 1400 1425 } else … … 1409 1434 print_label(label,10); 1410 1435 print_temp_info( cur, max, min, MINMAX ); 1411 printf(" %s\n", alarms&LM87_ALARM_TEMP2?"ALARM":""); 1436 printf(" %s%s\n", alarms&LM87_ALARM_TEMP2?"ALARM":"", 1437 alarms&LM87_ALARM_TEMP2_FAULT?" FAULT":""); 1412 1438 } 1413 1439 } else … … 1422 1448 print_label(label,10); 1423 1449 print_temp_info( cur, max, min, MINMAX ); 1424 printf(" %s\n", alarms&LM87_ALARM_TEMP3?"ALARM":""); 1450 printf(" %s%s\n", alarms&LM87_ALARM_TEMP3?"ALARM":"", 1451 alarms&LM87_ALARM_TEMP3_FAULT?" FAULT":""); 1425 1452 } 1426 1453 } else
