diff options
Diffstat (limited to 'drivers/hwmon/f71805f.c')
-rw-r--r-- | drivers/hwmon/f71805f.c | 46 |
1 files changed, 35 insertions, 11 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); |