aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm78.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-09-04 17:25:33 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:31 -0400
commit428a7039c5717695935b946af9413e59f68928a4 (patch)
treed59028911c185b076401929178f11d7f7e0c5c34 /drivers/hwmon/lm78.c
parent69f2f96d9c189070ed5e40ec186b755ef697288d (diff)
hwmon: (lm78) Add individual alarm files
Add individual alarm files to the lm78 driver, these are needed by the next version of libsensors. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm78.c')
-rw-r--r--drivers/hwmon/lm78.c30
1 files changed, 30 insertions, 0 deletions
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}
439static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 439static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
440 440
441static 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}
448static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
449static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
450static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2);
451static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
452static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
453static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 9);
454static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 10);
455static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
456static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
457static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 11);
458static 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