diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-10-10 15:11:52 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:41 -0500 |
commit | bb081300326335594c273107fcd4e5bdad765ae7 (patch) | |
tree | 1b76e5abc0f3ba30f858a112bd1537ba45f393c0 /drivers/hwmon/adm1025.c | |
parent | d8543e7f30fe9306c8d5a16086bf75f71ab79acf (diff) |
hwmon: (adm1025) Add individual alarm files
The future libsensors needs these individual alarm and fault files.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/adm1025.c')
-rw-r--r-- | drivers/hwmon/adm1025.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index f0d833eb1f47..92aaa98c1497 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
@@ -300,6 +300,23 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
300 | } | 300 | } |
301 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 301 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
302 | 302 | ||
303 | static ssize_t | ||
304 | show_alarm(struct device *dev, struct device_attribute *attr, char *buf) | ||
305 | { | ||
306 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
307 | struct adm1025_data *data = adm1025_update_device(dev); | ||
308 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
309 | } | ||
310 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
311 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
312 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
313 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
314 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
315 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 9); | ||
316 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 5); | ||
317 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
318 | static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_alarm, NULL, 14); | ||
319 | |||
303 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 320 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
304 | { | 321 | { |
305 | struct adm1025_data *data = adm1025_update_device(dev); | 322 | struct adm1025_data *data = adm1025_update_device(dev); |
@@ -348,12 +365,20 @@ static struct attribute *adm1025_attributes[] = { | |||
348 | &sensor_dev_attr_in2_max.dev_attr.attr, | 365 | &sensor_dev_attr_in2_max.dev_attr.attr, |
349 | &sensor_dev_attr_in3_max.dev_attr.attr, | 366 | &sensor_dev_attr_in3_max.dev_attr.attr, |
350 | &sensor_dev_attr_in5_max.dev_attr.attr, | 367 | &sensor_dev_attr_in5_max.dev_attr.attr, |
368 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
369 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
370 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
371 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
372 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
351 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 373 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
352 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 374 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
353 | &sensor_dev_attr_temp1_min.dev_attr.attr, | 375 | &sensor_dev_attr_temp1_min.dev_attr.attr, |
354 | &sensor_dev_attr_temp2_min.dev_attr.attr, | 376 | &sensor_dev_attr_temp2_min.dev_attr.attr, |
355 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 377 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
356 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 378 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
379 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
380 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
381 | &sensor_dev_attr_temp1_fault.dev_attr.attr, | ||
357 | &dev_attr_alarms.attr, | 382 | &dev_attr_alarms.attr, |
358 | &dev_attr_cpu0_vid.attr, | 383 | &dev_attr_cpu0_vid.attr, |
359 | &dev_attr_vrm.attr, | 384 | &dev_attr_vrm.attr, |
@@ -368,6 +393,7 @@ static struct attribute *adm1025_attributes_opt[] = { | |||
368 | &sensor_dev_attr_in4_input.dev_attr.attr, | 393 | &sensor_dev_attr_in4_input.dev_attr.attr, |
369 | &sensor_dev_attr_in4_min.dev_attr.attr, | 394 | &sensor_dev_attr_in4_min.dev_attr.attr, |
370 | &sensor_dev_attr_in4_max.dev_attr.attr, | 395 | &sensor_dev_attr_in4_max.dev_attr.attr, |
396 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
371 | NULL | 397 | NULL |
372 | }; | 398 | }; |
373 | 399 | ||
@@ -485,7 +511,9 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind) | |||
485 | || (err = device_create_file(&new_client->dev, | 511 | || (err = device_create_file(&new_client->dev, |
486 | &sensor_dev_attr_in4_min.dev_attr)) | 512 | &sensor_dev_attr_in4_min.dev_attr)) |
487 | || (err = device_create_file(&new_client->dev, | 513 | || (err = device_create_file(&new_client->dev, |
488 | &sensor_dev_attr_in4_max.dev_attr))) | 514 | &sensor_dev_attr_in4_max.dev_attr)) |
515 | || (err = device_create_file(&new_client->dev, | ||
516 | &sensor_dev_attr_in4_alarm.dev_attr))) | ||
489 | goto exit_remove; | 517 | goto exit_remove; |
490 | } | 518 | } |
491 | 519 | ||