diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-06 09:46:02 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-17 09:27:18 -0500 |
commit | 2d1374cad5a97d7c08a2c0e4282fb674b588b421 (patch) | |
tree | 7eb6d165d29c9d14abb011602ea14e6e9a95beb3 /drivers | |
parent | 13ff05e9f87101407445f79c7402aca087ddbd02 (diff) |
hwmon: (vt8231) Add individual alarm files
The new libsensors needs these individual alarm files.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
CC: Roger Lucas <vt8231@hiddenengine.co.uk>
Acked-by: Juerg Haefliger <juergh at gmail.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/vt8231.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index f87661775fe0..ed4b89857673 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -541,6 +541,28 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | |||
541 | } | 541 | } |
542 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 542 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
543 | 543 | ||
544 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
545 | char *buf) | ||
546 | { | ||
547 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
548 | struct vt8231_data *data = vt8231_update_device(dev); | ||
549 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
550 | } | ||
551 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
552 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
553 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
554 | static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
555 | static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
556 | static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
557 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
558 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
559 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
560 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
561 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
562 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
563 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
564 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); | ||
565 | |||
544 | static ssize_t show_name(struct device *dev, struct device_attribute | 566 | static ssize_t show_name(struct device *dev, struct device_attribute |
545 | *devattr, char *buf) | 567 | *devattr, char *buf) |
546 | { | 568 | { |
@@ -549,36 +571,42 @@ static ssize_t show_name(struct device *dev, struct device_attribute | |||
549 | } | 571 | } |
550 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 572 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
551 | 573 | ||
552 | static struct attribute *vt8231_attributes_temps[6][4] = { | 574 | static struct attribute *vt8231_attributes_temps[6][5] = { |
553 | { | 575 | { |
554 | &dev_attr_temp1_input.attr, | 576 | &dev_attr_temp1_input.attr, |
555 | &dev_attr_temp1_max_hyst.attr, | 577 | &dev_attr_temp1_max_hyst.attr, |
556 | &dev_attr_temp1_max.attr, | 578 | &dev_attr_temp1_max.attr, |
579 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
557 | NULL | 580 | NULL |
558 | }, { | 581 | }, { |
559 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 582 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
560 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, | 583 | &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, |
561 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 584 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
585 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
562 | NULL | 586 | NULL |
563 | }, { | 587 | }, { |
564 | &sensor_dev_attr_temp3_input.dev_attr.attr, | 588 | &sensor_dev_attr_temp3_input.dev_attr.attr, |
565 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, | 589 | &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, |
566 | &sensor_dev_attr_temp3_max.dev_attr.attr, | 590 | &sensor_dev_attr_temp3_max.dev_attr.attr, |
591 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
567 | NULL | 592 | NULL |
568 | }, { | 593 | }, { |
569 | &sensor_dev_attr_temp4_input.dev_attr.attr, | 594 | &sensor_dev_attr_temp4_input.dev_attr.attr, |
570 | &sensor_dev_attr_temp4_max_hyst.dev_attr.attr, | 595 | &sensor_dev_attr_temp4_max_hyst.dev_attr.attr, |
571 | &sensor_dev_attr_temp4_max.dev_attr.attr, | 596 | &sensor_dev_attr_temp4_max.dev_attr.attr, |
597 | &sensor_dev_attr_temp4_alarm.dev_attr.attr, | ||
572 | NULL | 598 | NULL |
573 | }, { | 599 | }, { |
574 | &sensor_dev_attr_temp5_input.dev_attr.attr, | 600 | &sensor_dev_attr_temp5_input.dev_attr.attr, |
575 | &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, | 601 | &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, |
576 | &sensor_dev_attr_temp5_max.dev_attr.attr, | 602 | &sensor_dev_attr_temp5_max.dev_attr.attr, |
603 | &sensor_dev_attr_temp5_alarm.dev_attr.attr, | ||
577 | NULL | 604 | NULL |
578 | }, { | 605 | }, { |
579 | &sensor_dev_attr_temp6_input.dev_attr.attr, | 606 | &sensor_dev_attr_temp6_input.dev_attr.attr, |
580 | &sensor_dev_attr_temp6_max_hyst.dev_attr.attr, | 607 | &sensor_dev_attr_temp6_max_hyst.dev_attr.attr, |
581 | &sensor_dev_attr_temp6_max.dev_attr.attr, | 608 | &sensor_dev_attr_temp6_max.dev_attr.attr, |
609 | &sensor_dev_attr_temp6_alarm.dev_attr.attr, | ||
582 | NULL | 610 | NULL |
583 | } | 611 | } |
584 | }; | 612 | }; |
@@ -592,36 +620,42 @@ static const struct attribute_group vt8231_group_temps[6] = { | |||
592 | { .attrs = vt8231_attributes_temps[5] }, | 620 | { .attrs = vt8231_attributes_temps[5] }, |
593 | }; | 621 | }; |
594 | 622 | ||
595 | static struct attribute *vt8231_attributes_volts[6][4] = { | 623 | static struct attribute *vt8231_attributes_volts[6][5] = { |
596 | { | 624 | { |
597 | &sensor_dev_attr_in0_input.dev_attr.attr, | 625 | &sensor_dev_attr_in0_input.dev_attr.attr, |
598 | &sensor_dev_attr_in0_min.dev_attr.attr, | 626 | &sensor_dev_attr_in0_min.dev_attr.attr, |
599 | &sensor_dev_attr_in0_max.dev_attr.attr, | 627 | &sensor_dev_attr_in0_max.dev_attr.attr, |
628 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
600 | NULL | 629 | NULL |
601 | }, { | 630 | }, { |
602 | &sensor_dev_attr_in1_input.dev_attr.attr, | 631 | &sensor_dev_attr_in1_input.dev_attr.attr, |
603 | &sensor_dev_attr_in1_min.dev_attr.attr, | 632 | &sensor_dev_attr_in1_min.dev_attr.attr, |
604 | &sensor_dev_attr_in1_max.dev_attr.attr, | 633 | &sensor_dev_attr_in1_max.dev_attr.attr, |
634 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
605 | NULL | 635 | NULL |
606 | }, { | 636 | }, { |
607 | &sensor_dev_attr_in2_input.dev_attr.attr, | 637 | &sensor_dev_attr_in2_input.dev_attr.attr, |
608 | &sensor_dev_attr_in2_min.dev_attr.attr, | 638 | &sensor_dev_attr_in2_min.dev_attr.attr, |
609 | &sensor_dev_attr_in2_max.dev_attr.attr, | 639 | &sensor_dev_attr_in2_max.dev_attr.attr, |
640 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
610 | NULL | 641 | NULL |
611 | }, { | 642 | }, { |
612 | &sensor_dev_attr_in3_input.dev_attr.attr, | 643 | &sensor_dev_attr_in3_input.dev_attr.attr, |
613 | &sensor_dev_attr_in3_min.dev_attr.attr, | 644 | &sensor_dev_attr_in3_min.dev_attr.attr, |
614 | &sensor_dev_attr_in3_max.dev_attr.attr, | 645 | &sensor_dev_attr_in3_max.dev_attr.attr, |
646 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
615 | NULL | 647 | NULL |
616 | }, { | 648 | }, { |
617 | &sensor_dev_attr_in4_input.dev_attr.attr, | 649 | &sensor_dev_attr_in4_input.dev_attr.attr, |
618 | &sensor_dev_attr_in4_min.dev_attr.attr, | 650 | &sensor_dev_attr_in4_min.dev_attr.attr, |
619 | &sensor_dev_attr_in4_max.dev_attr.attr, | 651 | &sensor_dev_attr_in4_max.dev_attr.attr, |
652 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
620 | NULL | 653 | NULL |
621 | }, { | 654 | }, { |
622 | &dev_attr_in5_input.attr, | 655 | &dev_attr_in5_input.attr, |
623 | &dev_attr_in5_min.attr, | 656 | &dev_attr_in5_min.attr, |
624 | &dev_attr_in5_max.attr, | 657 | &dev_attr_in5_max.attr, |
658 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
625 | NULL | 659 | NULL |
626 | } | 660 | } |
627 | }; | 661 | }; |
@@ -642,6 +676,8 @@ static struct attribute *vt8231_attributes[] = { | |||
642 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 676 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
643 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 677 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
644 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 678 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
679 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
680 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
645 | &dev_attr_alarms.attr, | 681 | &dev_attr_alarms.attr, |
646 | &dev_attr_name.attr, | 682 | &dev_attr_name.attr, |
647 | NULL | 683 | NULL |