aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1031.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adm1031.c')
-rw-r--r--drivers/hwmon/adm1031.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 53210555441a..5aaad3636c98 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -669,6 +669,29 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
669 669
670static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 670static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
671 671
672static ssize_t show_alarm(struct device *dev,
673 struct device_attribute *attr, char *buf)
674{
675 int bitnr = to_sensor_dev_attr(attr)->index;
676 struct adm1031_data *data = adm1031_update_device(dev);
677 return sprintf(buf, "%d\n", (data->alarm >> bitnr) & 1);
678}
679
680static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0);
681static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_alarm, NULL, 1);
682static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 2);
683static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
684static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 4);
685static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 5);
686static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6);
687static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 7);
688static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 8);
689static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_alarm, NULL, 9);
690static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_alarm, NULL, 10);
691static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, show_alarm, NULL, 11);
692static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, 12);
693static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13);
694static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14);
672 695
673static int adm1031_attach_adapter(struct i2c_adapter *adapter) 696static int adm1031_attach_adapter(struct i2c_adapter *adapter)
674{ 697{
@@ -681,16 +704,25 @@ static struct attribute *adm1031_attributes[] = {
681 &sensor_dev_attr_fan1_input.dev_attr.attr, 704 &sensor_dev_attr_fan1_input.dev_attr.attr,
682 &sensor_dev_attr_fan1_div.dev_attr.attr, 705 &sensor_dev_attr_fan1_div.dev_attr.attr,
683 &sensor_dev_attr_fan1_min.dev_attr.attr, 706 &sensor_dev_attr_fan1_min.dev_attr.attr,
707 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
708 &sensor_dev_attr_fan1_fault.dev_attr.attr,
684 &sensor_dev_attr_pwm1.dev_attr.attr, 709 &sensor_dev_attr_pwm1.dev_attr.attr,
685 &sensor_dev_attr_auto_fan1_channel.dev_attr.attr, 710 &sensor_dev_attr_auto_fan1_channel.dev_attr.attr,
686 &sensor_dev_attr_temp1_input.dev_attr.attr, 711 &sensor_dev_attr_temp1_input.dev_attr.attr,
687 &sensor_dev_attr_temp1_min.dev_attr.attr, 712 &sensor_dev_attr_temp1_min.dev_attr.attr,
713 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
688 &sensor_dev_attr_temp1_max.dev_attr.attr, 714 &sensor_dev_attr_temp1_max.dev_attr.attr,
715 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
689 &sensor_dev_attr_temp1_crit.dev_attr.attr, 716 &sensor_dev_attr_temp1_crit.dev_attr.attr,
717 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
690 &sensor_dev_attr_temp2_input.dev_attr.attr, 718 &sensor_dev_attr_temp2_input.dev_attr.attr,
691 &sensor_dev_attr_temp2_min.dev_attr.attr, 719 &sensor_dev_attr_temp2_min.dev_attr.attr,
720 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
692 &sensor_dev_attr_temp2_max.dev_attr.attr, 721 &sensor_dev_attr_temp2_max.dev_attr.attr,
722 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
693 &sensor_dev_attr_temp2_crit.dev_attr.attr, 723 &sensor_dev_attr_temp2_crit.dev_attr.attr,
724 &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
725 &sensor_dev_attr_temp2_fault.dev_attr.attr,
694 726
695 &sensor_dev_attr_auto_temp1_off.dev_attr.attr, 727 &sensor_dev_attr_auto_temp1_off.dev_attr.attr,
696 &sensor_dev_attr_auto_temp1_min.dev_attr.attr, 728 &sensor_dev_attr_auto_temp1_min.dev_attr.attr,
@@ -715,12 +747,18 @@ static struct attribute *adm1031_attributes_opt[] = {
715 &sensor_dev_attr_fan2_input.dev_attr.attr, 747 &sensor_dev_attr_fan2_input.dev_attr.attr,
716 &sensor_dev_attr_fan2_div.dev_attr.attr, 748 &sensor_dev_attr_fan2_div.dev_attr.attr,
717 &sensor_dev_attr_fan2_min.dev_attr.attr, 749 &sensor_dev_attr_fan2_min.dev_attr.attr,
750 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
751 &sensor_dev_attr_fan2_fault.dev_attr.attr,
718 &sensor_dev_attr_pwm2.dev_attr.attr, 752 &sensor_dev_attr_pwm2.dev_attr.attr,
719 &sensor_dev_attr_auto_fan2_channel.dev_attr.attr, 753 &sensor_dev_attr_auto_fan2_channel.dev_attr.attr,
720 &sensor_dev_attr_temp3_input.dev_attr.attr, 754 &sensor_dev_attr_temp3_input.dev_attr.attr,
721 &sensor_dev_attr_temp3_min.dev_attr.attr, 755 &sensor_dev_attr_temp3_min.dev_attr.attr,
756 &sensor_dev_attr_temp3_min_alarm.dev_attr.attr,
722 &sensor_dev_attr_temp3_max.dev_attr.attr, 757 &sensor_dev_attr_temp3_max.dev_attr.attr,
758 &sensor_dev_attr_temp3_max_alarm.dev_attr.attr,
723 &sensor_dev_attr_temp3_crit.dev_attr.attr, 759 &sensor_dev_attr_temp3_crit.dev_attr.attr,
760 &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr,
761 &sensor_dev_attr_temp3_fault.dev_attr.attr,
724 &sensor_dev_attr_auto_temp3_off.dev_attr.attr, 762 &sensor_dev_attr_auto_temp3_off.dev_attr.attr,
725 &sensor_dev_attr_auto_temp3_min.dev_attr.attr, 763 &sensor_dev_attr_auto_temp3_min.dev_attr.attr,
726 &sensor_dev_attr_auto_temp3_max.dev_attr.attr, 764 &sensor_dev_attr_auto_temp3_max.dev_attr.attr,