aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-01-06 09:25:52 -0500
committerMark M. Hoffman <mhoffman@lightlink.com>2008-02-17 09:27:18 -0500
commit6cb59e915d04f71c62a0ee8fab34de274aa3fe2a (patch)
treed8410cdbd344e886a13a1bc1428c7da93ce0fadb
parent101142c37be8e5af9b847860219217e6b958c739 (diff)
hwmon: (lm92) Add individual alarm files
The new libsensors needs these individual alarm files. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
-rw-r--r--drivers/hwmon/lm92.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
index af5c77d568fe..a2b804115ce5 100644
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -45,6 +45,7 @@
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/i2c.h> 46#include <linux/i2c.h>
47#include <linux/hwmon.h> 47#include <linux/hwmon.h>
48#include <linux/hwmon-sysfs.h>
48#include <linux/err.h> 49#include <linux/err.h>
49#include <linux/mutex.h> 50#include <linux/mutex.h>
50 51
@@ -209,6 +210,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
209 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); 210 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input));
210} 211}
211 212
213static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
214 char *buf)
215{
216 int bitnr = to_sensor_dev_attr(attr)->index;
217 struct lm92_data *data = lm92_update_device(dev);
218 return sprintf(buf, "%d\n", (data->temp1_input >> bitnr) & 1);
219}
220
212static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); 221static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL);
213static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit, 222static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit,
214 set_temp1_crit); 223 set_temp1_crit);
@@ -221,6 +230,9 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_max,
221 set_temp1_max); 230 set_temp1_max);
222static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL); 231static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL);
223static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 232static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
233static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
234static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
235static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
224 236
225 237
226/* 238/*
@@ -297,7 +309,9 @@ static struct attribute *lm92_attributes[] = {
297 &dev_attr_temp1_max.attr, 309 &dev_attr_temp1_max.attr,
298 &dev_attr_temp1_max_hyst.attr, 310 &dev_attr_temp1_max_hyst.attr,
299 &dev_attr_alarms.attr, 311 &dev_attr_alarms.attr,
300 312 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
313 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
314 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
301 NULL 315 NULL
302}; 316};
303 317