Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115898
b: refs/heads/master
c: 865c295
h: refs/heads/master
v: v3
  • Loading branch information
Jim Cromie authored and Linus Torvalds committed Oct 20, 2008
1 parent a82a553 commit 58292cb
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ca136741e15e8546e787ae92a7f4aeca84be494
refs/heads/master: 865c295360f61c2f3634fb1387b4468fdc8287da
58 changes: 57 additions & 1 deletion trunk/drivers/hwmon/pc87360.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,12 +714,68 @@ static struct sensor_device_attribute therm_crit[] = {
show_therm_crit, set_therm_crit, 2+11),
};

/* show_therm_min/max_alarm() reads data from the per-channel voltage
status register (sec 11.5.12) */

static ssize_t show_therm_min_alarm(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct pc87360_data *data = pc87360_update_device(dev);
unsigned nr = to_sensor_dev_attr(devattr)->index;

return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MIN));
}
static ssize_t show_therm_max_alarm(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct pc87360_data *data = pc87360_update_device(dev);
unsigned nr = to_sensor_dev_attr(devattr)->index;

return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MAX));
}
static ssize_t show_therm_crit_alarm(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct pc87360_data *data = pc87360_update_device(dev);
unsigned nr = to_sensor_dev_attr(devattr)->index;

return sprintf(buf, "%u\n", !!(data->in_status[nr] & TEMP_ALM_CRIT));
}

static struct sensor_device_attribute therm_min_alarm[] = {
SENSOR_ATTR(temp4_min_alarm, S_IRUGO,
show_therm_min_alarm, NULL, 0+11),
SENSOR_ATTR(temp5_min_alarm, S_IRUGO,
show_therm_min_alarm, NULL, 1+11),
SENSOR_ATTR(temp6_min_alarm, S_IRUGO,
show_therm_min_alarm, NULL, 2+11),
};
static struct sensor_device_attribute therm_max_alarm[] = {
SENSOR_ATTR(temp4_max_alarm, S_IRUGO,
show_therm_max_alarm, NULL, 0+11),
SENSOR_ATTR(temp5_max_alarm, S_IRUGO,
show_therm_max_alarm, NULL, 1+11),
SENSOR_ATTR(temp6_max_alarm, S_IRUGO,
show_therm_max_alarm, NULL, 2+11),
};
static struct sensor_device_attribute therm_crit_alarm[] = {
SENSOR_ATTR(temp4_crit_alarm, S_IRUGO,
show_therm_crit_alarm, NULL, 0+11),
SENSOR_ATTR(temp5_crit_alarm, S_IRUGO,
show_therm_crit_alarm, NULL, 1+11),
SENSOR_ATTR(temp6_crit_alarm, S_IRUGO,
show_therm_crit_alarm, NULL, 2+11),
};

#define THERM_UNIT_ATTRS(X) \
&therm_input[X].dev_attr.attr, \
&therm_status[X].dev_attr.attr, \
&therm_min[X].dev_attr.attr, \
&therm_max[X].dev_attr.attr, \
&therm_crit[X].dev_attr.attr
&therm_crit[X].dev_attr.attr, \
&therm_min_alarm[X].dev_attr.attr, \
&therm_max_alarm[X].dev_attr.attr, \
&therm_crit_alarm[X].dev_attr.attr

static struct attribute * pc8736x_therm_attr_array[] = {
THERM_UNIT_ATTRS(0),
Expand Down

0 comments on commit 58292cb

Please sign in to comment.