diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-06 09:36:13 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-17 09:27:18 -0500 |
commit | 1f08af7ea95e0f4ec632664b9f21a687426df658 (patch) | |
tree | 949d5dd6072e796bb61b3a0417f234a4b3ed229f /drivers | |
parent | 71062ffcd5173b8291ee80e84711b619b34a64eb (diff) |
hwmon: (smsc47m1) 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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 0d7f0c4d06bb..d1b498548736 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct device_attribute | |||
198 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); | 198 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); |
199 | } | 199 | } |
200 | 200 | ||
201 | static ssize_t get_fan_alarm(struct device *dev, struct device_attribute | ||
202 | *devattr, char *buf) | ||
203 | { | ||
204 | int bitnr = to_sensor_dev_attr(devattr)->index; | ||
205 | struct smsc47m1_data *data = smsc47m1_update_device(dev, 0); | ||
206 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
207 | } | ||
208 | |||
201 | static ssize_t get_pwm(struct device *dev, struct device_attribute | 209 | static ssize_t get_pwm(struct device *dev, struct device_attribute |
202 | *devattr, char *buf) | 210 | *devattr, char *buf) |
203 | { | 211 | { |
@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | |||
347 | get_fan_min, set_fan_min, offset - 1); \ | 355 | get_fan_min, set_fan_min, offset - 1); \ |
348 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | 356 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
349 | get_fan_div, set_fan_div, offset - 1); \ | 357 | get_fan_div, set_fan_div, offset - 1); \ |
358 | static SENSOR_DEVICE_ATTR(fan##offset##_alarm, S_IRUGO, get_fan_alarm, \ | ||
359 | NULL, offset - 1); \ | ||
350 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | 360 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ |
351 | get_pwm, set_pwm, offset - 1); \ | 361 | get_pwm, set_pwm, offset - 1); \ |
352 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ | 362 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ |
@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = { | |||
374 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 384 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
375 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 385 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
376 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 386 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
387 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
377 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 388 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
378 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 389 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
379 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 390 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
391 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
380 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 392 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
381 | &sensor_dev_attr_fan3_min.dev_attr.attr, | 393 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
382 | &sensor_dev_attr_fan3_div.dev_attr.attr, | 394 | &sensor_dev_attr_fan3_div.dev_attr.attr, |
395 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
383 | 396 | ||
384 | &sensor_dev_attr_pwm1.dev_attr.attr, | 397 | &sensor_dev_attr_pwm1.dev_attr.attr, |
385 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 398 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
533 | || (err = device_create_file(dev, | 546 | || (err = device_create_file(dev, |
534 | &sensor_dev_attr_fan1_min.dev_attr)) | 547 | &sensor_dev_attr_fan1_min.dev_attr)) |
535 | || (err = device_create_file(dev, | 548 | || (err = device_create_file(dev, |
536 | &sensor_dev_attr_fan1_div.dev_attr))) | 549 | &sensor_dev_attr_fan1_div.dev_attr)) |
550 | || (err = device_create_file(dev, | ||
551 | &sensor_dev_attr_fan1_alarm.dev_attr))) | ||
537 | goto error_remove_files; | 552 | goto error_remove_files; |
538 | } else | 553 | } else |
539 | dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); | 554 | dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); |
@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
544 | || (err = device_create_file(dev, | 559 | || (err = device_create_file(dev, |
545 | &sensor_dev_attr_fan2_min.dev_attr)) | 560 | &sensor_dev_attr_fan2_min.dev_attr)) |
546 | || (err = device_create_file(dev, | 561 | || (err = device_create_file(dev, |
547 | &sensor_dev_attr_fan2_div.dev_attr))) | 562 | &sensor_dev_attr_fan2_div.dev_attr)) |
563 | || (err = device_create_file(dev, | ||
564 | &sensor_dev_attr_fan2_alarm.dev_attr))) | ||
548 | goto error_remove_files; | 565 | goto error_remove_files; |
549 | } else | 566 | } else |
550 | dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); | 567 | dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); |
@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
555 | || (err = device_create_file(dev, | 572 | || (err = device_create_file(dev, |
556 | &sensor_dev_attr_fan3_min.dev_attr)) | 573 | &sensor_dev_attr_fan3_min.dev_attr)) |
557 | || (err = device_create_file(dev, | 574 | || (err = device_create_file(dev, |
558 | &sensor_dev_attr_fan3_div.dev_attr))) | 575 | &sensor_dev_attr_fan3_div.dev_attr)) |
576 | || (err = device_create_file(dev, | ||
577 | &sensor_dev_attr_fan3_alarm.dev_attr))) | ||
559 | goto error_remove_files; | 578 | goto error_remove_files; |
560 | } else if (data->type == smsc47m2) | 579 | } else if (data->type == smsc47m2) |
561 | dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); | 580 | dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); |