Changeset 2427
- Timestamp:
- 04/09/04 20:41:30 (5 years ago)
- Files:
-
- lm-sensors/trunk/doc/chips/SUMMARY (modified) (1 diff)
- lm-sensors/trunk/doc/chips/pc87360 (modified) (2 diffs)
- lm-sensors/trunk/kernel/chips/pc87360.c (modified) (11 diffs)
- lm-sensors/trunk/lib/chips.c (modified) (2 diffs)
- lm-sensors/trunk/prog/detect/sensors-detect (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/doc/chips/SUMMARY
r2403 r2427 150 150 pc87363 - - 2 2 pwm no yes (LPC) 151 151 pc87364 - - 3 3 pwm no yes (LPC) 152 pc87365 - - 3 3 pwm no yes (LPC) 153 pc87366 - - 3 3 pwm no yes (LPC) 152 154 153 155 sis5595 lm-sensors/trunk/doc/chips/pc87360
r2420 r2427 41 41 the readings more range or accuracy. Not all RPM values can accurately be 42 42 represented, so some rounding is done. With a divider of 2, the lowest 43 representable value is around 2600 RPM.43 representable value is around 1900 RPM. See doc/fan-divisors for details. 44 44 45 45 A different alarm is also triggered if the fan speed is too low to be … … 59 59 ----------- 60 60 61 This driver is read-only at the moment, and only supports fans. Since I 62 don't own a supported chip for testing, and the datasheet suggests that 63 you shouldn't change values once the monitoring has started (this is 64 normally done by the BIOS at boot time), I decided to play it safe. 61 This driver only supports fans at the moment. 62 63 The datasheets suggests that some values (fan mins, fan divisors) 64 shouldn't be changed once the monitoring has started, but we ignore that 65 recommendation. We'll reconsider if it actually causes trouble. lm-sensors/trunk/kernel/chips/pc87360.c
r2420 r2427 103 103 #define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0: \ 104 104 960000/((val)*(div))) 105 #define FAN_TO_REG(val,div) ((val)<=0?255: \ 106 960000/((val)*(div))) 105 107 #define FAN_DIV_FROM_REG(val) (1 << ((val >> 5) & 0x03)) 106 #define PWM_FROM_REG(val) (val)108 #define FAN_DIV_TO_REG(val) ((val)==8?0x60:(val)==4?0x40:(val)==1?0x00:0x20) 107 109 #define ALARM_FROM_REG(val) ((val) & 0x07) 108 110 … … 130 132 131 133 static int pc87360_read_value(struct i2c_client *client, u8 register); 132 #if 0133 134 static int pc87360_write_value(struct i2c_client *client, u8 register, 134 135 u8 value); 135 #endif136 136 static void pc87360_update_client(struct i2c_client *client); 137 137 static void pc87360_init_client(struct i2c_client *client); … … 178 178 179 179 static ctl_table pc87360_dir_table_template[] = { /* PC87363 too */ 180 {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0 444, NULL,180 {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, 181 181 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, 182 {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0 444, NULL,182 {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, 183 183 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, 184 {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0 444, NULL,184 {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, 185 185 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_div}, 186 186 {PC87360_SYSCTL_FAN1_STATUS, "fan1_status", NULL, 0, 0444, NULL, … … 188 188 {PC87360_SYSCTL_FAN2_STATUS, "fan2_status", NULL, 0, 0444, NULL, 189 189 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, 190 {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0 444, NULL,190 {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, 191 191 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, 192 {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0 444, NULL,192 {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, 193 193 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, 194 194 {0} … … 196 196 197 197 static ctl_table pc87364_dir_table_template[] = { /* PC87365 and PC87366 too */ 198 {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0 444, NULL,198 {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, 199 199 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, 200 {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0 444, NULL,200 {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, 201 201 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, 202 {PC87360_SYSCTL_FAN3, "fan3", NULL, 0, 0 444, NULL,202 {PC87360_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, 203 203 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, 204 {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0 444, NULL,204 {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, 205 205 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_div}, 206 206 {PC87360_SYSCTL_FAN1_STATUS, "fan1_status", NULL, 0, 0444, NULL, … … 210 210 {PC87360_SYSCTL_FAN3_STATUS, "fan3_status", NULL, 0, 0444, NULL, 211 211 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, 212 {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0 444, NULL,212 {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, 213 213 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, 214 {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0 444, NULL,214 {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, 215 215 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, 216 {PC87360_SYSCTL_PWM3, "pwm3", NULL, 0, 0 444, NULL,216 {PC87360_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, 217 217 &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, 218 218 {0} … … 357 357 } 358 358 359 #if 0360 359 static int pc87360_write_value(struct i2c_client *client, u8 reg, u8 value) 361 360 { … … 363 362 return 0; 364 363 } 365 #endif366 364 367 365 static void pc87360_init_client(struct i2c_client *client) … … 410 408 *nrels_mag = 2; 411 409 } 412 } 413 410 /* We ignore National's recommendation */ 411 else if (operation == SENSORS_PROC_REAL_WRITE) { 412 if (*nrels_mag >= 1) { 413 data->fan_min[nr] = FAN_TO_REG(results[0], 414 FAN_DIV_FROM_REG(data->fan_status[nr])); 415 pc87360_write_value(client, PC87360_REG_FAN_MIN(nr), 416 data->fan_min[nr]); 417 } 418 } 419 } 414 420 415 421 void pc87360_fan_div(struct i2c_client *client, int operation, … … 428 434 *nrels_mag = data->fannr; 429 435 } 436 /* We ignore National's recommendation */ 437 else if (operation == SENSORS_PROC_REAL_WRITE) { 438 for (i = 0; i < data->fannr && i < *nrels_mag; i++) { 439 /* Preserve fan min */ 440 int fan_min = FAN_FROM_REG(data->fan_min[i], 441 FAN_DIV_FROM_REG(data->fan_status[i])); 442 data->fan_status[i] = (data->fan_status[i] & 0x9F) 443 | FAN_DIV_TO_REG(results[i]); 444 pc87360_write_value(client, PC87360_REG_FAN_STATUS(i), 445 data->fan_status[i]); 446 data->fan_min[i] = FAN_TO_REG(fan_min, 447 FAN_DIV_FROM_REG(data->fan_status[i])); 448 pc87360_write_value(client, PC87360_REG_FAN_MIN(i), 449 data->fan_min[i]); 450 } 451 } 430 452 } 431 453 … … 440 462 else if (operation == SENSORS_PROC_REAL_READ) { 441 463 pc87360_update_client(client); 442 results[0] = PWM_FROM_REG(data->pwm[nr]);464 results[0] = data->pwm[nr]; 443 465 *nrels_mag = 1; 466 } 467 else if (operation == SENSORS_PROC_REAL_WRITE) { 468 if (*nrels_mag >= 1) 469 { 470 data->pwm[nr] = SENSORS_LIMIT(results[0], 0, 255); 471 pc87360_write_value(client, PC87360_REG_PWM(nr), 472 data->pwm[nr]); 473 } 444 474 } 445 475 } lm-sensors/trunk/lib/chips.c
r2422 r2427 4259 4259 PC87360_SYSCTL_FAN2, VALUE(2), 0 }, 4260 4260 { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, 4261 SENSORS_PC87360_FAN1, R , PC87360_SYSCTL_FAN1,4261 SENSORS_PC87360_FAN1, RW, PC87360_SYSCTL_FAN1, 4262 4262 VALUE(1), 0 }, 4263 4263 { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, 4264 SENSORS_PC87360_FAN2, R , PC87360_SYSCTL_FAN2,4264 SENSORS_PC87360_FAN2, RW, PC87360_SYSCTL_FAN2, 4265 4265 VALUE(1), 0 }, 4266 4266 { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, 4267 NOMAP, R , PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 },4267 NOMAP, RW, PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 }, 4268 4268 { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, 4269 NOMAP, R , PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 },4269 NOMAP, RW, PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 }, 4270 4270 { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, 4271 4271 NOMAP, R, PC87360_SYSCTL_FAN1_STATUS, VALUE(1), 0 }, … … 4284 4284 PC87360_SYSCTL_FAN3, VALUE(2), 0 }, 4285 4285 { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, 4286 SENSORS_PC87360_FAN1, R , PC87360_SYSCTL_FAN1,4286 SENSORS_PC87360_FAN1, RW, PC87360_SYSCTL_FAN1, 4287 4287 VALUE(1), 0 }, 4288 4288 { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, 4289 SENSORS_PC87360_FAN2, R , PC87360_SYSCTL_FAN2,4289 SENSORS_PC87360_FAN2, RW, PC87360_SYSCTL_FAN2, 4290 4290 VALUE(1), 0 }, 4291 4291 { SENSORS_PC87360_FAN3_MIN, "fan3_min", SENSORS_PC87360_FAN3, 4292 SENSORS_PC87360_FAN3, R , PC87360_SYSCTL_FAN3,4292 SENSORS_PC87360_FAN3, RW, PC87360_SYSCTL_FAN3, 4293 4293 VALUE(1), 0 }, 4294 4294 { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, 4295 NOMAP, R , PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 },4295 NOMAP, RW, PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 }, 4296 4296 { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, 4297 NOMAP, R , PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 },4297 NOMAP, RW, PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 }, 4298 4298 { SENSORS_PC87360_FAN3_DIV, "fan3_div", SENSORS_PC87360_FAN3, 4299 NOMAP, R , PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 },4299 NOMAP, RW, PC87360_SYSCTL_FAN_DIV, VALUE(3), 0 }, 4300 4300 { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, 4301 4301 NOMAP, R, PC87360_SYSCTL_FAN1_STATUS, VALUE(1), 0 }, lm-sensors/trunk/prog/detect/sensors-detect
r2419 r2427 1374 1374 { 1375 1375 name => "Nat. Semi. PC87365 Super IO Sensors", 1376 driver => " to-be-written",1376 driver => "pc87360", 1377 1377 devid => 0xe5, 1378 1378 logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e … … 1380 1380 { 1381 1381 name => "Nat. Semi. PC87366 Super IO Sensors", 1382 driver => " to-be-written",1382 driver => "pc87360", 1383 1383 devid => 0xe9, 1384 1384 logdev => 0x09, # fans; voltages at 0x0d; temps at 0x0e
