aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/it87.c75
1 files changed, 66 insertions, 9 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 2bdb153cf989..ca0a723cbce5 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -18,7 +18,7 @@
18 Sis950 A clone of the IT8705F 18 Sis950 A clone of the IT8705F
19 19
20 Copyright (C) 2001 Chris Gauthron 20 Copyright (C) 2001 Chris Gauthron
21 Copyright (C) 2005-2006 Jean Delvare <khali@linux-fr.org> 21 Copyright (C) 2005-2007 Jean Delvare <khali@linux-fr.org>
22 22
23 This program is free software; you can redistribute it and/or modify 23 This program is free software; you can redistribute it and/or modify
24 it under the terms of the GNU General Public License as published by 24 it under the terms of the GNU General Public License as published by
@@ -780,6 +780,30 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
780} 780}
781static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 781static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
782 782
783static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
784 char *buf)
785{
786 int bitnr = to_sensor_dev_attr(attr)->index;
787 struct it87_data *data = it87_update_device(dev);
788 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
789}
790static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8);
791static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9);
792static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10);
793static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11);
794static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12);
795static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13);
796static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14);
797static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15);
798static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0);
799static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 1);
800static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 2);
801static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 3);
802static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6);
803static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16);
804static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17);
805static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18);
806
783static ssize_t 807static ssize_t
784show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) 808show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf)
785{ 809{
@@ -841,6 +865,14 @@ static struct attribute *it87_attributes[] = {
841 &sensor_dev_attr_in5_max.dev_attr.attr, 865 &sensor_dev_attr_in5_max.dev_attr.attr,
842 &sensor_dev_attr_in6_max.dev_attr.attr, 866 &sensor_dev_attr_in6_max.dev_attr.attr,
843 &sensor_dev_attr_in7_max.dev_attr.attr, 867 &sensor_dev_attr_in7_max.dev_attr.attr,
868 &sensor_dev_attr_in0_alarm.dev_attr.attr,
869 &sensor_dev_attr_in1_alarm.dev_attr.attr,
870 &sensor_dev_attr_in2_alarm.dev_attr.attr,
871 &sensor_dev_attr_in3_alarm.dev_attr.attr,
872 &sensor_dev_attr_in4_alarm.dev_attr.attr,
873 &sensor_dev_attr_in5_alarm.dev_attr.attr,
874 &sensor_dev_attr_in6_alarm.dev_attr.attr,
875 &sensor_dev_attr_in7_alarm.dev_attr.attr,
844 876
845 &sensor_dev_attr_temp1_input.dev_attr.attr, 877 &sensor_dev_attr_temp1_input.dev_attr.attr,
846 &sensor_dev_attr_temp2_input.dev_attr.attr, 878 &sensor_dev_attr_temp2_input.dev_attr.attr,
@@ -854,6 +886,9 @@ static struct attribute *it87_attributes[] = {
854 &sensor_dev_attr_temp1_type.dev_attr.attr, 886 &sensor_dev_attr_temp1_type.dev_attr.attr,
855 &sensor_dev_attr_temp2_type.dev_attr.attr, 887 &sensor_dev_attr_temp2_type.dev_attr.attr,
856 &sensor_dev_attr_temp3_type.dev_attr.attr, 888 &sensor_dev_attr_temp3_type.dev_attr.attr,
889 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
890 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
891 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
857 892
858 &dev_attr_alarms.attr, 893 &dev_attr_alarms.attr,
859 &dev_attr_name.attr, 894 &dev_attr_name.attr,
@@ -886,6 +921,12 @@ static struct attribute *it87_attributes_opt[] = {
886 &sensor_dev_attr_fan3_min.dev_attr.attr, 921 &sensor_dev_attr_fan3_min.dev_attr.attr,
887 &sensor_dev_attr_fan3_div.dev_attr.attr, 922 &sensor_dev_attr_fan3_div.dev_attr.attr,
888 923
924 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
925 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
926 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
927 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
928 &sensor_dev_attr_fan5_alarm.dev_attr.attr,
929
889 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 930 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
890 &sensor_dev_attr_pwm2_enable.dev_attr.attr, 931 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
891 &sensor_dev_attr_pwm3_enable.dev_attr.attr, 932 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
@@ -1031,35 +1072,45 @@ static int __devinit it87_probe(struct platform_device *pdev)
1031 if ((err = device_create_file(dev, 1072 if ((err = device_create_file(dev,
1032 &sensor_dev_attr_fan1_input16.dev_attr)) 1073 &sensor_dev_attr_fan1_input16.dev_attr))
1033 || (err = device_create_file(dev, 1074 || (err = device_create_file(dev,
1034 &sensor_dev_attr_fan1_min16.dev_attr))) 1075 &sensor_dev_attr_fan1_min16.dev_attr))
1076 || (err = device_create_file(dev,
1077 &sensor_dev_attr_fan1_alarm.dev_attr)))
1035 goto ERROR4; 1078 goto ERROR4;
1036 } 1079 }
1037 if (data->has_fan & (1 << 1)) { 1080 if (data->has_fan & (1 << 1)) {
1038 if ((err = device_create_file(dev, 1081 if ((err = device_create_file(dev,
1039 &sensor_dev_attr_fan2_input16.dev_attr)) 1082 &sensor_dev_attr_fan2_input16.dev_attr))
1040 || (err = device_create_file(dev, 1083 || (err = device_create_file(dev,
1041 &sensor_dev_attr_fan2_min16.dev_attr))) 1084 &sensor_dev_attr_fan2_min16.dev_attr))
1085 || (err = device_create_file(dev,
1086 &sensor_dev_attr_fan2_alarm.dev_attr)))
1042 goto ERROR4; 1087 goto ERROR4;
1043 } 1088 }
1044 if (data->has_fan & (1 << 2)) { 1089 if (data->has_fan & (1 << 2)) {
1045 if ((err = device_create_file(dev, 1090 if ((err = device_create_file(dev,
1046 &sensor_dev_attr_fan3_input16.dev_attr)) 1091 &sensor_dev_attr_fan3_input16.dev_attr))
1047 || (err = device_create_file(dev, 1092 || (err = device_create_file(dev,
1048 &sensor_dev_attr_fan3_min16.dev_attr))) 1093 &sensor_dev_attr_fan3_min16.dev_attr))
1094 || (err = device_create_file(dev,
1095 &sensor_dev_attr_fan3_alarm.dev_attr)))
1049 goto ERROR4; 1096 goto ERROR4;
1050 } 1097 }
1051 if (data->has_fan & (1 << 3)) { 1098 if (data->has_fan & (1 << 3)) {
1052 if ((err = device_create_file(dev, 1099 if ((err = device_create_file(dev,
1053 &sensor_dev_attr_fan4_input16.dev_attr)) 1100 &sensor_dev_attr_fan4_input16.dev_attr))
1054 || (err = device_create_file(dev, 1101 || (err = device_create_file(dev,
1055 &sensor_dev_attr_fan4_min16.dev_attr))) 1102 &sensor_dev_attr_fan4_min16.dev_attr))
1103 || (err = device_create_file(dev,
1104 &sensor_dev_attr_fan4_alarm.dev_attr)))
1056 goto ERROR4; 1105 goto ERROR4;
1057 } 1106 }
1058 if (data->has_fan & (1 << 4)) { 1107 if (data->has_fan & (1 << 4)) {
1059 if ((err = device_create_file(dev, 1108 if ((err = device_create_file(dev,
1060 &sensor_dev_attr_fan5_input16.dev_attr)) 1109 &sensor_dev_attr_fan5_input16.dev_attr))
1061 || (err = device_create_file(dev, 1110 || (err = device_create_file(dev,
1062 &sensor_dev_attr_fan5_min16.dev_attr))) 1111 &sensor_dev_attr_fan5_min16.dev_attr))
1112 || (err = device_create_file(dev,
1113 &sensor_dev_attr_fan5_alarm.dev_attr)))
1063 goto ERROR4; 1114 goto ERROR4;
1064 } 1115 }
1065 } else { 1116 } else {
@@ -1070,7 +1121,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
1070 || (err = device_create_file(dev, 1121 || (err = device_create_file(dev,
1071 &sensor_dev_attr_fan1_min.dev_attr)) 1122 &sensor_dev_attr_fan1_min.dev_attr))
1072 || (err = device_create_file(dev, 1123 || (err = device_create_file(dev,
1073 &sensor_dev_attr_fan1_div.dev_attr))) 1124 &sensor_dev_attr_fan1_div.dev_attr))
1125 || (err = device_create_file(dev,
1126 &sensor_dev_attr_fan1_alarm.dev_attr)))
1074 goto ERROR4; 1127 goto ERROR4;
1075 } 1128 }
1076 if (data->has_fan & (1 << 1)) { 1129 if (data->has_fan & (1 << 1)) {
@@ -1079,7 +1132,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
1079 || (err = device_create_file(dev, 1132 || (err = device_create_file(dev,
1080 &sensor_dev_attr_fan2_min.dev_attr)) 1133 &sensor_dev_attr_fan2_min.dev_attr))
1081 || (err = device_create_file(dev, 1134 || (err = device_create_file(dev,
1082 &sensor_dev_attr_fan2_div.dev_attr))) 1135 &sensor_dev_attr_fan2_div.dev_attr))
1136 || (err = device_create_file(dev,
1137 &sensor_dev_attr_fan2_alarm.dev_attr)))
1083 goto ERROR4; 1138 goto ERROR4;
1084 } 1139 }
1085 if (data->has_fan & (1 << 2)) { 1140 if (data->has_fan & (1 << 2)) {
@@ -1088,7 +1143,9 @@ static int __devinit it87_probe(struct platform_device *pdev)
1088 || (err = device_create_file(dev, 1143 || (err = device_create_file(dev,
1089 &sensor_dev_attr_fan3_min.dev_attr)) 1144 &sensor_dev_attr_fan3_min.dev_attr))
1090 || (err = device_create_file(dev, 1145 || (err = device_create_file(dev,
1091 &sensor_dev_attr_fan3_div.dev_attr))) 1146 &sensor_dev_attr_fan3_div.dev_attr))
1147 || (err = device_create_file(dev,
1148 &sensor_dev_attr_fan3_alarm.dev_attr)))
1092 goto ERROR4; 1149 goto ERROR4;
1093 } 1150 }
1094 } 1151 }