diff options
author | Hans de Goede <j.w.r.degoede@hhs.nl> | 2007-06-18 16:59:34 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-07-19 14:22:15 -0400 |
commit | e432dc811bfb6b3d3ad618d99bd8d58132fec316 (patch) | |
tree | 31b0adef55a1cd1f7cd00457eacdb69711c2ca69 /drivers/hwmon/abituguru.c | |
parent | 2dbbdb35746fdc1a3c3bc5b07f197a90e53b059e (diff) |
hwmon: fix detection of abituguru volt inputs
This patch fixes the detection of volt inputs with a reading of more then 240
units.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/abituguru.c')
-rw-r--r-- | drivers/hwmon/abituguru.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 11a40da13535..0770688f79b6 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -418,7 +418,7 @@ static int __devinit | |||
418 | abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | 418 | abituguru_detect_bank1_sensor_type(struct abituguru_data *data, |
419 | u8 sensor_addr) | 419 | u8 sensor_addr) |
420 | { | 420 | { |
421 | u8 val, buf[3]; | 421 | u8 val, test_flag, buf[3]; |
422 | int i, ret = -ENODEV; /* error is the most common used retval :| */ | 422 | int i, ret = -ENODEV; /* error is the most common used retval :| */ |
423 | 423 | ||
424 | /* If overriden by the user return the user selected type */ | 424 | /* If overriden by the user return the user selected type */ |
@@ -436,7 +436,7 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
436 | return -ENODEV; | 436 | return -ENODEV; |
437 | 437 | ||
438 | /* Test val is sane / usable for sensor type detection. */ | 438 | /* Test val is sane / usable for sensor type detection. */ |
439 | if ((val < 10u) || (val > 240u)) { | 439 | if ((val < 10u) || (val > 250u)) { |
440 | printk(KERN_WARNING ABIT_UGURU_NAME | 440 | printk(KERN_WARNING ABIT_UGURU_NAME |
441 | ": bank1-sensor: %d reading (%d) too close to limits, " | 441 | ": bank1-sensor: %d reading (%d) too close to limits, " |
442 | "unable to determine sensor type, skipping sensor\n", | 442 | "unable to determine sensor type, skipping sensor\n", |
@@ -449,10 +449,20 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
449 | 449 | ||
450 | ABIT_UGURU_DEBUG(2, "testing bank1 sensor %d\n", (int)sensor_addr); | 450 | ABIT_UGURU_DEBUG(2, "testing bank1 sensor %d\n", (int)sensor_addr); |
451 | /* Volt sensor test, enable volt low alarm, set min value ridicously | 451 | /* Volt sensor test, enable volt low alarm, set min value ridicously |
452 | high. If its a volt sensor this should always give us an alarm. */ | 452 | high, or vica versa if the reading is very high. If its a volt |
453 | buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE; | 453 | sensor this should always give us an alarm. */ |
454 | buf[1] = 245; | 454 | if (val <= 240u) { |
455 | buf[2] = 250; | 455 | buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE; |
456 | buf[1] = 245; | ||
457 | buf[2] = 250; | ||
458 | test_flag = ABIT_UGURU_VOLT_LOW_ALARM_FLAG; | ||
459 | } else { | ||
460 | buf[0] = ABIT_UGURU_VOLT_HIGH_ALARM_ENABLE; | ||
461 | buf[1] = 5; | ||
462 | buf[2] = 10; | ||
463 | test_flag = ABIT_UGURU_VOLT_HIGH_ALARM_FLAG; | ||
464 | } | ||
465 | |||
456 | if (abituguru_write(data, ABIT_UGURU_SENSOR_BANK1 + 2, sensor_addr, | 466 | if (abituguru_write(data, ABIT_UGURU_SENSOR_BANK1 + 2, sensor_addr, |
457 | buf, 3) != 3) | 467 | buf, 3) != 3) |
458 | goto abituguru_detect_bank1_sensor_type_exit; | 468 | goto abituguru_detect_bank1_sensor_type_exit; |
@@ -469,13 +479,13 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
469 | sensor_addr, buf, 3, | 479 | sensor_addr, buf, 3, |
470 | ABIT_UGURU_MAX_RETRIES) != 3) | 480 | ABIT_UGURU_MAX_RETRIES) != 3) |
471 | goto abituguru_detect_bank1_sensor_type_exit; | 481 | goto abituguru_detect_bank1_sensor_type_exit; |
472 | if (buf[0] & ABIT_UGURU_VOLT_LOW_ALARM_FLAG) { | 482 | if (buf[0] & test_flag) { |
473 | ABIT_UGURU_DEBUG(2, " found volt sensor\n"); | 483 | ABIT_UGURU_DEBUG(2, " found volt sensor\n"); |
474 | ret = ABIT_UGURU_IN_SENSOR; | 484 | ret = ABIT_UGURU_IN_SENSOR; |
475 | goto abituguru_detect_bank1_sensor_type_exit; | 485 | goto abituguru_detect_bank1_sensor_type_exit; |
476 | } else | 486 | } else |
477 | ABIT_UGURU_DEBUG(2, " alarm raised during volt " | 487 | ABIT_UGURU_DEBUG(2, " alarm raised during volt " |
478 | "sensor test, but volt low flag not set\n"); | 488 | "sensor test, but volt range flag not set\n"); |
479 | } else | 489 | } else |
480 | ABIT_UGURU_DEBUG(2, " alarm not raised during volt sensor " | 490 | ABIT_UGURU_DEBUG(2, " alarm not raised during volt sensor " |
481 | "test\n"); | 491 | "test\n"); |