diff options
-rw-r--r-- | Documentation/hwmon/lm78 | 10 | ||||
-rw-r--r-- | drivers/hwmon/lm78.c | 30 |
2 files changed, 30 insertions, 10 deletions
diff --git a/Documentation/hwmon/lm78 b/Documentation/hwmon/lm78 index fd5dc7a19f0e..dfc318a60fd4 100644 --- a/Documentation/hwmon/lm78 +++ b/Documentation/hwmon/lm78 | |||
@@ -56,16 +56,6 @@ should work with. This is hardcoded by the mainboard and/or processor itself. | |||
56 | It is a value in volts. When it is unconnected, you will often find the | 56 | It is a value in volts. When it is unconnected, you will often find the |
57 | value 3.50 V here. | 57 | value 3.50 V here. |
58 | 58 | ||
59 | In addition to the alarms described above, there are a couple of additional | ||
60 | ones. There is a BTI alarm, which gets triggered when an external chip has | ||
61 | crossed its limits. Usually, this is connected to all LM75 chips; if at | ||
62 | least one crosses its limits, this bit gets set. The CHAS alarm triggers | ||
63 | if your computer case is open. The FIFO alarms should never trigger; it | ||
64 | indicates an internal error. The SMI_IN alarm indicates some other chip | ||
65 | has triggered an SMI interrupt. As we do not use SMI interrupts at all, | ||
66 | this condition usually indicates there is a problem with some other | ||
67 | device. | ||
68 | |||
69 | If an alarm triggers, it will remain triggered until the hardware register | 59 | If an alarm triggers, it will remain triggered until the hardware register |
70 | is read at least once. This means that the cause for the alarm may | 60 | is read at least once. This means that the cause for the alarm may |
71 | already have disappeared! Note that in the current implementation, all | 61 | already have disappeared! Note that in the current implementation, all |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index f5278fda8268..3f7055ee679f 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -438,6 +438,25 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *da, | |||
438 | } | 438 | } |
439 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 439 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
440 | 440 | ||
441 | static ssize_t show_alarm(struct device *dev, struct device_attribute *da, | ||
442 | char *buf) | ||
443 | { | ||
444 | struct lm78_data *data = lm78_update_device(dev); | ||
445 | int nr = to_sensor_dev_attr(da)->index; | ||
446 | return sprintf(buf, "%u\n", (data->alarms >> nr) & 1); | ||
447 | } | ||
448 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
449 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
450 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
451 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
452 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
453 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 9); | ||
454 | static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 10); | ||
455 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
456 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
457 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
458 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
459 | |||
441 | /* This function is called when: | 460 | /* This function is called when: |
442 | * lm78_driver is inserted (when this module is loaded), for each | 461 | * lm78_driver is inserted (when this module is loaded), for each |
443 | available adapter | 462 | available adapter |
@@ -453,36 +472,47 @@ static struct attribute *lm78_attributes[] = { | |||
453 | &sensor_dev_attr_in0_input.dev_attr.attr, | 472 | &sensor_dev_attr_in0_input.dev_attr.attr, |
454 | &sensor_dev_attr_in0_min.dev_attr.attr, | 473 | &sensor_dev_attr_in0_min.dev_attr.attr, |
455 | &sensor_dev_attr_in0_max.dev_attr.attr, | 474 | &sensor_dev_attr_in0_max.dev_attr.attr, |
475 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
456 | &sensor_dev_attr_in1_input.dev_attr.attr, | 476 | &sensor_dev_attr_in1_input.dev_attr.attr, |
457 | &sensor_dev_attr_in1_min.dev_attr.attr, | 477 | &sensor_dev_attr_in1_min.dev_attr.attr, |
458 | &sensor_dev_attr_in1_max.dev_attr.attr, | 478 | &sensor_dev_attr_in1_max.dev_attr.attr, |
479 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
459 | &sensor_dev_attr_in2_input.dev_attr.attr, | 480 | &sensor_dev_attr_in2_input.dev_attr.attr, |
460 | &sensor_dev_attr_in2_min.dev_attr.attr, | 481 | &sensor_dev_attr_in2_min.dev_attr.attr, |
461 | &sensor_dev_attr_in2_max.dev_attr.attr, | 482 | &sensor_dev_attr_in2_max.dev_attr.attr, |
483 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
462 | &sensor_dev_attr_in3_input.dev_attr.attr, | 484 | &sensor_dev_attr_in3_input.dev_attr.attr, |
463 | &sensor_dev_attr_in3_min.dev_attr.attr, | 485 | &sensor_dev_attr_in3_min.dev_attr.attr, |
464 | &sensor_dev_attr_in3_max.dev_attr.attr, | 486 | &sensor_dev_attr_in3_max.dev_attr.attr, |
487 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
465 | &sensor_dev_attr_in4_input.dev_attr.attr, | 488 | &sensor_dev_attr_in4_input.dev_attr.attr, |
466 | &sensor_dev_attr_in4_min.dev_attr.attr, | 489 | &sensor_dev_attr_in4_min.dev_attr.attr, |
467 | &sensor_dev_attr_in4_max.dev_attr.attr, | 490 | &sensor_dev_attr_in4_max.dev_attr.attr, |
491 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
468 | &sensor_dev_attr_in5_input.dev_attr.attr, | 492 | &sensor_dev_attr_in5_input.dev_attr.attr, |
469 | &sensor_dev_attr_in5_min.dev_attr.attr, | 493 | &sensor_dev_attr_in5_min.dev_attr.attr, |
470 | &sensor_dev_attr_in5_max.dev_attr.attr, | 494 | &sensor_dev_attr_in5_max.dev_attr.attr, |
495 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
471 | &sensor_dev_attr_in6_input.dev_attr.attr, | 496 | &sensor_dev_attr_in6_input.dev_attr.attr, |
472 | &sensor_dev_attr_in6_min.dev_attr.attr, | 497 | &sensor_dev_attr_in6_min.dev_attr.attr, |
473 | &sensor_dev_attr_in6_max.dev_attr.attr, | 498 | &sensor_dev_attr_in6_max.dev_attr.attr, |
499 | &sensor_dev_attr_in6_alarm.dev_attr.attr, | ||
474 | &dev_attr_temp1_input.attr, | 500 | &dev_attr_temp1_input.attr, |
475 | &dev_attr_temp1_max.attr, | 501 | &dev_attr_temp1_max.attr, |
476 | &dev_attr_temp1_max_hyst.attr, | 502 | &dev_attr_temp1_max_hyst.attr, |
503 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
477 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 504 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
478 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 505 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
479 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 506 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
507 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
480 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 508 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
481 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 509 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
482 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 510 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
511 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
483 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 512 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
484 | &sensor_dev_attr_fan3_min.dev_attr.attr, | 513 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
485 | &sensor_dev_attr_fan3_div.dev_attr.attr, | 514 | &sensor_dev_attr_fan3_div.dev_attr.attr, |
515 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
486 | &dev_attr_alarms.attr, | 516 | &dev_attr_alarms.attr, |
487 | &dev_attr_cpu0_vid.attr, | 517 | &dev_attr_cpu0_vid.attr, |
488 | 518 | ||