aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83792d.c
diff options
context:
space:
mode:
authorGong Jun <jgong@winbond.com>2007-07-13 12:45:54 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:28 -0400
commit43e61a2d7e2ce70a093df83871a436732bc48125 (patch)
tree59f94ce9762c21a299d8adbf8cf7194203b18f70 /drivers/hwmon/w83792d.c
parentc83c41e4e623aa6504d30c858a05eac771048029 (diff)
hwmon: (w83792d) Add individual alarm files
w83792d: add individual alarm files for the new libsensors. Signed-off-by: Gong Jun <jgong@winbond.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/w83792d.c')
-rw-r--r--drivers/hwmon/w83792d.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index b0fa296740d1..f6dee3800628 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -540,6 +540,15 @@ show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
540 return sprintf(buf, "%d\n", data->alarms); 540 return sprintf(buf, "%d\n", data->alarms);
541} 541}
542 542
543static ssize_t show_alarm(struct device *dev,
544 struct device_attribute *attr, char *buf)
545{
546 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
547 int nr = sensor_attr->index;
548 struct w83792d_data *data = w83792d_update_device(dev);
549 return sprintf(buf, "%d\n", (data->alarms >> nr) & 1);
550}
551
543static ssize_t 552static ssize_t
544show_pwm(struct device *dev, struct device_attribute *attr, 553show_pwm(struct device *dev, struct device_attribute *attr,
545 char *buf) 554 char *buf)
@@ -1015,6 +1024,25 @@ static SENSOR_DEVICE_ATTR_2(temp2_max_hyst, S_IRUGO | S_IWUSR,
1015static SENSOR_DEVICE_ATTR_2(temp3_max_hyst, S_IRUGO | S_IWUSR, 1024static SENSOR_DEVICE_ATTR_2(temp3_max_hyst, S_IRUGO | S_IWUSR,
1016 show_temp23, store_temp23, 1, 4); 1025 show_temp23, store_temp23, 1, 4);
1017static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); 1026static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
1027static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
1028static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
1029static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 2);
1030static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 3);
1031static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 4);
1032static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 5);
1033static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 6);
1034static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 7);
1035static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 8);
1036static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 9);
1037static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 10);
1038static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 11);
1039static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 12);
1040static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_alarm, NULL, 15);
1041static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 19);
1042static SENSOR_DEVICE_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL, 20);
1043static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 21);
1044static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 22);
1045static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23);
1018static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL); 1046static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
1019static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR, 1047static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
1020 show_chassis_clear, store_chassis_clear); 1048 show_chassis_clear, store_chassis_clear);
@@ -1123,26 +1151,30 @@ static SENSOR_DEVICE_ATTR(fan6_div, S_IWUSR | S_IRUGO,
1123static SENSOR_DEVICE_ATTR(fan7_div, S_IWUSR | S_IRUGO, 1151static SENSOR_DEVICE_ATTR(fan7_div, S_IWUSR | S_IRUGO,
1124 show_fan_div, store_fan_div, 7); 1152 show_fan_div, store_fan_div, 7);
1125 1153
1126static struct attribute *w83792d_attributes_fan[4][4] = { 1154static struct attribute *w83792d_attributes_fan[4][5] = {
1127 { 1155 {
1128 &sensor_dev_attr_fan4_input.dev_attr.attr, 1156 &sensor_dev_attr_fan4_input.dev_attr.attr,
1129 &sensor_dev_attr_fan4_min.dev_attr.attr, 1157 &sensor_dev_attr_fan4_min.dev_attr.attr,
1130 &sensor_dev_attr_fan4_div.dev_attr.attr, 1158 &sensor_dev_attr_fan4_div.dev_attr.attr,
1159 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
1131 NULL 1160 NULL
1132 }, { 1161 }, {
1133 &sensor_dev_attr_fan5_input.dev_attr.attr, 1162 &sensor_dev_attr_fan5_input.dev_attr.attr,
1134 &sensor_dev_attr_fan5_min.dev_attr.attr, 1163 &sensor_dev_attr_fan5_min.dev_attr.attr,
1135 &sensor_dev_attr_fan5_div.dev_attr.attr, 1164 &sensor_dev_attr_fan5_div.dev_attr.attr,
1165 &sensor_dev_attr_fan5_alarm.dev_attr.attr,
1136 NULL 1166 NULL
1137 }, { 1167 }, {
1138 &sensor_dev_attr_fan6_input.dev_attr.attr, 1168 &sensor_dev_attr_fan6_input.dev_attr.attr,
1139 &sensor_dev_attr_fan6_min.dev_attr.attr, 1169 &sensor_dev_attr_fan6_min.dev_attr.attr,
1140 &sensor_dev_attr_fan6_div.dev_attr.attr, 1170 &sensor_dev_attr_fan6_div.dev_attr.attr,
1171 &sensor_dev_attr_fan6_alarm.dev_attr.attr,
1141 NULL 1172 NULL
1142 }, { 1173 }, {
1143 &sensor_dev_attr_fan7_input.dev_attr.attr, 1174 &sensor_dev_attr_fan7_input.dev_attr.attr,
1144 &sensor_dev_attr_fan7_min.dev_attr.attr, 1175 &sensor_dev_attr_fan7_min.dev_attr.attr,
1145 &sensor_dev_attr_fan7_div.dev_attr.attr, 1176 &sensor_dev_attr_fan7_div.dev_attr.attr,
1177 &sensor_dev_attr_fan7_alarm.dev_attr.attr,
1146 NULL 1178 NULL
1147 } 1179 }
1148}; 1180};
@@ -1182,6 +1214,15 @@ static struct attribute *w83792d_attributes[] = {
1182 &sensor_dev_attr_in8_input.dev_attr.attr, 1214 &sensor_dev_attr_in8_input.dev_attr.attr,
1183 &sensor_dev_attr_in8_max.dev_attr.attr, 1215 &sensor_dev_attr_in8_max.dev_attr.attr,
1184 &sensor_dev_attr_in8_min.dev_attr.attr, 1216 &sensor_dev_attr_in8_min.dev_attr.attr,
1217 &sensor_dev_attr_in0_alarm.dev_attr.attr,
1218 &sensor_dev_attr_in1_alarm.dev_attr.attr,
1219 &sensor_dev_attr_in2_alarm.dev_attr.attr,
1220 &sensor_dev_attr_in3_alarm.dev_attr.attr,
1221 &sensor_dev_attr_in4_alarm.dev_attr.attr,
1222 &sensor_dev_attr_in5_alarm.dev_attr.attr,
1223 &sensor_dev_attr_in6_alarm.dev_attr.attr,
1224 &sensor_dev_attr_in7_alarm.dev_attr.attr,
1225 &sensor_dev_attr_in8_alarm.dev_attr.attr,
1185 &sensor_dev_attr_temp1_input.dev_attr.attr, 1226 &sensor_dev_attr_temp1_input.dev_attr.attr,
1186 &sensor_dev_attr_temp1_max.dev_attr.attr, 1227 &sensor_dev_attr_temp1_max.dev_attr.attr,
1187 &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, 1228 &sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
@@ -1191,6 +1232,9 @@ static struct attribute *w83792d_attributes[] = {
1191 &sensor_dev_attr_temp3_input.dev_attr.attr, 1232 &sensor_dev_attr_temp3_input.dev_attr.attr,
1192 &sensor_dev_attr_temp3_max.dev_attr.attr, 1233 &sensor_dev_attr_temp3_max.dev_attr.attr,
1193 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, 1234 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr,
1235 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
1236 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
1237 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1194 &sensor_dev_attr_pwm1.dev_attr.attr, 1238 &sensor_dev_attr_pwm1.dev_attr.attr,
1195 &sensor_dev_attr_pwm1_mode.dev_attr.attr, 1239 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
1196 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 1240 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
@@ -1233,12 +1277,15 @@ static struct attribute *w83792d_attributes[] = {
1233 &sensor_dev_attr_fan1_input.dev_attr.attr, 1277 &sensor_dev_attr_fan1_input.dev_attr.attr,
1234 &sensor_dev_attr_fan1_min.dev_attr.attr, 1278 &sensor_dev_attr_fan1_min.dev_attr.attr,
1235 &sensor_dev_attr_fan1_div.dev_attr.attr, 1279 &sensor_dev_attr_fan1_div.dev_attr.attr,
1280 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
1236 &sensor_dev_attr_fan2_input.dev_attr.attr, 1281 &sensor_dev_attr_fan2_input.dev_attr.attr,
1237 &sensor_dev_attr_fan2_min.dev_attr.attr, 1282 &sensor_dev_attr_fan2_min.dev_attr.attr,
1238 &sensor_dev_attr_fan2_div.dev_attr.attr, 1283 &sensor_dev_attr_fan2_div.dev_attr.attr,
1284 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
1239 &sensor_dev_attr_fan3_input.dev_attr.attr, 1285 &sensor_dev_attr_fan3_input.dev_attr.attr,
1240 &sensor_dev_attr_fan3_min.dev_attr.attr, 1286 &sensor_dev_attr_fan3_min.dev_attr.attr,
1241 &sensor_dev_attr_fan3_div.dev_attr.attr, 1287 &sensor_dev_attr_fan3_div.dev_attr.attr,
1288 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
1242 NULL 1289 NULL
1243}; 1290};
1244 1291