aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2008-10-18 23:27:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:35 -0400
commit865c295360f61c2f3634fb1387b4468fdc8287da (patch)
tree03878148480d3a2d4c52ab968a603f31f7a11681
parent8ca136741e15e8546e787ae92a7f4aeca84be494 (diff)
hwmon/pc87360 separate alarm files: add therm-min/max/crit-alarms
Adds therm-min/max/crit-alarm callbacks, sensor-device-attribute declarations, and refs to those new decls in the macro used to initialize the therm_group (of sysfs files) The thermistors use voltage channels to measure; so they don't have a fault-alarm, but unlike the other voltages, they do have an overtemp, which we call crit (by convention). [akpm@linux-foundation.org: cleanup] Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/hwmon/pc87360.c58
1 files changed, 57 insertions, 1 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 6804a3570f39..5fbfa34c110e 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -714,12 +714,68 @@ static struct sensor_device_attribute therm_crit[] = {
714 show_therm_crit, set_therm_crit, 2+11), 714 show_therm_crit, set_therm_crit, 2+11),
715}; 715};
716 716
717/* show_therm_min/max_alarm() reads data from the per-channel voltage
718 status register (sec 11.5.12) */
719
720static ssize_t show_therm_min_alarm(struct device *dev,
721 struct device_attribute *devattr, char *buf)
722{
723 struct pc87360_data *data = pc87360_update_device(dev);
724 unsigned nr = to_sensor_dev_attr(devattr)->index;
725
726 return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MIN));
727}
728static ssize_t show_therm_max_alarm(struct device *dev,
729 struct device_attribute *devattr, char *buf)
730{
731 struct pc87360_data *data = pc87360_update_device(dev);
732 unsigned nr = to_sensor_dev_attr(devattr)->index;
733
734 return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MAX));
735}
736static ssize_t show_therm_crit_alarm(struct device *dev,
737 struct device_attribute *devattr, char *buf)
738{
739 struct pc87360_data *data = pc87360_update_device(dev);
740 unsigned nr = to_sensor_dev_attr(devattr)->index;
741
742 return sprintf(buf, "%u\n", !!(data->in_status[nr] & TEMP_ALM_CRIT));
743}
744
745static struct sensor_device_attribute therm_min_alarm[] = {
746 SENSOR_ATTR(temp4_min_alarm, S_IRUGO,
747 show_therm_min_alarm, NULL, 0+11),
748 SENSOR_ATTR(temp5_min_alarm, S_IRUGO,
749 show_therm_min_alarm, NULL, 1+11),
750 SENSOR_ATTR(temp6_min_alarm, S_IRUGO,
751 show_therm_min_alarm, NULL, 2+11),
752};
753static struct sensor_device_attribute therm_max_alarm[] = {
754 SENSOR_ATTR(temp4_max_alarm, S_IRUGO,
755 show_therm_max_alarm, NULL, 0+11),
756 SENSOR_ATTR(temp5_max_alarm, S_IRUGO,
757 show_therm_max_alarm, NULL, 1+11),
758 SENSOR_ATTR(temp6_max_alarm, S_IRUGO,
759 show_therm_max_alarm, NULL, 2+11),
760};
761static struct sensor_device_attribute therm_crit_alarm[] = {
762 SENSOR_ATTR(temp4_crit_alarm, S_IRUGO,
763 show_therm_crit_alarm, NULL, 0+11),
764 SENSOR_ATTR(temp5_crit_alarm, S_IRUGO,
765 show_therm_crit_alarm, NULL, 1+11),
766 SENSOR_ATTR(temp6_crit_alarm, S_IRUGO,
767 show_therm_crit_alarm, NULL, 2+11),
768};
769
717#define THERM_UNIT_ATTRS(X) \ 770#define THERM_UNIT_ATTRS(X) \
718 &therm_input[X].dev_attr.attr, \ 771 &therm_input[X].dev_attr.attr, \
719 &therm_status[X].dev_attr.attr, \ 772 &therm_status[X].dev_attr.attr, \
720 &therm_min[X].dev_attr.attr, \ 773 &therm_min[X].dev_attr.attr, \
721 &therm_max[X].dev_attr.attr, \ 774 &therm_max[X].dev_attr.attr, \
722 &therm_crit[X].dev_attr.attr 775 &therm_crit[X].dev_attr.attr, \
776 &therm_min_alarm[X].dev_attr.attr, \
777 &therm_max_alarm[X].dev_attr.attr, \
778 &therm_crit_alarm[X].dev_attr.attr
723 779
724static struct attribute * pc8736x_therm_attr_array[] = { 780static struct attribute * pc8736x_therm_attr_array[] = {
725 THERM_UNIT_ATTRS(0), 781 THERM_UNIT_ATTRS(0),