aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pc87360.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 1043b116bded..3a7d7fa64ebc 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -494,11 +494,61 @@ static struct sensor_device_attribute in_max[] = {
494#define CHAN_ALM_MAX 0x04 /* max limit exceeded */ 494#define CHAN_ALM_MAX 0x04 /* max limit exceeded */
495#define TEMP_ALM_CRIT 0x08 /* temp crit exceeded (temp only) */ 495#define TEMP_ALM_CRIT 0x08 /* temp crit exceeded (temp only) */
496 496
497/* show_in_min/max_alarm() reads data from the per-channel status
498 register (sec 11.5.12), not the vin event status registers (sec
499 11.5.2) that (legacy) show_in_alarm() resds (via data->in_alarms) */
500
501static ssize_t show_in_min_alarm(struct device *dev,
502 struct device_attribute *devattr, char *buf)
503{
504 struct pc87360_data *data = pc87360_update_device(dev);
505 unsigned nr = to_sensor_dev_attr(devattr)->index;
506
507 return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MIN));
508}
509static ssize_t show_in_max_alarm(struct device *dev,
510 struct device_attribute *devattr, char *buf)
511{
512 struct pc87360_data *data = pc87360_update_device(dev);
513 unsigned nr = to_sensor_dev_attr(devattr)->index;
514
515 return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MAX));
516}
517
518static struct sensor_device_attribute in_min_alarm[] = {
519 SENSOR_ATTR(in0_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 0),
520 SENSOR_ATTR(in1_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 1),
521 SENSOR_ATTR(in2_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 2),
522 SENSOR_ATTR(in3_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 3),
523 SENSOR_ATTR(in4_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 4),
524 SENSOR_ATTR(in5_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 5),
525 SENSOR_ATTR(in6_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 6),
526 SENSOR_ATTR(in7_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 7),
527 SENSOR_ATTR(in8_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 8),
528 SENSOR_ATTR(in9_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 9),
529 SENSOR_ATTR(in10_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 10),
530};
531static struct sensor_device_attribute in_max_alarm[] = {
532 SENSOR_ATTR(in0_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 0),
533 SENSOR_ATTR(in1_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 1),
534 SENSOR_ATTR(in2_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 2),
535 SENSOR_ATTR(in3_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 3),
536 SENSOR_ATTR(in4_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 4),
537 SENSOR_ATTR(in5_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 5),
538 SENSOR_ATTR(in6_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 6),
539 SENSOR_ATTR(in7_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 7),
540 SENSOR_ATTR(in8_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 8),
541 SENSOR_ATTR(in9_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 9),
542 SENSOR_ATTR(in10_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 10),
543};
544
497#define VIN_UNIT_ATTRS(X) \ 545#define VIN_UNIT_ATTRS(X) \
498 &in_input[X].dev_attr.attr, \ 546 &in_input[X].dev_attr.attr, \
499 &in_status[X].dev_attr.attr, \ 547 &in_status[X].dev_attr.attr, \
500 &in_min[X].dev_attr.attr, \ 548 &in_min[X].dev_attr.attr, \
501 &in_max[X].dev_attr.attr 549 &in_max[X].dev_attr.attr, \
550 &in_min_alarm[X].dev_attr.attr, \
551 &in_max_alarm[X].dev_attr.attr
502 552
503static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) 553static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
504{ 554{