diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-06 09:27:59 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-17 09:27:18 -0500 |
commit | 71062ffcd5173b8291ee80e84711b619b34a64eb (patch) | |
tree | 7b524925fc838a7fdfaa1f5ded619c0f755c3565 /drivers/hwmon/max1619.c | |
parent | 6cb59e915d04f71c62a0ee8fab34de274aa3fe2a (diff) |
hwmon: (max1619) Add individual alarm and fault files
The new libsensors needs these individual alarm and fault 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>
Diffstat (limited to 'drivers/hwmon/max1619.c')
-rw-r--r-- | drivers/hwmon/max1619.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 38a44c3d6cee..342803417973 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/hwmon-sysfs.h> | ||
35 | #include <linux/err.h> | 36 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
37 | #include <linux/sysfs.h> | 38 | #include <linux/sysfs.h> |
@@ -161,6 +162,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
161 | return sprintf(buf, "%d\n", data->alarms); | 162 | return sprintf(buf, "%d\n", data->alarms); |
162 | } | 163 | } |
163 | 164 | ||
165 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
166 | char *buf) | ||
167 | { | ||
168 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
169 | struct max1619_data *data = max1619_update_device(dev); | ||
170 | return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1); | ||
171 | } | ||
172 | |||
164 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); | 173 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); |
165 | static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); | 174 | static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); |
166 | static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, | 175 | static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, |
@@ -172,6 +181,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2, | |||
172 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, | 181 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, |
173 | set_temp_hyst2); | 182 | set_temp_hyst2); |
174 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 183 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
184 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
185 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); | ||
186 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
187 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
175 | 188 | ||
176 | static struct attribute *max1619_attributes[] = { | 189 | static struct attribute *max1619_attributes[] = { |
177 | &dev_attr_temp1_input.attr, | 190 | &dev_attr_temp1_input.attr, |
@@ -182,6 +195,10 @@ static struct attribute *max1619_attributes[] = { | |||
182 | &dev_attr_temp2_crit_hyst.attr, | 195 | &dev_attr_temp2_crit_hyst.attr, |
183 | 196 | ||
184 | &dev_attr_alarms.attr, | 197 | &dev_attr_alarms.attr, |
198 | &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, | ||
199 | &sensor_dev_attr_temp2_fault.dev_attr.attr, | ||
200 | &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, | ||
201 | &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, | ||
185 | NULL | 202 | NULL |
186 | }; | 203 | }; |
187 | 204 | ||