Changeset 5372
- Timestamp:
- 10/22/08 21:24:54 (5 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
kernel/chips/max1619.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r5371 r5372 15 15 Module lm78: Prevent misdetection of Winbond chips 16 16 Module lm90: Don't spam the kernel log (2.6 backport) 17 Module max1619: Use inline functions instead of macros (2.6 backport) 17 18 Program pwmconfig: Fix MINSTOP and MINSTART test functions (#2340) 18 19 Change default for MINTEMP from 0 to 20 degrees C -
lm-sensors/trunk/kernel/chips/max1619.c
r2867 r5372 74 74 75 75 /* 76 * Conversions and various macros 77 */ 78 79 #define TEMP_FROM_REG(val) ((val) & 0x80 ? (val)-0x100 : (val)) 80 #define TEMP_TO_REG(val) ((val) < 0 ? (val)+0x100 : (val)) 76 * Conversions 77 */ 78 79 static int temp_from_reg(int val) 80 { 81 return val & 0x80 ? val-0x100 : val; 82 } 83 84 static int temp_to_reg(int val) 85 { 86 return val < 0 ? val+0x100 : val; 87 } 81 88 82 89 /* … … 398 405 else if (operation == SENSORS_PROC_REAL_READ) { 399 406 max1619_update_client(client); 400 results[0] = TEMP_FROM_REG(data->local_temp);407 results[0] = temp_from_reg(data->local_temp); 401 408 *nrels_mag = 1; 402 409 } … … 413 420 else if (operation == SENSORS_PROC_REAL_READ) { 414 421 max1619_update_client(client); 415 results[0] = TEMP_FROM_REG(data->remote_high);416 results[1] = TEMP_FROM_REG(data->remote_low);417 results[2] = TEMP_FROM_REG(data->remote_temp);422 results[0] = temp_from_reg(data->remote_high); 423 results[1] = temp_from_reg(data->remote_low); 424 results[2] = temp_from_reg(data->remote_temp); 418 425 *nrels_mag = 3; 419 426 } else if (operation == SENSORS_PROC_REAL_WRITE) { 420 427 if (*nrels_mag >= 1) { 421 data->remote_high = TEMP_TO_REG(results[0]);428 data->remote_high = temp_to_reg(results[0]); 422 429 i2c_smbus_write_byte_data(client, 423 430 MAX1619_REG_W_REMOTE_THIGH, data->remote_high); 424 431 } 425 432 if (*nrels_mag >= 2) { 426 data->remote_low = TEMP_TO_REG(results[1]);433 data->remote_low = temp_to_reg(results[1]); 427 434 i2c_smbus_write_byte_data(client, 428 435 MAX1619_REG_W_REMOTE_TLOW, data->remote_low); … … 441 448 else if (operation == SENSORS_PROC_REAL_READ) { 442 449 max1619_update_client(client); 443 results[0] = TEMP_FROM_REG(data->remote_max);444 results[1] = TEMP_FROM_REG(data->remote_hyst);450 results[0] = temp_from_reg(data->remote_max); 451 results[1] = temp_from_reg(data->remote_hyst); 445 452 *nrels_mag = 2; 446 453 } else if (operation == SENSORS_PROC_REAL_WRITE) { 447 454 if (*nrels_mag >= 1) { 448 data->remote_max = TEMP_TO_REG(results[0]);455 data->remote_max = temp_to_reg(results[0]); 449 456 i2c_smbus_write_byte_data(client, 450 457 MAX1619_REG_W_REMOTE_TMAX, data->remote_max); 451 458 } 452 459 if (*nrels_mag >= 2) { 453 data->remote_hyst = TEMP_TO_REG(results[1]);460 data->remote_hyst = temp_to_reg(results[1]); 454 461 i2c_smbus_write_byte_data(client, 455 462 MAX1619_REG_W_REMOTE_THYST, data->remote_hyst);
