diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-07-05 14:37:58 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-10-09 22:56:30 -0400 |
commit | bf76e9d3c42fae879feabe26a10bf8ebf27ab328 (patch) | |
tree | 995b4e8097def5f1e9b1f010fce2b2934e995c40 /drivers/hwmon/lm85.c | |
parent | 6b9aad2d8acf309f99213875dd94f2ec691fe820 (diff) |
hwmon: (lm85) Add individual alarm files
The future libsensors needs these individual alarm and fault files.
Also delete old and unused alarm defines.
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/hwmon/lm85.c')
-rw-r--r-- | drivers/hwmon/lm85.c | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 6229e7d488cb..3b70815ab982 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -123,23 +123,6 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); | |||
123 | #define EMC6D102_REG_EXTEND_ADC3 0x87 | 123 | #define EMC6D102_REG_EXTEND_ADC3 0x87 |
124 | #define EMC6D102_REG_EXTEND_ADC4 0x88 | 124 | #define EMC6D102_REG_EXTEND_ADC4 0x88 |
125 | 125 | ||
126 | #define LM85_ALARM_IN0 0x0001 | ||
127 | #define LM85_ALARM_IN1 0x0002 | ||
128 | #define LM85_ALARM_IN2 0x0004 | ||
129 | #define LM85_ALARM_IN3 0x0008 | ||
130 | #define LM85_ALARM_TEMP1 0x0010 | ||
131 | #define LM85_ALARM_TEMP2 0x0020 | ||
132 | #define LM85_ALARM_TEMP3 0x0040 | ||
133 | #define LM85_ALARM_ALARM2 0x0080 | ||
134 | #define LM85_ALARM_IN4 0x0100 | ||
135 | #define LM85_ALARM_RESERVED 0x0200 | ||
136 | #define LM85_ALARM_FAN1 0x0400 | ||
137 | #define LM85_ALARM_FAN2 0x0800 | ||
138 | #define LM85_ALARM_FAN3 0x1000 | ||
139 | #define LM85_ALARM_FAN4 0x2000 | ||
140 | #define LM85_ALARM_TEMP1_FAULT 0x4000 | ||
141 | #define LM85_ALARM_TEMP3_FAULT 0x8000 | ||
142 | |||
143 | 126 | ||
144 | /* Conversions. Rounding and limit checking is only done on the TO_REG | 127 | /* Conversions. Rounding and limit checking is only done on the TO_REG |
145 | variants. Note that you should be a bit careful with which arguments | 128 | variants. Note that you should be a bit careful with which arguments |
@@ -477,6 +460,32 @@ static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr | |||
477 | 460 | ||
478 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); | 461 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); |
479 | 462 | ||
463 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
464 | char *buf) | ||
465 | { | ||
466 | int nr = to_sensor_dev_attr(attr)->index; | ||
467 | struct lm85_data *data = lm85_update_device(dev); | ||
468 | return sprintf(buf, "%u\n", (data->alarms >> nr) & 1); | ||
469 | } | ||
470 | |||
471 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
472 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
473 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
474 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
475 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
476 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 18); | ||
477 | static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 16); | ||
478 | static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 17); | ||
479 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
480 | static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_alarm, NULL, 14); | ||
481 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5); | ||
482 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
483 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 15); | ||
484 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 10); | ||
485 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
486 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 12); | ||
487 | static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 13); | ||
488 | |||
480 | /* pwm */ | 489 | /* pwm */ |
481 | 490 | ||
482 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, | 491 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, |
@@ -966,6 +975,10 @@ static struct attribute *lm85_attributes[] = { | |||
966 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 975 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
967 | &sensor_dev_attr_fan3_min.dev_attr.attr, | 976 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
968 | &sensor_dev_attr_fan4_min.dev_attr.attr, | 977 | &sensor_dev_attr_fan4_min.dev_attr.attr, |
978 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
979 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
980 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
981 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | ||
969 | 982 | ||
970 | &sensor_dev_attr_pwm1.dev_attr.attr, | 983 | &sensor_dev_attr_pwm1.dev_attr.attr, |
971 | &sensor_dev_attr_pwm2.dev_attr.attr, | 984 | &sensor_dev_attr_pwm2.dev_attr.attr, |
@@ -986,6 +999,10 @@ static struct attribute *lm85_attributes[] = { | |||
986 | &sensor_dev_attr_in1_max.dev_attr.attr, | 999 | &sensor_dev_attr_in1_max.dev_attr.attr, |
987 | &sensor_dev_attr_in2_max.dev_attr.attr, | 1000 | &sensor_dev_attr_in2_max.dev_attr.attr, |
988 | &sensor_dev_attr_in3_max.dev_attr.attr, | 1001 | &sensor_dev_attr_in3_max.dev_attr.attr, |
1002 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | ||
1003 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
1004 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
1005 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
989 | 1006 | ||
990 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 1007 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
991 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 1008 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
@@ -996,6 +1013,11 @@ static struct attribute *lm85_attributes[] = { | |||
996 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 1013 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
997 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 1014 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
998 | &sensor_dev_attr_temp3_max.dev_attr.attr, | 1015 | &sensor_dev_attr_temp3_max.dev_attr.attr, |
1016 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
1017 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
1018 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
1019 | &sensor_dev_attr_temp1_fault.dev_attr.attr, | ||
1020 | &sensor_dev_attr_temp3_fault.dev_attr.attr, | ||
999 | 1021 | ||
1000 | &sensor_dev_attr_pwm1_auto_channels.dev_attr.attr, | 1022 | &sensor_dev_attr_pwm1_auto_channels.dev_attr.attr, |
1001 | &sensor_dev_attr_pwm2_auto_channels.dev_attr.attr, | 1023 | &sensor_dev_attr_pwm2_auto_channels.dev_attr.attr, |
@@ -1037,6 +1059,7 @@ static struct attribute *lm85_attributes_in4[] = { | |||
1037 | &sensor_dev_attr_in4_input.dev_attr.attr, | 1059 | &sensor_dev_attr_in4_input.dev_attr.attr, |
1038 | &sensor_dev_attr_in4_min.dev_attr.attr, | 1060 | &sensor_dev_attr_in4_min.dev_attr.attr, |
1039 | &sensor_dev_attr_in4_max.dev_attr.attr, | 1061 | &sensor_dev_attr_in4_max.dev_attr.attr, |
1062 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
1040 | NULL | 1063 | NULL |
1041 | }; | 1064 | }; |
1042 | 1065 | ||
@@ -1054,6 +1077,9 @@ static struct attribute *lm85_attributes_in567[] = { | |||
1054 | &sensor_dev_attr_in5_max.dev_attr.attr, | 1077 | &sensor_dev_attr_in5_max.dev_attr.attr, |
1055 | &sensor_dev_attr_in6_max.dev_attr.attr, | 1078 | &sensor_dev_attr_in6_max.dev_attr.attr, |
1056 | &sensor_dev_attr_in7_max.dev_attr.attr, | 1079 | &sensor_dev_attr_in7_max.dev_attr.attr, |
1080 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
1081 | &sensor_dev_attr_in6_alarm.dev_attr.attr, | ||
1082 | &sensor_dev_attr_in7_alarm.dev_attr.attr, | ||
1057 | NULL | 1083 | NULL |
1058 | }; | 1084 | }; |
1059 | 1085 | ||