diff options
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 08bbeaf64e94..40301bc6ce18 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -141,6 +141,10 @@ static const u16 W83627EHF_REG_TEMP_CONFIG[] = { 0x152, 0x252 }; | |||
141 | #define W83627EHF_REG_DIODE 0x59 | 141 | #define W83627EHF_REG_DIODE 0x59 |
142 | #define W83627EHF_REG_SMI_OVT 0x4C | 142 | #define W83627EHF_REG_SMI_OVT 0x4C |
143 | 143 | ||
144 | #define W83627EHF_REG_ALARM1 0x459 | ||
145 | #define W83627EHF_REG_ALARM2 0x45A | ||
146 | #define W83627EHF_REG_ALARM3 0x45B | ||
147 | |||
144 | /* | 148 | /* |
145 | * Conversions | 149 | * Conversions |
146 | */ | 150 | */ |
@@ -218,6 +222,7 @@ struct w83627ehf_data { | |||
218 | s16 temp[2]; | 222 | s16 temp[2]; |
219 | s16 temp_max[2]; | 223 | s16 temp_max[2]; |
220 | s16 temp_max_hyst[2]; | 224 | s16 temp_max_hyst[2]; |
225 | u32 alarms; | ||
221 | }; | 226 | }; |
222 | 227 | ||
223 | static inline int is_word_sized(u16 reg) | 228 | static inline int is_word_sized(u16 reg) |
@@ -427,6 +432,13 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | |||
427 | W83627EHF_REG_TEMP_HYST[i]); | 432 | W83627EHF_REG_TEMP_HYST[i]); |
428 | } | 433 | } |
429 | 434 | ||
435 | data->alarms = w83627ehf_read_value(client, | ||
436 | W83627EHF_REG_ALARM1) | | ||
437 | (w83627ehf_read_value(client, | ||
438 | W83627EHF_REG_ALARM2) << 8) | | ||
439 | (w83627ehf_read_value(client, | ||
440 | W83627EHF_REG_ALARM3) << 16); | ||
441 | |||
430 | data->last_updated = jiffies; | 442 | data->last_updated = jiffies; |
431 | data->valid = 1; | 443 | data->valid = 1; |
432 | } | 444 | } |
@@ -474,6 +486,14 @@ store_in_##reg (struct device *dev, struct device_attribute *attr, \ | |||
474 | store_in_reg(MIN, min) | 486 | store_in_reg(MIN, min) |
475 | store_in_reg(MAX, max) | 487 | store_in_reg(MAX, max) |
476 | 488 | ||
489 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, char *buf) | ||
490 | { | ||
491 | struct w83627ehf_data *data = w83627ehf_update_device(dev); | ||
492 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
493 | int nr = sensor_attr->index; | ||
494 | return sprintf(buf, "%u\n", (data->alarms >> nr) & 0x01); | ||
495 | } | ||
496 | |||
477 | static struct sensor_device_attribute sda_in_input[] = { | 497 | static struct sensor_device_attribute sda_in_input[] = { |
478 | SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), | 498 | SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), |
479 | SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), | 499 | SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), |
@@ -487,6 +507,19 @@ static struct sensor_device_attribute sda_in_input[] = { | |||
487 | SENSOR_ATTR(in9_input, S_IRUGO, show_in, NULL, 9), | 507 | SENSOR_ATTR(in9_input, S_IRUGO, show_in, NULL, 9), |
488 | }; | 508 | }; |
489 | 509 | ||
510 | static struct sensor_device_attribute sda_in_alarm[] = { | ||
511 | SENSOR_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0), | ||
512 | SENSOR_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1), | ||
513 | SENSOR_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2), | ||
514 | SENSOR_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3), | ||
515 | SENSOR_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8), | ||
516 | SENSOR_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 21), | ||
517 | SENSOR_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 20), | ||
518 | SENSOR_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 16), | ||
519 | SENSOR_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL, 17), | ||
520 | SENSOR_ATTR(in9_alarm, S_IRUGO, show_alarm, NULL, 19), | ||
521 | }; | ||
522 | |||
490 | static struct sensor_device_attribute sda_in_min[] = { | 523 | static struct sensor_device_attribute sda_in_min[] = { |
491 | SENSOR_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 0), | 524 | SENSOR_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 0), |
492 | SENSOR_ATTR(in1_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 1), | 525 | SENSOR_ATTR(in1_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 1), |
@@ -516,6 +549,7 @@ static struct sensor_device_attribute sda_in_max[] = { | |||
516 | static void device_create_file_in(struct device *dev, int i) | 549 | static void device_create_file_in(struct device *dev, int i) |
517 | { | 550 | { |
518 | device_create_file(dev, &sda_in_input[i].dev_attr); | 551 | device_create_file(dev, &sda_in_input[i].dev_attr); |
552 | device_create_file(dev, &sda_in_alarm[i].dev_attr); | ||
519 | device_create_file(dev, &sda_in_min[i].dev_attr); | 553 | device_create_file(dev, &sda_in_min[i].dev_attr); |
520 | device_create_file(dev, &sda_in_max[i].dev_attr); | 554 | device_create_file(dev, &sda_in_max[i].dev_attr); |
521 | } | 555 | } |
@@ -618,6 +652,14 @@ static struct sensor_device_attribute sda_fan_input[] = { | |||
618 | SENSOR_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4), | 652 | SENSOR_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4), |
619 | }; | 653 | }; |
620 | 654 | ||
655 | static struct sensor_device_attribute sda_fan_alarm[] = { | ||
656 | SENSOR_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6), | ||
657 | SENSOR_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7), | ||
658 | SENSOR_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 11), | ||
659 | SENSOR_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 10), | ||
660 | SENSOR_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 23), | ||
661 | }; | ||
662 | |||
621 | static struct sensor_device_attribute sda_fan_min[] = { | 663 | static struct sensor_device_attribute sda_fan_min[] = { |
622 | SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, | 664 | SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, |
623 | store_fan_min, 0), | 665 | store_fan_min, 0), |
@@ -642,6 +684,7 @@ static struct sensor_device_attribute sda_fan_div[] = { | |||
642 | static void device_create_file_fan(struct device *dev, int i) | 684 | static void device_create_file_fan(struct device *dev, int i) |
643 | { | 685 | { |
644 | device_create_file(dev, &sda_fan_input[i].dev_attr); | 686 | device_create_file(dev, &sda_fan_input[i].dev_attr); |
687 | device_create_file(dev, &sda_fan_alarm[i].dev_attr); | ||
645 | device_create_file(dev, &sda_fan_div[i].dev_attr); | 688 | device_create_file(dev, &sda_fan_div[i].dev_attr); |
646 | device_create_file(dev, &sda_fan_min[i].dev_attr); | 689 | device_create_file(dev, &sda_fan_min[i].dev_attr); |
647 | } | 690 | } |
@@ -729,6 +772,9 @@ static struct sensor_device_attribute sda_temp[] = { | |||
729 | store_temp_max_hyst, 0), | 772 | store_temp_max_hyst, 0), |
730 | SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst, | 773 | SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst, |
731 | store_temp_max_hyst, 1), | 774 | store_temp_max_hyst, 1), |
775 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), | ||
776 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), | ||
777 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), | ||
732 | }; | 778 | }; |
733 | 779 | ||
734 | /* | 780 | /* |