diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-09-24 14:52:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:15 -0400 |
commit | 2d45771e6ea79f56a7d85e448f702f60ef86c228 (patch) | |
tree | c3cdd385657c59fe9356cb32283f85f09a717382 | |
parent | 51bd56339335fad3643739504523190cd6d3416b (diff) |
hwmon: Add individual alarm files to 4 drivers
hwmon: Add individual alarm files to 4 drivers
Add individual sysfs files for all f71805f, lm63, lm83 and lm90 alarm
and fault conditions. This is a requirement for the planned
chip-independent libsensors. Almost all other hwmon drivers will need
the same improvement.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/hwmon/f71805f.c | 46 | ||||
-rw-r--r-- | drivers/hwmon/lm63.c | 33 | ||||
-rw-r--r-- | drivers/hwmon/lm83.c | 49 | ||||
-rw-r--r-- | drivers/hwmon/lm90.c | 37 |
4 files changed, 151 insertions, 14 deletions
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index fd72440faf76..678bae43716d 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated | 2 | * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated |
3 | * hardware monitoring features | 3 | * hardware monitoring features |
4 | * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2005-2006 Jean Delvare <khali@linux-fr.org> |
5 | * | 5 | * |
6 | * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates | 6 | * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates |
7 | * complete hardware monitoring features: voltage, fan and temperature | 7 | * complete hardware monitoring features: voltage, fan and temperature |
@@ -147,7 +147,7 @@ struct f71805f_data { | |||
147 | u8 temp_high[3]; | 147 | u8 temp_high[3]; |
148 | u8 temp_hyst[3]; | 148 | u8 temp_hyst[3]; |
149 | u8 temp_mode; | 149 | u8 temp_mode; |
150 | u8 alarms[3]; | 150 | unsigned long alarms; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static inline long in_from_reg(u8 reg) | 153 | static inline long in_from_reg(u8 reg) |
@@ -311,10 +311,9 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) | |||
311 | data->temp[nr] = f71805f_read8(data, | 311 | data->temp[nr] = f71805f_read8(data, |
312 | F71805F_REG_TEMP(nr)); | 312 | F71805F_REG_TEMP(nr)); |
313 | } | 313 | } |
314 | for (nr = 0; nr < 3; nr++) { | 314 | data->alarms = f71805f_read8(data, F71805F_REG_STATUS(0)) |
315 | data->alarms[nr] = f71805f_read8(data, | 315 | + (f71805f_read8(data, F71805F_REG_STATUS(1)) << 8) |
316 | F71805F_REG_STATUS(nr)); | 316 | + (f71805f_read8(data, F71805F_REG_STATUS(2)) << 16); |
317 | } | ||
318 | 317 | ||
319 | data->last_updated = jiffies; | 318 | data->last_updated = jiffies; |
320 | data->valid = 1; | 319 | data->valid = 1; |
@@ -557,8 +556,7 @@ static ssize_t show_alarms_in(struct device *dev, struct device_attribute | |||
557 | { | 556 | { |
558 | struct f71805f_data *data = f71805f_update_device(dev); | 557 | struct f71805f_data *data = f71805f_update_device(dev); |
559 | 558 | ||
560 | return sprintf(buf, "%d\n", data->alarms[0] | | 559 | return sprintf(buf, "%lu\n", data->alarms & 0x1ff); |
561 | ((data->alarms[1] & 0x01) << 8)); | ||
562 | } | 560 | } |
563 | 561 | ||
564 | static ssize_t show_alarms_fan(struct device *dev, struct device_attribute | 562 | static ssize_t show_alarms_fan(struct device *dev, struct device_attribute |
@@ -566,7 +564,7 @@ static ssize_t show_alarms_fan(struct device *dev, struct device_attribute | |||
566 | { | 564 | { |
567 | struct f71805f_data *data = f71805f_update_device(dev); | 565 | struct f71805f_data *data = f71805f_update_device(dev); |
568 | 566 | ||
569 | return sprintf(buf, "%d\n", data->alarms[2] & 0x07); | 567 | return sprintf(buf, "%lu\n", (data->alarms >> 16) & 0x07); |
570 | } | 568 | } |
571 | 569 | ||
572 | static ssize_t show_alarms_temp(struct device *dev, struct device_attribute | 570 | static ssize_t show_alarms_temp(struct device *dev, struct device_attribute |
@@ -574,7 +572,17 @@ static ssize_t show_alarms_temp(struct device *dev, struct device_attribute | |||
574 | { | 572 | { |
575 | struct f71805f_data *data = f71805f_update_device(dev); | 573 | struct f71805f_data *data = f71805f_update_device(dev); |
576 | 574 | ||
577 | return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07); | 575 | return sprintf(buf, "%lu\n", (data->alarms >> 11) & 0x07); |
576 | } | ||
577 | |||
578 | static ssize_t show_alarm(struct device *dev, struct device_attribute | ||
579 | *devattr, char *buf) | ||
580 | { | ||
581 | struct f71805f_data *data = f71805f_update_device(dev); | ||
582 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
583 | int bitnr = attr->index; | ||
584 | |||
585 | return sprintf(buf, "%lu\n", (data->alarms >> bitnr) & 1); | ||
578 | } | 586 | } |
579 | 587 | ||
580 | static ssize_t show_name(struct device *dev, struct device_attribute | 588 | static ssize_t show_name(struct device *dev, struct device_attribute |
@@ -655,18 +663,34 @@ static struct sensor_device_attribute f71805f_sensor_attr[] = { | |||
655 | SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, | 663 | SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, |
656 | show_temp_hyst, set_temp_hyst, 2), | 664 | show_temp_hyst, set_temp_hyst, 2), |
657 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), | 665 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), |
666 | |||
667 | SENSOR_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0), | ||
668 | SENSOR_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1), | ||
669 | SENSOR_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2), | ||
670 | SENSOR_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3), | ||
671 | SENSOR_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 4), | ||
672 | SENSOR_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 5), | ||
673 | SENSOR_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 6), | ||
674 | SENSOR_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 7), | ||
675 | SENSOR_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL, 8), | ||
676 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 11), | ||
677 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 12), | ||
678 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), | ||
658 | }; | 679 | }; |
659 | 680 | ||
660 | static struct sensor_device_attribute f71805f_fan_attr[] = { | 681 | static struct sensor_device_attribute f71805f_fan_attr[] = { |
661 | SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0), | 682 | SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0), |
662 | SENSOR_ATTR(fan1_min, S_IRUGO | S_IWUSR, | 683 | SENSOR_ATTR(fan1_min, S_IRUGO | S_IWUSR, |
663 | show_fan_min, set_fan_min, 0), | 684 | show_fan_min, set_fan_min, 0), |
685 | SENSOR_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 16), | ||
664 | SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1), | 686 | SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1), |
665 | SENSOR_ATTR(fan2_min, S_IRUGO | S_IWUSR, | 687 | SENSOR_ATTR(fan2_min, S_IRUGO | S_IWUSR, |
666 | show_fan_min, set_fan_min, 1), | 688 | show_fan_min, set_fan_min, 1), |
689 | SENSOR_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 17), | ||
667 | SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2), | 690 | SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2), |
668 | SENSOR_ATTR(fan3_min, S_IRUGO | S_IWUSR, | 691 | SENSOR_ATTR(fan3_min, S_IRUGO | S_IWUSR, |
669 | show_fan_min, set_fan_min, 2), | 692 | show_fan_min, set_fan_min, 2), |
693 | SENSOR_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 18), | ||
670 | }; | 694 | }; |
671 | 695 | ||
672 | /* | 696 | /* |
@@ -737,7 +761,7 @@ static int __devinit f71805f_probe(struct platform_device *pdev) | |||
737 | goto exit_class; | 761 | goto exit_class; |
738 | } | 762 | } |
739 | for (i = 0; i < ARRAY_SIZE(f71805f_fan_attr); i++) { | 763 | for (i = 0; i < ARRAY_SIZE(f71805f_fan_attr); i++) { |
740 | if (!(data->fan_enabled & (1 << (i / 2)))) | 764 | if (!(data->fan_enabled & (1 << (i / 3)))) |
741 | continue; | 765 | continue; |
742 | err = device_create_file(&pdev->dev, | 766 | err = device_create_file(&pdev->dev, |
743 | &f71805f_fan_attr[i].dev_attr); | 767 | &f71805f_fan_attr[i].dev_attr); |
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 071f0fc6adec..00a50bea7cbd 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * lm63.c - driver for the National Semiconductor LM63 temperature sensor | 2 | * lm63.c - driver for the National Semiconductor LM63 temperature sensor |
3 | * with integrated fan control | 3 | * with integrated fan control |
4 | * Copyright (C) 2004-2005 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2004-2006 Jean Delvare <khali@linux-fr.org> |
5 | * Based on the lm90 driver. | 5 | * Based on the lm90 driver. |
6 | * | 6 | * |
7 | * The LM63 is a sensor chip made by National Semiconductor. It measures | 7 | * The LM63 is a sensor chip made by National Semiconductor. It measures |
@@ -330,6 +330,16 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy, | |||
330 | return sprintf(buf, "%u\n", data->alarms); | 330 | return sprintf(buf, "%u\n", data->alarms); |
331 | } | 331 | } |
332 | 332 | ||
333 | static ssize_t show_alarm(struct device *dev, struct device_attribute *devattr, | ||
334 | char *buf) | ||
335 | { | ||
336 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
337 | struct lm63_data *data = lm63_update_device(dev); | ||
338 | int bitnr = attr->index; | ||
339 | |||
340 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
341 | } | ||
342 | |||
333 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); | 343 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); |
334 | static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, | 344 | static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, |
335 | set_fan, 1); | 345 | set_fan, 1); |
@@ -350,6 +360,14 @@ static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); | |||
350 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, | 360 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, |
351 | set_temp2_crit_hyst); | 361 | set_temp2_crit_hyst); |
352 | 362 | ||
363 | /* Individual alarm files */ | ||
364 | static SENSOR_DEVICE_ATTR(fan1_min_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
365 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
366 | static SENSOR_DEVICE_ATTR(temp2_input_fault, S_IRUGO, show_alarm, NULL, 2); | ||
367 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
368 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
369 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
370 | /* Raw alarm file for compatibility */ | ||
353 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 371 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
354 | 372 | ||
355 | /* | 373 | /* |
@@ -449,6 +467,8 @@ static int lm63_detect(struct i2c_adapter *adapter, int address, int kind) | |||
449 | &sensor_dev_attr_fan1_input.dev_attr); | 467 | &sensor_dev_attr_fan1_input.dev_attr); |
450 | device_create_file(&new_client->dev, | 468 | device_create_file(&new_client->dev, |
451 | &sensor_dev_attr_fan1_min.dev_attr); | 469 | &sensor_dev_attr_fan1_min.dev_attr); |
470 | device_create_file(&new_client->dev, | ||
471 | &sensor_dev_attr_fan1_min_alarm.dev_attr); | ||
452 | } | 472 | } |
453 | device_create_file(&new_client->dev, &dev_attr_pwm1); | 473 | device_create_file(&new_client->dev, &dev_attr_pwm1); |
454 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); | 474 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); |
@@ -465,6 +485,17 @@ static int lm63_detect(struct i2c_adapter *adapter, int address, int kind) | |||
465 | device_create_file(&new_client->dev, | 485 | device_create_file(&new_client->dev, |
466 | &sensor_dev_attr_temp2_crit.dev_attr); | 486 | &sensor_dev_attr_temp2_crit.dev_attr); |
467 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); | 487 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); |
488 | |||
489 | device_create_file(&new_client->dev, | ||
490 | &sensor_dev_attr_temp2_input_fault.dev_attr); | ||
491 | device_create_file(&new_client->dev, | ||
492 | &sensor_dev_attr_temp2_min_alarm.dev_attr); | ||
493 | device_create_file(&new_client->dev, | ||
494 | &sensor_dev_attr_temp1_max_alarm.dev_attr); | ||
495 | device_create_file(&new_client->dev, | ||
496 | &sensor_dev_attr_temp2_max_alarm.dev_attr); | ||
497 | device_create_file(&new_client->dev, | ||
498 | &sensor_dev_attr_temp2_crit_alarm.dev_attr); | ||
468 | device_create_file(&new_client->dev, &dev_attr_alarms); | 499 | device_create_file(&new_client->dev, &dev_attr_alarms); |
469 | 500 | ||
470 | return 0; | 501 | return 0; |
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 2137d7879df6..ea224891d311 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * lm83.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | * lm83.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | * monitoring | 3 | * monitoring |
4 | * Copyright (C) 2003-2005 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2003-2006 Jean Delvare <khali@linux-fr.org> |
5 | * | 5 | * |
6 | * Heavily inspired from the lm78, lm75 and adm1021 drivers. The LM83 is | 6 | * Heavily inspired from the lm78, lm75 and adm1021 drivers. The LM83 is |
7 | * a sensor chip made by National Semiconductor. It reports up to four | 7 | * a sensor chip made by National Semiconductor. It reports up to four |
@@ -191,6 +191,16 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy, | |||
191 | return sprintf(buf, "%d\n", data->alarms); | 191 | return sprintf(buf, "%d\n", data->alarms); |
192 | } | 192 | } |
193 | 193 | ||
194 | static ssize_t show_alarm(struct device *dev, struct device_attribute | ||
195 | *devattr, char *buf) | ||
196 | { | ||
197 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
198 | struct lm83_data *data = lm83_update_device(dev); | ||
199 | int bitnr = attr->index; | ||
200 | |||
201 | return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1); | ||
202 | } | ||
203 | |||
194 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); | 204 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); |
195 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); | 205 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); |
196 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); | 206 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); |
@@ -208,6 +218,20 @@ static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp, NULL, 8); | |||
208 | static SENSOR_DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp, | 218 | static SENSOR_DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp, |
209 | set_temp, 8); | 219 | set_temp, 8); |
210 | static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp, NULL, 8); | 220 | static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp, NULL, 8); |
221 | |||
222 | /* Individual alarm files */ | ||
223 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
224 | static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
225 | static SENSOR_DEVICE_ATTR(temp3_input_fault, S_IRUGO, show_alarm, NULL, 2); | ||
226 | static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
227 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
228 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
229 | static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, 9); | ||
230 | static SENSOR_DEVICE_ATTR(temp4_input_fault, S_IRUGO, show_alarm, NULL, 10); | ||
231 | static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_alarm, NULL, 12); | ||
232 | static SENSOR_DEVICE_ATTR(temp2_input_fault, S_IRUGO, show_alarm, NULL, 13); | ||
233 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 15); | ||
234 | /* Raw alarm file for compatibility */ | ||
211 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 235 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
212 | 236 | ||
213 | /* | 237 | /* |
@@ -350,6 +374,16 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
350 | device_create_file(&new_client->dev, | 374 | device_create_file(&new_client->dev, |
351 | &sensor_dev_attr_temp3_crit.dev_attr); | 375 | &sensor_dev_attr_temp3_crit.dev_attr); |
352 | 376 | ||
377 | device_create_file(&new_client->dev, | ||
378 | &sensor_dev_attr_temp3_input_fault.dev_attr); | ||
379 | device_create_file(&new_client->dev, | ||
380 | &sensor_dev_attr_temp1_max_alarm.dev_attr); | ||
381 | device_create_file(&new_client->dev, | ||
382 | &sensor_dev_attr_temp3_max_alarm.dev_attr); | ||
383 | device_create_file(&new_client->dev, | ||
384 | &sensor_dev_attr_temp1_crit_alarm.dev_attr); | ||
385 | device_create_file(&new_client->dev, | ||
386 | &sensor_dev_attr_temp3_crit_alarm.dev_attr); | ||
353 | device_create_file(&new_client->dev, &dev_attr_alarms); | 387 | device_create_file(&new_client->dev, &dev_attr_alarms); |
354 | 388 | ||
355 | if (kind == lm83) { | 389 | if (kind == lm83) { |
@@ -367,6 +401,19 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
367 | &sensor_dev_attr_temp2_crit.dev_attr); | 401 | &sensor_dev_attr_temp2_crit.dev_attr); |
368 | device_create_file(&new_client->dev, | 402 | device_create_file(&new_client->dev, |
369 | &sensor_dev_attr_temp4_crit.dev_attr); | 403 | &sensor_dev_attr_temp4_crit.dev_attr); |
404 | |||
405 | device_create_file(&new_client->dev, | ||
406 | &sensor_dev_attr_temp2_input_fault.dev_attr); | ||
407 | device_create_file(&new_client->dev, | ||
408 | &sensor_dev_attr_temp4_input_fault.dev_attr); | ||
409 | device_create_file(&new_client->dev, | ||
410 | &sensor_dev_attr_temp2_max_alarm.dev_attr); | ||
411 | device_create_file(&new_client->dev, | ||
412 | &sensor_dev_attr_temp4_max_alarm.dev_attr); | ||
413 | device_create_file(&new_client->dev, | ||
414 | &sensor_dev_attr_temp2_crit_alarm.dev_attr); | ||
415 | device_create_file(&new_client->dev, | ||
416 | &sensor_dev_attr_temp4_crit_alarm.dev_attr); | ||
370 | } | 417 | } |
371 | 418 | ||
372 | return 0; | 419 | return 0; |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index d9eeaf7585bd..77f8e3f7fd49 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * lm90.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | * lm90.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | * monitoring | 3 | * monitoring |
4 | * Copyright (C) 2003-2005 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2003-2006 Jean Delvare <khali@linux-fr.org> |
5 | * | 5 | * |
6 | * Based on the lm83 driver. The LM90 is a sensor chip made by National | 6 | * Based on the lm83 driver. The LM90 is a sensor chip made by National |
7 | * Semiconductor. It reports up to two temperatures (its own plus up to | 7 | * Semiconductor. It reports up to two temperatures (its own plus up to |
@@ -327,6 +327,16 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy, | |||
327 | return sprintf(buf, "%d\n", data->alarms); | 327 | return sprintf(buf, "%d\n", data->alarms); |
328 | } | 328 | } |
329 | 329 | ||
330 | static ssize_t show_alarm(struct device *dev, struct device_attribute | ||
331 | *devattr, char *buf) | ||
332 | { | ||
333 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
334 | struct lm90_data *data = lm90_update_device(dev); | ||
335 | int bitnr = attr->index; | ||
336 | |||
337 | return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1); | ||
338 | } | ||
339 | |||
330 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); | 340 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); |
331 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); | 341 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); |
332 | static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp8, | 342 | static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp8, |
@@ -344,6 +354,16 @@ static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp8, | |||
344 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temphyst, | 354 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temphyst, |
345 | set_temphyst, 3); | 355 | set_temphyst, 3); |
346 | static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, show_temphyst, NULL, 4); | 356 | static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, show_temphyst, NULL, 4); |
357 | |||
358 | /* Individual alarm files */ | ||
359 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
360 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
361 | static SENSOR_DEVICE_ATTR(temp2_input_fault, S_IRUGO, show_alarm, NULL, 2); | ||
362 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
363 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
364 | static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 5); | ||
365 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
366 | /* Raw alarm file for compatibility */ | ||
347 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 367 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
348 | 368 | ||
349 | /* pec used for ADM1032 only */ | 369 | /* pec used for ADM1032 only */ |
@@ -595,6 +615,21 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
595 | &sensor_dev_attr_temp1_crit_hyst.dev_attr); | 615 | &sensor_dev_attr_temp1_crit_hyst.dev_attr); |
596 | device_create_file(&new_client->dev, | 616 | device_create_file(&new_client->dev, |
597 | &sensor_dev_attr_temp2_crit_hyst.dev_attr); | 617 | &sensor_dev_attr_temp2_crit_hyst.dev_attr); |
618 | |||
619 | device_create_file(&new_client->dev, | ||
620 | &sensor_dev_attr_temp2_input_fault.dev_attr); | ||
621 | device_create_file(&new_client->dev, | ||
622 | &sensor_dev_attr_temp1_min_alarm.dev_attr); | ||
623 | device_create_file(&new_client->dev, | ||
624 | &sensor_dev_attr_temp2_min_alarm.dev_attr); | ||
625 | device_create_file(&new_client->dev, | ||
626 | &sensor_dev_attr_temp1_max_alarm.dev_attr); | ||
627 | device_create_file(&new_client->dev, | ||
628 | &sensor_dev_attr_temp2_max_alarm.dev_attr); | ||
629 | device_create_file(&new_client->dev, | ||
630 | &sensor_dev_attr_temp1_crit_alarm.dev_attr); | ||
631 | device_create_file(&new_client->dev, | ||
632 | &sensor_dev_attr_temp2_crit_alarm.dev_attr); | ||
598 | device_create_file(&new_client->dev, &dev_attr_alarms); | 633 | device_create_file(&new_client->dev, &dev_attr_alarms); |
599 | 634 | ||
600 | if (new_client->flags & I2C_CLIENT_PEC) | 635 | if (new_client->flags & I2C_CLIENT_PEC) |