diff options
-rw-r--r-- | Documentation/hwmon/it87 | 3 | ||||
-rw-r--r-- | drivers/hwmon/it87.c | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index 38425f0f2645..6f496a586732 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -76,7 +76,8 @@ IT8718F, IT8720F, IT8721F, IT8726F, IT8758E and SiS950 chips. | |||
76 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, | 76 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, |
77 | joysticks and other miscellaneous stuff. For hardware monitoring, they | 77 | joysticks and other miscellaneous stuff. For hardware monitoring, they |
78 | include an 'environment controller' with 3 temperature sensors, 3 fan | 78 | include an 'environment controller' with 3 temperature sensors, 3 fan |
79 | rotation speed sensors, 8 voltage sensors, and associated alarms. | 79 | rotation speed sensors, 8 voltage sensors, associated alarms, and chassis |
80 | intrusion detection. | ||
80 | 81 | ||
81 | The IT8712F and IT8716F additionally feature VID inputs, used to report | 82 | The IT8712F and IT8716F additionally feature VID inputs, used to report |
82 | the Vcore voltage of the processor. The early IT8712F have 5 VID pins, | 83 | the Vcore voltage of the processor. The early IT8712F have 5 VID pins, |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 5f5247750430..d912649fac50 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -1172,6 +1172,32 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | |||
1172 | struct it87_data *data = it87_update_device(dev); | 1172 | struct it87_data *data = it87_update_device(dev); |
1173 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | 1173 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); |
1174 | } | 1174 | } |
1175 | |||
1176 | static ssize_t clear_intrusion(struct device *dev, struct device_attribute | ||
1177 | *attr, const char *buf, size_t count) | ||
1178 | { | ||
1179 | struct it87_data *data = dev_get_drvdata(dev); | ||
1180 | long val; | ||
1181 | int config; | ||
1182 | |||
1183 | if (strict_strtol(buf, 10, &val) < 0 || val != 0) | ||
1184 | return -EINVAL; | ||
1185 | |||
1186 | mutex_lock(&data->update_lock); | ||
1187 | config = it87_read_value(data, IT87_REG_CONFIG); | ||
1188 | if (config < 0) { | ||
1189 | count = config; | ||
1190 | } else { | ||
1191 | config |= 1 << 5; | ||
1192 | it87_write_value(data, IT87_REG_CONFIG, config); | ||
1193 | /* Invalidate cache to force re-read */ | ||
1194 | data->valid = 0; | ||
1195 | } | ||
1196 | mutex_unlock(&data->update_lock); | ||
1197 | |||
1198 | return count; | ||
1199 | } | ||
1200 | |||
1175 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); | 1201 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); |
1176 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); | 1202 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); |
1177 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); | 1203 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); |
@@ -1188,6 +1214,8 @@ static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6); | |||
1188 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); | 1214 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); |
1189 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); | 1215 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); |
1190 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); | 1216 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); |
1217 | static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, | ||
1218 | show_alarm, clear_intrusion, 4); | ||
1191 | 1219 | ||
1192 | static ssize_t show_beep(struct device *dev, struct device_attribute *attr, | 1220 | static ssize_t show_beep(struct device *dev, struct device_attribute *attr, |
1193 | char *buf) | 1221 | char *buf) |
@@ -1350,6 +1378,7 @@ static struct attribute *it87_attributes[] = { | |||
1350 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | 1378 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, |
1351 | 1379 | ||
1352 | &dev_attr_alarms.attr, | 1380 | &dev_attr_alarms.attr, |
1381 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, | ||
1353 | &dev_attr_name.attr, | 1382 | &dev_attr_name.attr, |
1354 | NULL | 1383 | NULL |
1355 | }; | 1384 | }; |