aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/adm1021.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index cc4097094282..ebdc6d7db231 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -147,6 +147,14 @@ static ssize_t show_temp_min(struct device *dev,
147 return sprintf(buf, "%d\n", 1000 * data->temp_min[index]); 147 return sprintf(buf, "%d\n", 1000 * data->temp_min[index]);
148} 148}
149 149
150static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
151 char *buf)
152{
153 int index = to_sensor_dev_attr(attr)->index;
154 struct adm1021_data *data = adm1021_update_device(dev);
155 return sprintf(buf, "%u\n", (data->alarms >> index) & 1);
156}
157
150static ssize_t show_alarms(struct device *dev, 158static ssize_t show_alarms(struct device *dev,
151 struct device_attribute *attr, 159 struct device_attribute *attr,
152 char *buf) 160 char *buf)
@@ -203,6 +211,12 @@ static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max,
203 set_temp_max, 1); 211 set_temp_max, 1);
204static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min, 212static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min,
205 set_temp_min, 1); 213 set_temp_min, 1);
214static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6);
215static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 5);
216static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
217static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
218static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
219
206static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 220static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
207 221
208static int adm1021_attach_adapter(struct i2c_adapter *adapter) 222static int adm1021_attach_adapter(struct i2c_adapter *adapter)
@@ -219,6 +233,11 @@ static struct attribute *adm1021_attributes[] = {
219 &sensor_dev_attr_temp2_max.dev_attr.attr, 233 &sensor_dev_attr_temp2_max.dev_attr.attr,
220 &sensor_dev_attr_temp2_min.dev_attr.attr, 234 &sensor_dev_attr_temp2_min.dev_attr.attr,
221 &sensor_dev_attr_temp2_input.dev_attr.attr, 235 &sensor_dev_attr_temp2_input.dev_attr.attr,
236 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
237 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
238 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
239 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
240 &sensor_dev_attr_temp2_fault.dev_attr.attr,
222 &dev_attr_alarms.attr, 241 &dev_attr_alarms.attr,
223 NULL 242 NULL
224}; 243};